On Wed, 2007-11-28 at 18:39 +0100, Rémi Thébault wrote:
By the way, for the moment I use FFTW for the
frequency identification.
Is there a way to identify a frequency with quite high precision without
computing a big spectrum analysis ?
For a 0.7 Hz precision with fft, I need 65536 samples, what will take a
lot CPU load every 1.5 sec.
If you use the peak spectrum (by calculating the peak locations through
parabolic interpolation) and picking the lowest peak, you can get quite
precise results with a much smaller window size (~1024-2048 samples
should be fine).
This method has some flaws though, particularly if your sound has a weak
or missing fundamental. In this case you might want to look at
Autocorrelation/AMDF/ASDF, which don't require the fundamental to be the
strongest component, or even present at all.
You might be able to find some useful code in libxtract
(
http://libxtract.sourceforge.net/): xtract_peak_spectrum(),
xtract_f0(), xtract_failsafe_f0(), xtract_asdf() etc.
One approach might be to do a pre-filtering stage to determine whether
or not most of the energy in the spectrum falls above or below a certain
frequency threshold, and then pick a PDA based on the result. In my
experience, it tends to be low instrumental sounds (e.g. low piano
notes) that tend to have a 'missing fundamental'.
Jamie
--
www.postlude.co.uk