View Full Version : Gapless playback with mp3 - another shot

Christian Pernegger
2005-03-11, 02:36
>Ah, I see. And I take it there's no field in the header that tells you how
>many audio samples are *really* in the track? If you had that, then you
>could just pad out the data during encode, and discard extra samples during

IIRC the 'mp3_accurate_length' flag in the LAME tag means that
such information is available for this exact purpose. My LAME version
(3.90 recommended compile from Hydrogen Audio) generates it,
and reportedly newer versions, too.

Additionally, foobar2000's fix mp3 header function seems to add this
info but I haven't tried it.


>What is the size quanta, i.e., how much padding can be needed, worst case?
>FLAC doesn't seem to have this problem; it has always produced decompressed
>WAV files that are identical to the original files before encoding,
>regardless of length. I presume that they have to be an integral number of
>N-channel samples, though; i.e., for ordinary CD 16-bit PCM, the FLAC input
>stream can be reasonably expected to be a multiple of 4 bytes long.