U-Law dithering

Help for Audacity 2.x.x on Windows.

ImageThis forum is for Audacity 2.x.x 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.

U-Law dithering

Permanent link to this post Posted by Piotr Grochowski » Fri Apr 13, 2018 5:34 am

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.
Piotr Grochowski
Probationer
 
Posts: 138
Joined: Fri Jun 23, 2017 12:45 pm
Operating System: Windows 10

Re: U-Law dithering

Permanent link to this post Posted by steve » Fri Apr 13, 2018 11:54 am

Piotr Grochowski wrote:The exact three-section version of Audacity from "Help menu > About Audacity":

What that means, is the "version number", which has 3 parts to it, separated by dots.
For example, this image shows the top of the "About Audacity" screen in the current release version:

3-part-version-number.png
3-part-version-number.png (46.94 KiB) Viewed 82 times


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.


Piotr Grochowski wrote:U-Law dithering is only by a very little amount. The distortion will still happen. Please fix this.

Please give steps to illustrate this problem.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 46549
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: U-Law dithering

Permanent link to this post Posted by Piotr Grochowski » Fri Apr 13, 2018 3:51 pm

steve wrote:
Piotr Grochowski wrote:The exact three-section version of Audacity from "Help menu > About Audacity":

What that means, is the "version number", which has 3 parts to it, separated by dots.
For example, this image shows the top of the "About Audacity" screen in the current release version:

3-part-version-number.png


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.

But the forum text states "three-section", and I gave the three sections. You stated "three part".
steve wrote:
Piotr Grochowski wrote:U-Law dithering is only by a very little amount. The distortion will still happen. Please fix this.

Please give steps to illustrate this problem.

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.

By the way, the forum has a glitch with Unicode: https://mega.nz/#!Sao1wDTK!CL3sSVjQW5yZ ... Zs1t9IvNPI
Piotr Grochowski
Probationer
 
Posts: 138
Joined: Fri Jun 23, 2017 12:45 pm
Operating System: Windows 10

Re: U-Law dithering

Permanent link to this post Posted by steve » Sat Apr 14, 2018 11:06 am

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 it is a 16-bit track, then generating any sound will give exact 16-bit values.
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.

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's what should happen.

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, 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:
u-law-big-dither.wav
(215.39 KiB) Downloaded 1 time



Piotr Grochowski wrote:By the way, the forum has a glitch with Unicode

Yes,thank you. That's a known limitation of the forum software that we are using.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 46549
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: U-Law dithering

Permanent link to this post Posted by Piotr Grochowski » Sat Apr 14, 2018 12:09 pm

steve wrote:
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 it is a 16-bit track, then generating any sound will give exact 16-bit values.

Of course. But I mean that it will contain all 16-bit PCM values, not just some of them.

steve wrote:
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's what should happen.

Are you sure? There is still distortion. The entire purpose of dithering is to make the difference between original and output - noise.

steve wrote:
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, 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:
u-law-big-dither.wav


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.
Piotr Grochowski
Probationer
 
Posts: 138
Joined: Fri Jun 23, 2017 12:45 pm
Operating System: Windows 10

Re: U-Law dithering

Permanent link to this post Posted by Piotr Grochowski » Sat Apr 14, 2018 12:14 pm

By the way your "big dither" didn't mask the distortion properly either.
Piotr Grochowski
Probationer
 
Posts: 138
Joined: Fri Jun 23, 2017 12:45 pm
Operating System: Windows 10

Re: U-Law dithering

Permanent link to this post Posted by steve » Sat Apr 14, 2018 1:03 pm

Piotr Grochowski wrote: The entire purpose of dithering is to make the difference between original and output - noise.

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:By the way your "big dither" didn't mask the distortion properly either.

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.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 46549
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: U-Law dithering

Permanent link to this post Posted by Piotr Grochowski » Sat Apr 14, 2018 1:21 pm

steve wrote:
Piotr Grochowski wrote: The entire purpose of dithering is to make the difference between original and output - noise.

The purpose of dither is to break up cyclical repetition of quantization errors by distributing the errors into frequency bands that are least audible.

And noise has distributed frequencies, doesn't it?

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.
Piotr Grochowski
Probationer
 
Posts: 138
Joined: Fri Jun 23, 2017 12:45 pm
Operating System: Windows 10

Re: U-Law dithering

Permanent link to this post Posted by steve » Sat Apr 14, 2018 1:37 pm

Piotr Grochowski wrote:so your statement "Yes, that's what should happen." is incorrect.

Then let me rephrase: That is the correct behaviour according to its design.

Piotr Grochowski wrote:But anyway, the point is that dithering for U–Law doesn't do its job.

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.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 46549
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: U-Law dithering

Permanent link to this post Posted by Piotr Grochowski » Sat Apr 14, 2018 1:57 pm

steve wrote:
Piotr Grochowski wrote:But anyway, the point is that dithering for U–Law doesn't do its job.

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.

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.
Piotr Grochowski
Probationer
 
Posts: 138
Joined: Fri Jun 23, 2017 12:45 pm
Operating System: Windows 10

Next

Return to Windows



Who is online

Users browsing this forum: Bing [Bot] and 9 guests