R/E/P Community

Please login or register.

Login with username, password and session length
Advanced search  

Pages: [1]   Go Down

Author Topic: AD fundumentals, tutorial  (Read 2574 times)

danlavry

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 997
AD fundumentals, tutorial
« on: October 19, 2004, 08:18:57 pm »

AD fundamentals:

An AD samples the sound and converts it to a number. When we use the binary system, each number is made of bits. With digital, we must set some minimum possible value and maximum possible value for the signal. The first bit tells us if the sample is “above half way” between min and max. The first and second bit together tell “break” the min to max range into 4 equal parts, telling us in which quarter the sample value is. The first, second and third bits (together), break the range into 8 equal parts, and so on.

The first bit is called the most significant bit (MSB). Indeed, it is very significant to know in which half of the range the sampled signal is. But the information is “very crude”: a signal just slightly above the “min to max mid point” has the same MSB as a full scale max. This condition, indicated by MSB=1 is for a signal anywhere in the top half (a signal with MSB=0 is anywhere in the lower half). A 1 bit AD (only the MSB) will convert a signal into a crude 2 state affair. On average the difference between the signal input and the AD output would be very large. There are 2 ways to view the error:

1. The error is somewhere between zero and half the full range of the converter.
In other words: the MSB yields an “imprecise signal”.

2. The signal is known perfectly. But there is also an error on top of it. The error can be small, even zero, or as big as 1/2 the range. Of course each sample may have a different error, so on average the error is 1/4  of a full scale.

Choosing the second view, we have a perfect signal with an error, and assuming the error is random we can relate to it as noise. In fact, with full scale signal, the noise is at about 7.8dB below full scale. It is a rather limited dynamic range! Also, the error signal is not random with a 1 bit converter. The nature of the error is very signal dependent.

But when adding more bits we get lower and lower noise. Each added bit adds detail to the quantized (converted) signal. Again we can view it as having a perfect signal with smaller and smaller error, thus increased dynamic range (or lower the noise). Each additional bit lowers the noise by 6dB. Also, adding more bits makes the error less signal dependent, thus more random and noise like.

With 1 bit, the signal range is broken to 2 regions, the dynamic range is about -7.8dB
With 2 bits, the signal range is broken to 4 regions, the dynamic range is about -14.8dB
With 3 bits, the signal range is broken to 8 regions, the dynamic range is about -20.8dB

Each bit doubles the quantization levels (regions) and adds 6db To the dynamic range.
At 16 bits we have 65536 quantization levels and 98dB dynamic range
At 20 bits we have about a million quantization levels and 122dB dynamic range
At 24 bits we have about 16 million quantization levels and 146dB dynamic range

We can view the regions (quantization) as equally spaced grid horizontal lines. At 20 bits, we have about a million such grid lines…
What happens to a signal of say -95dB converted by a 16 bits AD? True we have 65536 grid lines, but the signal is so small that it is “broken into” only 2 regions. It is the same picture as a full scale converter with only 1 bit (the MSB), only it is now taking place at very small signal levels. Therefore the error signal is not random anymore, it is signal dependent.

A signal dependent error signal is very undesirable. Some of the error will produce very un pleasant harmonic distortions, and the rest ends up as noise changing in amplitude over time (noise modulation) which is an annoying.

For large signal levels, we solve the problem by adding more quantization levels (more bits, finer grid), which breaks the relationship between the error and the signal, making the error into random noise. But when the signal is very small, we can not always add more bits. The solution is often the addition of dither: adding sufficient externally generated random noise to “swamp” the signal dependent error. Of course adding dither increases the noise floor by some dB’s, yet it’s benefits outweigh the penalty.

To be continued…

BR
Dan Lavry
Logged

punkest

  • Jr. Member
  • **
  • Offline Offline
  • Posts: 63
Re: AD fundumentals, tutorial
« Reply #1 on: October 20, 2004, 03:29:18 am »

danlavry wrote on Wed, 20 October 2004 01:18

AD fundamentals:

With 1 bit, the signal range is broken to 2 regions, the dynamic range is about -7.8dB
With 2 bits, the signal range is broken to 4 regions, the dynamic range is about -14.8dB
With 1 bits, the signal range is broken to 8 regions, the dynamic range is about -20.8dB

Dan Lavry



Hi Dan, I think you meant 3 bits when the signal range is broken to 8 regions. Great post!!!

Thanks

Hans Mues
Logged

locosoundman

  • Jr. Member
  • **
  • Offline Offline
  • Posts: 65
Re: AD fundumentals, tutorial
« Reply #2 on: October 20, 2004, 09:24:33 am »

