Re: Sound mixing

From: <broteng_at_no.spam.please>
Date: Tue Sep 21 1999 - 17:26:08 CST

Thanks Sean!
I was citing from memory, and its been a while since I studied
communications theory.

Any idea why a CD uses a linear quantization scheme as opposed to a
non-linear scheme?

On Tue, 21 Sep 1999, Sean Connor wrote:

> On Tue, Sep 21, 1999 at 02:57:36PM -0600, wrote:
> > Andy:
> > I don't like to sit on the fence, but the answer is probably it
> > depends on the source of the sound. If you have sampled the sound
> > yourself it should be simple, since you know the scale used.
> > If the sound comes from somewhere else, eg. a CD, then the scale used
> > in non-linear.
> > A little background:
> > To improve the Signal to Noise Ration, for digital "sound" it is sampled
> > using a non-linear scale. This applies to music, voice communications
> > etc. A non-linear scale allocates more of the sample bins (at 8 bits
> > there is only 256 bins) to the lower voltage range thus improving the
> > S/N ratio for quieter sounds. This process is known as non-linear
> > quantization. Upon playback, the non-linear quantization is reversed to
> > restore the original signal.
> > How this applies to your problem:
> > If the two signals you are trying to mix have been quantized using a
> > non-linear process, then you can't simply at them together since we are
> > using a non-linear process. I believe that you will have to first reverse
> > the non-linear "quantization" then add and then reapply the nonlinear
> > sample algorithm (assuming of course you know what it is).
> >
> > Hope this helps Andy and that I'm not "out to lunch".!
> On the whole, you are correct. However, CDs don't use non-linear scales.
> As the matter of fact, I can't think of an example of any 16-bit encoding
> scheme that uses a non-linear scale -- the SNR is usually good enough
> without.
> But, you are entirely correct about the situation. If you have non-linear
> scales, you _cannot_ simply add the samples. You must first convert them
> to a linear scale, then add the samples.
> There are two commonly used non-linear scales: mu-law and A-law. mu-law
> is used in voice communications in North America. (Also, if you have an
> .au file, it uses a mu-law scale). A-law is used for voice communications
> in Europe. You can generally find the equations used for the transformation
> in digital communications textbooks.
> An important thing to remember: if you convert a non-linear sample to a
> linear one, _DO NOT_ truncate the converted sample at 8 bits! If you
> do, you'll add noise to the signal. Keep at least 12, preferably 16
> bits of precision in your intermediate calculations. Heck, keep as
> much precision as is reasonable.
> Also, if the samples are unsigned, you will have to convert them to signed
> before you can add them correctly. Otherwise, it won't work properly.
> (This is irrespective of whether the scale is linear or not.)
> --
> -Sean Connor (
> (
> (
> If you give Billy-boy a shot of Viagra, will he cease being Microsoft?
> -
> Saskatoon Linux Group Mailing List.
> -
> To unsubscribe, send mail to
> '' with
> 'unsubscribe' in the body.

Gregory Broten, P.Eng. (@ @)
                                              ( ^ )~^
Internet: ==w==w===
Ph. No:(306) 652-5493 []

Saskatoon Linux Group Mailing List.
To unsubscribe, send mail to
'' with
'unsubscribe' in the body.
Received on Tue Sep 21 17:26:08 1999

This archive was generated by hypermail 2.1.8 : Sun Jan 09 2005 - 13:53:59 CST