• WANTED: Happy members who like to discuss audio and other topics related to our interest. Desire to learn and share knowledge of science required as is 20 years of participation in forums (not all true). Come here to have fun, be ready to be teased and not take online life too seriously. We now measure and review equipment for free! Click here for details.

Dithering is a Mathematical Process - NOT a psychoacoustic process.

j_j

Addicted to Fun and Learning
Audio Luminary
Technical Expert
Joined
Oct 10, 2017
Messages
604
Likes
850
Location
My dining room.
#1
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!
 

j_j

Addicted to Fun and Learning
Audio Luminary
Technical Expert
Joined
Oct 10, 2017
Messages
604
Likes
850
Location
My dining room.
#2
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');
 

j_j

Addicted to Fun and Learning
Audio Luminary
Technical Expert
Joined
Oct 10, 2017
Messages
604
Likes
850
Location
My dining room.
#5
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

Technical Expert
Technical Expert
Forum Donor
Joined
Mar 15, 2016
Messages
3,808
Likes
5,449
Location
Monument, CO
#6
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

Technical Expert
Technical Expert
Joined
Apr 6, 2018
Messages
3,614
Likes
6,783
Location
Phoenix, AZ
#7
Sigh. This takes me back to my days at Nicolet...

/very old man
 

DonH56

Technical Expert
Technical Expert
Forum Donor
Joined
Mar 15, 2016
Messages
3,808
Likes
5,449
Location
Monument, CO
#8
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

Technical Expert
Technical Expert
Joined
Apr 6, 2018
Messages
3,614
Likes
6,783
Location
Phoenix, AZ
#9
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

Major Contributor
Forum Donor
Joined
Aug 18, 2017
Messages
1,235
Likes
1,712
Location
North-East
#10
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 View 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

Addicted to Fun and Learning
Forum Donor
Joined
Jan 1, 2019
Messages
520
Likes
641
Location
São Paulo, Brazil
#11

solderdude

Major Contributor
Joined
Jul 21, 2018
Messages
4,114
Likes
7,531
Location
The Neverlands
#13
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

Major Contributor
Forum Donor
Joined
Aug 18, 2017
Messages
1,235
Likes
1,712
Location
North-East
#14
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

Active Member
Joined
Oct 12, 2019
Messages
123
Likes
61
Location
Netherlands
#15
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

Technical Expert
Technical Expert
Forum Donor
Joined
Mar 15, 2016
Messages
3,808
Likes
5,449
Location
Monument, CO
#16
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

Technical Expert
Technical Expert
Forum Donor
Joined
Mar 15, 2016
Messages
3,808
Likes
5,449
Location
Monument, CO
#17
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

Major Contributor
Forum Donor
Joined
Feb 6, 2018
Messages
3,597
Likes
3,624
#18
I suppose Radsone's marketing of their "advanced dithering" is just BS?



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

DonH56

Technical Expert
Technical Expert
Forum Donor
Joined
Mar 15, 2016
Messages
3,808
Likes
5,449
Location
Monument, CO
#20
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.
 
Thread starter Similar threads Forum Replies Date
maxxevv General Audio Discussions 15

Similar threads

Top Bottom