[flac] decoding with -F
Brian Willoughby
brianw at sounds.wa.com
Thu Oct 25 00:45:50 PDT 2007
There is no such thing as a "silent" sample. A sample does not
contain any "sound," therefore a wrong sample cannot contain either
silence or a wrong sound.
A sample is a snapshot of an instant in time, and one single sample
doesn't tell you what was happening before or after that sample.
When a speaker stops moving, you get silence. It doesn't matter
where the speaker is, once it stops moving long enough, you hear
nothing. A sample only tells you where the speaker cone should be
(or your eardrum), not whether it is moving or not. Movement of air
means sound, so you have to look at many samples together, in
sequence, in order to determine what sound will be heard.
For example, if you encode a full-volume sine wave, with a frequency
within the human hearing range, then inserting a "zero" sample at the
peak of the positive wave will give you a very loud pop. That's not
silent at all, even though the one bad sample is 0. At other points
in a given waveform, inserting a 0 would make less of a pop.
The interesting thing about FLAC is that it is a differential code.
Instead of always using 16 bits for each sample, FLAC encodes the
difference between the previous sample and the current sample, and
then uses the least number of bits to encode the small changes. I
have not had any bad FLAC files, but it is possible that reading a
bad "sample" would result in 0 difference from the decoder - i.e.
you'd get the same sample twice in a row. Repeating the same sample
when one is lost would be closer to "silence" than just blindly
inserting a 0, because it represents a cessation of movement of air
(or your eardrum). However, any bad sample causes distortion of some
kind, whether it is loud or quiet depends upon many factors of human
perception. But I don't know which result FLAC gives when errors are
found and -F is requested.
Brian W.
On Oct 24, 2007, at 17:35, Harry Sack wrote:
I was also wondering if there is a chance the flac decoder outputs a
wrong sample containing wrong sound rather then outputting a silent
sample or no sample at all. Or is this not possible ?
thx in advance
More information about the Flac
mailing list