Dynamic Range Compressor new class library. I wish to share.

aidyw

Active member
Hi,
I have just created a new class library for the Audio Library (a new audio object) as the pjrc web page describes it. I'm not sure which is the correct terminology. Anyway. I have a fully functional .cpp and .h file which follows the guidelines as described and works very well. I have been using it in the wild. That is as a vocal compressor whilst playing live music and it seems to work great.

It offers the following controls:
Attack rates 0.1 - 2000 mS
Release rates 0.1 - 2000mS
Ratio between 1 to 32767
Knee width between 0 to 40dB (soft to hard knee control)
Threshold between 0 to -40dB
Makeup Gain between 0 to 40dB
Multiple side chain inputs that can be selected at run time.


I wanted to share the code and make the object available to others. I would have created a branch on the github site, but it seems I can not contribute in this way.

Perhaps you can tell me how best to share the code.
Aidan
 
I would like to point out that because the compressor works in the Log domain and to try and avoid excessive floating point operations. I have used LUTs to convert from linear to Log and also Log to linear. These require about 20K of program memory. I tried very hard to minimise this footprint and what I did may seem a little odd but it truly works, and is quite efficient.

Running on a Teensy 3.2 and downsampling the gain computations to 1/4*Fs it takes around 15% compute time per instance.


The code is reasonably well documented so any questions or modifications just fire away.

All the best
Aidan
 
Have you tried this on a 4.1 with the built in log functions? the 4.1 uses a blazingly fast chip

Recently I bought 4 x Teensy 4. But........ the hardware I have built into my PA system is based on the 3.2. It is a royal PITA to retrofit the 4. It is in my plan, but at the same time I am also planning to upgrade the AD and DA devices as the SGTL5000 is quite noisy. Anyway, instead of a retro fit on the MCU. I battle on with the 3.2 in this version of the active hardware. The 4.0 is for future development.

If I was only focused on the 4 / 4.1, then perhaps I would have used the FPU capabilities without a care. I'm sure it would make minced meat out of this but I do love the challenge of squeezing the most from a fix point system.

From the point of view of a library addition, it also offers the most flexibility. It would be a simple task to 'if elseif' the LUTs, to better use the 4 / 4.1. Essentially the compression calculations have none of this fixed point concern within the code anyway, so it is only the Log to Lin / Lin to Log that would need addressing.

Aidan
 
Hi,
I have just created a new class library for the Audio Library (a new audio object) as the pjrc web page describes it. I'm not sure which is the correct terminology. Anyway. I have a fully functional .cpp and .h file which follows the guidelines as described and works very well. I have been using it in the wild. That is as a vocal compressor whilst playing live music and it seems to work great.

It offers the following controls:
Attack rates 0.1 - 2000 mS
Release rates 0.1 - 2000mS
Ratio between 1 to 32767
Knee width between 0 to 40dB (soft to hard knee control)
Threshold between 0 to -40dB
Makeup Gain between 0 to 40dB
Multiple side chain inputs that can be selected at run time.


I wanted to share the code and make the object available to others. I would have created a branch on the github site, but it seems I can not contribute in this way.

Perhaps you can tell me how best to share the code.
Aidan
I'm trying to get it to work, but can't seem to get audio out.
Maybe I'm just not getting how to connect it.
it has 3 inputs:
INPUT (port 0), SideChainA (port 1), and SideChainB (port 2).

as far as i can tell from the code, the input is only used if the compressor is not enabled.
If the compressor is enabled, it uses sideChainA or B depending on sideChainSel.

I can get the input to come out the output if i disable the compressor, but no other way can i get the input to go to the audio out.

Do you have a demo sketch I could take a look at?

EDIT:
I can get the sideChainA (or B) to come out the output, if i have the makeup gain above zero db (like 6 db or something).
The compression seems to just compress the sideChain signal itself, not the input signal. I can still use it this way, so that's good.
But i figured what it was supposed to do was compress the input based on the sideChain signal.


Thanks.
 
Last edited:
Back
Top