[flac-dev] Gapless Support

Declan Kelly flac-dev at groov.ie
Thu Feb 2 13:11:02 PST 2012


On Tue, Jan 17, 2012 at 09:44:25AM +0100, rs at noveltech.de wrote:

> We are currently try to add Gapless support on our device? If we rip an CD
> with our device, we can find out, that one track follow after another so we
> can
> recognize, that the tracks are gapless or not.

Are you aiming for maximum compatibility with how the source CD would be
played on an average CD audio player?

Or just trying to avoid the *extra* silence that is typically added by
formats like MP3 and some of the software players/libraries?

As you should know, the Red Book spec allows for indexes to be used to
define "pre gaps" before tracks, that are not part of the track itself.

It's also possible to violate the Red Book standard and add "track 0"
before the first index, or other weird tricks to include "bonus" tracks
on a disc that may or may not get ripped by common software. As far as I
recall, even having no silence between each track violates the standard.

Many people who use FLAC to archive entire CDs (as opposed to "albums"
of tracks that may or may not be on the same CD) will rip the entire
disc and store it in a single FLAC file, with the CUE sheet either as a
separate file, embedded in the FLAC metadata, or both.

This preserves the musical "flow" of the exact timing of the music and
silence across the disc, regardless of each each track boundary.

> But how can we find that out on already existing FLAC files (or other
> formats). Is there a marker inside the file, who tell me, that this
> File is a gapless file? Also gapless make only sense, if you have the follow
> up file also?

A file on its own cannot really be called "gapless", however that
depends on how it was ripped. If a CD has deliberate silence between
tracks it's usually there for very sensible musical reasons. I have been
at mastering sessions where the mastering engineer added in silence, or
edited the silence that was included on the final DAT or CD-R, and asked
the artist/producer to listen to the difference. Typical DAT recorders
add a standard gap between tracks, and older tape formats (such as Sony
PCM-F1 on Betamax) have longer and less predictable gaps. A fraction of
a second added (or removed) in between tracks can make a huge difference
to how an album comes across.

The aim of pregaps on a CD is to allow the track skip buttons to hit the
beginning of the desired track, while also having the correct gap before
the track when playing through from the previous track.

Strictly, that silence isn't part of any track, but to preserve the
overall flow most ripping software will add the silence to the end of
the previous track. That way the tracks will all start at the beginning
of the music, not on silence.

For some albums, this fails on tracks where the pre-gap might actually
be part of an intro or a segue from the previous track. I can't think of
any specific examples, but many albums of live music will have a spoken
intro before some tracks (mastered in the pre-gap).


> If I rip now all 4 titles and play them later the player must know, that
> Song 1 is not gapless but Song2 and 3 ?Fit? together.
> 
> What will happen, if I delete Song3?. Is the player playing now from Song2
> to Song4 gapless, which is not correct?

If track 3 is deleted (or the end user removes it from a playlist, or
whatever) then the "fit" (or "flow") that was there (between tracks 2
and 3 and 4) has been changed. What happens depends on where the silence
was placed in each track.

This is not a new problem, as the very first CD audio players had the
ability to skip tracks, either by programming a crude "playlist" or with
a "shuffle" function.

> Anybody a good description for me, how this is solved on FLAC?

The most complete "solution" is the entire CD as a single FLAC file,
with CUE sheet both in the FLAC metadata and a separate CUE file. That
way, all the "bonus track" weirdness can be preserved.

A more flexible solution is to use 1 FLAC file per track with decisions
made as to how it will sound with and without all tracks present and in
sequence.

-- 
-Dec.
---
"Mosaic is going to be on every computer in the world." - Marc Andreessen, 1994


More information about the flac-dev mailing list