Difference between revisions of "Dither"

From Audacity Wiki
Jump to: navigation, search
(Dither: shaped dither places noise in the high frequencies)
m (Dither)
Line 13: Line 13:
 
You can choose the type of dither (or none) to be used in Audacity when performing different operations requiring bit depth conversion. The settings are on the {{menu|Quality tab of Preferences}}. The setting for "real-time dither" applies to dithering done when playing back or editing, and that for "high-quality dither" when mixing or exporting. Note that applying dither can slow down processing a little due to the extra calculations involved.  
 
You can choose the type of dither (or none) to be used in Audacity when performing different operations requiring bit depth conversion. The settings are on the {{menu|Quality tab of Preferences}}. The setting for "real-time dither" applies to dithering done when playing back or editing, and that for "high-quality dither" when mixing or exporting. Note that applying dither can slow down processing a little due to the extra calculations involved.  
  
The rectangular and triangular types of dither are simply different methods for randomising the rounding process. The rectangular method can be thought of as like the roll of a die - any number has the same random probability of surfacing. The triangular method can be thought of as equivalent to a roll of two dice. The shaped  dither means that instead of creating the [[white noise]] typical of the other two dithers, the created noise is shaped so that the quantisation errors occur less in the frequencies we can hear easily, and more in very high frequencies that we cannot hear so easily. The general consensus is that shaped dither tends to sound the best.
+
The rectangular and triangular types of dither are simply different methods for randomising the rounding process. The rectangular method can be thought of as like the roll of a die - any number has the same random probability of surfacing. The triangular method can be thought of as equivalent to a roll of two dice. The shaped  dither means that instead of creating the [[white noise]] typical of the other two dithers, the created noise is shaped so that the quantisation errors occur less in the frequencies we can hear easily, and more in very high frequencies that we cannot hear so easily. The general consensus is that shaped or triangle dither tends to sound the best.
  
 
== Dither applied on Export - detailed explanation ==
 
== Dither applied on Export - detailed explanation ==

Revision as of 18:36, 25 February 2010

Related articles:

Bit Depth

Other articles in our Digital Audio Technology category


Dither

"Dither" is intentional noise which is added so as to randomise the quantisation errors  (rounding errors) that occur when downsampling the Bit Depth of an audio stream to a lower resolution than the current format. An example of downsampling is when you convert from a 32 bit or 24 bit recording to a 16 bit export format. The noise itself isn't audible, but randomises the "arithmetical carry" on rounding the last bit to be used, rather than creating a repeatable, quantifiable rounding error. In this way the potentially audible distortion problems inherent in downsampling are minimised.

In addition to applying dither when converting to a format with a lesser bit depth, Audacity also applies dither in real time on every operation when you work with 16bit or 24bit tracks, because to perform the operation Audacity temporarily converts the samples to 32 bit float format, then downsamples back to the current format. However, when working with 32 bit float tracks themselves, no dithering will be performed because no downsampling occurs. Also, the precision of float samples is good enough to justify not applying dither.

You can choose the type of dither (or none) to be used in Audacity when performing different operations requiring bit depth conversion. The settings are on the Quality tab of Preferences. The setting for "real-time dither" applies to dithering done when playing back or editing, and that for "high-quality dither" when mixing or exporting. Note that applying dither can slow down processing a little due to the extra calculations involved.

The rectangular and triangular types of dither are simply different methods for randomising the rounding process. The rectangular method can be thought of as like the roll of a die - any number has the same random probability of surfacing. The triangular method can be thought of as equivalent to a roll of two dice. The shaped dither means that instead of creating the white noise typical of the other two dithers, the created noise is shaped so that the quantisation errors occur less in the frequencies we can hear easily, and more in very high frequencies that we cannot hear so easily. The general consensus is that shaped or triangle dither tends to sound the best.

Dither applied on Export - detailed explanation

Dither is only applied when converting from a higher bit depth to a lower bit depth. Exporting in WAV format is virtually lossless in all situations. However there is a very small amount of change to the audio data with some types of WAV export, depending on the settings in Audacity Preferences (see below).

  • If you export to 32-bit PCM WAV format, it is 100% lossless - no dithering is applied.
  • If you export to 24-bit PCM WAV format , it is 100% lossless - no dithering is applied.
  • If you export to 16-bit PCM WAV format it will be between 100% and 99.975% lossless depending on the original audio format in Audacity and settings in Audacity Preferences.

For exporting to 16-bit, he maximum error is +/- 2 on a scale of -32768 to +32768 and you should bear in mind that 16-bit audio is at best only accurate to the nearest digit on this scale.

So where does the error come from?

Audacity performs calculations using 32bit float numbers, which provides incredible accuracy (considerably better than even the best top of the range sound cards). If Audacity needs to reduce the resolution to 16 bit, then there will be "rounding off" errors. If simple "rounding" is done by simply taking each sample value and converting it to the nearest 16 bit value, then a "steppiness" in the output will result which may be audible, particularly with extremely quiet sounds. To avoid this, Audacity applies "dither" in the conversion - this is often likened to "anti-aliasing" in graphics which is used to smooth the steppiness of curves. Rather than always rounding the values to the nearest 16-bit value, dithering will apply a degree of randomness to the rounding off so as to prevent causing steps.


Audacity has 3 alternative algorithms for how it applies dither and they are found in "Edit menu > Preferences > Quality". The dither settings we are talking about are the ones for "High Quality Conversion". The available options are: None (no dither), rectangle, triangle and shaped. The differences between these settings are very subtle and you need to be listening carefully with good equipment to notice any difference. Generally, "triangle" or "shaped" will give the best (subjective) results.

  • If dither is set to "none", then conversions from one bit depth to a lower bit depth will be done by simple rounding.
  • If dither is set to "rectangle" or "triangle", then a random factor of +/- 1 bit is applied. In effect, this is applying a very small amount of "noise" to the signal.
  • If dither is set to "shaped", then a random factor of +/- 2 bits is applied. While this may appear to be worse than the other 2 types of dither (the peak amplitude of the noise is greater) the distribution of these random variations is done in such a way that the noise is mostly at the high frequency end of the audio spectrum and as it is at a very low level it may be less noticeable than the other types of dither.

If you are working in Audacity with 32-bit audio, then dither should be enabled in the high quality conversion settings (it is by default). Dither will only be applied if the output is at a lower bit depth. Converting from a higher bit depth to a lower bit depth will inevitably have inaccuracies (because the lower bit depth is less accurate). Using dither just makes these inaccuracies less noticeable in the music.

Converting from 32-bit (float) to 24-bit does not introduce dither noise because 32 bit float uses 24-bit precision (and an 8-bit exponent) so the 24 bits are used without modification.

Here's the exception to the rule: If you have recorded in 16-bit and are only doing simple editing (cut, delete, paste, trim...) and not doing any processing (amplify, equalize, frequency filter....) then for highest accuracy dither can be set to "none". In this case, because there are no 32-bit operations prior to export there is no benefit to using dither. Exporting a 16-bit track to 16-bit with dither set to "none" will be lossless.

If you are doing any form of processing of the audio, then the highest quality will be achieved by using 32-bit (float) throughout. Note that 32-bit audio files are twice the size of 16-bit audio files.