Only apply dither on export

As Audacity is due soon receive the first audio quality upgrade in many years it is probably a good time to raise another issue regarding sound quality - Dither.

This question falls into two areas:

  1. When to apply dither.
  2. What sort of dither to apply.

This feature request concerns the first - when to apply dither.

Current behaviour:

Audacity applies dither whenever both:

  1. The sample format is changed to a lesser bit-depth
  2. Dither is enabled in Preferences > Quality

Why the current behaviour should be changed:
This image shows the difference between 16 bit silence that has had dither applied once, three times and 10 times. In each case the track has been amplified by +50 dB to make the waveform visible:
As can clearly be seen, applying dither has a cumulative effect.

The noise floor of correctly dithered 16 bit audio should be extremely low and in the presence of normal level audio should be inaudible, but if dither is applied multiple times the noise floor is progressively raised and will become audible.

Why Audacity behaves as it does:

This appears to boil down to historical reasons. Audacity prior to 1.3.x was only able to handle one audio format per track.
A consequence of this limitation is that if part of a track is processed, then it must be returned to the track in the same format.

Audacity applies all processing in 32-bit float format.
This means that for Audacity 1.2.x (and earlier), integer format audio is converted to 32-bit float, then converted back to its original integer format. To avoid creating quantize noise for low-amplitude or highly-periodic audio, the audio is, by default, dithered when converting back to the integer format. The consequence of this is that each time any process is applied to integer format audio, noise is cumulatively added.

Why Audacity 2.x does not need to perpetuate this problem:

Audacity 2.x is able to handle multiple audio formats in the same track (and frequently does).
This means that the requirement to always convert processed audio back down to the track format is no longer necessary, so it is no longer necessary to add noise each time the audio is processed.

The feature request:

When processing integer audio, do not convert back to integer format and do not apply dither. Only apply dither when converting to an integer format is necessary and appropriate (for example on Export).

Benefits of this feature:

The main benefit is improved audio quality when applying multiple effects or processes to integer format tracks.

A side benefit is there will probably be some improvement in speed performance as (a) one format conversion is no longer required and (b) computers generally handle float format data more efficiently than integer format.

To avoid too much complexity to the main thrust of the feature request, I have split this ancillary feature to a separate post:

Additional note - Mix and Render:

Although the feature request specifies “Export” as the case for applying dither, it would need to be decided what to do for Mix and Render when the default format is set to 16 or 24 bit. The options are to either (a) render to the format set in Quality > Preferences and apply dither if it is an integer format, or (b) always render to 32-bit float (no dither).

My preference would be for option (b) as this is the higher quality option.
This would mean that “Preferences > Quality > Default Sample Format” would then only apply to recording and generating new tracks.

If option (a) were adopted, then it would be better for “Triangle” dither to be used rather than any other type as this adds less colouration to sound that is going to be processed again (as in Export). This would add complication to Preference settings and is another reason why option (b) would be better.

@Steve: you will be much better off developing this into a Wiki>Proposal rather than me just trnsferring this to Wiki>Pending Feature Requests.

Please advise.


Thanks Peter.
Please add this as a feature request (see quote) and move the topic to Audio Processing so that it is retained for reference. I’ll put together a proposal when I have time.

Done - plus I added my vote for this in the Wiki