• 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.

restorer-john

Grand Contributor
Joined
Mar 1, 2018
Messages
12,743
Likes
39,009
Location
Gold Coast, Queensland, Australia
a good question might be is that even relevant with sigma-delta technology vs classical multi-bit.

Absolutely true, but as you know, my pet interests are vintage and often classic CD players with multibit D/As, some with individual trimming of the top 1-4 bits for minimizing THD at low levels. Here's the one on my bench right now as I write. A Pioneer PD-7300 (18bit, 8x OS using the NPC SM5813 and twin BB PCM58Ps. It has of course the trims for each D/A set at -60dB which is essentially a zero cross adjustment for the MSB.

pioneer.jpeg


So it is relevant to me, and I appreciate the discussion and contributions from you all, especially as I was getting different THD figures depending on the reference discs and issues I couldn't make sense from. :)
 

pma

Major Contributor
Joined
Feb 23, 2019
Messages
4,616
Likes
10,805
Location
Prague
So it is relevant to me, and I appreciate the discussion and contributions from you all, especially as I was getting different THD figures depending on the reference discs and issues I couldn't make sense from. :)

I think it might be because those ancient CD test discs usually did not use dither. As I can see even now, dither is not well understood by many, which surprises me. The result of CD player spectrum with non-dithered 997Hz and 1000Hz sine would be quite big.

Please see below a comparison of CD player spectra with dithered and non-dithered 1kHz/-60dBFS. The usage of non-dithered signal is a mystery to me.

1581494565295.png


1581494590417.png
 

pozz

Слава Україні
Forum Donor
Editor
Joined
May 21, 2019
Messages
4,036
Likes
6,827
Given a 64-bit float DAW environment, Bitter (FREE) is a useful plug-in which shows what a plug-in returns.

e.g. 1kHz sine generated in 64-bit float:

View attachment 49779

Following an EQ plug-in (filters all off):

View attachment 49780

Following a DIFFERENT EQ plug-in (filters all off):
View attachment 49781

Both are truncating to 32-bit float.

Most modern plug-ins are 64-bit float internally, but many will return 32-bit float back to the host application. Some are still 32-bit float internally.

Here is the older of the two EQ plug-ins referred to above, with a bell filter added:

View attachment 49789

And the more modern of the two EQ plug-ins referred to above with approx. the same bell filter added:

View attachment 49790




Some plug-ins that are 64-bit internally but return 32-bit float will dither before truncation. Those that return fixed point 16-bit/24-bit etc. will usually have the option to add dither first (sometimes noise shaping also, e.g. in the case of various Waves limiters.) This can be a problem, actually, because then you have to manage the subsequent gain structure around the added dither, i.e. don't start adding too much gain or the noise floor will be far higher than it need be!

Strictly, dither is needed for all operations but then we get into the question of dither for floating-point and certainly at 64-bit float, truncation effects aren't generally anything to ever be concerned about.

(Hopefully the developer hasn't got into a mess e.g. with denormals.)

Incidentally, when Cakewalk (SONAR) moved over to 64-bit floating-point, I think it was the first DAW to do so (or certainly one of the first) and someone from Cakewalk wrote an AES paper showing that 64-bit float was needed in a mixer to achieve strict 24-bit performance. (i.e. 32-bit float is insufficient.) The (in)audibility of the difference (for mixing, i.e. scaling/adding) is a bit irrelevant to my mind given 64-bit float mixing is no problemo for a modern PC. :)

Yes, when exporting to a lower bit-depth add dither at the end of the "stereo bus" and not on every channel/sub mix bus--unless exporting "stems" (i.e. sub-mixes) or individual tracks to lower bit-depth.
Thanks @xr100 for the detailed response:)

+1 as a well as a like.
 

pma

Major Contributor
Joined
Feb 23, 2019
Messages
4,616
Likes
10,805
Location
Prague
Bitter is not very reliable tool, it shows 32-bit in mp3 files, just because the codec is doing (calculating) something. It does not show true information resolution.
 

mansr

Major Contributor
Joined
Oct 5, 2018
Messages
4,685
Likes
10,705
Location
Hampshire
So, back to dither. If the +32767/-32767 digitally generated Philips tracks have dither applied, doesn't that dither potentially (depending on the dither characteristics) push some samples "over" and technically into clipping?
The RMS value of the Philips track is slightly higher than it ought to be, suggesting that dither was applied to a full-scale signal, possibly clipping at the peaks. Looking for consecutive samples with peak value, there are some in the two lowest frequencies. The higher frequencies may still have clipped single samples. It's harder to tell whether this has happened.
 

