Sign in to follow this  
Followers 0
MadSc13ntist

Calculating WAV duration

2 posts in this topic

#1 ·  Posted (edited)

I have been trying to figure out how to calculate the play duration of a WAV file.

One of my problems is that it isn't PCM it's GSM 6.10.

A sample of one of the WAV files i am working with is:

file size: 561,152 bytes (on disk)

Bit Rate: 13kbps

Channels: 1 (mono)

Audio sample rate: 8kHz

Audio Format: GSM 6.10

I was told for PCM one can use: filesize / bytespersecond but I have seen this is not the case for GSM.

I would greatly appreciate any help someone could throw my way, If I find an answer before a reply is made I will be sure to post it for everyone.

Thanks in advance.

Edited by MadSc13ntist

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Figured it out.

filesize_in_bytes / 1625.15

pretty close, accurate within a few hundredths of a second. here is the tiny script I used to proof it.

Dim $file = @DesktopDir&'\Test1.wav'
$filesize = FileGetSize($file)
MsgBox(64,'GSM 6.10 duration calc.', Round($filesize / 1625.15, 2)&' seconds.')
Edited by MadSc13ntist

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0