Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Future-proof gapless MP3 (Read 7854 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Future-proof gapless MP3

Hi,

although this is my first post in this fantastic board, I hope that it is not too much beginner-like

I have been searching the the web for the whole day for information about creating gapless MP3s, played around with different options - and now think that I am more confused than before... Maybe you can give me some hints. My aim is to get some kind of "future-proof" library with music that will play without gaps on most of the actual and forthcoming players.

I have seen that there are 3 Versions of getting MP3s that ought to play seemlessly, but there are a few things that are not really clear to me:

1) Enoding MP3s with LAME: http://www.rockbox.org/twiki/bin/view/Main/GaplessHowTo says, that I should use LAME with the --nogap option (this guide seems to be from somewhat around 2005), searching here, people said already in 2003 or 2004, that the --nogap option is automatically used since version 3.90 or similar and that this switch does not need to be added. But: If I don´t use this switch, EncSpot says that this MP3 is not gapless. Furthermore, foobar2000 shows me a higher padding value in the LAME header if the file is not encoded with the --nogap option. What is the reason for this?
Someone claimed, that the --nogap option fills the MP3 frames and that this is the reason why you have to add all the WAVs that you want to encode as parameters... If this was correct, wouldn´t that be the best option for encoding seemless MP3s because, in theory, also players would be able to play the files seemlessly that don´t read the LAME header but have better buffer handling?
2) iTunes seems to read the LAME header, but does not add it´s own special ID3Tag Comment fields to a LAME encoded file. LAME files are played back correctly within iTunes, but not on the iPod itself while MP3s ripped with iTunes play like they should do. Is there a tool that can generate the special iTunes Comment fields with the information taken from the LAME header and visa verse, giving a much better compatibility as it supports both "standards"?
3) The last option: Ripping the whole CD to MP3/CUE and split it with pcutmp3. Sounds good on all software players I tested and also on a Rockbox player, on the iPod I get the same result as with the LAME-MP3s. Even if the MP3 frames are overlapping, causing a little erro if you play the songs not in the right order, wouldn´t this be the most future-proof concept because player could also play it seemlessly if the LAME-Header and the iTunes-Tags are are missing?
4) Did anybody succeed with burning an Audio-CD with seamless tracks with an other tool than foobar2000 (e.g. Nero 9, ExactAudioCopy and CDBurnerXP), reading the LAME header or the iTunes Tags before?

Thanks a lot for any answers,

JK

Future-proof gapless MP3

Reply #1
1) The --nogap switch is pretty much obsolete.  I would be extremely surprised to hear that Rockbox still requires it.

2) What model and generation is your iPod?  My friends' 3G Nanos have no problem with gapless playback.  My 3G iPod on the other hand does, but Apple never implemented gapless support in that model.

3) pcutmp3 shouldn't be necessary unless you already have single-file mp3 images.  I certainly wouldn't go out of my way to make them.

4) Winamp is capable of accurate length decoding to wave, as is the command-line decoder in Lame 3.98.  I think Burrrn does also.  Of course, once you have decoded these mp3s to accurate length waves, your burning program is pretty much irrelevant.  I'm not sure about accurate length decoding of iTunes encoded mp3 files.

Future-proof gapless MP3

Reply #2
1) Enoding MP3s with LAME: http://www.rockbox.org/twiki/bin/view/Main/GaplessHowTo says, that I should use LAME with the --nogap option


Quote
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 gapless with 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.


 

Future-proof gapless MP3

Reply #3
Quote
1) The --nogap switch is pretty much obsolete.  I would be extremely surprised to hear that Rockbox still requires it.

So, why do I get different results when checking the padding with Foobar2000? Does the --nogap version indeed fill all MP3 frames while the "new" nogap relies on the information in the header?

Quote
2) What model and generation is your iPod?  My friends' 3G Nanos have no problem with gapless playback.  My 3G iPod on the other hand does, but Apple never implemented gapless support in that model.

It´s an iPod touch. I checked it yesterday with LAME and iTunes encoded files. The iTunes files play without any glitch while you hear a (very soft) click when playing back LAME encoded files. Maybe, a lot of people did not listen careful enough because this click is really very subtle.

Quote
3) pcutmp3 shouldn't be necessary unless you already have single-file mp3 images.  I certainly wouldn't go out of my way to make them.

I have written a little DOS batch file that I just have to execute in the folder where I have the MP3 and the CUE. So it´s not much more work to do.

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

I also have a Rockbox player, but Rockbox is not the world standard. iPods aren´t also, but seem to become some kind of pseudo-standard. And what about the players listed at http://en.wikipedia.org/wiki/Gapless? Do they take care of the LAME header, or means gapless here that the pcutmp3 way would work better because all MP3 frames are filled which is not the case with gapless LAME?

