U-Law dithering
Forum rules
This forum is for Audacity on Windows.
Please state which version of Windows you are using,
and the exact three-section version number of Audacity from "Help menu > About Audacity".
Audacity 1.2.x and 1.3.x are obsolete and no longer supported. If you still have those versions, please upgrade at https://www.audacityteam.org/download/.
The old forums for those versions are now closed, but you can still read the archives of the 1.2.x and 1.3.x forums.
Please state which version of Windows you are using,
and the exact three-section version number of Audacity from "Help menu > About Audacity".
Audacity 1.2.x and 1.3.x are obsolete and no longer supported. If you still have those versions, please upgrade at https://www.audacityteam.org/download/.
The old forums for those versions are now closed, but you can still read the archives of the 1.2.x and 1.3.x forums.
-
Piotr Grochowski
- Posts: 364
- Joined: Fri Jun 23, 2017 12:45 pm
- Operating System: Windows 10
U-Law dithering
Windows version: Windows 10
The exact three-section version of Audacity from "Help menu > About Audacity":
Section 1 — Audacity: https://pastebin.com/PjJZMWyE
Section 2 — Build Information: https://pastebin.com/88MBEjW7
Section 3 — GPL License: https://pastebin.com/i3WUAU1v
U-Law dithering is only by a very little amount. The distortion will still happen. Please fix this.
The exact three-section version of Audacity from "Help menu > About Audacity":
Section 1 — Audacity: https://pastebin.com/PjJZMWyE
Section 2 — Build Information: https://pastebin.com/88MBEjW7
Section 3 — GPL License: https://pastebin.com/i3WUAU1v
U-Law dithering is only by a very little amount. The distortion will still happen. Please fix this.
Re: U-Law dithering
What that means, is the "version number", which has 3 parts to it, separated by dots.Piotr Grochowski wrote:The exact three-section version of Audacity from "Help menu > About Audacity":
For example, this image shows the top of the "About Audacity" screen in the current release version:
The three part version number shown above is "2.2.2".
We specify "3 parts", because too many people write things like "I'm using version 2" or "I'm using version 2.x", or "I'm using the latest version", or "I'm using 2.2", but none of these provide enough information. Each release has new features / enhancements / bug fixes / other changes, so what applies to one version may not apply to another.
Your version of Audacity is "Audacity 2.1.3", which is now old and missing many features, bug fixes and enhancements that have been developed over the last year.
Please give steps to illustrate this problem.Piotr Grochowski wrote:U-Law dithering is only by a very little amount. The distortion will still happen. Please fix this.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
-
Piotr Grochowski
- Posts: 364
- Joined: Fri Jun 23, 2017 12:45 pm
- Operating System: Windows 10
Re: U-Law dithering
But the forum text states "three-section", and I gave the three sections. You stated "three part".steve wrote:What that means, is the "version number", which has 3 parts to it, separated by dots.Piotr Grochowski wrote:The exact three-section version of Audacity from "Help menu > About Audacity":
For example, this image shows the top of the "About Audacity" screen in the current release version:
The three part version number shown above is "2.2.2".
We specify "3 parts", because too many people write things like "I'm using version 2" or "I'm using version 2.x", or "I'm using the latest version", or "I'm using 2.2", but none of these provide enough information. Each release has new features / enhancements / bug fixes / other changes, so what applies to one version may not apply to another.
Your version of Audacity is "Audacity 2.1.3", which is now old and missing many features, bug fixes and enhancements that have been developed over the last year.
Generate a 1Hz sine wave at 205887Hz Project Rate, which should contain all 16-bit PCM values, because it's 65536×PI rounded down, but maybe the sine curvature will compensate for rounding down. Set "shaped" dithering from Preferences and Quality. Export to an other uncompressed file that is WAV and U–Law. Now open this file... and to your surprise the dithering didn't work as expected — there is still a clear staircase, which is like a sawtooth wave distortion. Only when you zoom in at the beginning, middle or the end (where there are quiet samples and U–Law has greater precision) it's possible to see the dithering clearly. Shouldn't audio dithering adapt to the precision of the output? That seems difficult if the implementation is to add a small dither value to each sample. However it's possible to calculate what the U–Law precision of the sample value is, and then adjust the value of the small dither. Of course the samples of the dither to be added are not fully independent with shaped dither, but still it's possible to multiply the individual samples of the dither when necessary.steve wrote:Please give steps to illustrate this problem.Piotr Grochowski wrote:U-Law dithering is only by a very little amount. The distortion will still happen. Please fix this.
By the way, the forum has a glitch with Unicode: https://mega.nz/#!Sao1wDTK!CL3sSVjQW5yZ ... Zs1t9IvNPI
Re: U-Law dithering
If it is a 16-bit track, then generating any sound will give exact 16-bit values.Piotr Grochowski wrote:Generate a 1Hz sine wave at 205887Hz Project Rate, which should contain all 16-bit PCM values, because it's 65536×PI rounded down
If the track is 32-bit float, then the sample values will not all be exact 16-bit values. For example, sample number 51471 has a value of sin((360 * 51471) / 205887) = 1.000000000, and the closest 16-bit value is 32767/32768 = 0.999969482.
Yes, that's what should happen.Piotr Grochowski wrote:Only when you zoom in at the beginning, middle or the end (where there are quiet samples and U–Law has greater precision) it's possible to see the dithering clearly.
Yes, that would be possible, but it would be much slower, and no perceptual benefit. The level of dither noise would be considerably higher for larger amplitude sample values and would be clearly audible, similar to this:Piotr Grochowski wrote:However it's possible to calculate what the U–Law precision of the sample value is, and then adjust the value of the small dither.
Yes,thank you. That's a known limitation of the forum software that we are using.Piotr Grochowski wrote:By the way, the forum has a glitch with Unicode
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
-
Piotr Grochowski
- Posts: 364
- Joined: Fri Jun 23, 2017 12:45 pm
- Operating System: Windows 10
Re: U-Law dithering
Of course. But I mean that it will contain all 16-bit PCM values, not just some of them.steve wrote:If it is a 16-bit track, then generating any sound will give exact 16-bit values.Piotr Grochowski wrote:Generate a 1Hz sine wave at 205887Hz Project Rate, which should contain all 16-bit PCM values, because it's 65536×PI rounded down
Are you sure? There is still distortion. The entire purpose of dithering is to make the difference between original and output - noise.steve wrote:Yes, that's what should happen.Piotr Grochowski wrote:Only when you zoom in at the beginning, middle or the end (where there are quiet samples and U–Law has greater precision) it's possible to see the dithering clearly.
Are you sure? There is still distortion. The entire purpose of dithering is to make the difference between original and output - noise. The fact that the noise would be clearly audible is a result of U-law having low precision at high sample values.steve wrote:Yes, that would be possible, but it would be much slower, AND NO PERCEPTUAL BENEFIT. The level of dither noise would be considerably higher for larger amplitude sample values and would be clearly audible, similar to this:Piotr Grochowski wrote:However it's possible to calculate what the U–Law precision of the sample value is, and then adjust the value of the small dither.
-
Piotr Grochowski
- Posts: 364
- Joined: Fri Jun 23, 2017 12:45 pm
- Operating System: Windows 10
Re: U-Law dithering
By the way your "big dither" didn't mask the distortion properly either.
Re: U-Law dithering
The purpose of dither is to break up cyclical repetition of quantization errors by distributing the errors into frequency bands that are least audible.Piotr Grochowski wrote: The entire purpose of dithering is to make the difference between original and output - noise.
It wasn't intended to. It was just a quick illustration of the high level of noise that would be created if μ-Law export was dithered in the manner that you suggested.Piotr Grochowski wrote:By the way your "big dither" didn't mask the distortion properly either.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
-
Piotr Grochowski
- Posts: 364
- Joined: Fri Jun 23, 2017 12:45 pm
- Operating System: Windows 10
Re: U-Law dithering
And noise has distributed frequencies, doesn't it?steve wrote:The purpose of dither is to break up cyclical repetition of quantization errors by distributing the errors into frequency bands that are least audible.Piotr Grochowski wrote: The entire purpose of dithering is to make the difference between original and output - noise.
But anyway, the point is that dithering for U–Law doesn't do its job.
Here is an example sound: https://mega.nz/#!SDp2GbSY!QpvLIHNP6usT ... W5J5Q7M3jI
Using Audacity to shaped-dither it to U–Law, the output is https://mega.nz/#!PPpFUDyZ!RDgwVo_bEnCY ... H8Ci5RmFwc . It clearly has cyclical repetition of quantization errors, so your statement "Yes, that's what should happen." is incorrect.
Re: U-Law dithering
Then let me rephrase: That is the correct behaviour according to its design.Piotr Grochowski wrote:so your statement "Yes, that's what should happen." is incorrect.
It does for audio close to zero, which is arguably the best compromise for μ-Law. At least, that appears to be the opinion of the developer that designed this feature.Piotr Grochowski wrote: But anyway, the point is that dithering for U–Law doesn't do its job.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
-
Piotr Grochowski
- Posts: 364
- Joined: Fri Jun 23, 2017 12:45 pm
- Operating System: Windows 10
Re: U-Law dithering
That's not complete dithering, if it only does for audio close to zero. That means the dithering only works properly in very quiet sounds, and barely does anything otherwise.steve wrote:It does for audio close to zero, which is arguably the best compromise for μ-Law. At least, that appears to be the opinion of the developer that designed this feature.Piotr Grochowski wrote: But anyway, the point is that dithering for U–Law doesn't do its job.