View Single Post
Old 16th April 2011, 17:23   #2
Major Dude
Join Date: Mar 2008
Location: Erlangen
Posts: 862
That's easy

1. To dampen the bass response, use

dec = pow(0.5,30/fps); //fps independant decay rate
mybass = dec*mybass + (1-dec)*bass_att; //mybass is the dampened bass

The factor 0.5 determines the rate: 0 is no damping, 0.9 is very strongly dampened. Keep it below 1.

2. To limit a variable, use either
mybass = min(1, mybass); // min returns the smaller one of the arguments

mybass = pow(mybass, k); //where k is below 1; not a limiter but similar to soft clipping

or also
mybass = log(mybass+1);
Nitorami is offline   Reply With Quote