Future-proof gapless MP3

Reply #4
I've done some experimenting with gapless on my touch.  Foobar2000 with latest version of lame does it perfectly with just default (vbr) switches. I listened very critically for gaps, clicks or pops.  I was using Nero aac before, and bad to switch because of very subtle gaps or pops on my touch. They worked fine elsewhere (including iTunes), just not on the touch.

Future-proof gapless MP3

Reply #5
I've done some experimenting with gapless on my touch.  Foobar2000 with latest version of lame does it perfectly with just default (vbr) switches. I listened very critically for gaps, clicks or pops.  I was using Nero aac before, and bad to switch because of very subtle gaps or pops on my touch. They worked fine elsewhere (including iTunes), just not on the touch.

The Touch is just one example of a very popular player, and it´s annoying that it works if the file has been encoded with iTunes itself and has the "proprietary" COMMENT tags. However, I was thinking about adding at least the "COMMENT iTunPGAP tag=1" and listen if it then works without glitches, maybe even add the iTunSMPB as partly "documented" at http://www.hydrogenaudio.org/forums/index....8231&st=136 using the information in the LAME header.

However, the iTunes tags as well the xing header do not work on players with optimized buffer handling that ignore both information and play the whole MP3 packet even if it is not filled completely, that´s why I also ask on comments about the pcutmp3 way.

Future-proof gapless MP3

Reply #6
Does the --nogap version indeed fill all MP3 frames while the "new" nogap relies on the information in the header?

Yes.  You got a padding value of 0 for the files using --nogap, correct?

The iTunes files play without any glitch while you hear a (very soft) click when playing back LAME encoded files.

One thing about lossy encoding and gapless, there can easily be an audible discontinuity in amplitude between the last sample of one track and the first sample of the next.  Perhaps this is the cause of your click?  Have you recorded the output of your iPod Touch and looked for a noticeable gap of silence?

Future-proof gapless MP3

Reply #7
I spend this evening reading the description of pcutmp3 again and doing several encodings (192 kBit VBR, WMP11 CBR) and testing the results with the iPod touch as well as with a Rockbox player (Sansa e250). I used the first track of the album "Sehnsucht Special Edition CD1" by "Schiller" where every song continues seamlessly to the next...

The files and their MP3 gapless playback information - determined with foobar2000 (first delay, then padding):
1) LAME:                      576, 3008208
2) LAME with --nogap:  576, 3007296
3) LAME with pcutmp3: 1728, 3008208
4) iTunes:                        0, 3011328 (no LAME, but Xing header; special ID3Tags)
5) WMP11:                      0, 3006720 (no LAME, no Xing, no special Tags)

The results:
1) Rockbox: perfect, iPod: click
2) Rockbox: click, iPod: click
3) Rockbox: perfect, iPod: little break (!)
4) Rockbox: click, iPod: perfect
5) Rockbox: click, iPod: click

I think, the results are (nearly) clear:
1) and 3) are nearly the same, apart from the first delay. 3008208 is a multiple of 588 which is the sample size of one CD sector. As the Rockbox firmware supports the LAME header, those files play perfectly there.
The iPod however does ignore the LAME header, playing the encoder delay. While you can hear this with a value of around 2000, you just recognize it as a little click if it is 576. If the encoder delay and the real track length is stored in iTunSMPB tag, then the iPod might not have any problems.
I don´t think that it makes sense talking about 5)...
But what´s about variant 3)? Simply an old, unfixed bug? Anyway, I will have to reencode some of my CDs... 

