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
 
Back
Top