Band compresor

Greetings, today I want to present my band compressor.
I use audacity screen reader and it really is very complicated to work with precision using vst, since it works only with sliders.
That’s why I decided to create this plug-in to have more control over the options.
I really liked the Pop mute function that, by the way, I posted a de-eser.
Bandcomp.ny (1.56 KB)

In Audacity it is possible to turn off the graphical interface (GUI) for a VST, then all the VST controls are displayed as sliders.
You have to close then reopen the VST plugin for the change to sliders to take place …
Turn off GUI, replace with sliders.gif

An interesting use of the Pop Mute effect.
I did some experiments with this type of de-esser some time ago, and at least for some voices it can work very well.

I presume that when using it for de-essing, you would set the filter frequency fairly high, according to the centre frequency of the sibilance, in which case it would probably be useful to set the default frequency somewhat higher. For example, to set the default filter frequency to 4000 Hz (4 kHz), you would change line 15 to:

;control hz "Frequencies above" int "Hz" 4000 60 8000

I’d also be inclined to restrict the range a bit more as any setting below 1000 Hz will be useless for correcting sibilance, so something like:

;control hz "Frequencies above" int "Hz" 4000 1000 8000

or define it in kHz and multiply “hz” by 1000 in the “scale input values” section

;control hz "Frequencies above" int "kHz" 4 1 8

and

;; scale input values
(setf hz (* hz 1000))  ;convert from kHz
(setf hz (min hz (/ *sound-srate* 2)))

There’s a technical error in your code, which doesn’t affect it’s performance, but could cause a problem if the code is modified by someone else and they don’t spot the error.
In lines 38 and 39 you have:

(defun filter (sig)
    (bandpass2 *track* hz 4.7071))

Given that you are passing the sound to be filtered to this function as “sig”, you should be using “sig” rather than track in the second line of this function, like this:

(defun filter (sig)
    (bandpass2 sig hz 4.7071))

A couple of other issues that I notice:

In the interface it says “Frequencies above”, which implies a shelf or low-pass filter, but the actual filter is a band-stop filter. I assume that the code is correct and the wording in the interface is left over from previous experiments with different types of filter. Simply calling that control “Frequency” or “Center frequency” would describe better what the control actually does.

In the “Listen” choice, I’m confused by what the option “Removed parts” is intended to do. I assumed that would give the part of the sound that would be removed when using the “processed part” option. In other words, the difference between the original (input) sound, and the processed sound. If that is the intention, then the second to last line of the code needs to be (diff track processed), like this:

