MP3 Players and No-gap playback
Reply #5 – 2003-11-13 04:21:36
Wasn't stock Winamp3 gapless? Don't remember too well, it's been years since I touched WA. "Gapless" as in "doesn't need to reopen output between tracks". 1by1 can do that too, as well as any half-decent player these days (actually Winamp2/5 needs output plugin side hack for that). "Gapless playback" consists of two parts: 1) Gapless decoding - lossy formats like MP3 store audio data in frames, which can't store entire audio CD track without either truncating last samples or adding extra null samples (total length must be a multiply of frame size, being fixed at 1152 samples for MPEG-1 layer 3); MP3 also suffers from encoder/decoder delay causing the decoder to produce additional null samples at the beginning of decoded stream. In order to correct this problem, lossy-encoded file needs to store two additional numbers - amount of samples to remove at the beginning of stream, and amount of samples to remove at the end of stream, then the decoder needs to take these nubmers into account. That's what this thread is about. LAME 3.90 and newer can store gapless playback info in LAME headers, and some players (like foobar2000) can play those files without encoder-added null samples at the beginning/end of file. Another way to workaround gapless decoding is to write a DSP that tries to guess amount of samples that needs to be removed, but that method is simply unreliable and generally useless since players reading LAME header info exist (as well as tools to manually add gapless playback info to MP3 files that don't contain it). 2) Gapless output - many (mostly old) players have a design flaw requiring them to reopen wave output device between tracks, producing audible pauses. Modern players such as Winamp3 and foobar2000 don't have this problem; Winamp2/5 has "gapless output plugins" that avoid reopening output at cost of other minor glitches (displayed playback position being ahead of actual sound, etc; they trick the player to start decoding next track while previous one is still being played).