xr100

Addicted to Fun and Learning
Joined
Jan 6, 2020
Messages
518
Likes
237
Location
London, UK
Bitter is not very reliable tool, it shows 32-bit in mp3 files, just because the codec is doing (calculating) something. It does not show true information resolution.

If the MP3 decoder spits out 32-bit float, then that's what it'll show.

16-bit source signal:

1581503013897.png


Scale by -1dB:

1581503078653.png


Hence the discussion in my post about e.g. plug-ins that are 64-bit float internally returning 32-bit float, and those that are 32-bit float internally returning... 32-bit float... and an example of the different performance of EQ's (i.e. IIR filters.)

Bitter is a very useful tool for its intended application. :)
 

mansr

Major Contributor
Joined
Oct 5, 2018
Messages
4,685
Likes
10,705
Location
Hampshire
The reason for all this investigation was primarily to get to the bottom of the following:
a) why the various prime frequencies on standard test discs and determine why they were chosen and also why aren't we still using primes?
If not using dither, a longer period before the rounding pattern repeats lowers the level of individual distortion products. This period is maximised for (integer) frequencies that are prime relative the sample rate. They also take on many more distinct values. An undithered 16-bit 1 kHz signal has only 441 different values.

Here's a graph illustrating the difference (FFT size 65536, Dolph-Chebyshev window):
1581510695300.png


b) why 0dbFS was not 0dbFS on some standard test discs.
Do you mean the Denon track having peaks of 32766? I doubt we can find out for sure why they did that.

c) the effect of dither on full level digitally derived sines on these test discs and the reporting of clipping on such tracks.
Clipping a few peaks of a sine wave by at most 2 LSB has no discernible effect on the spectrum.

d) why the large difference in the 5th harmonic of 1KHz (~10dB less) on the Denon undithered track.
Good question. There's also a lot more smearing of the main peak. Maybe (part of) the reason is that 5 * 997 Hz is closer to the centre of an FFT bin than 5 * 1001 Hz.

e) what arbitrary frequency (~1KHz) hits the most 16 bit theoretical values (exercises all the levels @16/44.1) as that is the one I figure I want to use.
Over what time period? A frequency of 1000 + 1/32768 Hz hits all 16-bit values over about 60 seconds.
 
Last edited:

bennetng

Major Contributor
Joined
Nov 15, 2017
Messages
1,634
Likes
1,693
Bitter is not very reliable tool, it shows 32-bit in mp3 files, just because the codec is doing (calculating) something. It does not show true information resolution.
It is entirely possible to store 32-bit data in mp3 files if both the encoder and decoder support the format. Try the attached volume fade mp3 file.
32bit mp3.png


Also read this:
https://www.audiosciencereview.com/...ot-a-psychoacoustic-process.11169/post-318338

...and this:
https://www.audiosciencereview.com/...tively-best-most-compliant-mp3-decoder.10886/
 

Attachments

  • 32bit mp3.zip
    83.1 KB · Views: 82
Last edited:

Hayabusa

Addicted to Fun and Learning
Joined
Oct 12, 2019
Messages
839
Likes
585
Location
Abu Dhabi
There is actually a probability distribution which is difficult to compute. We had to study this for ADSL where crest factor reduction was important and a single over in a symbol could trash the data. In one of Archimago's blog posts he found a pathological case in a commercial CD. If you look at the cause it is not hard to push it even further but the probability of having exactly that sequence occur vanishes rapidly. By simply pushing individual samples around in Audition I could get well over 3.5dB.

I just did a test with "the worst case sequence" from https://www.gearslutz.com/board/geekslutz-forum/410284-maximum-intersample-peak.html and you are right, its indeed more than 3.5dB.

Simulated with 8 times oversampling in audacity this gives a peak of +6.67 dB:

1581509983132.png
 

bennetng

Major Contributor
Joined
Nov 15, 2017
Messages
1,634
Likes
1,693

Hayabusa

Addicted to Fun and Learning
Joined
Oct 12, 2019
Messages
839
Likes
585
Location
Abu Dhabi

