jeremybboy / Pitchtracker

https://jeremybboy.github.io/Pitchtracker/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spectral Product Algorithm

We are going to estimate the F0 of this multipitch piano sample: A3 C4 E4 G4

Your browser does not support the audio element.

The spectral product is calculated by multiplying H compressed versions of the spectrum. Let's call the discrete frequency of the DFT:

We have the spectral product:

We calculate the DFT frequencies and amplitudes with the Fast Fourier Transform algorithm.

dddd

We then calculate the vectors containing the spectral product frequencies and amplitudes.

Maximum of the spectral product

dddd

When the signal is polyphonic, we have a superposition of several harmonic spectrum. The idea is to subtract the harmonic spectrum that corresponds to the f0 we estimated. In order to do so, we need to know where the different harmonics of the fundamental frequency are. The idea is to look for the maximum of the spectrum around each theorical harmics of frequency

dddd

Substraction of the harmonics

In order to better discern the sounds that are in harmonic relation (and especially the sounds at the octave level) it is preferable not to totally subtract a sound from the mixture, but to try to subtract only its contribution at the level of each harmonic. For this, the principle of spectral smoothness is used. We calculate a smoothed harmonic spectrum where the amplitude of the spectrum at each harmonic f_h is replaced by the average of the amplitudes of the harmonics f_h-1, f_h and f_h+1.

dddd

Stop criterion

The previous steps are then iterated until a certain stopping criterion is verified.

dddd

ggg

ggg

The algorithm succeeded in extracting the frequency 332, which corresponds to the note E4 which was indeed in the piano chord of the studied audio sample.

Your browser does not support the audio element.

About

https://jeremybboy.github.io/Pitchtracker/