KyEllen Notes

First checks before next steps

Device Setup

What Does a FLAC Copy Keep from a Recording?

In December 2024, the Internet Engineering Task Force (IETF) published RFC 9639, the specification for the Free Lossless Audio Codec (FLAC). The specification describes a format that can recover the original audio samples exactly from the compressed stream. That is what stays identical when an existing PCM recording goes into FLAC unchanged and is then decoded: the sequence of sample values, the numbers that represent the audio signal. PCM stands for pulse-code modulation, the form of sampled audio the specification describes.

A laptop displays an audio waveform beside headphones and a microphone on a timber desk.

The IETF defines lossless compression in the specification: "In other words, decompressing losslessly compressed information returns exactly the original data." The object of that sentence matters in a file conversion. In this example it is the audio supplied to the encoder. The expectation is that the recording comes back as the same PCM, even if the compressed file stores it in a very different way. There is a separate question about what information attached to the original file travels with it.

Which saved recording sets the baseline?

In a hypothetical conversion, the baseline is the saved PCM recording the encoder is meant to receive. A working audio editor can hold a recording alongside changes that have not been written to that file. For this comparison the intended input is the saved recording, with no intervening edit, channel conversion or sample-rate change. The point is to compare the decoder’s result with the input to the encoding operation, not with whichever version of a project happens to be open.

Sample values have an order within each channel. The channel arrangement and sample rate, the rate at which samples represent the signal over time, also matter to a comparison of the recording. The IETF specification describes those attributes separately from the values themselves. A useful comparison can therefore begin by establishing the recording’s channel arrangement and sampling details, then proceed to the values in corresponding positions. Matching some values without aligning their positions would answer a different question.

What makes the comparison like for like?
  • Baseline: the saved PCM recording supplied to the encoder
  • Alignment: corresponding sample positions and channels
  • Timing: the same sampling rate

There is a distinction between the numbers in the audio and the bytes of the file that carries them. Comparing the original file directly with the compressed file is a comparison of containers and encodings as well as of whatever sound is stored in them. The relevant comparison here comes after decoding, when corresponding audio samples can be examined as values. An output file can have a different structure while expressing the same recording.

The baseline is particularly useful if the editor is also set to change the audio as it exports. A hypothetical conversion that combines the channels into one makes a different sequence available to the encoder from the stereo sequence saved in the original. A perfect reconstruction of that new input would leave the earlier stereo recording unverified. That is why the kept original and the settings that leave its audio unchanged matter before a choice about how much to compress the file.

How does a prediction that misses still recover the right sample?

The IETF specification explains that audio samples tend to have much in common with neighbours close to them. FLAC divides the input into consecutive sections called blocks. When it uses prediction, a predictor supplies an estimate of a sample from earlier values. The format can store the difference between the actual and predicted values. That difference is called the residual.

The decoder can make the same prediction and add the decoded residual to recover the original value. An estimate that falls below the actual value leaves a positive difference to add; an estimate that goes above it leaves a negative one. That arithmetic is the reason prediction need not be exact. The correction is retained rather than rounded away. The first samples needed to start a predictor are stored without prediction, since the decoder does not yet have the preceding values it requires.

Where the correction enters
Encoding:
actual sample minus predicted sample gives the residual
Decoding:
predicted sample plus residual gives the original sample

Where the prediction works well, the specification explains that the residual can take fewer bits to code than the original sample sequence. The amount of space saved depends on the signal and how it is coded. A section for which the encoder cannot find a usable predictor can instead be stored without prediction. The choice changes how the sample values are represented, while the same lossless requirement applies to decoding either representation.

Stereo offers a second way to change the representation. The IETF describes an option that stores the left channel and a side channel containing the left-minus-right difference. The decoder then subtracts that difference from the left sample to recover the right sample. This side channel is part of the coding, not an extra channel to be preserved as part of the recording. A comparison with a stereo original concerns the reconstructed left and right channels, not the intermediate pair.

One consequence is that the compressed file is not a drawing of the waveform with fewer points. The data that restores the original values is still there. Seeing two waveforms that look alike on screen can help relate their contents, but a visual preview does not account for every numeric value that went into the conversion.

