electro-smith / DaisySP

A Powerful DSP Library in C++
https://www.electro-smith.com/daisy
Other
848 stars 134 forks source link

Compressor improvement #63

Closed AvAars closed 4 years ago

AvAars commented 4 years ago

Improved the compressor a lot, as this was one of the modules I currently use most. Would appreciate any feedback 👍

Some changes I made:

And, as mentioned in #59 , added block processing (for single- and multichannel). The single sample process methods inside these block processing methods get fully inlined, so there's a performance gain for those using these methods.

AvAars commented 4 years ago

Maybe have to check up on best practices of inline functions, the recalculation of the internals might be better off outside the header file.

stephenhensley commented 4 years ago

Looks great! I'll be able to test it today or tomorrow and get it merged.

I had actually just starting to make a lot of similar (some identical) changes while working on a project that needed several of compressors.

Thanks for the contribution!

stephenhensley commented 4 years ago

This tests well. I haven't checked with too many input sources yet, but the auto makeup gain is nice. One thing that would be nice (maybe for the entire library) is to be able to set a 0dB value.

I imagine this won't be much of an issue on the Daisy Pod, etc. where the maximum output is a reasonable line level, but with the Daisy patch there's an extra 6dB of headroom so with Auto Makeup Gain the output gets close to 20Vpp.

That said, maybe that should be something that can be set for the whole library via a DaisySPConfig struct or something because everything is based on nominal 0dB==1.0 right now.

Overall, this is most likely good to go. I'm going to run a few more tests in a little and then I'll get it merged.

AvAars commented 4 years ago

Great 👍 I'm using it on my Patch as well, but running the output straight into a performance mixer with 20dB headroom so I didn't experience any issues. For other modules it might be too hot indeed.

The auto makeup gain is based on this topic where the auto makeup gain of TASCAM products is explained:

It would be easy enough to implement a 0dB = -6dB correction (adding it to the threshold in the processing stage, but not in the calculation of the makeup gain), so that's easily fixed when there a library-wide configuration option is available. It would be a nuisance to use if it would be implemented as a regular option for the compressor.