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: I need some help understanding gapless playback (Read 14783 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

I need some help understanding gapless playback

I'm going through my ripped CD collection (most of which is in FLAC), and trying to understand how gapless playback works.  I just did a search on the forum and read through a half dozen threads, as well as the wiki and the article on Wikipedia.

I understand that lossy compression, especially MP3, can introduce gaps due to padding, which can cause an audible "blip" when transitioning from one track to another.

But I don't get how FLAC works here.  Where exactly is the gapless information stored?

I have Foobar2000 loaded and am listening to the Kinks album Live: The Road.  Here's what I am seeing.

3 tracks: 1- The Road 2- Destroyer 3- Apeman

All three tracks smoothly transition from one track to another with no grab, no click, no bump.  Just a continuously cheering crowd.

Then I take another song (in my case Pulling Mussels From A Shell by Squeeze) and drop it in between track 2 and 3.  When Destroyer end and the Squeeze song begins, I hear an audible delay between tracks.

How does Foobar2000 know to add a a gap between the two track when they're from different albums and not add a gap when it's the same album?

Are all my FLACs playing gapless all the time and there's just silent padding on the albums that have gaps between songs?

I need some help understanding gapless playback

Reply #1
The album its self has to be gapless, ie if you play it on a normal CD player there should be no gap between tracks.

All CD Rippers and all lossless formats are gapless, by default.

I need some help understanding gapless playback

Reply #2
The album its self has to be gapless, ie if you play it on a normal CD player there should be no gap between tracks.

All CD Rippers and all lossless formats are gapless, by default.


So, the gap is actually hard coded into the track?

I need some help understanding gapless playback

Reply #3
So, the gap is actually hard coded into the track?

Must be.  Open your files with a free sound editor like Audacity to check for yourself.  FLAC - or any lossless codec - will never add gaps that aren't already in the source audio data.

I need some help understanding gapless playback

Reply #4
So, the gap is actually hard coded into the track?

Must be.  Open your files with a free sound editor like Audacity to check for yourself.  FLAC - or any lossless codec - will never add gaps that aren't already in the source audio data.


Well, when a CD is pressed, I thought the gap was not part of the track

I need some help understanding gapless playback

Reply #5
It depends entirely on how the CD was mastered. If there is silence at the end of a track during the mastering/burning process, then it will be present when that CD is ripped.

I need some help understanding gapless playback

Reply #6
Well, when a CD is pressed, I thought the gap was not part of the track


A CD is an audio recording. It can contain whatever is recorded.  The whole track could be silence if someone wants.

I need some help understanding gapless playback

Reply #7
Often songs will have a small amount of silence at the beginning and end of the tracks when they aren't meant to be gapless. CD's also have a feature where the player will read that there is supposed to be a gap of x seconds and it will pause for that amount of time before playing the next track, but this isn't necessary or required. It's not encoded in the audio track itself. The audio tracks on the CD are just PCM audio whether it's silence or not. When there isn't supposed to be a gap then the end of one track and the beginning of the next are aligned with each other with the last sample of the 1st track and the first sample of the next track being part of the same waveform.

FLAC,, being lossless, is natively gapless since it will reproduce the PCM of the tracks perfectly, including there being no "silence" at the beginning or end of the track that didn't exist in the original.

The silence you heard in your test is likely just PCM silence at the beginning and end of the non-gapless track.

I need some help understanding gapless playback

Reply #8
Ok. so I think I am understanding this better.  I loaded some non-gapless tracks up in Audacity, and I can see the 2 seconds or so of dead silence at the end of the track.  When I load a live track up, I see that there is noticeable audio to the end of the track.

So, for all intents and purposes, all my FLAC files are playing gapless at all times.  Songs don't play one right after the other because there is silence introduced at the end of the track.

Now, I seem to recall, back when I had a dedicated CD player, you'd play a song and it would count up.  Then, when the next track started I would see it count down for 2 seconds and then start up the next song.  But it's been a while, so I may be remembering wrong.  I wonder if ripping software captures that and pads tracks accordingly.

I need some help understanding gapless playback

Reply #9
Before you do anything else, read this:
http://wiki.hydrogenaud.io/index.php?title...layback#CD_gaps

Then go back and read the entire article:
http://wiki.hydrogenaud.io/index.php?title=Gapless_playback

Now read this (keeping in mind that portions of audio on a CD indexed as a "gap" have nothing to do with gapless decoding and playback; despite the fact that they use the same word):
http://wiki.hydrogenaud.io/index.php?title...andling_of_gaps

Also realize that there is no law which mandates that "gaps," or more appropriately, "pre-gaps," must be silent.  CDs of a concert would serve as a perfect example.  They often contain 00 indices which contain audio and they usually don't have silent breaks between tracks.

In the future, you might want to check the wiki, even before searching the forums.

I need some help understanding gapless playback

Reply #10
Before you do anything else, read this:
http://wiki.hydrogenaud.io/index.php?title...layback#CD_gaps

Then go back and read the entire article:
http://wiki.hydrogenaud.io/index.php?title=Gapless_playback

Now read this (keeping in mind that portions of audio on a CD indexed as a "gap" have nothing to do with gapless decoding and playback; despite the fact that they use the same word):
http://wiki.hydrogenaud.io/index.php?title...andling_of_gaps

Also realize that there is no law which mandates that "gaps," or more appropriately, "pre-gaps," must be silent.  CDs of a concert would serve as a perfect example.  They often contain 00 indices which contain audio and they usually don't have silent breaks between tracks.

In the future, you might want to check the wiki, even before searching the forums.


I was waiting for you to show up and proceed to tell me where my searches failed me.  :-)

