Leveller effect adds distortion

This section is now closed.
Forum rules
This forum is now closed.

For help with current Audacity, please post to the 2.x. board for your operating system.

Please post feedback about the current 2.x version on the 2.x.feedback board.
billw58
Forum Staff
Posts: 5600
Joined: Wed Aug 12, 2009 2:10 am
Operating System: macOS 10.15 Catalina or later

Leveller effect adds distortion

Post by billw58 » Tue Oct 06, 2009 7:15 pm

Try out the Leveller effect with any amplitude of pure tone then do a Plot Spectrum on it. Ugly! So bad you can clearly hear it. Worse, it's all odd harmonics. I would not willingly subject my audio to this effect.

The Compressor effect is much cleaner, adding only a tiny bit of third harmonic to the compressed waveform.

Chris's Compressor (Compress Dynamics in the Effect menu - if you've installed it) is perfectly clean.

Also perfectly clean are Steve Harris' Dyson Compressor and SC4.

Mac users will be pleased to know that all the Apple AU compressors/limiters are also perfectly clean.

-- Bill

kozikowski
Forum Staff
Posts: 69369
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: macOS 10.13 High Sierra

Re: Leveller effect adds distortion

Post by kozikowski » Tue Oct 06, 2009 8:53 pm

<<<I would not willingly subject my audio to this effect.>>>

I don't know anybody who claimed any compressor was distortion free. Even Chris creates enormous distortions of the original given that the show becomes as much as 20dB louder with dramatic phrase-to-phrase variations. It's just how you measure it. Chris designed his work to be insanely pleasant to listen to and he succeeded in an amazing way.

Leveler simulates "carbon microphone" or communications channel compression that takes a very hard line on the sound level never making it over a certain value. I sent my voice through it twice to simulate an Air Traffic Controller.

Let's take this the other way 'round. If you wanted to create Air Traffic Controller or two-way radio voice without Leveler, how would you do it? You'll find it hard to create that distinctive harsh compression sound with other tools that don't do something else wrong.

Not all shows are Haydn and Schubert.

Koz

billw58
Forum Staff
Posts: 5600
Joined: Wed Aug 12, 2009 2:10 am
Operating System: macOS 10.15 Catalina or later

Re: Leveller effect adds distortion

Post by billw58 » Tue Oct 06, 2009 9:38 pm

kozikowski wrote:I don't know anybody who claimed any compressor was distortion free. Even Chris creates enormous distortions of the original given that the show becomes as much as 20dB louder with dramatic phrase-to-phrase variations. It's just how you measure it. Chris designed his work to be insanely pleasant to listen to and he succeeded in an amazing way.
Because it uses an envelope-follower instead of applying some undocumented algorithm on a sample-by-sample basis. And Chris's compressor does not introduce enormous distortions according to my measurements. Perhaps my methodology is faulty. If that is so, please tell me and I'll change it and try again.

Nobody knows what Leveller is meant to do because there is no documentation and no comments in the code. Any compressor will create some small amount of distortion while it is changing gain, but should be a straight wire on a steady-state signal. Leveller is not.

Do the experiment. Create a string of 5-second tones each 0.1 louder than the other, going from 0.1 to 0.9 amplitude. Select the entire track and apply the compressor of your choice at the settings of your choice. You can then use Plot Spectrum to look at the distortion in the steady-state and the dynamic portions of the resulting waveform. Only Leveller (and to a lesser extent, Compressor) add any significant distortion either in the dynamic or steady-state portions of the waveform.
kozikowski wrote:Leveler simulates "carbon microphone" or communications channel compression that takes a very hard line on the sound level never making it over a certain value. I sent my voice through it twice to simulate an Air Traffic Controller.
If that is, indeed, what it is meant to do then let's call it something other than "Leveller", or at least document that that is what it does.
kozikowski wrote:Not all shows are Haydn and Schubert.
Agreed. So for those who are doing Haydn and Schubert, let's warn them off using Leveller.

-- Bill

steve
Site Admin
Posts: 81627
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Leveller effect adds distortion

Post by steve » Tue Oct 06, 2009 10:17 pm

billw58 wrote:And Chris's compressor does not introduce enormous distortions
All a matter of definition. The change in dynamics is itself a form of distortion. Put a signal into a black box with zero distortion, and other than the gain level the output is identical to the input. On the other hand, the shape of individual waveforms remain largely unchanged so there is little harmonic distortion.

In contrast, the leveller produces a huge amount of harmonic distortion. This effect has more in common with "soft clipping" than it does with "dynamic compression" (in the traditional sense).

