Oriol Romani Picas pointed out a few errors in my implementation of the
algorithm above.  Thanks, Oriol!

Specifically, in step 4, the *square root* of PB/PA -- effectively an RMS
-- is used, and we multiply by the sampling rate divided by two pi.
The example
code <http://pastebin.com/EfRv4HRC> has been updated to reflect this.

Apologies for the misinformation and any confusion it might have caused --
I was referencing a very different implementation of the algorithm when
writing the original post.

– Evan Balster
creator of imitone <http://imitone.com>

On Tue, Feb 2, 2016 at 10:35 AM, Risto Holopainen <ebel...@ristoid.net>
wrote:

>
>
> On February 1, 2016 at 7:41:49 pm +01:00, Evan Balster <e...@imitone.com>
> wrote:
>
>
>
>    1. Apply a first-difference filter to input signal A, yielding signal
>    B.
>    2. Square signal A, yielding signal AA; square signal B, yielding
>    signal BB.
>    3. Apply a low-pass filter of your choice to AA, yielding PA, and BB,
>    yielding PB.
>    4. Divide PB by PA, then multiply the result by the input signal's
>    sampling rate divided by pi.
>
>
> The low-pass filter used in step 3 determines the time-domain weighting
> for the frequency average.  (I recommend a rectangular or triangular
> average.)
>
>
> You don't see that formula as often as the one involving spectral bins,
> but it can be found in a few places such as the DAFX book by Zölzer. It's a
> nice trick when you want to track fast changes in the centroid without
> having to do lots of overlapped windows.
>
> Another simple way if you do an FFT would be to accumulate the amplitude
> of successive bins, counting from 0 Hz upwards as well as from f_s/2
> downwards, stopping at the bin where the summed amplitudes match.
>
> And welcome to the list!
>
> Risto Holopainen
>
>
>
> _______________________________________________
> dupswapdrop: music-dsp mailing list
> music-dsp@music.columbia.edu
> https://lists.columbia.edu/mailman/listinfo/music-dsp
>
_______________________________________________
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp

Reply via email to