Length of a playback MP3, WAV file to determine. Without FMOD

earthjumper

Member
Licensed User
Hallo,

Is there any way to do This. ? I Have nothing found !
The FMOD library is very Big. And i must use the DLL from FMOD.

Thanks
 

Byak@

Active Member
Licensed User
you can play wav with sound() and MP3 with WMPlayer(from CMD)
 

earthjumper

Member
Licensed User
you can play wav with sound() and MP3 with WMPlayer(from CMD)

Thanks for the answer, but i don't want to play the wav/mp3, i want to have the length (milliseconds) of the file.


is there any way to do it with .net?
 

kolbe

Active Member
Licensed User
Longtime User
You can do it manually by scanning for the mp3 header in each frame, then calculating the frame sized based on the bitrate and samplerate you read from each header and summing up the lengths of each frame. If you know it is a CBR file you can just do it for one header and trust that the frames don't vary. If it is VBR than you must check each frame if you want a reliable length. There is one catch and that is sometimes frames use padding and that will mess with these calculations a bit.

Hope it helps
 

Byak@

Active Member
Licensed User
earthjumper oups,sorry=)
as kolbe say,you can find a documentation for MP3 format and then read a file as binary and find length
 
Top