(let* ((filtered (filter *track*))
       (passband (diff *track* filtered))
       (gated (multichan-expand #'inverse-gate filtered))
       (processed (sum passband gated)))
  (if (= apply 1)
      (diff *track* processed)
      processed))

I explain some things:
My intention is not to make a de-eser since I have one. This is as I say, a band compressor.
The use that is given is, for example in a musical production.
Suppose the voice was equalized / compressed well, but in some parts of the song some frequency sounds a little loud.Well, if we equalize with a parametric equalizer we could lose the frequency more than we want when it does not sound strong. That’s where the band compressor comes in. We select the frequency and a few db of reduction and all the audio sounds normal.
My intention in some functions in this plug-in is a bit different in the code.
If you set the option to listen to the deleted part, it would work like this:
Set the reduction quite low. With this you can hear that at the moment that the frequency reaches a high peak the signal is greatly attenuated.
Well, to leave everything balanced, it is enough to attenuate a maximum of about 6 db, even though very rarely. After this the processed sound option is set to listen to all the sound.
If you feel that the band dims a lot, you have to reduce the attenuation.
Now it’s time to apply to the entire audio track.

Hello Steve and all of the forum! Here I present a new version of my band compressor with some modifications:
Bandcomp.ny (1.56 KB)
All interface controls have keyboard shortcuts to make it easy to scroll over them.
The option parts removed in the listening control was renamed to effect only, so that you can hear how the frequency band is compressed.
The control frequencies above: was renamed to central frequency.
The minimum db range in the threshold control was increased from -24 db to -48 db.
The default attenuation value was changed from -6 db to -3 db, and the minimum value from -100 db to -10 db. The last change made was a variable called * track *, which was changed to sig in the filter definition.
Has anyone tried the band compressor in any voice, on an instrument or on the master?
Let me know. Thank you.

Do they work correctly on Windows?

Unfortunately they don’t work on Linux. This is a bug/limitation affecting all Nyquist effects. The only access keys that do work for effects on Linux are the buttons at the bottom, but if access keys are defined for other controls, then the access keys for the buttons don’t work either.

Until this issue is fixed, I prefer to not use access keys, and rely on tabbing around the interface, so that at least the buttons at the bottom work on all platforms.

If you wish to retain access keys for all controls, then you may want to consider revising the access key characters so as to avoid duplications. The access keys for the buttons at the bottom are:
M = Manage button
P = Preview button
G = Debug button
O = OK button
C = Cancel button

Other than that, the changes look good.

When testing on music, I find that I have to set the Threshold very low for the effect to do anything on the “Process” setting. Because the Threshold refers to the peak level of the band passed audio, the threshold usually needs to be set at -15 or less before any of the band-passed signal exceeds the threshold. With the default settings, the effect does virtually nothing to real-world audio.

One feature that I think would be useful to add, would be an additional “Listen” option, to allow hearing what is removed in the processed sound. The “CASE” construct would be appropriate for handling a three way choice:

  (case apply
    (0 processed)
    (1 gated)
    (t (diff *track* processed))))

Bandcomp.ny (1.59 KB)

Looks good :slight_smile:

Are there any usage tips you’d like to suggest?

I knew how to explain the use of my plugin, but below I leave a link that explains 9 situations to use a multi-band compressor.
In the case of my plug-in, it may be necessary to apply it more than once, with different configurations.

Let me know if you have understood.
I have updated the plug-in by adding the following controls.
Q (only for band stop) and make up gain.
Bandcomp.ny (1.96 KB)

Yes, I know how to use a multi-band compressor (I have many years experience as a professional sound engineer). I was asking because I’m considering adding your plug-in to the plug-ins section of the Audacity wiki (Missing features - Audacity Support)

This effect is a bit different from a “traditional” multi-band compressor, so if I upload it to the wiki I will need to add some brief notes about how it works. I can write that myself, but as this is your effect I thought that you might like to have some input into how it is described on the wiki. If you would rather just leave that to me, then that’s fine.

The version that I’d like to upload to the wiki is your Aug 16th version.

The latest version has some features that look a bit strange, and I’m not sure that they are coded correctly. For example, if “Make up gain” is set to “No”, then the value of “gated” is zero, and “processed” is the opposite type of filter to the one selected (the band-stop setting gives a band-pass effect).

Ok, I do it
Start
This effect can be used to compress a voice section, where some frequency band exits the level.
If equalization is applied, energy can be lost in the non-problematic parts.
This can also be applied to drum, bass or guitar toms.
It has the following controls:

Listen: Allows you to listen to the effect applied to the sound (normal), compressed band, (allows you to listen to how the compressor is acting in the chosen frequency band) and parts removed, (it allows you to hear only the parts of the signal that are compressed, which will not be compressed will be silent), the default is normal.
Center frequency: 60 to 8000 Hz, the default value is 220, sets the frequency of the band to be compressed.

Treshold: 0 to -48 db, default -15, sets the threshold to capture the peaks in the frequency band. Everything that is above the threshold will be compressed.
Mute Level: 0 to -10 dB, default -3, allows you to adjust how much the signal will be attenuated when it is above the threshold.
Look ahead: 0 to 100 ms, default 50, allows you to adjust how fast the frequency band dims when it crushes the threshold.
Release: 20 to 500 ms, default 250, sets how fast the band returns to the normal volume when it is below the threshold.
Usage tip: If you have more than one frequency band that is causing problems, apply the effect with different frequency band settings, treshold and mute level.
End.