Hayabusa

Addicted to Fun and Learning
Joined
Oct 12, 2019
Messages
839
Likes
585
Location
Abu Dhabi

pma

Major Contributor
Joined
Feb 23, 2019
Messages
4,616
Likes
10,805
Location
Prague
If the MP3 decoder spits out 32-bit float, then that's what it'll show.

Hence the discussion in my post about e.g. plug-ins that are 64-bit float internally returning 32-bit float, and those that are 32-bit float internally returning... 32-bit float... and an example of the different performance of EQ's (i.e. IIR filters.)

Bitter is a very useful tool for its intended application. :)

Yes but I am not taking the usefulness of Bitter too seriously, as well as I am not taking seriously 32-bit resolution of the mp3 format.

If I start with 1kHz/16-bit wav, Bitter properly shows 16-bit resolution. Then I make a conversion to the stupid mp3 format and Bitter shows 32-bit ...., which is a nonsense, because there is no information added to the original 16-bit signal. Only degradation is added. Similar with all added fade-outs etc. As such, Bitter is unreliable, because no one knows what processing was used with the recording. I do not care about computed data that carry no useful new information.

bitter_wav16bit.png

Original 16-bit wav

bitter_wav16bit_to_mp3.png

Same 16-bit wav converted to mp3

bitter_wav16bit_to_mp3_spectr.png

.... and spectrum of the mp3 file

Interestingly enough, CoolEdit Pro shows the proper real bit depth of that f...ing mp3 file, which is 16-bit.
1581514882862.png


finally both files, wav and mp3 attached.
 

Attachments

  • test_signals.zip
    508.8 KB · Views: 71
Last edited:

Hayabusa

Addicted to Fun and Learning
Joined
Oct 12, 2019
Messages
839
Likes
585
Location
Abu Dhabi
It is just an amplified 1 LSB dither (rather than +/- 1 LSB) with DC offset corrected, so basically a square wave sounds like white noise.

Ah, that's a difference.. I used the audacity white noise generater at level 0.5.
 

Hayabusa

Addicted to Fun and Learning
Joined
Oct 12, 2019
Messages
839
Likes
585
Location
Abu Dhabi

bennetng

Major Contributor
Joined
Nov 15, 2017
Messages
1,634
Likes
1,693
Yes but I am not taking the usefulness of Bitter too seriously, as well as I am not taking seriously 32-bit resolution of the mp3 format.

If I start with 1kHz/16-bit wav, Bitter properly shows 16-bit resolution. Then I make a conversion to the stupid mp3 format and Bitter shows 32-bit ...., which is a nonsense, because there is no information added to the original 16-bit signal. Only degradation is added. Similar with all added fade-outs etc. As such, Bitter is unreliable, because no one knows what processing was used with the recording. I do not care about computed data that carry no useful new information.

View attachment 49891
Original 16-bit wav

View attachment 49892
Same 16-bit wav converted to mp3

View attachment 49893
.... and spectrum of the mp3 file

Interestingly enough, CoolEdit Pro shows the proper real bit depth of that f...ing mp3 file, which is 16-bit.
View attachment 49895

finally both files, wav and mp3 attached.
The decoding bit-depth can be configured.
audition.png


Algorithms in modern lossy codecs don't have a fixed bit-depth. In fact, if you insist to use fixed-point, there will be risks of clipping during decoding, even if the input file is 16-bit.
https://izotope-rx.livejournal.com/5760.html
https://forum.cockos.com/showthread.php?p=2001665#post2001665
 

DonH56

Master Contributor
Technical Expert
Forum Donor
Joined
Mar 15, 2016
Messages
7,916
Likes
16,749
Location
Monument, CO
I've lost track of this thread... Regarding intersample amplitude, I have seen 3-6 dB over full-scale fairly often for full-scale, or near full-scale (IEEE testing is typically at -1 dBFS) input signals, and 6-12 dB or more inside the digital filter structures subject to how well the filter gain structure was optimized. Before I had the grad class, and again after I forgot and shot myself in the foot again, I could easily hit 20 dB "over" in the digital filters. Which is quite vexing when you do all the simulations using 64-bit floating-point math (where things are fine) and then dump the coefficients into a 16- or 32-bit DSP/MCU in the actual implementation. :facepalm:
 
Top Bottom