Pitch shifting samples and relation to spectral centroid

I’m doing spectral analysis on groups of sound files in chunks of 4096 samples. These samples can have various sample rates but the sample rate at which the FFT and spectral analysis runs is fixed.

If I have a 44.1kHz sound file which I naively put through a spectral analysis which runs at 48kHz without compensating for the sound files sample rate mismatch, the spectral centroid values will be a bit higher than they should be, because the file was played a bit faster than it should be.

To get the correct spectral centroid values, is it as easy as just multiplying the spectral centroid values with 44100 / 48000?

What if later playback a sound file twice as fast, and I want to get the spectral centroid without rerunning the FFT analysis. Can I multiply the spectral centroid with 2 to get the correct value?

should be if my maths are correct:

1 Like