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 for already recorded 16 bit audio (Read 10364 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Dither for already recorded 16 bit audio

Does it make sense to add dither to published (i.e. a CD) 16 bit audio? 

Some musical formats like .ape and .flac can represent higher than 16 bit samples. (you can find 24 bit examples on the web)  Shouldn't we be making (at least) 17 bit samples from ripped music, adding dither to move the quantization error to something less audible?

Is there a tool that will do this?  i.e. take a 16 bit WAV (or ape or flac ideally) and output a 17 or 18 bit file with dither noise?

Am I missing something fundamental here?

Bill

Dither for already recorded 16 bit audio

Reply #1
Does it make sense to add dither to published (i.e. a CD) 16 bit audio?

Not really -- unless you want to alter the signal in any way (like a volume adjustment) so that the altered signal is represented in a higher resolution (like floating point for example) and needs to get dithered again to 16 bit or less.

Some musical formats like .ape and .flac can represent higher than 16 bit samples. (you can find 24 bit examples on the web)  Shouldn't we be making (at least) 17 bit samples from ripped music, adding dither to move the quantization error to something less audible?
Is there a tool that will do this?  i.e. take a 16 bit WAV (or ape or flac ideally) and output a 17 or 18 bit file with dither noise?

I really don't understand what drives you to these conclusions. Exactly why should we add dither and store 17 or 18 bit signals?

Am I missing something fundamental here?


Possibly.

Cheers!
SG

Dither for already recorded 16 bit audio

Reply #2
Hi Bill,

ripping by itself doesn't require dither. It's just copying 16 bit audio from cd to another medium.
Using dither only makes sense when going to a lower wordlength (bits per sample), like from 24 to 16. The dither will remove the (re-)quantization distortion at the expense of some extra wideband noise. Adding dither without reducing wordlength is useless since it will only increase the noise level. If the signal contains quantization distortion from a previous process, it can't be removed with dither.

Most dsp processing of audio (plugins, EQ, level corrections etc.) will increase the wordlength somewhere in the signal path (like 56 or 64 bits), so applying dither is required every time when going back to a lower wordlength. The designer of the device is responsible for the internal dithering. It's usually beyond the control of the user.

Hope this helps,

Kees de Visser

Dither for already recorded 16 bit audio

Reply #3
>If the signal contains quantization distortion from a previous process, it can't be removed with dither.

I don't understand this:  I would have thought you could reduce one bit of quantization error by adding dither unless the CD already has dither on it (probably common these days but not common in some earlier CD's.  In the case of earlier CD's, if the quantization was simply a rounding up or down to the nearest 16 bit value, then adding dither now (and noise shaping to hide the noise) would seem to be beneficial: adding an extra bit of info making it a 17 bit recording.  I don't know if that is audible of course.

Am I still not understanding something?

Dither for already recorded 16 bit audio

Reply #4
(...) but not common in some earlier CD's.  In the case of earlier CD's, if the quantization was simply a rounding up or down to the nearest 16 bit value, then adding dither now (...) would seem to be beneficial.

No, it doesn't work that way. Dithering is supposed to be applied before quantization (=rounding). If some old CD has been made without dithering it's already as good as it can get. Adding dither after quantization only introduces more noise.

 

Dither for already recorded 16 bit audio

Reply #5
When you apply dither going from higher to lower resolution what you are actually doing is combining the dither with the bits that you are about to lose. If you are already at the lower resolution then you no longer have the bits that would be needed to combine with dither, i.e. the extra bits are all zero. Adding dither to zero should still give you zero so there should be no change in the data.

Edit: Think of it this way - dithering never improves the quality, it only lessens the loss in quality when going from higher to lower resolution.

Dither for already recorded 16 bit audio

Reply #6
>If the signal contains quantization distortion from a previous process, it can't be removed with dither.

I don't understand this:  I would have thought you could reduce one bit of quantization error by adding dither unless the CD already has dither on it (probably common these days but not common in some earlier CD's.  In the case of earlier CD's, if the quantization was simply a rounding up or down to the nearest 16 bit value, then adding dither now (and noise shaping to hide the noise) would seem to be beneficial: adding an extra bit of info making it a 17 bit recording.  I don't know if that is audible of course.

Am I still not understanding something?


Q. When do we dither?
A. We dither only when reducing the bit-depth of audio (e.g. when converting a 24-bit recording to 16-bit for producing a CD or when decoding an MP3, or after any mathematical operation on the sample values, such as applying gain or attenuation, running a lowpass filter, EQ, resampling etc. where the internal precision is greater than the original and we have to return to the original bit-depth).

Q. Why do we dither when reducing bit-depth?
A. To decorrelate the rounding or truncation error by adding a small random value just before we round that will push the samples value to be more likely to be rounded upward or downwards when it is rounded to the destination bit-depth. If we didn't decorrelate the rounding error, we would get slow fades of a tonal signal (e.g. sine wave) suddenly vanishing to silence. With random white noise, which has a low-strength, flat broadband frequency spectrum, the tonal signal remains distinguishable above the noise floor rather than vanishing and if it keeps getting smaller it will gracefully fade into the noise floor. Another symptom of not decorrelating the rounding error is possibly more severe, and that is quantization distortion, where spurious frequency components not present in the original are actually created by the process of rounding (which is somewhat analogous to clipping distortion). I speculate that this can be a reason that 8-bit sound cards sound rough as well as hissy when playing CD audio. With 16-bit audio it's audible far less often, so lack of dither can be harder to spot without worst-case test samples.

Once the fading tonal signal has been lost through lack of dither when rounding, it can't be recovered by dithering afterwards. Likewise, once spurious frequency components have been created by quantization distortion upon rounding or truncation, rather than being decorrelated by dither before rounding, they are present in the audio and won't be removed by dithering afterwards. In such cases adding dither to 16-bit audio either adds noise, or in the case of 0.5-bit magnitude dither, they make no change at all.

Dither Probability Distribution
A final note about dither - the probability distribution (PDF = probability density function) of the random numbers is also important. Triangular distribution of dither value probability (easily created from the subtraction of one independent random value from another where each have the common rectangular distribution) is arguably best, with a range of -1 LSB to +1 LSB (where LSB refers to the least significant bit magnitude of the destination bit-depth). This has peak probability of adding zero before rounding and low probability of adding 1 LSB. The other minimal fully-decorrelating probability distribution is rectangular dither of -0.5 to +0.5 LSB range, but it allows noise modulation to be created by the underlying signal where the dither noise may vanish and reappear from time to time based on the signal below. Triangular PDF (the sum or the subtraction of two independent rectangular values) doesn't have this disadvantage and behaves in an entirely consistent manner, but it is 3.01 dB louder than the rectangular noise (being the double the power of a single rectangular-PDF random signal of -0.5 to +0.5 LSB range).

Each successive trade-off gives slightly more noise in exchange for an advantage, but spread thinly over a white spectrum, and never concentrated in a peak or trough at one frequency or a group of a few, this is why triangular PDF dither is arguably preferable over:

a: No dither - quantization distortion creating new spurious frequencies or cancelling out intended frequencies entirely (i.e. the rounding error over time has strong tonal components which may add to or subtract from the original signal's tonal components) and varying rounding noise (in the non-tonal sense of noise, i.e. hiss).

or b: Rectangular dither - no quantization distortion, so no strong tonal components, but still varying noise (hiss), which if perceived at all (actually very unlikely for 16-bit audio) is far less easy for human perception to ignore than consistent background noise (hiss).

Some people refer to terms such as "digititis" (e.g. Bob Katz uses the term on digido.com) in early digital recordings, and usually it's lack of dither (though sometimes it's bad A-to-D converters or aliasing of frequencies above the Nyquist limit into audible frequencies below it, which can also be caused by shoddy ADC design or resampling).

Edit (afterthought): On the other hand, don't get too hung up on dither for single processes on 16-bit audio under normal conditions. I'm pretty damned sure my in-car CD/USB/MP3 player/radio doesn't dither and has only a 16-bit DAC, yet it sounds very good indeed even at full volume in a quiet location playing back mp3 files with Album Gain applied (hence quieter than original) or with deep fades applied to the mp3 using mp3DirectCut. I guess I'm no golden-ears but I do at least know what sort of problems I'm listening for. OK, full volume isn't painfully loud because I used Album Gain (50 watt output on 4 speakers isn't too shabby, though)
Dynamic – the artist formerly known as DickD

Dither for already recorded 16 bit audio

Reply #7
@Dynamic: I love your explanation. Perhaps there should be a link to it from the Wiki?

Dither for already recorded 16 bit audio

Reply #8
@Dynamic: I love your explanation. Perhaps there should be a link to it from the Wiki?
Indeed, nice post.
If age or weaknes doe prohibyte bloudletting you must use boxing

Dither for already recorded 16 bit audio

Reply #9
Dynamic,

I wonderful explanation indeed. 

But I still think we are talking about two different things.

I'm not proposing to add dither to a 16 bit stream and end with a 16 bit stream:  this would of course just add noise.

I am saying that you create a higher bit stream out of the lower bit one (17 or perhaps 18 bits) and THEN add the dither.  It seems to me that 1 bit of dither added in this way could help lower the quantization error from the original rounding/truncating of the original 16 bit signal (which by implication is a downsampling from reality which is infinite precision)

Dither for already recorded 16 bit audio

Reply #10
I'm sorry but I can't quite make sense out of what you are asking for. If you take the 16 bit data from a CD and pass it unmodified to a 16 bit D/A then what you get out is as good as it gets, i.e. as close to the original as you will ever come. Any further processing, including adding dither, decreases quality. However you add the 17th or 18th bit, as long as they are not zero, the result will be less like the original than if you leave the 16 bits unmodified.

Dither for already recorded 16 bit audio

Reply #11
The point is to try to recover the quantization error as well as you can.  You can't remove all of it because it is large when you use only 16 bit samples.  But I thought perhaps you could help to recover 1 bit of it (17 bit versus 16) if you first upconverted to 17 bits (just scale the entire sample) and THEN add one bit of dither.  Most DA's can't probably understand 17 bit samples so you would probably then upconvert again to 18 or 20 or 24 bits.

If the original engineer on the album didn't use dither when making the CD, it seems like this process would add resolution.  If the engineer did use dither, the extra noise won't be too intrusive since it is random.

Dither for already recorded 16 bit audio

Reply #12
If dither was not used when going to 16 bits on the CD then that added noise. Further dithering then just adds additional noise. There is no way to remove the quantization noise once it has been added.

Edit: For example, if a sine wave less than 1 bit in amplitude was lost due to lack of dither, how is additional dithering going to magically make it reappear?

Edit 2: You still seem to be thinking of dither as something that improves the quality of the data, which it absolutely is not! What it does is lessen the loss in quality when going from higher to lower resolution.

BTW: Even a CD which was not dithered when it was mastered almost certainly has enough noise already to make dithering unnecessary.

Dither for already recorded 16 bit audio

Reply #13
I agree with pdq, who is absolutely correct in the last two posts.

You can't get back what you lost by not dithering, and neither can you remove what was spuriously added by not dithering unless you have access to the original sources at the higher bit depth and can remaster them.
Dynamic – the artist formerly known as DickD

Dither for already recorded 16 bit audio

Reply #14
BTW: Even a CD which was not dithered when it was mastered almost certainly has enough noise already to make dithering unnecessary.
Self dithering is an urban legend. In most cases the noise from analog equipment and acoustical noise is gaussian, which is a bad choice for removing quantization distortion.

"Once the signal is quantised, the noise spectrum is no longer Gaussian. It's spiky. This means you can never rely on the noise that's in the programme material to self-dither subsequent digital processing steps (it works after a fantastic all-pass filter but it goes horribly wrong with gain changes or subtle EQ'ing." (Bruno Putzeys)

Dither for already recorded 16 bit audio

Reply #15
I am saying that you create a higher bit stream out of the lower bit one (17 or perhaps 18 bits) and THEN add the dither.  It seems to me that 1 bit of dither added in this way could help lower the quantization error from the original rounding/truncating of the original 16 bit signal (which by implication is a downsampling from reality which is infinite precision)

You need to listen to what everyone else is telling you rather than insisting that you're right.  You can't dither during an upsample... there's nothing to base the dither on!  If the error is there, then it's there... adding some random noise (which is what you'd be doing, not dithering) would just add more purposeless noise to the signal.  It won't improve anything, it has no advantages, and there's no math underlying it that makes it necessary or desirable.  Dither is used when downsampling.  Dither is based on the sample values prior to the downsampling.

Dither for already recorded 16 bit audio

Reply #16
I've asked this here, and elsewhere, before. Can anyone point to any 24 bit recording of real music which, when down sampled to 16 bit without dithering, can be ABXed from the same recording down sampled to 16 bit with proper noise shaped dither?

This is easy to do with test tones. You might be able to do it by recording something under artificial conditions such as at very low level in an exceptionally quiet laboratory environment, but no one has come up with anything except artificial arguments in response to this question so far.

The general advice is to dither each transform, at least when working in 16 bit format. A few people even argue for dithering 32 bit transforms. Well, no one does any serious work in 16 bit anymore, but even with distinguishable test tones, doing several transforms with dither, at least the way CoolEdit does them (no noise shaping on individual transforms, noise shaping only available when resampling) adds so much noise that turning dither off after (two, three operations? I don't remember) does not make any difference except less noise. I.E. you can no longer hear the quantization distortion nor can you even detect it with the analysis tools available in the program. Self dithering does work if there is very much noise involved (e.g. any LP transfer).

The conclusion to this is that an attempt to improve any previous 16 bit recording with dither is going to fail at least as badly as the attempt to improve any 24 bit recording, regardless of the theoretical considerations, at least as far as quantization distortion goes.

Dither for already recorded 16 bit audio

Reply #17
So is opinion like this completely misguided?

http://www.stereophile.com/digitalprocessors/367/


They claim that adding dither helps 16 bit recordings.

I admit I don't understand this stuff... (please no flames about my ignorance  :-)  )

Dither for already recorded 16 bit audio

Reply #18
The basic answer is that the people at Stereophile inhabit a universe with different laws of physics which only true believers can visit.

Dither for already recorded 16 bit audio

Reply #19
BTW: Even a CD which was not dithered when it was mastered almost certainly has enough noise already to make dithering unnecessary.
Self dithering is an urban legend. In most cases the noise from analog equipment and acoustical noise is gaussian, which is a bad choice for removing quantization distortion.

"Once the signal is quantised, the noise spectrum is no longer Gaussian. It's spiky. This means you can never rely on the noise that's in the programme material to self-dither subsequent digital processing steps (it works after a fantastic all-pass filter but it goes horribly wrong with gain changes or subtle EQ'ing." (Bruno Putzeys)

I was merely suggesting that any CD whose noise is at least a few db above quantization level (and in this day of compressed CDs this is probably true of most of them) that addition of dithering is unlikely to result in an audible improvement.

Dither for already recorded 16 bit audio

Reply #20
Given the scarcity of >16-bit source audio for mere mortals like us, and that fact that early 1980s ADCs had other problems besides lack of dither or equivalent noise, and that people with >16-bit material tend not to listen to it at 16-bit, let alone without dither, I'd say it's likely to be tough to uncover samples of real music that satisfy AndyH-ha's long-standing challenge, even if they exist.

Regarding the quote of Bruno Putzeys' on another forum, sure, Gaussian PDF white noise (which results from the Central Limit Theorem) is not perfect for dithering, but it's not that drastically different from triangular PDF white noise.* In fact, as long as it's a little greater in power, while it will then add a thicker, louder veil of white noise, it will still decorrelate the error pretty darned well.

Bruno says in another quote from that post "Natural noise is Gaussian. The FT of a gaussian is a gaussian (no zeros!)".

He appears to have lost track (as I have done occassionally, leading to head-scratching until I took a break before coming back to the lab) that it's the Probability Density Function of sample values that is gaussian, and not the waveform, so the power spectrum can indeed be white, i.e. flat from 0 Hz to the Nyquist limit. If the waveform shape were a gaussian bell curve, then indeed the Fourier Transform would also be gaussian in shape, but the waveform is actually random noise, hence the flat FT and power spectrum.

I repeat, that I've definitely made the same mistake as Bruno more than once, so I'm not criticizing him harshly, and most of his comments not arising from that false premise are very rational indeed.

The flat spectrum of Gaussian PDF noise will be OK, and an amplitude with standard deviation of about 1 to 2 bit-values at the destination bit-depth would probably be sufficient. Very sterile studio recordings might actually lack that degree of white noise mixed in with the tonal content of the audio and would then suffer problems. Problems could also occur quite easily during deep fades. I doubt they'd be very audible with normal music played at 16-bit without ludicrous volume increases during such deep fades, so I really wouldn't worry that it's worth trying to counteract any possible quantization distortion embedded in the original CD even if it were possible (and it cannot be possible to do so completely, and probably not at all. Certainly adding dither will do nothing to help.)

* Triangular PDF white noise is the result of adding two independent (i.e. uncorrelated) sources of rectangular PDF white noise. As the number of uncorrelated sources of rectangular white noise you add increases, the resulting probability function of that sum approaches a gaussian bell curve. This is why gaussian PDFs (or the "Normal Distribution") is observed so much in nature at the macroscopic level we normally see, even when the underlying probability distributions at the microscopic level may be very un-gaussian. This is a case of the Central Limit Theorem, and starting with rectangular PDF, one approaches something fairly Gaussian quite quickly. Even the triangular PDF has the beginnings of a crude bell curve shape about its PDF.
Dynamic – the artist formerly known as DickD

Dither for already recorded 16 bit audio

Reply #21
So is opinion like this completely misguided?

http://www.stereophile.com/digitalprocessors/367/

They claim that adding dither helps 16 bit recordings.


Stereophile may imply this, but the manual for that product doesn't...

http://www.meridian-audio.com/handbooks/518user.pdf

page 51...

Quote
The noise-floor of a digital system is determined absolutely by the lowest preceding word size. For nearly all commercial material this is 16 bits. 518 allows you to get the most of out whatever comes next, by making sure that the full output capability is used.


They then go on to explain the exact ways in which processing at 20-bits and using correct dither can help. It's written in 1995 to people buying mostly well mastered CDs.

Everything they say is true. It would be objectively measurable. I'm not about to try to ABX it.

However, I'm not about to dither my 16-bit recordings when playing them on a 24-bit DAC.

Also, I don't have many 16-bit recordings with any headroom left to increase their gain - quite the opposite, sadly!

Cheers,
David.


Re: Gaussian dither.

If the amplitude is sufficient, then it's fine. Not optimal, but fine.

Why? Because you can think of it as comprising of optimal triangular PDF dither, plus a little extra noise.

Therefore you are dithering with tri-PDF dither, but you're also adding some extra noise.

I'll let someone else figure out what amplitude of Gaussian dither is required for that to hold true. At the amplitude where this works, it's certainly audibly noisier than tri-PDF, but apart from that, it's fine.

Cheers,
David.

Dither for already recorded 16 bit audio

Reply #22
So is opinion like this completely misguided?
http://www.stereophile.com/digitalprocessors/367/
They claim that adding dither helps 16 bit recordings.


The article's 1st page mentions the word 'dither' exactly twice. First, in the context of a volume adjustment and secondly in the context of a word length reduction from 20 to 16 bits. Both cases involve quantization, so dithering (prior quantization!) makes perfect sense.

I only skimmed through the rest but it doesn't look like the author's suggesting that the device can improve an already existing 16 bit signal via dithering. It's all about word length reduction.

Cheers!
SG

Dither for already recorded 16 bit audio

Reply #23
Regarding the quote of Bruno Putzeys' on another forum, sure, Gaussian PDF white noise (which results from the Central Limit Theorem) is not perfect for dithering, but it's not that drastically different from triangular PDF white noise.* In fact, as long as it's a little greater in power, while it will then add a thicker, louder veil of white noise, it will still decorrelate the error pretty darned well.
It was me who got Bruno into this thread. He is no HA member so please allow me to post his reply.

"I'm a bit puzzled what I said to make people think that I had anything other in mind than the waveform. I can't for the life of it imagine what a "gaussian waveform" is, at least not in a context that could make me confuse it with a signal even remotely suitable for dithering. So I hope people re-read my original text with the notion firmly in mind that I was really talking only of PDF's, never the wave form. Not the spectrum either. Contrary to popular belief, there is nothing that links the power spectrum and the PDF. You can shape a gaussian (-PDF!) signal to any power spectrum by simply filtering it. You can even make RPDF noise of various spectra but it's just slightly less trivial.

I find that in discussions among knowledgeable people, a surprisingly common error is to see that someone on the one hand has a firm grip on the facts and on the other hand believe that he suddendly gets this very basic thing so crashingly wrong. Even I have made that error at times. After a few embarrassing forum episodes I have installed a mental alarm bell that goes off as soon as I suspect someone previously deemed in good understanding of saying something entirely out of the reasonable. When that alarm goes off, I re-read the text before posting a scathing reply. Usually it turns out I'd have ended up repeating exactly what the other guy was saying, but only in different words. Needless to say, in serious discussions I spend a lot more time reading than writing.

I wish to stress my original point: it's not because the sum of 4 RPDF sources looks a lot like a gaussian, that a *true* gaussian of the same amplitude (standard deviation) is as effectively a dither signal as the 4RPDF one. The FT of both PDFs shows why.

Oh yes, be it hereby illustrated why many discussion forums have an explicit rule against cross-posting."

Bruno Putzeys

Dither for already recorded 16 bit audio

Reply #24
[...]

* Triangular PDF white noise is the result of adding two independent (i.e. uncorrelated) sources of rectangular PDF white noise. As the number of uncorrelated sources of rectangular white noise you add increases, the resulting probability function of that sum approaches a gaussian bell curve. This is why gaussian PDFs (or the "Normal Distribution") is observed so much in nature at the macroscopic level we normally see, even when the underlying probability distributions at the microscopic level may be very un-gaussian. This is a case of the Central Limit Theorem, and starting with rectangular PDF, one approaches something fairly Gaussian quite quickly. Even the triangular PDF has the beginnings of a crude bell curve shape about its PDF.

May be this article helps: dither basics. It deals with the errors introduced when no dither is applied. Nice to see is that convolution rectangular PDF's will result in a more and more uncorrelated error-signal relationship. At the expense of adding noise power and this sets the limit. In short: one RPDF eliminantes the first moment of the stochast, a TPDF (two RPDF's convoluted) removes the first and second moment (being non-linear distortion and noise modulation respectively) and so on. An infinite number of RPDF's convoluted would be ideal from a statistical moment perspective, but in practise this cannot be realised. 2 or 3 Rectangular PDF's convoluted seems to be sufficient.

Regards,
Jacco
Logical reasoning brings you from a to b, imagination brings you everywhere.