[linux-audio-user] Fwd: [Jamin] Re: soft clip: Achieving Gain, inconsequential overloads

Martin McCormick martin at dc.cis.okstate.edu
Sun Apr 11 17:29:26 EDT 2004


	I am new to this list and got in in the middle of this
discussion, but Here are some thoughts on 0 VU and what it means in
the digital domain.

	You probably already know that an A/D converter when fed
silence normally produces an output that is exactly halfway between
the number 0 and 0xFFFF for a 16-bit converter.  For a converter with
more or less bits, the maximum reading is all bits on so it is 2^N
power.

	The halfway point makes the D/A converter output a voltage
that is halfway between 0 and the maximum peak voltage that particular
A/D converter can put out.

	All that being said, the A/D converter can't go so much as one
bit more than maximum or one bit less than minimum so there is
absolutely no head room.

	If you send out a sine wave to the A/D converter, any part of
that wave that goes above the maximum input threshold or below the
minimum level will cause the output to  flatten out.  If you graph the
levels, you would see a sine wave with a flat spot on top and another
on bottom.  A little flat spot probably doesn't hurt anything if it
happens infrequently, but the more it happens, the worse the
distortion.

	In other words, if you stay below the hard limits, the
distortion is next to nothing, but it hits big time when you reach the
limits of the sample value the A/D converter was designed to read.

	As to how you can tell when you are flat-topping, one could
run a program designed to read the data for each channel and look for
extreme limits such as all 0's or all 1's for one or two samples in
succession and register this.

	In the amateur experimenting I have done with writing level
detectors for 8-bit audio, I look for low values between 0 and some
arbitrary value such as 1 to 3 and also values between 0xFF and maybe
0xFc to 0xFE.  If I see any of those, the alarm goes off because that
is darn close to the limit and may actually be the limit.

	I haven't messed much with stereo 16-bit audio such as a .wav
file, but the bits of the left-channel sample and the right-channel
sample are interleaved so you'll have to reassemble the 16-bit word
for each channel to test it.

Cheers.

Martin McCormick WB5AGZ  Stillwater, OK 
OSU Information Technology Division Network Operations Group



More information about the Linux-audio-user mailing list