I'm trying to replicate a guitar heavy amplifier kind of sound in max. i may have gotten lost along the way and thought i need a compressor for that. so here is an attempt at making a compressor with gen~. I'm not sure what i'm doing.
There is a buffer of 50 samples that is rewritten each sample and averaged, so it's a circular running buffer, to get the average sound level. Then this level is compared to a threshold and the sound that will be louder than this threshold will be attenuated, according to a ceiling : a maximum ceiling level must be set in dB wherein it will be the new maximum amplitude of the compressed sound. Then there is an automatic makeup gain which will add as much as the ceil level to the sound, so that the new maximum is like the previous maximum.
I am not sure i got the maths right. It seems to work, but, well, sometimes it doesn't seem right, so i don't know, can someone advise ? !