Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Effects apply dither to non-float tracks #1584

Closed
petersampsonaudacity opened this issue Aug 31, 2021 · 2 comments · Fixed by #698
Closed

Effects apply dither to non-float tracks #1584

petersampsonaudacity opened this issue Aug 31, 2021 · 2 comments · Fixed by #698
Assignees
Labels
bug An error, undesired behaviour, or missed functionality Effects (EGATs) Effects, Generators, Analyzers and Tools P3 Medium Priority
Milestone

Comments

@petersampsonaudacity
Copy link

Describe the bug
Effects apply dither to non-float tracks

Dither should be applied once only on export, but Audacity unnecessarily reduces the sound quality with integer format tracks by applying dither on every process.

Ideally this would be fixed by not converting back to integer format after processing.

Originally logged on Bugzilla as P3 2292
https://bugzilla.audacityteam.org/show_bug.cgi?id=2292

To Reproduce
Steps to reproduce the behavior:

  1. Create a 16-bit track.
  2. Generate 30 seconds of silence followed by 30 seconds of Tone.
  3. Apply an effect to the track.
  4. Observe: the first 30 seconds is not absolute silence when expected to be.

Expected behavior
Dither should not be applied to to non-float tracks by effects

Screenshots
If applicable, add screenshots to help explain your problem.

Additional information (please complete the following information):

  • OS: all
  • Version all Audacity

Additional context
For more detail see the Bugzilla bug thread
https://bugzilla.audacityteam.org/show_bug.cgi?id=2292

@petersampsonaudacity petersampsonaudacity added bug An error, undesired behaviour, or missed functionality P3 Medium Priority labels Aug 31, 2021
@petersampsonaudacity
Copy link
Author

Roger Dannenberg wrote to me by email:

You can think of dither as a kind of "perceptually optimized quantization." Quantization (rounding to integer) can be thought of as adding the rounding amounts to the signal. Rounding is essentially white noise with a peak-to-peak amplitude of 0.5 quantization levels. (Converting 16-bit scale to the range -1 to +1, quantization noise would be in the range [-0.5/32768, +0.5/32768].) It's not clear that dithering effect output is a bad thing if the target is 16-bit samples. With or without, you are adding noise, and dither noise is arguably better for listeners than non-dithered white noise.

Not converting back to integer is a different approach. That would require a processing step to convert (and double storage size), or else a track with a mix of integer and float blocks. It seems to me users are asking for noise if they process 16-bit tracks, and automatic dithering (the status quo) seems right to me.

@Ryan-Miller-Audacity
Copy link

Verified with build (https://github.com/audacity/audacity/actions/runs/3758557971) from PR #698 on Windows.

Other dithering checks were also completed to ensure proper application of dithering when it is needed vs not based off the following:

... Mixing stereo down to mono. Because -- averaging of 16 bit values might make fractional values that must be quantized again
... resampling to a different rate
... Applying a destructive effect to ANY PART of the track (this may dither untouched parts unnecessarily, but it would complicate things to tag portions of track separately, so pessimistically, any effect application anywhere causes dithering everywhere)
... BUT exception to the last: Invert, Reverse, Truncate Silence, and Repair effects. (Truncate Silence does make cross-fades, but they are few and of short duration, so I reasoned, we skip dithering. Repair, little used really, is an effect that only makes spot corrections for very short durations).
... and the Pencil tool also does not cause dithering. (Reasoning as with Repair)
... Things that do cause dithering: pasting any new material, that was not imported from a 16 bit file, into the imported track, "contaminates" it just as applying most effects to any part of it.
... If a stereo track is not center-panned, then rendering it (either in the app with mix-and-render, or by exporting) must dither because the pan value can vary continuously.
... Likewise if the gain slider is not at default position
... Likewise if there are any envelope points on the track

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error, undesired behaviour, or missed functionality Effects (EGATs) Effects, Generators, Analyzers and Tools P3 Medium Priority
Projects
Status: Done
4 participants