0

From my understanding, dithering is used to mask the systematic error that one introduces by reducing the bitrate simply by truncating (i.e. chopping off) the least significant bits. This makes sense to me.

But what if instead of truncation one uses the lower bits to round instead, wouldn't that be even better for quality? So say you reduce the bit rate from 24 bit to 16 bit, use the lowest 8 bit of the 24bit sample to decide if a one is added to the truncated value (with e.g. round-to-even for the half-way point 128). That would seem like the most "correct" way to me, as it is the mathematically closest representation of the original signal in the lower bitrate.

And by using rounding instead of truncation, there may possibly be less need for dithering afterwards (when reducing to otherwise near-transparent bitrates like 16bit or above, as obviously rounding vs truncation won't matter much for easily audible quality-reducing reductions). Since the maximum amplitude of the error signal by rounding is only half of that of truncation I assume the introduced noise is more quiet, which might be quiet enough to not be noticeable at 16bit and possibly preferable over the added dither noise. So my question is, are there publicly available studies that compare the quality of truncation vs rounding (with and without dithering)?

5
  • 1
    Hi. In reviewing your question, I can see you've got a misconception about dither, that it somehow "belongs with" truncation and you are comparing that with rounding. In fact, what you should be comparing is rounding vs truncation period. Dither should be used in either case. It doesn't belong to one or the other method, but is a separate process. Dec 15, 2023 at 15:26
  • @DataProcessing I understand those are separate processes, so I don't think I have a misconception there, though I may have formulated my question not clear enough. But you are right in the sense that I can generalize my question to why truncation is ever used, as rounding seems to be the obvious superior choice in general (regardless of whether dither is applied later on or not). It is just that if rounding already produces a better signal, there may be much less need to mask the errors with dithering as is with truncation, hence my original question.
    – zse
    Dec 16, 2023 at 18:25
  • 1
    The question of rounding vs truncation is already very well understood (spoiler alert: it doesn't make all that much difference, it's the dithering that makes the most difference), although I don't recall seeing it discussed on here before. Would you like me to rewrite your question to fix the wording or would you like to do it? Dec 18, 2023 at 16:00
  • Updated, it is hopefully clear enough now. If you can quote some source for the claim that it doesn't make much difference that would be much appreciated.
    – zse
    Dec 19, 2023 at 13:38
  • You can do tests like this yourself, it's actually not that difficult to do. It just takes a little bit of coding knowledge, and you can round however you want and listen to and analyse the results. (That's my idea of fun!)
    – n00dles
    Dec 23, 2023 at 19:43

2 Answers 2

1

The purpose of dithering in audio processing is to hide quantizing noise. In effect the dithering moves hearable noise to frequencys where the ear is less sensitive.

Rounding has no effect on the frequency profile of the quantizing noise and gives the same effect as simply truncating.

10
  • Can you quote some source for this claim? Purely mathematically speaking, truncation is a clear bias/systematic error, whereas correctly rounding is not. In a way you could say rounding is some sort of 1-bit dithering as it will add a "one" sometimes, just instead of randomly it adds it depending on the input signal. Not saying you are wrong, but I'd like to have at least some sort of explanation why this mathematical argument is not applicable here.
    – zse
    Dec 8, 2023 at 9:40
  • It wouldn't be "correct" even in mathematical terms, @zse - we only use rounding in maths because we do not mind the error it introduces. In sound, that error is not acceptable - it is audible. You could try it and hear how annoying it would be :-)
    – Rory Alsop
    Dec 8, 2023 at 10:03
  • 1
    @zse The point is the frequncy distribution of the quantization error. This article gives a bit of insight on how to calculate it scielo.org.mx/pdf/jart/v7n2/v7n2a3.pdf (way above my ability to work through it). Ditheriing is more of a psychoacoustic processing, moving the noise to frequencys where it is less heard. One of example: unison.audio/dithering/…. And no, rounding could perhaps decrease the noise one half bit (?) but it will not change the frequency.
    – ghellquist
    Dec 8, 2023 at 11:49
  • 1
    @zse Just to completely clear: the question is the frequency distribution of the quantization noise (not of the wanted signal). Notice that dithering will increase total noise, but move it to frequencies where the ear is less disturbed. I have seen nothing that would indicate that rounding would make any large impact on frequency response of the dithering noise.
    – ghellquist
    Dec 8, 2023 at 14:15
  • 1
    @zse Rounding is useful in other cases, but here it is equivalent to adding a DC offset - a zero hertz signal that is removed at the DA stage. Example (using decimal digits). Assume we have a signal going from 0.00 to 1.00 which we truncate down to 0.0 to 1.0. In order to do rounding we simply add a fixed value of 0.05 before truncating. 0.00 becomes 0.05 and truncates to 0.0. Then 0.05 adds up to 0.10 and is truncated to 0.1 (in effect rounding). And so on. Works the same with digital numbers. Try it for yourself.
    – ghellquist
    Dec 9, 2023 at 10:51
