View Single Post
Old 01-13-2021, 03:25 PM   #6
Human being with feelings
Join Date: Aug 2015
Posts: 1,569

Oh, well, I've never done anything like that... I gather fft is a (computationally heavy?) of getting autocorrelation.

Have you seen JS: FFT Peak-Following Filter?

As far as a simple moving average goes, I've got something like this, which was for a jsfx compressor that I never finished.

the circular buffer (array) remembers scaled values. It has LENGTH slots.

new_value = abs(spl0);

sample_count += 1;
idx = sample_count % LENGTH;

avg -= array[idx];
avg += new_value / LENGTH;

array[idx] = new_value / LENGTH;
it's meant to sound like that...

Last edited by jrk; 01-13-2021 at 03:41 PM.
jrk is offline   Reply With Quote