Get duration for MP3 file?

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
 
R

Rick

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
 
N

Nicholas Paldino [.NET/C# MVP]

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.
 
I

Ignacio Machin \( .NET/ C# MVP \)

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.
 
N

Nicolas Noakes

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top