On the theme of mult-effects for guitar, I have completed a stompbox-style feedback compressor. Here now for anybody who needs a compressor.
[EDIT] Added project to patchstorage[/EDIT]
Transfer Function, now that I got the ratio computation corrected:
Something to notice is this feedback compressor mode isn't log-linear above the threshold -- in fact the slope is always going to approach infinity:1 ratio as signal level gets large enough.
I have interpreted the ratio as the interception of feedback compressor curve and log-linear prototype at signal level 0dB, assuming threshold is always less than 0 dB. In other words, gain reduction applied to an input signal of 0 dB level will be the same for both the feedback compressor and the feedforward (log-linear) compressor. What happens between threshold and 0 dB differs according to plot above.
It becomes more and more a soft-knee compressor with an increasingly large radius as threshold is decreased. A higher threshold and ratio makes it tend to be more of a hard-knee compressor.
Note I updated the code and added the expf() function in the feedback loop as a user-settable operation mode option. This mode does get decently close to a log-linear transfer function. I also added a soft-knee (user-selectable) function and parallel compression (wet/dry mix) to complete the arsenal.
After adding the exponential function I captured the transfer function with the log-linear approximated responses.
First hard-knee response:
And then with the soft-knee option enabled:
LIMITING | RELEASE | ATTACK
Implemented an envelope follower inspired by a circuit presented in an EDN article by Harry Bissel:
and block diagram
With soft knee and exponential feedback mode enabled it behaves very similarly to an analog OTA-based compressor, minus the noise.