Wiki > Main > GaplessHowTo (compare)
Difference: GaplessHowTo (r14 vs. r13)
NOTE: This page describes how to make MP3 files play back gaplessly on hardware codec players (currently only the Archos line). If you are using any other player (Iriver, Ipod, Iaudio, etc.), method 1 described on this page will be the only thing you need to read.
For many kinds of music it is desirable to have gapless transitions between the tracks. Typical examples are live recordings, classical music or audio books (when it's too difficult to cut between sentences). Unfortunately, gapless playback is a little bit tricky when using the mp3 format, but it's possible in Rockbox if you encode your mp3s the right way.
The problem is that mp3s have a fixed frame size, meaning that your mp3 file will almost always end with a partially filled last frame. The encoders fill the frame with silence and the result is the small gap between the tracks. If you want to encode your files without these gaps, you have to place the track transitions on mp3 frame boundaries, i. e. the last frame of a track is not filled with silence but with the first (very short) snippet of the next track. This way, the transitions will be a few milliseconds off its nominal position but you usually won't notice this.
The simplest method is to use a format/codec other than MP3. For instance, Ogg Vorbis, Musepack and FLAC are all supported by Rockbox (except on the SH1 Archos devices) and are capable of gapless playback natively, without any special encoding techniques or workarounds. Simply encode the tracks per the respective encoder's documentation and they should play back gaplessly with Rockbox. If your format of choice remains MP3, then you can still have gapless playback with by using any recent version of the LAME encoder, which will encode gaplessly by default. Files encoded by older versions or other encoders are not guaranteed to play back gaplessly in Rockbox.
If your format of choice remains MP3, then you can still have gapless playback by using any recent version of the LAME encoder, which will encode gapless by default. From LAME v3.90.3 upwards Rockbox will decode gapless, files encoded by older versions or other encoders are not guaranteed to playback gapless in Rockbox. The current recommended version of LAME is v3.97, for more info about LAME go here, http://wiki.hydrogenaudio.org/index.php?title=Lame_Compiles#Recommended_encoder_compiles_and_source_code
One way to achieve gapless playback is to encode the whole CD (or live recording) as one big mp3 and cut it afterwards. Most ripping programms are able to create a cuesheet which allows automatic cutting. You can find the necessary tools in our tools section. Windows users can use ExactAudioCopy combined with Lame for ripping and encoding (Actions -> Copy image & Create CUE sheet -> Compressed) and cut the mp3 with MP3DirectCut or MusiCutter afterwards.
The drawback of this simple method is that there will be problems if you don't play the files in the original order. Because mp3 frames are overlapping, they can't be treated independently. Furthermore, there's a bit reservoir which is used to balance the bitrate between frames. This is not a problem if you play the tracks in the right order, because Rockbox will put the frames together before they're passed to the decoder. The problem arises if you play the tracks independently. You'll have a corrupt frame at the beginning and at the end of each track (see http://lame.sourceforge.net/tech-FAQ.txt).
Lame has a --nogap command line option which does basically the same. This is useful if you don't want to rip the whole CD as one file and it has the additional benefit that this way you'll get completely valid mp3 files. For this method it is necessary to have Lame encode all tracks at once! Because many MP3 players are not able to strip metadata properly, Lame removes all tags by default. The additional option --nogaptags overrides this behaviour. Use it this way:
lame --other_options --nogaptags --nogap track01.wav track02.wav track03.wav ...
Lame can only produce gapless mp3s (by pushing the track boundaries slightly) if it gets all the tracks in the right order!
HINT: You can use the attached GLOB.EXE to automaticly send a series of files to lame. The glob command would be like:
GLOB -c 'command' 'file pattern'
For lame this means something like:
glob -c lame --other_options --nogaptags --nogap *.wav
A variation of Method 2 is to use a patched version of Lame with cuesheet support. Extract the whole CD as one wave file with cuesheet and let Lame do the rest. It splits the wave file, encodes the tracks gaplessly and adds the track titles as tags. More info can be found on http://www.geocities.com/nyaochi2000/lame/cuesheet/.
A common mistake is to rip the tracks individually and then try to encode each one on its own with the --nogap option:
lame --other_options --nogap track01.wav lame --other_options --nogap track02.wav ...
This won't work! If lame doesn't know anything about the consecutive track, it can only fill the last frame with silence.
r16 - 06 Mar 2007 - 10:39:47 - MarcoenHirschbergRevision r14 - 22 Nov 2006 - 10:53 - JoaquimDias
Revision r13 - 14 Nov 2006 - 20:12 - ThomJohansen
Copyright © by the contributing authors.