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: Qustion about samplerate conversion (Read 12722 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Qustion about samplerate conversion

Reply #25
Gigapod,

It is very unlikely that you'll ever hear the distortion due to not dithering 24-bits. All real signals are self dithering at this level, and those that aren't (e.g. at the end of a fade, or artificial/synthetic sounds) will cause distortion at such low a level you're unlikely to hear it.

However, it's virtually certain that you'll never hear the noise due to 24-bit dither.

So you can decide between a "very unlikely" problem, and "virtually certainly" no problem. The choice may not matter, but the right choice is clearly the second one: dither - virtually certain to be inaudible at 24-bits.


As for the Ozone guide, good as it is, it's not definitive. Figure 3 is wrong for a start!

When they say "dither once" they mean, if converting a 24-bit master to a 16-bit target, dither once. Don't re-dither the 16-bit version. They clearly say that this means don't do anything to the 16-bit version. If you did have to do anything (e.g. you lost the 24-bit master, and wanted to EQ the 16-bit version), you would have to dither again.

I'm aware of, and more importantly have read and understood, the papers you refer to, though I find some of the mathematical proofs less-than-simple!

Cheers,
David.

Qustion about samplerate conversion

Reply #26
...
I'm aware of, and more importantly have read and understood, the papers you refer to, though I find some of the mathematical proofs less-than-simple!
...

David,
Dithering - adding noise - only makes sense if you are adding noise at or above the noise floor of your recording. As we both know, dithering, besides reducing distortion, raises the noise floor. Dither twice, and you raise the noise floor twice.
So, either you are dithering below the noise floor, and so are not changing anything at all, or you are dithering at or above the noise floor, and adding noise to your recording.
Now tell me, if you are editing/mixing at a constant 24-bit depth, should you dither at every step?
I believe you shouldn't.
Dithering should always be performed when downsampling from a higher to a lower bit depth (assuming your noise floor at the higher bit depth was below the LSB of your lower bit depth), but shouldn't be cumulatively applied at a constant bit depth, as it will just increase the noise level if done at the noise floor, or not do anything at all if done below the noise floor.

Qustion about samplerate conversion

Reply #27
Dithering - adding noise - only makes sense if you are adding noise at or above the noise floor of your recording.

No no, this is a misconception.
Dither noise should be at the level of at least 1 LSB for correct use. The noise of the audio itself has nothing (!) to do with it. In order to eliminate the quantization distortion, 1 LSB noise is necessary, more is just a waste of SNR. At 24-bit resolution 1 LSB dither is at such a low level that it becomes inaudible in almost any situation.
Another advantage of 24-bit dither is that noise-shaping is absolutely not necessary since the noise won't be audible in the first place. Simple dither can be used which won't put much load on the CPU (or DSP).
Again: dither is a technical thing and is not related to auditory masking.

Now, the possible cause of the confusion is that repeated dithering at 16-bit level can become audible in some situations which is a pity, although it's still better than 16-bit truncation.
Until the mid 90's most of the recordings were done on 16-bit recorders. The ADC output was dithered to 16-bit. Then the stereo mix was dithered again and put onto DAT, Umatic or another medium. Then there was the mastering which had to use dither again. The "mix-dither" was probably the most critical one since mastering is mostly used to make things louder, including the dither on the mix.

Now that 20 and 24-bit recorders are available, the 16-bit dither can be applied only once during the final stage, which is a good thing. To put things into perspective: 1 LSB 16-bit dither is hard to hear at reasonable listening levels. With most compressed modern music I doubt if it's the dither noise that will be most disturbing.

Qustion about samplerate conversion

Reply #28
Hi Kees,
Assuming you have a 24-bit track with a noise floor at -96dB (around the 16th bit), which you mix with another 24-bit track which has a noise floor at -120dB (around the 20th bit). What good would it do to dither at the LSB bit level (24th bit or -144dB at this stage) after mixing?

Sure, if you downsample to 16-bit, you have to dither again, at the 16th bit level.

Qustion about samplerate conversion

Reply #29
Hi Kees,
Assuming you have a 24-bit track with a noise floor at -96dB (around the 16th bit), which you mix with another 24-bit track which has a noise floor at -120dB (around the 20th bit). What good would it do to dither at the LSB bit level (24th bit or -144dB at this stage) after mixing?
The dither will eliminate quantization distortion. It's hard/impossible to predict how loud the distortion will be so why take the risk ?
I can't say it better than 2Bdecided did:
Quote
So you can decide between a "very unlikely" problem [truncation/no dither], and "virtually certainly" no problem [dither]. The choice may not matter, but the right choice is clearly the second one: dither - virtually certain to be inaudible at 24-bits.
You might find some interesting reading in the following paper by Robert Stuart of Meridian.

Note: your example is a special case: by simply adding (mixing) two 24-bit signals without any level changes you'll end up with a 24-bit signal again. No wordlength reduction (and no dither) is needed. Only if the summed signal would exceed 0 dBFS you might want to lower the gain of one or both of the signals, and thereby increasing the wordlength to whatever internal resolution your mixer/dsp has. In that case you'd have to add dither at the output.

Qustion about samplerate conversion

Reply #30
Hi Kees,
Assuming you have a 24-bit track with a noise floor at -96dB (around the 16th bit), which you mix with another 24-bit track which has a noise floor at -120dB (around the 20th bit). What good would it do to dither at the LSB bit level (24th bit or -144dB at this stage) after mixing?
The dither will eliminate quantization distortion.
...
by simply adding (mixing) two 24-bit signals without any level changes you'll end up with a 24-bit signal again. No wordlength reduction (and no dither) is needed.
...

OK, so far we agree. No dither is needed.

But what I meant is: we already have noise on both tracks at much higher dB levels than the dither noise that you are suggesting we add anyways. Perhaps the tracks have already been dithered. So let's say track A has noise around the 16th bit, and track B has noise around the 20th bit. I am going to mix them, apply a few filters, normalize, etc... at a constant bit depth of 24 bits. What good would it do to add dither noise at each step, at the LSB bit level (24th bit or -144dB at this stage) if both tracks A and B already contain noise at higher bit levels, and hence have already had their quantization distortion reduced?
Just assume track A has a 1kHz pure sine tone and track B has a 440Hz pure sine tone (+ their respective noise from previous dithering).
Would you agree that in this case, dithering is required if and only if I am going to resample the final edit to 16-bit depth, and not at each step of my editing?

BTW: thanks a lot for the link to the article, it is very interesting (I am re-reading it right now, particularly the text that refers to figure 14).

Qustion about samplerate conversion

Reply #31
Essentially any change to digitized audio results in quantization errors; no change ot wordlength is necessary. The shift of 16 bits up or down within a 24 bit word, as discussed recently vis a vis digital volume controls, is one exception, but is a very special case. I don't know if there are any others. What no one has pointed out explicitly, however, is that the quantization error amplitude is 36dB lower when working at 24 bit than when working at 16 bit, and much lower still for floating point files. This is what makes dithering on those files most likely pointless.

I'm not certain what the process is when working with existing digital files, but I believe of necessity the dither must be added to the data before the transform is done. I don't think that adding dither after the transform could do anything for uncorrelating the quantization error from the signal. Also, I read in Pohlmann that dither is added to the analogue signal before digitizing, this being the only way it can work to effectively randomize the quantization errors that will result from the A to D process.

I also read in Pohlmann that the quantization error will have little correlation with high level complex signals. Thus it is much like white noise. Raising the noise level is its only significant contribution to audio (dis)quality. With low level signals, however, the error becomes highly correlated to the signal and thus is readily perceived as distortion.

Gathering evidence is much easier under simplified conditions. My casual experiments with 16 bit CoolEdit generated tones (much easier to analyze than recorded music) puts the level of the signal at which quantization error becomes audible at -80dB. I'm sure there is some range either side of that depending upon just what the signal is and just what you do to it.

CoolEdit will dither any 16 bit transforms. It does not use noise shaping however (unlike when it resamples). The result of this is that the dither can become quite audible after only a few transforms, one of the disadvantages of working with 16 bit files. Some further experiments showed me that dithering the first 16 bit transform, then not dithering the second (on the same file), still produces audible quantization distortion from that second transform  (the quantization noise is also quite visible in CoolEdit's Spectral View).

However, when I dithered the first two transforms, but not the third, I was unable to determine that any audible problems were produced. It seemed that, after two applications, the random noise content of the signal is so high that further dithering is irrelevant. More dithering will add more noise but not produce any benefit in return. Again, this may depend upon the particular signal and particular series of transforms; I don't know what those parameters might be.

CoolEdit & Audition do not work with 24bit integer files, so I can't say what audible differences may exist from dithering/not dithering at 24 bit. My experiments with 32 bit tones suggest that dither is not added to 32bit transforms and that this is all to the good. It is also consistent with what I remember reading quite a while ago.

It also seems to be the way many soundcards works. The Echo Mia, for instance, has an option to dither the input, but the documentation says it is off by default, and recommends dither be left turned off unless one is truncating the signal to16 bits in the recording application. No other card of the several I've worked with even has a dither option (16 bit Soundblasters, of course, can be considered self-dithering. Unfortunately it is rather ugly sounding "dither").

I did the following experiment using a generated tone in floating point.
I created a five second file of 440Hz A at -10dB.
I applied a logarithmic fade out (0 to -240dB).
Over the last half second of the fade the program measured peak: -225.92dB / RMS average:  -238.77dB.
After 10 complete cycles of:
amplify by a large negative amount (.e.g. -60dB or -80dB),
then amplify by the same positive amount to return to the original level,
the measurements on that last half second were identical to the two decimal places that the program displays.  Increasing spectral plot resolution from the default 120dB to 300dB also failed to reveal any trace of quantization noise.

In agreement with my observation above that dither seems to be unnecessary beyond two or three applications when working on 16 bit files, I concluded that dither is also unnecessary for resampling from floating point to 16 bit when working with phonograph or cassette transfers. The background noise level of those media is so high that self dithering unconditionally occurs.

I proposed this some time ago in an inquiry on another forum. All of the six or eight people taking part in the discussion assured me I was wrong. There were a number of posts that went quite beyond the "better safe than sorry" viewpoint to quite explicit claims that not dithering produced easily audible ugly and unpleasant audio results.

My experiments on music files, even from much cleaner sources, suggested otherwise. Finally, I issued a challenge for someone/anyone to find some music that would reveal any audible trace of quantization error when resampled from floating point to 16 bit (a number of these people are professional recording engineers so one might think they could get such a sample if such a sample exists). That ended the discussion.

I ask the same thing here. Test tones are easy. Can anyone provide a music sample where it is possible to hear negative results of not dithering when resampling from 32 bit (or 24 bit) to 16 bit?

I know that quantization errors are real; I'm not saying that no distortion will exist if one doesn't dither, I'm only saying I have been unable to find any case where that distortion is audible or where one can reliable detect the difference between no dithering and proper noise shaped dither.  The later stipulation is necessary because dither could be chosen that will in itself be audible, invalidating the test. Well designed noise shaped dither will not be audible.v

Qustion about samplerate conversion

Reply #32
AndyH-ha,

Thanks for your long reply with much detailed information. Comments follow:

Essentially any change to digitized audio results in quantization errors; no change of wordlength is necessary.


Any digital representation uses quanta - small steps - to represent a continuous audio signal. No change is necessary because just representing an analog signal in digital format introduces quantization error (of 1/2 LSB).

Quote
The shift of 16 bits up or down within a 24 bit word, as discussed recently vis a vis digital volume controls, is one exception, but is a very special case. I don't know if there are any others.


Shifting data up or down a word also shifts the quantization error, but no error is added - as long as the LSB of your original data is preserved intact.

Quote
What no one has pointed out explicitly, however, is that the quantization error amplitude is 36dB lower when working at 24 bit than when working at 16 bit, and much lower still for floating point files. This is what makes dithering on those files most likely pointless.


This was clearly pointed out in the first article that I referenced in this thread. Quantization error in floating-point is a little more complicated, since it is not 1/2 LSB (since we now have mantissa and exponent): it varies according to the amplitude of the signal.

Quote
I'm not certain what the process is when working with existing digital files, but I believe of necessity the dither must be added to the data before the transform is done. I don't think that adding dither after the transform could do anything for uncorrelating the quantization error from the signal. Also, I read in Pohlmann that dither is added to the analogue signal before digitizing, this being the only way it can work to effectively randomize the quantization errors that will result from the A to D process.


24-bit A/D converters for audio use (such as those you can find in high-end PC sound cards) are self-dithering, since the noise floor of most analog equipment is above -144dB. What happens afterwards depends on the respective devices in your mixing/editing chain.

Quote
I also read in Pohlmann that the quantization error will have little correlation with high level complex signals. Thus it is much like white noise. Raising the noise level is its only significant contribution to audio (dis)quality. With low level signals, however, the error becomes highly correlated to the signal and thus is readily perceived as distortion.

Gathering evidence is much easier under simplified conditions. My casual experiments with 16 bit CoolEdit generated tones (much easier to analyze than recorded music) puts the level of the signal at which quantization error becomes audible at -80dB. I'm sure there is some range either side of that depending upon just what the signal is and just what you do to it.


There are some very informative comments about the audibility of quantization distortion in the article referenced by Kees a few posts above; quite a good read, actually.

Quote
CoolEdit will dither any 16 bit transforms. It does not use noise shaping however (unlike when it resamples). The result of this is that the dither can become quite audible after only a few transforms, one of the disadvantages of working with 16 bit files. Some further experiments showed me that dithering the first 16 bit transform, then not dithering the second (on the same file), still produces audible quantization distortion from that second transform  (the quantization noise is also quite visible in CoolEdit's Spectral View).


Any FFT transform will result in an additional quantization error of >= 1/2 LSB -> there goes your dither. Just a guess here: CoolEdit doesn't use noise shaping when dithering after a transform because the cumulative high-frequency noise would become audible after even fewer transforms, compared to dithering without noise shaping.

Quote
However, when I dithered the first two transforms, but not the third, I was unable to determine that any audible problems were produced. It seemed that, after two applications, the random noise content of the signal is so high that further dithering is irrelevant. More dithering will add more noise but not produce any benefit in return. Again, this may depend upon the particular signal and particular series of transforms; I don't know what those parameters might be.


When the cumulative dither is > the quantization error of your transform, further dithering is not required.

Quote
...
I ask the same thing here. Test tones are easy. Can anyone provide a music sample where it is possible to hear negative results of not dithering when resampling from 32 bit (or 24 bit) to 16 bit?
...


Good point! It is already answered at the end of the same article: http://www.hifi-writer.com/he/dvdaudio/dither.htm

Quoting:
Code: [Select]
The individual distortion components, themselves reaching to no more than -49dB (ref the -60dBFS tone), would actually be below the limits of human hearing in even a perfectly silent environment.


Since you are talking about audibility (a subjective, psychoacoustic phenomenon), you would really need to ABX your music samples. So this thread is now reaching for a similar problem as that in the thread of 24 vs. 16-bit sample audibility.

At one point somebody may want to do a public listening test with 16-bit non-dithered, 16-bit dithered without noise-shaping, 16-bit dithered with noise-shaping, and 24-bit audio samples, so we can bury these issues once and forever.

Notes:

 

Qustion about samplerate conversion

Reply #33
A quote from the Robert Stuart paper:

"So, we have established the core point, that wherever audio is digitised (like in an analogue–digital converter) or re-digitised (as in a filter or other DSP process) there is a right way and a wrong way to do it. Neglect of the quantisation effects will lead to highly-audible distortion (as we will see later). However – and this is perhaps the most fundamental point of all – if the quantisation is performed using the right dither,  then the only consequence of the digitisation is effectively the addition of a white, uncorrelated, benign, random noise floor. The level of the noise depends on the number of the bits in the channel – and that is that!"

This confirms my understanding of re-quantization. Correctly done with dither or wrongly without.
I see similarities with the lossless/lossy debates. There's not necessarily an audible difference between the two formats, still some prefer one over the other. Now if the resulting files would be the same size, what format would you prefer ?

Are there any signal theory experts on HA who care to share some knowledge about the subject ? (especially about the presumed effects of self-dither and the requirements for theoretically correct dither)

Qustion about samplerate conversion

Reply #34
...
Are there any signal theory experts on HA who care to share some knowledge about the subject ? (especially about the presumed effects of self-dither and the requirements for theoretically correct dither)


http://en.wikipedia.org/wiki/Dithering#Which_dither_to_use

ADC example: http://www.cirrus.com/en/pubs/proDatasheet/CS5361_F2.pdf

Cirrus Logic CS5361 ADC has typ. -105dB THD+N for a signal at -1dB. That's around the 17th/18th bit-level. Imho give or take a couple of dB, that's as good as it gets for amateur-grade good quality equipment, and probably by far exceeds the performance of any microphone + preamp combo I can get my hands on. So should I worry about dithering before quantization?
Imho, no. Not only the ADC, but the analog circuitry that comes before it is already self-dithering enough.

Once quantized at 24-bit level, with the inevitable quantization error of 1/2 LSB, should I worry about dithering during mixing/editing/equalizing, either with fixed-point 24-bit DSP algorithms or 32-bit floating point ones?
Again, imho, no. Quantization error (of 1/2 LSB) will occur at each step, but who cares? That's way below my noise floor.

Would I dither with noise shaping when mastering the final 16-bit downsampled track?
Imho, yes, but only then, and I would keep my 24-bit master undithered.

Qustion about samplerate conversion

Reply #35
If 'dither once' is recommended, does that mean that if one is working on a track one has ripped from a commercial CD (which thus has almost certainly been dithered once already), then imported into a 24 - or 32-bit environment (e.g. Audition) , one should not use dither again when finally converting back to 16 bit?

Qustion about samplerate conversion

Reply #36
If 'dither once' is recommended, does that mean that if one is working on a track one has ripped from a commercial CD (which thus has almost certainly been dithered once already), then imported into a 24 - or 32-bit environment (e.g. Audition) , one should not use dither again when finally converting back to 16 bit?

With the usual caveats:
I believe dithering with noise shaping of mastered CD tracks is a recent practice, not more than 10-years old, so many CDs have not been dithered.
Anyways, if you dither with noise shaping at the end of your processing, there are two possible outcomes:
1) either you are dithering again with noise shaping, and you should be able to detect an audible +6dB increase in noise above 7kHz. If that's the case, revert to the undithered version.
2) either you are dithering the sound track for the first time. And you should do dithering with noise shaping.

Qustion about samplerate conversion

Reply #37
I attempting to find something that might show a difference between dithering and not dithering, I used commercial CD tracks, simple things like one voice and instrument, with wide dynamic range. I did not find anything where dithering or not dithering made a difference that could be heard.

As far as the number of times dither should be applied goes, there are professionals, people who actually produce music, who say apply at every step if working in 16 bit. Of course these days they probably never do work in 16 bit.

Qustion about samplerate conversion

Reply #38
As far as the number of times dither should be applied goes, there are professionals, people who actually produce music, who say apply at every step if working in 16 bit. Of course these days they probably never do work in 16 bit.
Count me in
Dither isn't like a vaccin that will cure from truncation errors for a lifetime. It's more like an antibiotic that has to be applied every time when necessary.
Once quantization errors by truncation without dither have been made, they'll be embedded in the audio and redithering at a later stage won't be able to repair that. The damage has been done. I remember AES lectures by Stanley Lipshitz, the passionate dither advocate, who has been hammering that into the heads of audio professionals for years.

Dithering at 16-bit level can become a bit tricky because it's at a level where the noise can become audible (although as you've noticed it's usually masked by the music and other noise). In a few cases I had to deal with very soft music (classical) where 16-bit dither would become noticable. The solution was to use Sony's SBM (super bitmapping) which doesn't add noise but still reduces truncation artifacts. It turned out very effective.

Quote
I believe dithering with noise shaping of mastered CD tracks is a recent practice, not more than 10-years old, so many CDs have not been dithered.
Noise shaping and dithering are not necessarily linked. There was (flat) dither years before noise shaping became trendy. Most of the early (80's) cd's were edited and mastered on Sony DAE1100 systems. This was a great machine, but it turned out that its master fader wasn't dithered. If left in the zero position, there was no problem since a properly dithered recording wouldn't be altered. Most mixing was done on analog consoles in those days, so the mix master was recorded straight from the ADC. When Lipshitz started to promote dither, Sony rapidly produced the DAE3000 successor with a properly (flat) dithered fader. IIRC that was around 1988. Having the proper equipment available is still no guarantee for correctly treated (dithered) audio, but there's no excuse for cd's made after 1990 for not being properly dithered
The first time I've heard of SBM and noise shaped dither (not the same!) was around 1992.
The recommended use of noise shaping in those days was to use it only when it was certain that the signal would make it unaltered to the DAC. In other cases flat dither was preferred. IMO this is still a good rule of thumb.