Could you possibly take it one step further and explain how TPDF Dither is implemented?

Thanks,
Rob
Logged
What does this little red button do?

danlavry

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 997
Re: AD fundumentals, tutorial
« Reply #3 on: October 20, 2004, 01:45:22 pm »

punkest wrote on Wed, 20 October 2004 08:29

danlavry wrote on Wed, 20 October 2004 01:18

AD fundamentals:

With 1 bit, the signal range is broken to 2 regions, the dynamic range is about -7.8dB
With 2 bits, the signal range is broken to 4 regions, the dynamic range is about -14.8dB
With 1 bits, the signal range is broken to 8 regions, the dynamic range is about -20.8dB

Dan Lavry



Hi Dan, I think you meant 3 bits when the signal range is broken to 8 regions. Great post!!!

Thanks

Hans Mues



Thanks, I corrected it.

Dan Lavry
Logged

danlavry

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 997
Re: AD fundumentals, tutorial
« Reply #4 on: October 20, 2004, 03:19:44 pm »

locosoundman wrote on Wed, 20 October 2004 14:24

Could you possibly take it one step further and explain how TPDF Dither is implemented?

Thanks,
Rob


Regarding triangle PDF. First why?

As I mentioned in the earlier post, when the signal get to be low, and we “run out of” quantization levels (not enough bits relative to small signal), the error signal becomes signal dependent - no more a random noise behavior. Part of the error signal becomes harmonic distortions, and the rest does becomes noise, but not at constant amplitude. The noise “going up and down in level” is called “noise modulation”.

Of course, adding random noise (dither) is a compromise, but just slight increase in the noise floor is a small price to pay. The harmonic distortion and noise modulation are a lot more offensive. Yet, we are interested in adding as little noise energy as possible.

Dr. Lipshitz and DR. Vanderkooey from Toronto university presented the solution, which is TDPF (triangle dither). They found out that 1 LSB rectangular dither is enough to eliminate the harmonic distortions, but the noise modulation does not disappear.

Say you have a quantization levels at -2,-1,0,1,2,3… and the dither amplitude is .999 (near 1). With zero signal, if the DC is at 0, the dither will be between 0 and 0.999, never hitting 1, so the output code is always at zero. No noise at all. But say we move the DC to +0.5. Now the dither is between 0.5 and 1.499. So about half the time we are between 0 and 1, the rest of the time we are between 1 and 2. We now have noise.

If a tiny bit of DC van change the noise, so can a small signal… That is how noise modulation occurs. So Lipshitz and Vanderkooey figured that the minimum noise energy required to eliminate both distortions and noise modulation is triangle noise (statistical distribution wise). The idea is to have the same constant noise level on average (changing DC or adding a small signal should not effect the noise amplitude.

What is triangle probability, how do we make it?

Lets, begin with rectangular probability. We take a dice and throw it many times, and soon enough we learn that each number (1 through 6) is about as likely as the other. With a lot of dice throwing we find equal probability thus a rectangular shape

1  x
2  x
3  x
4  x
5  x
6  x


Now let’s throw 2 dice. We can get a 1+1=2, or a 3+4=7 or “anything”. But there is only one way to get a 2 - (1+1)
two ways to get a 3 – (1+2) or (2+1)
three ways to get a 4 – (1+3) or (3+1) or (2+2)
four ways to get a 5
five ways to get a 6
six ways to get a  7
five ways to get a 8…
one way to get a 12 (6+6)

Combined to a pictue it looks like a traingle:

2   x
3   x x
4   x x x
5   x x x x
6   x x x x x
7   x x x x x x  
8   x x x x x
9   x x x x
10  x x x
11  x x
12  x

There are 2 requirements to get (on average) a triangle shape:
1. Each dice is random or “fair”
2. The dice do not influence each other, they are independent.

Therefore generating a triangular dither is done by adding 2 separate and INDEPENDENT rectangular dithers, 1LSB in amplitude each. The minimum value is 0+0=0. The maximum value is 1+1=2 LSB’s, and the energy is concentrated (peak of the triangular) at 1.

If you make that dither and subtract 1, you end up with:  
The minimum value is 0+0-1= -1. The maximum value is 1+1-1= 1 LSB’s, and the most of the time (peak of the triangular) you are near 0, thus most of the time you are not adding too much noise… The main point is that if you now add DC (or signal), the dither energy stays constant(I am not expaling in detail but it is so).

Adding more noise will buy noting and only increase the noise level. But it is interesting to note that adding more and more rectangular will approach a normal (Gaussian) distribution - It looks like a bell shaped curve.  

BR
Dan Lavry
Logged
Pages: [1]   Go Up