Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Dither and Noise shaping (Read 4396 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Dither and Noise shaping

Can anyone please explain me how dither is used to reduce the quantization noise? And how Noise shaping works?


Dither and Noise shaping

Reply #2
Dither is irrelevant unless the signal, the audio you want, is very low level. Dither is low level  random noise at roughly the same amplitude as the low level audio it needs to correct (e.g. say below -85dBfs).

Sampling audio involves measuring the signal level at selected instances and assigning a number to represent the amplitude at that particular instance. The audio is, for all practical purposes, continuous. Like a geometric line, there are an infinite number of points, or amplitude values, between any beginning and end.

However, digital sampling can only choose from a limited number of values for each measurement. From  zero to the maximum possible amplitude the equipment can handle, or more realistically, from negative maximum to positive maximum on either side of zero, is divided into a certain number of discrete values, depending on the bit depth (16 bit has 2**16 possible values).

The converter (ADC) must choose the value that is nearest to the actual audio amplitude. The difference between that value and the actual amplitude is the quantization error. When converted back to audio (DAC) these errors make audio which sounds different than the original input.

When the audio amplitude is high, the error is so small, relative to the audio, that the difference cannot be heard. When the audio amplitude is very low, a sine wave, or any variation thereof, will tend to vary between two, or very few, digital values. By itself , it will not sound much like the original audio. It will not be very pleasant.

Dither, random noise, added to the audio, breaks up the assignment of such a small number of values because the noise adds to or subtracts from the audio signal at each sampling instance, making the measured level either larger or smaller than the audio actually is.

It turns out that the quantization error, averaged over enough time to register to human hearing, is completely eliminated. Over a sufficient number of samples, the actual value of the audio signal comes up often enough that, if graphed, a smooth curve can be drawn that exactly represents the input signal. There are also all those other random measurements around that line, but human hearing tends to automatically ignore them.

The output sounds very much like the original audio plus some white noise. The overall result is much clearer, more accurate, and better sounding than the audio signal sampled by itself would provide. This is also true with many things other than audio.

Noise shaping shifts the noise away from a purely random distribution in the frequency domain. A large part of the dither noise is created at frequencies not heard well by humans. The noise shaping curve is the mathematical distribution that provides both this benefit and randomness. The dither still works the same way, vis a vis quantization error, but mainly only the audio, not the noise, is heard, on playback.

Dither and Noise shaping

Reply #3
David, your references may be better than my writing, but I write slow.

Dither and Noise shaping

Reply #4
Can anyone please explain me how dither is used to reduce the quantization noise? And how Noise shaping works?


Dither doesn't reduce quantization noise. Dither may even raise the noise floor. It often does.

What dither does is randomize quantization noise and make it less noticable and ugly-sounding.

You see quantization noise may be a misleading term. Most of us think of noise as being something that is random, like a hiss or a roar.

Quantization noise is *not* nexessarily random. It is 100% predictable given the signal and the sampling used. It is not necessarily a hiss or a roar, but instead it is a mixture of different sounds that result from the mixing of the sampling process with the signal being sampled. It includes some odd and ugly sounds that can sound like varying tones. For example if you sample a rising sine wave (musical note going up the scale?) the quantizaiton noise includes tones that quickly rise and fall.

Rnadom noise, particularly at low levels is relatively innocious because its energy is so diffuse. The ear tends to ignore diffuse sounds. Quantization noise can include concentrated sounds that the ear picks up quite well, even when at low levels. 

What dither does is ensure that the quantization noise is randomized and more like regular thermal noise.

As I said quantization noise is 100% predictable given the signal and the sampling. If you add dither, then it becomes a third element that defines the exact nature of the quantization noise.  Dither can be just about any signal, but some signals work far better than others at fooling the ear. The idea of noise shaping is to force the quantizaiton noise into parts of the audio band where it  is less noticable to the ear.

The usual goal of designing dither is to force the quantization noise to be random and concentrated at high frequencies.

Dither and Noise shaping

Reply #5
@ Andy - Thanks a lot for your kind effort to explain me all. It is really helpful.

@ 2BDecided - The Hydrogen audio wiki is down i doubt.

@ Arnold - Helped me a lot to understand the concepts fully.

Dither and Noise shaping

Reply #6
Wiki's down because MySQL took an enormous #2 earlier today. (I'm honestly surprised the forum itself is working - props to admins)

I don't know if this analogy will help your understanding any, but there is a sort of connection between dither and one time pads in cryptography: in both cases, you're essentially adding random noise to a very non-random signal, in order to mask a signal you don't want predicted in some sense. In cryptography it's the plaintext, in audio, it's the quantization noise.

Dither and Noise shaping

Reply #7
That's a very bad analogy. Dither doesn't mask a discrete stream of information, but decorrelates quantization noise from the main stream of information, the audio signal. Further, it is not a main goal in cryptography to make a stream of information unpredictable - that is only a side effect. Unpredictability in one time pad cryptography refers to the key stream. "Unpredictability" in the domain of PCM audio refers to the unwanted data itself, not the key stream. Quantization noise gets decorrelated from the main signal to make it less audible (lets not forget that that is the primary goal). The key stream itself can simply be pseudo-random, thus possibly predictable in a cryptographical sense, but still completely accomplish all objectives required in the audio domain.

Dither and Noise shaping

Reply #8
Wiki's down because MySQL took an enormous #2 earlier today. (I'm honestly surprised the forum itself is working - props to admins)

I don't know if this analogy will help your understanding any, but there is a sort of connection between dither and one time pads in cryptography: in both cases, you're essentially adding random noise to a very non-random signal, in order to mask a signal you don't want predicted in some sense. In cryptography it's the plaintext, in audio, it's the quantization noise.


I think that most people who really understand dither would strongly object to the use of the word "mask". It's especially troubling when used in a context where people understand how masking works in the context of the perception of sound.

Dither does not mask, it randomizes. Dither imposes minor time-shifts on the transition points of the quantization process.