Open PaulStoffregen opened 10 years ago
This might be useful for dynamics processors (e.g. AGC, compressors) as well as metering. Configurable time constants, yes please. Variants using RMS averaging (for accuracy) or a simple average (for efficiency) would be nice too.
isn't this just FIR or IIR into a peak? maybe peak just needs to be faster? at any rate this is an easy object to make, just rectify, lowpass (works best with specific filtering for upward and downward movement separated into attack and decay slew rate limiting)
here is a snippet from part of my omnimod code that does this decently:
uint16_t ADCsmooth(uint8_t ADCchan){
if(ADCmapped[ADCchan] <= ADCvalueOld[ADCchan]){
ADCvalue[ADCchan] = (ADCmapped[ADCchan] + (ADCvalue[ADCchan] << CVsmoothingDown[ADCchan]) - ADCvalueOld[ADCchan]) >> CVsmoothingDown[ADCchan]; }
else{
ADCvalue[ADCchan] = (ADCmapped[ADCchan] + (ADCvalue[ADCchan] << CVsmoothingUp[ADCchan]) - ADCvalueOld[ADCchan]) >> CVsmoothingUp[ADCchan]; }
}
There should be an analyze object that reports "volume". It should take the absolute value of the input, and apply different filters for increases (short time constant) and decreases (long time constant) to simulate the time response of a traditional VU meter. Maybe the time constants should be configurable?