• WANTED: Happy members who like to discuss audio and other topics related to our interest. Desire to learn and share knowledge of science required. There are many reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!

Dithering is a Mathematical Process - NOT a psychoacoustic process.

j_j

Major Contributor
Audio Luminary
Technical Expert
Joined
Oct 10, 2017
Messages
2,267
Likes
4,758
Location
My kitchen or my listening room.
I have calculated a sine wave of magnitude .4, rounded it, added uniform dither, rounded that, and added tpd, and rounded THAT, i.e. I've set a step size of '1' in the quantizer.

The routine that does this will follow in a comment.

The photo I'm attaching now has 4 lines. each line shows a signal. The four columns are
(signal) (signal spectrum) (error signal) and (error spectrum)

The four lines are
dither_demo.jpg

undithered unquantized
undithered quantized - NOTE THE SIGNAL IS GONE. POOF, LOST, MISSING, GONE. Information is ***LOST***
uniform dithered quantized - Note, signal is back, but noise level changes with data value, so data modulates noise level.
TPD - Note, signal is back at same level, noise is 3dB higher, but there is no modulation of the noise level.

This shows, clearly, visibly, and without debate, that DITHERING PRESERVES INFORMATION.

That is all!
 
OP
j_j

j_j

Major Contributor
Audio Luminary
Technical Expert
Joined
Oct 10, 2017
Messages
2,267
Likes
4,758
Location
My kitchen or my listening room.
This script generates that screen shot:

clc
clear all
close all

x=.4*sin((1:8192)/512*2*pi);

xnd=round(x);

for ii=1:8192
t=rand();
xud(ii)=round(x(ii)+t-.5);
t=rand()+rand();
xtd(ii)=round(x(ii)+t-1);
end

xt=abs(fft(x));
xndt=abs(fft(xnd));
xudt=abs(fft(xud));
xtdt=abs(fft(xtd));

xe=x-x;
xnde=x-xnd;
xude=x-xud;
xtde=x-xtd;
xet=abs(fft(xe));
xndet=abs(fft(xnde));
xudet=abs(fft(xude));
xtdet=abs(fft(xtde));

subplot(4,4,1)
plot(x)
title('x');
subplot(4,4,2)
plot(xt);
title('spectrum of x');
subplot(4,4,3)
plot(xe)
title(' error');
subplot(4,4,4)
plot(xet)
title('error spectrum');

subplot(4,4,5)
plot(xnd);
title('no dither');
subplot(4,4,6)
plot(xndt);
title(' spectrum ');
subplot(4,4,7)
plot(xnde)
title('error');
subplot(4,4,8)
plot(xndet);
title('error spectrum');

subplot(4,4,9)
plot(xud)
title('uniform dither')
subplot(4,4,10)
plot(xudt)
title('spectrum uniform');
subplot(4,4,11)
plot(xude)
title('error')
subplot(4,4,12)
plot(xudet)
title('error spectrum')

subplot(4,4,13)
plot(xtd)
title('tpd');
subplot(4,4,14)
plot(xtdt)
title('tpd spectrum');
subplot(4,4,15)
plot(xtde)
title('tpd error');
subplot(4,4,16)
plot(xtdet)
title('tpd error spectrum');
 
OP
j_j

j_j

Major Contributor
Audio Luminary
Technical Expert
Joined
Oct 10, 2017
Messages
2,267
Likes
4,758
Location
My kitchen or my listening room.
I was going blind trying to read the plots then realized I could click on them for full size. :)

Thanks for the visualization. It helps a lot.