There was a Nyquist plug-in that got posted on one of the Audacity / Nyquist mailing lists a while ago that produced a similar effect to the leveller. It went through a number of iterations progressively reducing the gain at increasing amplitude levels (it actually worked internally repeatedly amplifying the signal below a reducing threshold, then summing the results - but the result is the same). I would not be surprised if the leveller effect was based on that Nyquist script.
billw58 wrote:Any compressor will create some small amount of distortion while it is changing gain, but should be a straight wire on a steady-state signal. Leveller is not.
We probably all have our definitions of what a compressor should or should not do, but I think we can agree that the leveller effect is not a "compressor" in the usual sense (fortunately it is not called a compressor).
billw58 wrote: If that is, indeed, what it is meant to do then let's call it something other than "Leveller", or at least document that that is what it does.
Well the documentation has been started http://manual.audacityteam.org/index.php?title=Leveller :D
Would you like to suggest some text to flesh it out a bit?
billw58 wrote:Agreed. So for those who are doing Haydn and Schubert, let's warn them off using Leveller.
For Haydn and Schubert I'd definitely recommend Chris's Dynamic Compressor.
But while we are on the subject of names - I don't think that is a particularly good name either.
As a "Compressor" it has a rather odd way of working. With most "traditional" compressors you see a squashing of the amplitude above a relatively high threshold, whereas with CDC the most noticeable effect is the raising of low level sounds. This is perfect for its intended purpose (so that Chris could listen to his classical music collection against a high background noise level of driving in his car), but is much less suitable for other types of compression (see "Loudness War"). Personally I think that "Leveller" would be a good name for CDC except for the confusion with Audacitys Leveller effect.

As for the Audacity Leveller - how about "Crusher"?
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

billw58
Forum Staff
Posts: 5600
Joined: Wed Aug 12, 2009 2:10 am
Operating System: macOS 10.15 Catalina or later

Re: Leveller effect adds distortion

Post by billw58 » Tue Oct 06, 2009 10:46 pm

stevethefiddle wrote: All a matter of definition. The change in dynamics is itself a form of distortion. Put a signal into a black box with zero distortion, and other than the gain level the output is identical to the input. On the other hand, the shape of individual waveforms remain largely unchanged so there is little harmonic distortion.
Point taken. I'll be more rigourous in the future and specifically say "harmonic distortion".
stevethefiddle wrote: In contrast, the leveller produces a huge amount of harmonic distortion. This effect has more in common with "soft clipping" than it does with "dynamic compression" (in the traditional sense).

There was a Nyquist plug-in that got posted on one of the Audacity / Nyquist mailing lists a while ago that produced a similar effect to the leveller. It went through a number of iterations progressively reducing the gain at increasing amplitude levels (it actually worked internally repeatedly amplifying the signal below a reducing threshold, then summing the results - but the result is the same). I would not be surprised if the leveller effect was based on that Nyquist script.
That's what Leveller appears to be doing from my perusal of the code. It appears to increase gain at low initial amplitudes and decrease gain at high initial amplitudes. The only difference between the "Light" and "Heaviest" settings is the number of times the algorithm is applied to the signal.

As for "soft clipping", I don't think that's a good analogy, especially since Leveller is changing the values of samples well below the clipping level.
stevethefiddle wrote:We probably all have our definitions of what a compressor should or should not do, but I think we can agree that the leveller effect is not a "compressor" in the usual sense (fortunately it is not called a compressor).
True. I'd call the Audacity compressor a soft limiter, and Chris's compressor a compressor. The first (limiter) only adjusts its gain when the input signal is above the threshold; below the threshold its gain is unity. The latter (compressor), has two different gain settings for signals above and below the threshold: above the threshold it applies downward compression, below the threshold it applies upward compression. The better compressors will have a second threshold setting (e.g. Noise Floor) below which downward expansion is applied to avoid pumping the noise. For those who object that a limiter by definition should never allow its output to exceed the threshold, I'd call that a hard limiter.
stevethefiddle wrote:Well the documentation has been started http://manual.audacityteam.org/index.php?title=Leveller :D
Would you like to suggest some text to flesh it out a bit?
This whole investigation started because I'm the one trying to write that description!
stevethefiddle wrote:As for the Audacity Leveller - how about "Crusher"?
I like it! :D

-- Bill

steve
Site Admin
Posts: 81627
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Leveller effect adds distortion

Post by steve » Wed Oct 07, 2009 12:17 am

