[PD] get data from mp3 files

Peter P. peterparker at fastmail.com
Sun Apr 5 15:52:51 CEST 2015

* João Pais <jmmmpais at gmail.com> [2015-04-05 06:27]:
> >It seems there is no standard for the metadata in mp3 and several
> >different methods are in use. Some of them are at the end of the file and
> >others at >the beginning, so it's not straightforward.
> >Most of the tags give the name but not all of them give the length, and
> >since mp3 is compressed in a non-linear way, there's no way to determine
> >the >length except by playing it.
> I never went that far into the insides of mp3 coding. but since any file
> player software indicates the duration of an mp3 when you add it to the
> playlist, that information must be easy to get from somewhere.

soxi myfile.mp3

gives the following info, which I suspect to be from the header rather
than from the mp3 metadata itself:

Input File     : 'myfile.mp3'
Channels       : 1
Sample Rate    : 44100
Precision      : 16-bit
Duration       : 00:00:05.83 = 256927 samples = 436.951 CDDA sectors
File Size      : 46.6k
Bit Rate       : 64.0k
Sample Encoding: MPEG audio (layer I, II or III)

More information about the Pd-list mailing list