Previously we saw what dithering is, why it’s needed and when to use it.
In this video, we’ll take a closer look at the different types of dither signals.
They are generally categorized based on technique either non-subtractive or subtractive dithering,
the range or interval of the random values, usually measured in LSB or least significant
bit, and based on the probability density function.
All of this sounds complicated, but in fairness, there is not much to it.
Consider this input signal.
Let’s say we apply a dither signal or noise to this input.
Let’s zoom in to a single time instance, a thin slice of this signal.
Let’s also imagine a range of values that can be added to or subtracted from this sample
to create this dither signal.
There could be an equal probability that the noise value falls anywhere within this range.
Or you could have a probability which is skewed such that there is more likelihood for the
noise sample to fall in the middle of the interval, closer to the original sample.
This expression of probability is called a probability density function or PDF for short.
The simplest one to explain is the Rectangular probability density function.
This is essentially like rolling a die.
All die faces are equally probable and there is no bias.
So a dither signal with Rectangular PDF, produces a noise signal where the values are equally
probable throughout the interval range.
The next one is a Triangular probability density function or TPDF.
As you can imagine from this graph, this density function is skewed and biased towards the
middle of the interval.
An example for this, is rolling 2 dice and summing up the results.
The probability of 1,1 or 6,6 being cast is quite low, but there are several possible
combinations that result in the sum of 7.
It’s quite easy to achieve a triangular function programmatically for our dither signal.
We just take 2 rectangular functions, one with a range of -1 to 0, and another one with
a range of 0 to 1.
And we just add them together.
Done.
The last PDF we’re going to discuss today is the Gaussian PDF or Normal PDF.
An example for this would be the height of all the people in a given population.
Some people may be very short, some people may be extremely tall, but most people have
an average height and fall somewhere in the middle of the distribution.
The shape or the curve of the Gaussian PDF is determined by the RMS value, or sometimes
called the standard deviation.
Gaussian dither is easy to implement in the analog domain.
A simple diode can be used as a noise source, and this produces gaussian noise.
And a lot of the time, an explicit dither signal is not needed at all in the analog
domain, since electronic components produce enough noise to self-dither.
Gaussian PDF is generally not used for digital dither signals, neither is rectangular PDF.
The most commonly used function is the triangular PDF.
There are reasons for this.
The correlated distortion that quantization introduces can be mathematically measured.
This graph is called an input-output characteristics graph which is averaged out.
It measures the linearity of an output signal after quantization against the original signal
before quantization.
A straight line matching the input and output levels indicate a linear quantization system,
where no distortion is present.
If the line is skewed, it indicates that there is non-linearity in the quantization process,
which essentially means correlated distortion is still present.
We know that when dither is applied before quantization, the distortion generally disappears.
But what is the strength of dither we need to linearize the system?
A better way of putting this, is asking, what is the minimum strength of dither we need
to get away with not having any distortion in our output.
The strength of a dither signal is measured in LSBs.
The wider the interval of LSBs, the higher is the strength of the dither signal, and
higher is the noise floor of the output signal after quantization.
If we apply Rectangular PDF dither, when the measurements are averaged over a few thousand
traces, these are the input-output characteristic curves you get for different LSBs.
And we notice that in order to linearize the system with Rectangular PDF dither, we need
at least 1LSB of strength.
That’s a range from -0.5 to 0.5.
Beyond 1LSB, the system loses linearity again and gains it at every integer multiple of
the LSB.
For a triangular PDF dither, we see that the dither needs a range of 2 LSBs to linearize
the system.
Beyond 2 LSBs, the system stays linearized.
Looking at Gaussian PDF dither, since a gaussian function has a theoretically infinite range
on either side, we study the RMS value instead.
The RMS value needed for Gaussian dither to linearize the system is half an LSB.
On the face of it, the Rectangular PDF looks like a better option.
But for a strength of 1LSB, there are instances for very low frequency signals where there
is a risk of the noise being modulated by the input signal.
So practically, we need 2 LSBs to avoid that.
A 2LSB triangular PDF is more suitable than a 2LSB rectangular PDF.
Let’s take a quick look at Reaper.
There’s a Bit reduction / Dither plugin built in with loads of options.
Since this is a JS plugin, you can actually take a look at the source code of this plugin,
it’s built using a scripting language that’s compiled on the fly.
So if you ever want to look at the math behind a plugin, you can check it out here, and tweak
it as well if you want to.
We’ll turn off all the noise shaping for now.
And we’ll only look at the rectangular and triangular dither types.
The dither amplitude is set to 1 LSB.
But this is an absolute value, the effective range of values is from -1 to 1, so that’s
2 LSBs effectively.
I’ll also bring up a VU meter here to monitor the levels.
Once we reduce the bit depth to 8, we notice the dither noise.
In the VU meter, the RMS value is generally a better indicator of loudness, than the peak
value, and we can see that the RMS value of the noise floor is around -45dbBFS.
If you use Triangular dither, we see that the noise floor drops slightly to -48dBFS.
Another thing that I forgot to mention last time, is that you don’t need fancy plugins
for dither.
It’s mathematically well established and most DAW softwares have similar implementations.
But if you explicitly use a plugin for dither, always be aware of the possibility of accidentally
dithering twice.
For instance, if I wanted to render this track as a WAV file, Reaper has options for me to
dither and noise shape the master.
If I’ve applied dither at the track level and if these options are checked during rendering,
I would effectively be dithering the track twice, which is not what we want.
Alright, everything we’ve looked at so far falls under the category of non-subtractive
dithering.
Which means we add the dither signal to our input signal before quantization, and that’s
it.
We’re done.
Subtractive dithering on the other hand, is an extension of the existing technique, where
we take the same dither signal, and subtract it from the output.
This would lower the noise floor quite a bit.
Though this seems like a great solution, practically implementing it, is harder than it seems.
That’s because we need a way to transmit the dither signal to the output, beyond the
quantization boundary, and not have the dither signal be quantized as well.
One way of doing this is to use a pseudo random number generator with an agreed upon seed
followed by a DAC as the source of analog dither noise.
This makes it possible to transmit discrete values instead of the analog noise, and hence
dither subtraction becomes more realistic.
It’s way beyond the scope of this module.
Coming up next is noise shaping and how it’s applied in tandem with dithering to reduce
our perception of the noise in the output signal.