Two waveform panes appear side by side on an audio workstation.
Viewed over the operator’s shoulder, two blue waveform panes sit side by side on an audio workstation.

Does a match in the audio also account for the tags?

The IETF specification places file-level metadata, information about or associated with the recording, in blocks before the audio frames, the encoded units that carry the sample data. One such block, the Vorbis comment, can hold text fields often called FLAC tags. The format provides for these fields separately from the audio. A sample comparison can succeed without saying whether the title attached to the source file was copied into one of them.

What can be checked separately?
Audio samples
Comparison of decoded values with the saved input
Descriptive metadata
Inspection of the tags in the output file

The distinction works in the other direction as well. A familiar title on the screen identifies what a field says. By itself it cannot show that the audio beneath that title came from the same saved recording. Nor does the presence of a tag mechanism in the specification establish how a particular export tool maps the source file’s fields. That behaviour belongs to the export, so a title that needs to be kept is a separate observable property of the saved result.

What does reopening the FLAC prove before a sample check?

Opening the saved FLAC in a compatible player checks that the saved file, rather than the editor’s working preview, yields audio in that player. In a hypothetical check, the first thing that establishes is ordinary access to the output. Listening is useful for a check at that level. It does not inspect the value of each sample, establish that the whole file decodes without a problem or settle the fate of an unseen tag.

A small external drive is connected to an audio workstation on a wood desk.
An external drive sits on a wooden desk beside an audio mixing console.

In a second hypothetical check, software reads the PCM values of the saved baseline and decodes the FLAC, then compares the two sample sequences in order with their channels aligned. A full match is evidence of the property that lossless audio encoding is intended to preserve. If the sequences differ, the result establishes a difference between the files as compared. It does not, by itself, say whether the encoder received a changed signal or which step introduced a change.

There is also an integrity check within the format. The IETF specifies a field in the stream information for an MD5 checksum of the unencoded audio data. A checksum is a value calculated from specified data so that a later calculation can be checked against it. The specification says a zero value in this field means the checksum is not known. When a value is supplied, it lets a decoder check the audio against the checksum carried by the file, even when the stream’s structure looks valid.

That internal check and the comparison with the saved recording start from different references. The IETF specifies that the checksum covers the audio samples of all channels in a defined order and representation. It does not cover an album title or the contents of a picture block. If a different recording was supplied to the encoder in the first place, its own stored checksum would not name the earlier file a person intended to copy. The independently kept PCM baseline is what connects the output check to that particular recording.

The first saved FLAC can be kept alongside a second output made from the same baseline under a different compression setting. In that comparison the setting is the variable, while the input file, sample rate and channel arrangement stay put. If the audio in both outputs decodes to the same values as the original, differences in compressed size do not indicate a difference in the checked audio. That is a distinct result from a successful playback test or a comparison of title fields.

The same setup would expose an incomplete export that happened to play from the beginning. For the comparison to match, each sequence must also end at the same place. The shared opening of the recordings cannot account for samples missing from the tail.

Frequently Asked Questions

Can FLAC store a mono recording?

The IETF specification supports PCM audio with a single channel, which is mono. A mono input does not need to be made stereo to fit the format.

What does bit depth describe in digital audio?

Bit depth is the number of bits used to contain each sample, as defined in the IETF specification. It describes how a value is represented, while sample rate describes how often values occur.

Can a FLAC file hold cover art?

The FLAC specification defines a picture metadata block and includes front cover as a picture type. A file can carry artwork there independently of its audio frames.

Does a FLAC file need a seek table to skip to a different point?

The IETF’s FLAC specification says a decoder can jump to a sample without a seek table, but the delay can be unpredictable when the amount of data per second varies. A seek table records points in the stream that can shorten that delay.

Does every FLAC stream belong to the streamable subset?

The streamable subset adds restrictions to the general FLAC format. In the IETF specification, those restrictions allow a decoder that cannot seek to pick up in the middle of the stream and start decoding.

Sources

  • Internet Engineering Task Force (IETF): RFC 9639: Free Lossless Audio Codec (FLAC)