Get duration for MP3 file?

  • Thread starter Thread starter Gustaf
  • Start date Start date
G

Gustaf

I've been googling for this for a while now, and it appears it's not at
easy as it sounds, due to MP3's variable bitrate option and other things
that goes above my head. Hopefully, there's a simple solution, that
doesn't include learning hardcore C and writing my own MP3 decoder. All
I want is a number of seconds for an MP3 file. Somehow, Windows itself
can do it. Could this be extracted from a system source somehow?

Gustaf
 
I've been googling for this for a while now, and it appears it's not at
easy as it sounds, due to MP3's variable bitrate option and other things
that goes above my head. Hopefully, there's a simple solution, that
doesn't include learning hardcore C and writing my own MP3 decoder. All
I want is a number of seconds for an MP3 file. Somehow, Windows itself
can do it. Could this be extracted from a system source somehow?

Gustaf

Use the fmod. http://www.fmod.org

Cheers,

Rick
 
Gustaf,

You will want to look into DirectSound (or DirectX in general). There
should be some managed wrappers for it as well. It will allow you to create
a render graph, and from there, you should be able to get the information
you need.

If you have the luxury of creating a visual control, then you might be
able to load the mp3 into a player control and then get the information you
need from the control.
 
Hi,

Gustaf said:
I've been googling for this for a while now, and it appears it's not at
easy as it sounds, due to MP3's variable bitrate option and other things
that goes above my head. Hopefully, there's a simple solution, that
doesn't include learning hardcore C and writing my own MP3 decoder. All I
want is a number of seconds for an MP3 file. Somehow, Windows itself can
do it. Could this be extracted from a system source somehow?

I would think so, that it's encoded somewhere in the header of the file. To
be 100% sure you ahve to check the format definition.
 
Back
Top