So I think, only a tool would have to be written that converts the LAME padding values to the iTunSMPB tag to get an iPod-compatible LAME encoding (see also http://www.hydrogenaudio.org/forums/index....showtopic=63480).

Future-proof gapless MP3

Reply #8
There is something not right with what is going on with your iPod touch.  I had a 1G 16GB iPod touch that played back files (Lame mp3, iTunes mp3, iTunes AAC, and Nero AAC) gaplessly just fine.  I now have a 120GB iPod classic that has no problems either.  There will occasionally be a small gap between older Nero AAC files but I can go back and play them again without any gaps.  iPods themselves aren't gapless but rather rely on information added through iTunes.  I believe this information is stored in your library.xml file unless you use iTunes to rip/encode the songs.  What are you using to encode the files besides Lame (I am guessing foobar2000).  Also, what version of Lame are you using and what build?  I haven't had any issues with Lame CBR and VBR files from versions 3.97 and 3.98.2.  I haven't tried older versions but I don't see why I wouldn't so long as iTunes scans the files for gapless playback.

Future-proof gapless MP3

Reply #9
I have a 5.5G 8- GB iPod.  This was the generation where gapless playback was added to the iPod and it the reason that I made the jump.  Before this, I was using a Sony hd3 with ATRAC.

I too was confused at first with LAME and the gapless options.  It's really simple - encode you files using foobar and LAME with default options (or a higher bitrate if you prefer) and viola - gapless files on the iPod.

Something important to keep in mind is that on the iPod, if you fast forward through the file, there will be a gap in the transition.  You have to let the files play through in their entirety to test gapless playback.  Apple has never fixed this bug which existed since they added the feature.

The Logitech/Slimdevices Squeezebox products also support gapless playback of LAME mp3 files.

Hope this helps.

Future-proof gapless MP3

Reply #10
There is something not right with what is going on with your iPod touch.  I had a 1G 16GB iPod touch that played back files (Lame mp3, iTunes mp3, iTunes AAC, and Nero AAC) gaplessly just fine.  I now have a 120GB iPod classic that has no problems either.  There will occasionally be a small gap between older Nero AAC files but I can go back and play them again without any gaps.  iPods themselves aren't gapless but rather rely on information added through iTunes.  I believe this information is stored in your library.xml file unless you use iTunes to rip/encode the songs.  What are you using to encode the files besides Lame (I am guessing foobar2000).  Also, what version of Lame are you using and what build?  I haven't had any issues with Lame CBR and VBR files from versions 3.97 and 3.98.2.  I haven't tried older versions but I don't see why I wouldn't so long as iTunes scans the files for gapless playback.


The click is REALLY very subtle, and the mentioned album has some soft synth string passages where you can clearly hear things like little clicks between most of the tracks. Furthermore, the pcutmp3 version makes it clear that there is a bigger gap. If have just seen that there has been a discussion at http://www.hydrogenaudio.org/forums/index....showtopic=48231, but there, people also can´t decide if there is a gap when playing back on the iPod or not. Currently, I am even using more expensive Sennheiser headphones here to check this issue...

I just did a check again on the iPod as well as on iTunes. iTunes seems to play the LAME files correctly while the pcutmp3 files again have again audible short gaps. On the iPod touch I can still hear the gaps in both versions. So, either there is some kind of crossfading on iTunes or the soundcard driver so that I don´t here the clicks on the "normal" LAME version, or there is a bug in the latest iPod firmware.

I use the latest version of Exact Audio Copy (because of it´s excellent error correction) with LAME 3.98.2 (foobar shows v3.98r) called as external compressor with the -V 2 parameter. Furthermore, I have installed the latest iTunes version as well as the latest iPod firmware.
I am thinking about adding the iTunSMPB tag with MP3Tag manually to see/listen if this might fix the gap problem.
Furthermore, it would be interesting if someone else with an iPod would give pcutmp3 a try (using the EAC function "Create a compressed image" before which creates an MP3 file and a corresponding CUE sheet). This would at least prove that there is a firmware bug, even if it is just because the encoder delay is too high. Then, we could continue with the real sublte 528/576 encoder delay research...

EDIT: @maggior: I have just seen your post. I checked your hint it again, but it did not change anything. Furthermore, I can also fast forward through until 0:20-0:10 to the end of an iTunes encoded file, and there is no problem with the transition.
EDIT2: If you are sure that there is no problem with your iPod touch, I use a European version of the iPod touch, Generation 1 - maybe this makes a difference...

Future-proof gapless MP3

Reply #11
Just for comparison, try foobar and latest version of lame with default options. Only change the vbr quality if you wish. I'm positive thee are no gaps on my 2g touch this way. I've listened carefully enough to hear the iPods volume change noise.

Future-proof gapless MP3

Reply #12
Just for comparison, try foobar and latest version of lame with default options. Only change the vbr quality if you wish. I'm positive thee are no gaps on my 2g touch this way. I've listened carefully enough to hear the iPods volume change noise.


Tried it, but I have the same soft click as if I am using EAC with LAME.

I just copied the iTunesSMPB tag from the iTunes MP3s to my LAME MP3s and adjusted the second value from 210 (iTunes decoder delay) to 240 (LAME decoder delay). Did not work on my iPod

So I think that I have to give this up. Maybe I am going to chross-check this issue with other iPod users because I have no more ideas.

On http://www.zshare.net/audio/57891634d705fc39/ you can find a sample where you can hear it on your own (recorded from my iPod), unfortunately I am even not able to find the click in the waveform view.

And again, as I said before: No problems with Rockbox, Winamp, iTunes etc. with LAME. It´s just my iPod who seems to play back only iTunes encoded MP3s correctly.