Wednesday, September 29, 2010

CDDA, pre-gap, post-gap

Notes on CD mastering to avoid tracks cutting off last few seconds.

This is how a CD is made:

Digital Audio, or CD-DA, was the initial compact disc format. The Red Book standard of 1980 was followed in 1987 by IEC 908. Sound is recorded in frames, each containing 24 bytes of digitized audio. A continuous, spiral track consists of lead-in followed by pre-gap, then a single physical track of audio frames, then post-gap, and finally lead-out. Multiple songs are accessed by dividing the physical track into as many as 99 logical tracks, and by subdividing logical tracks using indexing. All compact disc drives must be capable of playing this CD-DA format. [*]

The specifications are contained in the Red Book (costs $100 and you have to sign a NDA), but there are alternative specifications (close enough) free from ECMA.

The interesting fact is that by default the post-gap on each track is 2 seconds. The non-so-obvious fact is that this post-gap is not an additional 2 seconds, but is the last 2 seconds of the track. The gap is simply an index to the last two second, that a player playing in gapless mode will automatically skip (sometimes switching the display to a countdown).

Friday, September 24, 2010

Batch normalization

Make all the tracks in one folder the same volume (peak -3dB)
for i in *.wav; do sox "$i" "norm/$i" norm -3; done