On Wed, 2008-10-15 at 17:24 +0200, Frank Barknecht wrote:
Hallo, Frank Barknecht hat gesagt: // Frank Barknecht wrote:
I'm trying to build a pure-Pd compressor/limiter effect.
Attached is a slightly better version, which now uses a snapshot~ to get the current gain, which then is compared to the target gain to calculate the next gain. Now it seems to be possible to actually compress audio with it, if you set a low threshold (~ 0.2), a sharp attack (~1ms), and comp1 to some small value (or 1/comp1 to a large one) while keeping comp1 at 1.
Testing and comments would be cool!
yo... late comment, but still a comment :-)
i tried it on a bad quality voice recording (with some background noise, which makes it easier for me to hear, how the compressor behaves). it turned out, that i ended up using similar settings as you proposed in the post above to get compressorlike results. and yes, at least for voice it works pretty well, i'd say.
with c2 set to ~2 i could achieve a noise gate (or more correct: downwards expander) with voice compressor at the same time. however, i had the impression, that the release time doesn't seem to affect the gate. when c2 is set to 1, i clearly hear the difference between 10 and 1000 ms release time. when i set c2 to > 1 and release time to a high value, the abstraction still very quickly kicks in to suppress background noise. is this because both, c1 and c2, share the same [pd attack-release] section? i checked again by watching the $0-diff table and it seems, that attack and release times are swapped for c2, compared to what you usually would expect from a downward expander/gate. on a raising signal, the gain should be corrected in 'attack' time, while on a muting signal, the gain should follow in 'release' time. in your implementation it is the other way around. i am not quite sure, how this could be fixed. probably c1 and c2 need a separate [pd attack-release] section?
i also encountered, that the c1 ratio is not a straight line, but rather curve on a logarithmic (dB) scale (except when it is 1, of course), while the c2 ratio is a straight line. i know some vst compressor plugins - the C1 from waves in particular - that show similar behaviour. i always wondered about the formula for those curves. it's cool to have that now in pd as well.
i added an input/output graph to compress~-help.pd, which helped me to understand what the abstraction actually does. see attachment.
roman