billw58 wrote:As for "soft clipping", I don't think that's a good analogy, especially since Leveller is changing the values of samples well below the clipping level.
It still sounds more like soft clipping than dynamic compression. :smiley-with-hands-over-ears:
billw58 wrote: That's what Leveller appears to be doing from my perusal of the code. It appears to increase gain at low initial amplitudes and decrease gain at high initial amplitudes. The only difference between the "Light" and "Heaviest" settings is the number of times the algorithm is applied to the signal.
If I recall correctly, the Nyquist effect was described as a "Peak Limiter", and it only kicked in above a relatively high level (-6dB or something like that). It actually worked quite well when used for limiting the occasional transient peak. With the Leveller, it appears to do it on everything above the "Threshold for Noise" (which by default is -70dB, so that's just about everything).
billw58 wrote:The first (limiter) only adjusts its gain when the input signal is above the threshold; below the threshold its gain is unity.
If there is make-up gain, then the gain below the threshold is no longer unity.

Most of my experience with dynamic compressors is with the hardware variety. These can vary a lot from one make/model to another, but typically I would expect to find an input gain, output gain (equivalent to make-up), threshold (upper threshold), gate level (lower threshold - though with good compressors this is more often downward expansion rather than gating, or is switchable), compression ratio, knee (the transition from below to above the upper threshold), attack, release, link (coupled left & right) and a limiter. Many modern hardware compressors have a lot of other features (side chain filters, look-ahead, dynamic enhancer, interactive ratio, ....)

The distinction between the "compressor" section and the "limiter" is that the limiter will be a very fast, high ratio compression with a high threshold (so that it "limits" peaks).

Similarly, modern limiters can have a whole array of features for adjusting the speed and hardness of their effect, but generally they will have compression ratios greater than 10:1 (up to "infinite", which is "hard clipping") and very fast attack and decay times. To slightly confuse the issue, they sometimes have the ability to adjust the input gain automatically, which is more like a compressor effect with a very slow decay time.

A limiter that never allows its output to exceed the threshold is often called a "brick wall limiter". This is not usual in hardware devices as in order to avoid hard clipping it requires too much delay on the signal to achieve the necessary lookahead. The limiter would more commonly be set so as to allow some headroom above the threshold rather than rely on a brick wall effect.
billw58 wrote:This whole investigation started because I'm the one trying to write that description!
I suspected that may be the case ;)
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

billw58
Forum Staff
Posts: 5600
Joined: Wed Aug 12, 2009 2:10 am
Operating System: macOS 10.15 Catalina or later

Re: Leveller effect adds distortion

Post by billw58 » Wed Oct 07, 2009 12:46 am

stevethefiddle wrote:
billw58 wrote:The first (limiter) only adjusts its gain when the input signal is above the threshold; below the threshold its gain is unity.
If there is make-up gain, then the gain below the threshold is no longer unity.
Again, I need to be more rigourous. :oops: Should have said "below the threshold the I/O transfer curve is a line with slope = 1".
stevethefiddle wrote:Most of my experience with dynamic compressors is with the hardware variety. These can vary a lot from one make/model to another, but typically I would expect to find an input gain, output gain (equivalent to make-up), threshold (upper threshold), gate level (lower threshold - though with good compressors this is more often downward expansion rather than gating, or is switchable), compression ratio, knee (the transition from below to above the upper threshold), attack, release, link (coupled left & right) and a limiter. Many modern hardware compressors have a lot of other features (side chain filters, look-ahead, dynamic enhancer, interactive ratio, ....)
Me too. Agreed on all your points. Except the input gain control and the threshold control will interact, so you should only have one, and it's usually the threshold control. (I know: picky picky)

But I think we're agreed that the Leveller is not a compressor/limiter in any sense that a recording engineer would recognize, right?

So I'm no further ahead :( How the heck do I describe it in terms that a novice will understand?

"The Leveller effect will squash the sound of your track - making the quiet parts louder and the loud parts quieter - and make it sound grittier at the same time. Choose your poison: Light, Moderate, Heavy, Heavier or Heaviest." ;)

-- Bill

steve
Site Admin
Posts: 81627
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Leveller effect adds distortion

Post by steve » Wed Oct 07, 2009 1:33 am

billw58 wrote:Except the input gain control and the threshold control will interact, so you should only have one, and it's usually the threshold control. (I know: picky picky)
To be even more pedantic - it's quite common for an input gain control to be a switch for selecting the nominal line level, but in any case, it's set once then left alone.
billw58 wrote:But I think we're agreed that the Leveller is not a compressor/limiter in any sense that a recording engineer would recognize, right?
Right :D
billw58 wrote:How the heck do I describe it in terms that a novice will understand?
Perhaps a close up of a squashed wave? I'm not sure - I'll think about it, but it's late now.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

kozikowski
Forum Staff
Posts: 69369
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: macOS 10.13 High Sierra

Re: Leveller effect adds distortion

Post by kozikowski » Wed Oct 07, 2009 6:44 pm

This wouldn't be the first time people have batted these terms around.

The original 2-way radios either had carbon microphones or diode/resistor networks in the sound channel to keep the apparent loudness up cheaply, since it didn't matter at all the quality of the voice. Nobody would argue if you called them clippers as, in high volume applications, that's exactly what they did. As a respected audio engineer once said, "Distortion is Loud."

Carbon microphones just sitting there on the front seat of the car have auto compression (pun intended). They would not generate waveforms past a certain level, so as you screamed into the microphone, you would get louder, but the radio signal didn't increase. Your distortion would go up.

They do work on a cycle by cycle basis and pretty mush ignore the overall loudness or anything even remotely considered 'graceful.'

"Hard Limiter" wouldn't be that far off.

Koz

steve
Site Admin
Posts: 81627
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Leveller effect adds distortion

Post by steve » Wed Oct 07, 2009 8:38 pm

A sine wave before and after the Leveller effect:
firsttrack000.png
firsttrack000.png (10.11 KiB) Viewed 7772 times
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Locked