3
$\begingroup$

I am having trouble with some intuition with quantization, bit-depth, noise floor, dynamic range and signal/noise ratio. Let's say I have two signals, $s_1$ and $s_2$ that are 1hz sine waves, with slightly different amplitudes (8 vs 8.1). The signal is sampled at 8hz and quantized into q1 and q2 as shown below. They quantize to the same samples whether I round, truncate towards zero, floor or ceiling. How is the original amplitude recovered?

$$s_1 = 8.0\sin( 2 \pi t )$$ $$s_2= 8.1\sin( 2 \pi t ) $$

sample(n) time(t) s1 s2 q1 q2
0 0.000 0.000 0.000 0 0
1 0.125 5.657 5.728 5 5
2 0.250 8.000 8.100 8 8
3 0.375 5.657 5.728 5 5
4 0.500 0.000 0.000 0 0
5 0.625 -5.657 -5.728 -5 -5
6 0.750 -8.000 -8.100 -8 -8
7 0.875 -5.657 -5.728 -5 -5
8 1.000 0.000 0.000 0 0
$\endgroup$
0

2 Answers 2

5
$\begingroup$

You can’t recover, that’s what quantization error is.

Because the quantized values $q_1$ and $q_2$ are identical, recovering the exact original amplitude difference between $s_1$ and $s_2$ is impossible from the quantized samples alone.

To mitigate such issues, you could:

  1. Increase Bit-Depth: More levels reduce the quantization step size and hence quantization error.
  2. Dithering: Adding a small amount of noise before quantization can spread quantization error, making it less correlated with the signal and more like random noise, which can sometimes help in perceptual quality.

In your example, you want the quantization step to be $$\Delta\leq 0.1$$ If your signals have maximum amplitude, say, from $-10$ to $10$, giving you a dynamic range $D=20$, you can calculate the needed bit depth to achieve that quantization step: $$\Delta =\frac{D}{L-1}$$ where $L$ is the number of levels. Solving for $L$, you need $$L\geq 201$$ levels, which requires $$n\geq \log_2(201)\geq 7.65 = 8 \,\texttt{bits}$$ A similar calculation for $D=100$ would give you $n=10 \,\texttt{bits}$

$\endgroup$
3
  • $\begingroup$ This matches my intuitive sense. I've only ever read that the bit-depth only affects the noise-floor and not the number of distinct "levels" that can be represented? In my example, if I change the amplitudes to 0.80 and 0.81, that puts both signals at around -2dB. 4-bits has the noise-floor at -24dB but I would end up with identical signals where as 8-bits the samples will have differences. Does this mean that the noise-floor and dynamic-range also affects the smallest detectable difference in level between any two signals? $\endgroup$ Commented Jul 22 at 16:02
  • $\begingroup$ Bit-depth determines the number of quantization levels: $2^n$ levels for an $n$-bit system. Each additional bit doubles the number of quantization levels, thereby halving the quantization step size $\Delta$. The noise floor is the level of quantization noise introduced by the finite bit-depth, and the dynamic range is the ratio between the largest signal and the smallest detectable signal. It can be expressed as $6.02n + 1.76 \, \tt{dB}$. As stated in my answer, the smallest detectable difference is tied to the bit-depth and dynamic range. For bit depth $n$: $$\Delta = \frac{D}{2^n-1}$$ $\endgroup$
    – Jdip
    Commented Jul 22 at 16:15
  • 1
    $\begingroup$ Thanks! Marked this as the answer. I need to go reread my signals book and wikipedia a few more times on noise-floor and signal-to-noise-ratio. $\endgroup$ Commented Jul 22 at 18:14
4
$\begingroup$

An Analog to Digital Converter (ADC) quantizes the input relative to its "full scale voltage". Typically you will need to scale the input signal so it fits reasonably well into range of the ADC,

In your example you could use and ADC with $8$ bits and a range from -10 to +10. This results in a quantization step of $\Delta = \frac{20}{2^8} \approx 0.078125$ If you were to do this, you get :

     0     0
    72    73
   102   104
    72    73
     0     0
   -72   -73
  -102  -104
   -72   -73
     0     0

So the signals are indeed different.

In your example you use a quantization step of $\Delta = 1$. Given that the max amplitude of your signal is 8.1 you are only using a little more than 4 bits. That generates so much quantization noise, that it masks most of the amplitude difference.

This is aggravated by the fact that you use a sine wave frequency that is an integer divider of the sample rate. That means the samples are repetitive and you are using only 3 unique amplitudes to quantize. If you were to choose and irrational frequency (say $\pi/3 Hz$) and a lot more samples, you would see the occasional difference even that this very low bit resolution.

enter image description here

$\endgroup$
1
  • $\begingroup$ If I scale down the amplitude to 0.80 and 0.81 (-1.94dB -1.83dB) and use 4-bits quantization, I get identical signals for q1 and q2. I thought the bit-depth only determined noise-floor? 4-bits has the noise-floor at about -24dB and 8-bits at around -48dB. Does this mean that 8-bits can represent more "levels" than 4-bits between say, 0dB and -10dB? $\endgroup$ Commented Jul 22 at 15:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.