pythonsignalssignal-processingpitch-tracking

Pitch detection results wrong


I am using freq_from_crossings from here (I haven't changed the code). My input is an audio file with an acoustic guitar E2 note and nothing else (as my microphone is pretty bad, the sound is not very clear).

This is the waveform:

waveform And this is the spectrogram I am getting:

spectrogram

From the spectrogram it is pretty clear that the loudest harmonic corresponds to the E2 note. However, freq_from_crossings returns 415.461966359 which is not at all the pitch played. What components could have gone wrong?

Thanks


Solution

  • A waveform that is not a single pure sinewave can have more zero crossings than once per pitch period. Within one period, it can include lots of "wiggles" that cross zero. The harmonic content of your guitar note spectrogram shows that the total waveform is far from being a single pure sinewave. It's also changing over time.

    Therefore, estimating pitch frequency from zero crossings won't work for these types of guitar sounds.