1

Rounding gives exactly the same sort of quantisation errors as truncation does.

You can see this because rounding is effectively the same as adding 0.5 (scaled appropriately) and then truncating.  The exact transition points shift, but the basic pattern remains.  (Rounding does avoid a systematic error averaging -0.5 — but that's effectively a DC shift, which inaudible.)

It's worth seeing the Wikipedia page for Dithering, which discusses this.  It uses the following values as an example:

0.8  1.6  2.4  3.2  4.0  4.8  5.6  6.4

Truncation gives:

0    1    2    3    4    4    5    6

While rounding gives:

1    2    2    3    4    5    6    6

The quantisation noise is not identical, but still has the same character, resulting in ‘additional content at discrete frequencies created by the regular and repeated quantisation error.’

The page then goes on to look at how you might vary the rounding to avoid that — and so derives dithering.

This may be clearer in its image examples.  In particular, truncation or rounding are illustrated in the non-dithered example:

image of a cat, reduced to the 256-colour web-safe palette, with no dithering

(The flat areas show how much detail is lost.)

Whereas the following version uses dithering — you can see how much more detail is preserved, despite having the same bit depth as the image above:

same image of a cat, reduced to the 256-colour web-safe palette, but this time with Floyd-Steinberg dithering

The effects on digital audio are perhaps less obvious, but you can see how the fairly regular, repeating errors in the first image might correspond to prominent low-frequency noise, and those in the second to noise spread more evenly across much higher frequencies where it would be much less noticeable.

5
  • I appreciate your effort, though I do understand the concept of dithering already. But your answer made me realize my question was still too imprecisely formulated, I have updated it again.
    – zse
    Dec 24, 2023 at 21:39
  • One more thing, I think you may be disregarding a DC shift before a truncation operation as unimportant prematurely, as truncation is a non-linear operation (ie DC shift before truncation does by no means result in the same thing as truncation plus DC shift afterwards). Furthermore, truncation pulls the signal towards -inf, so it gives your signal a (admittedly very slight) negative DC offset, which is another argument against using truncation and preferring rounding which doesn't do that.
    – zse
    Dec 24, 2023 at 21:48
  • 1
    @zse Depending on where the resulting signal is going, any DC bias might get completely stripped out by further encoding/compression (especially if it's based on DCT or other frequency analysis, which I think most are) or by audio hardware (converters, interfaces, amplifiers, connections).  So although it wouldn't end up being audible if it reached the listener's ears, in most cases it's unlikely to get anywhere near that far.  (contd)
    – gidds
    Dec 25, 2023 at 0:34
  • 2
    …But my main point was that truncation and rounding are equally bad — both non-linear — and both result in the same sort of quantisation noise, despite the exact numbers (and bias) being different.  Imagine, for example, the first image but with the colour bands shifted sideways slightly; it might reduce the RMS error a little, but subjectively it's just as bad.  As others have already said, the different is insignificant compared to the benefit from dithering.
    – gidds
    Dec 25, 2023 at 0:35
  • I would have liked a bit less on dithering and a bit more on the different characteristics of the noise resulting from rounding vs truncating.
    – n00dles
    Dec 29, 2023 at 18:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.