I have a recording of a single note played several times on a violin. I'm working with Matlab to estimate the amplitude of the first N harmonics. I already know which note is played but there can be fluctuations in frequency and noise (very little, actually). Can you suggest me the more robust method in this kind of situation? At the moment I am windowing the signal and using a peak detection algorithm on the FFT of each frame in order to find the amplitude of the harmonics. Is there anything better?
pitch detection and tracking. use autocorrelation or perhaps AMDF (average-magnitude difference function) or ASDF (average-squared difference function).
either the "heterodyne oscillator" or, i would recommend, wavetable synthesis techniques to get the amplitude and phase of each harmonic.
If you know the precise pitch at which the note is being played, then an FFT is overkill. You can use a Goertzel filter tuned for each harmonic, with a filter length that the integer closest to an exact integer multiple of the period of the pitch. Use the same filter length for all the harmonics in order to compare their amplitudes. Most Goertzel filter formulations will give you the same result (minus numerical artifacts) as 1 bin of an FFT of the same length.
A non-rectangular window will destroy some of the amplitude information. An FFT that is of a length that is not an exact integer multiple of the period will give you scalloping errors for some or all of the harmonics, due to frequencies not being at the FFT result bin centers. A so-called "flat top" window may help, but why create errors and then try to correct them?
If you don't know the precise pitch, then you can first use a pitch estimation algorithm to estimate the frequency, and then created customized Goertzel filters to estimate the relative amplitudes of the harmonic series.