Yeah, there is a (*&(*&(*load of detail there. So I uploaded a full 1080P version. I might have done this at work and done a 4K, even, now that you point it out.
 

DonH56

Master Contributor
Technical Expert
Forum Donor
Joined
Mar 15, 2016
Messages
7,834
Likes
16,496
Location
Monument, CO
Nice job, @j_j ! Need to copy the script and fire up Matlab again.

I must have missed it -- who thought dither was psychoacoustic? How is such a conclusion even considered (I guess by audiophiles who dismiss all science and math as irrelevant?)

I first heard of dither (noise decorrelation) in the early 1980's and applied colored noise to an RF ADC for an X-band (8-12 GHz) radar system. It worked and I'm pretty sure no psychoacoustics were involved... :)
 
Last edited:

SIY

Grand Contributor
Technical Expert
Joined
Apr 6, 2018
Messages
10,383
Likes
24,749
Location
Alfred, NY
Sigh. This takes me back to my days at Nicolet...

/very old man
 

DonH56

Master Contributor
Technical Expert
Forum Donor
Joined
Mar 15, 2016
Messages
7,834
Likes
16,496
Location
Monument, CO
Sigh. This takes me back to my days at Nicolet...

/very old man

Nicolet, that brings back some memories... What happened to NTI? Sure I knew at one time, senility.
 

SIY

Grand Contributor
Technical Expert
Joined
Apr 6, 2018
Messages
10,383
Likes
24,749
Location
Alfred, NY
Nicolet, that brings back some memories... What happened to NTI? Sure I knew at one time, senility.

A few years after I left, they were acquired by Thermo-Fisher. AFAIK, the digital scopes are long gone, but their analytical instrumentation is still around, though with NIC sort of in the background as a brand.
 

pkane

Master Contributor
Forum Donor
Joined
Aug 18, 2017
Messages
5,626
Likes
10,202
Location
North-East
I have calculated a sine wave of magnitude .4, rounded it, added uniform dither, rounded that, and added tpd, and rounded THAT, i.e. I've set a step size of '1' in the quantizer.

The routine that does this will follow in a comment.

The photo I'm attaching now has 4 lines. each line shows a signal. The four columns are
(signal) (signal spectrum) (error signal) and (error spectrum)

The four lines areView attachment 47956
undithered unquantized
undithered quantized - NOTE THE SIGNAL IS GONE. POOF, LOST, MISSING, GONE. Information is ***LOST***
uniform dithered quantized - Note, signal is back, but noise level changes with data value, so data modulates noise level.
TPD - Note, signal is back at same level, noise is 3dB higher, but there is no modulation of the noise level.

This shows, clearly, visibly, and without debate, that DITHERING PRESERVES INFORMATION.

That is all!

Here's an example of 4 bit quantization of 1kHz signal using my DISTORT software.

No dither:
1580392579146.png


TPDF dither:
1580392553881.png


Shaped dither, pushing quantization noise to higher frequencies (unfiltered):
1580392609364.png


Shaped dither, filtered at 20kHz:
1580392785359.png
 

Matias

Master Contributor
Forum Donor
Joined
Jan 1, 2019
Messages
5,029
Likes
10,794
Location
São Paulo, Brazil

solderdude

Grand Contributor
Joined
Jul 21, 2018
Messages
15,891
Likes
35,912
Location
The Neitherlands
As far as I know, there are different dithering algorithms that generate different noise shaping responses, and the developers choose them by psychoacoustics tests.

The demo by @j_j was intended to show what dither does (preventing truncation) showing adding dither is and not :
Dithering is a signal processing that always results in degradation of a signal waveform (adding noise) but the same time it improves auditory perception of that signal..... So, dithering is a perfect example of psychoacoustic treatment of audio signal

Of course the NS3™ algorithm is based on psychoacoustic tests and improves the final result of added jitter by shifting noise into higher frequencies that are less audible by changing the 'shape' of the jitter as shown by @pkane. Paul's shaped dither most likely differs a bit from NS3™.
 

pkane

Master Contributor
Forum Donor
Joined
Aug 18, 2017
Messages
5,626
Likes
10,202
Location
North-East
Of course the NS3™ algorithm is based on psychoacoustic tests and improves the final result of added jitter by shifting noise into higher frequencies that are less audible by changing the 'shape' of the jitter as shown by @pkane. Paul's shaped dither most likely differs a bit from NS3™.

DISTORT shaped dither is my own creation and will bear no resemblance to anything else out there. It was just meant to help demonstrate the difference between no dither, TPDF, and a simple shaped dither :) Of course, this being part of DISTORT, you can also listen to the differences.
 

Hayabusa

Addicted to Fun and Learning
Joined
Oct 12, 2019
Messages
786
Likes
518
Location
Abu Dhabi
Nice job, @j_j ! Need to copy the script and fire up Matlab again.

I must have missed it -- who thought dither was psychoacoustic? How is such a conclusion even considered (I guess by audiophiles who dismiss all science and math as irrelevant?)

The dither can be noise shaped with psycho-acoustic rules to minimize the audibility.
 

DonH56

Master Contributor
Technical Expert
Forum Donor
Joined
Mar 15, 2016
Messages
7,834
Likes
16,496
Location
Monument, CO
spin off from here

Ah, thank you. Using psychoacoustics (is that a euphemism for listening tests in this context?) to decide what sort of dither to use seems fundamentally different than explaining how dither works.

In my example the applied noise was out of the signal band and still impacted in-band signals as desired. It did require higher amplitude, natch. I do not recall trying different envelope shapes at that time; white noise is the only source I had and I filtered it to obtain the desired passband. It was a flash ADC, not delta-sigma.
 

DonH56

Master Contributor
Technical Expert
Forum Donor
Joined
Mar 15, 2016
Messages
7,834
Likes
16,496
Location
Monument, CO
The dither can be noise shaped with psycho-acoustic rules to minimize the audibility.

What rules? Curious... My system shaped the noise to move it out of band and control the amplitude. What sort of psychoacoustic rules are used to optimize dither in audio systems? Do they correlate to the math? Noise decorrelation is pretty well defined and has been for decades; I don't know anything (relatively) about psychoacoustics.
 

Veri

Master Contributor
Joined
Feb 6, 2018
Messages
9,596
Likes
12,036
I suppose Radsone's marketing of their "advanced dithering" is just BS?

7cu6g8T.png


They're quite literally advertising two "Radsone-tuned" dithering modes.
 

DonH56

Master Contributor
Technical Expert
Forum Donor
Joined
Mar 15, 2016
Messages
7,834
Likes
16,496
Location
Monument, CO
There are a myriad of ways to apply noise decorrelation but fundamentally they should all do the same basic things as shown by @j_j. Level (amplitude) and "shaping" of the applied noise will certainly produce measurable, and probably audible, differences in the noise floor and such. Guess I am still confused on the debate. You can use psychoacoustics to tweak whatever you want, but dither itself is a known process and predictable (statistically) results. As an analogy, if I add distortion (dither), the effects are measurable and predictable; psychoacoustics should predict whether I like it or not. I think; psychoacoustics is way out of my field.
 
Top Bottom