Ok, just to be clear, I did read the wiki also.  So, it's not like I didn't do some homework first....

The first 2 wiki posts I read over and over again, and it did little to explain why I was hearing a gap with lossless files.  The EAC article was the key to understanding, however.  Thank you for providing that link.

So, EAC, when ripping, will take the Index 0 of the NEXT track and add it to the end of the current track.  I wonder if other ripping software does that also.  I tend to hop between Linux and Windows PCs, so I am not always ripping using the same app.  It would an odd mix if I had songs with the gaps at the end for some albums, and songs with the gaps in the beginning for other albums.  Would make for some odd playlists.

Time to rip some things on the Linux laptop and see what happens.

I need some help understanding gapless playback

Reply #11
The first 2 wiki posts I read over and over again, and it did little to explain why I was hearing a gap with lossless files.

If you were using a player that transitions between tracks gaplessly then you were never hearing a gap (again, don't confuse gapless playback with silence recorded to CD, indexed with 00 or otherwise!).

The EAC article was the key to understanding, however.  Thank you for providing that link.

I linked it in order to stem confusion.  Now to address the rest of your post which is technically off-topic...

So, EAC, when ripping, will take the Index 0 of the NEXT track and add it to the end of the current track.

By default, yes; and this is how every other ripping program will work unless it is broken.  Re-positioning pre-gaps requires extra work on the part of the program and most don't actually have this functionality.

I need some help understanding gapless playback

Reply #12
Thank you everyone for your help in understanding gapless playback.

I need some help understanding gapless playback

Reply #13
It may not be very technical, but this is what I understand by "gapless playback:" hearing the songs just as you would from a CD in a CD player.

If anybody coming to this thread does not understand the difference, I suggest they rip a live-concert performance, or a classical piece in which the track numbers are not used for movements, but for mapping arbitrary moments in the music to comments in the booklet, and try listening to the result on a player that is not gapless --- like VLC. It's horrible.

"Normal," might have been better terminology than "gapless"!

(VLC was not gapless the last time I looked: that might have been as long as five years ago, so I can't be sure of today.)
The most important audio cables are the ones in the brain

I need some help understanding gapless playback

Reply #14
This really boils down to commonly accepted terminology.

In the context of a digital media player, gapless playback means that tracks transition without the player adding any delay.

In  the context of an audio file, gapless means that provisions are taken to ensure that any additional encoded silence which was not part of the original source can be excluded during decoding.

Things are trickier in the context of a CD.  What terminology is commonly accepted will likely depend on the community using them.  Terms you might see in ripping software might or might not reflect how they are defined in official specifications.  I haven't seen a definition for gap or gapless, but I have for pre-gap, post-gap, pause area and transition area.  This doesn't mean that definitions for gap and gapless don't exist, just that I am dubious about any of these terms being used properly by the general public and by software developers.  I'm fairly certain I've already used them incorrectly in this discussion as well!

Any amendments/corrections are welcome.

I need some help understanding gapless playback

Reply #15
CD's also have a feature where the player will read that there is supposed to be a gap of x seconds and it will pause for that amount of time before playing the next track, but this isn't necessary or required. It's not encoded in the audio track itself.

Incorrect. The between-song silence (or near-silence) known as a "gap" or "pregap" is encoded on the CD as audio. It takes up space just like non-silent audio.

Ideally, this silence is flagged as a "pause" in one of the subcode channels, and correspondingly marked as "index 00" (rather than the main part of the song's "index 01") in another subcode channel. You can think of indexes as sub-tracks. All tracks have index 01. Some also have index 00 preceding index 01. Some have index 02 and up.

The pause flag is mostly unused AFAIK, but the index 00 tells a real (not computer) CD player to display a count-up from a negative number to 0:00.

A possible source of confusion is the fact that a cue sheet can include a "PREGAP" instruction to a CD burner, saying to add a certain amount of silence that's not in the audio files. Another possible source of confusion is the fact that when you rip a track or just navigate to it  in a real CD player, you are using the index 01 start points as the track boundaries.

I need some help understanding gapless playback

Reply #16
this silence is flagged as a "pause" in one of the subcode channels, and correspondingly marked as "index 00"

I was looking all over.  Do you have a source for this?