# [SciPy-User] Accurate Frequency Measurement

Nicolau Werneck nwerneck@gmail....
Mon Nov 29 19:41:58 CST 2010

```Hi, Seth. That is a fascinating subject, I would love you to give us
some more details of your problem. And I would love to give lots of
ideas too! :)

If I understand correctly, your signal has a number of partials, and
you want to measure their frequencies, correct? I had this problem once
analyzing signals recorded from an electric guitar. I wanted to
measure the beatings of the partials on time, and for that I needed to
measure peaks that were very close to each other, around each natural
frequency. I ended up trying to use an algorithm called SNTLN,
structured nonlinear total least norm. It's an optimization procedure,
and you can use scipy to implement it. I think it has been used with
speech signals, for example. There are other similar techniques such
as regularized total least squares, etc. Take a look at these
articles:

http://www.ece.umassd.edu/Faculty/acosta/ICASSP/Icassp_1998/pdf/author/ic981693.pdf
http://www.eurasip.org/Proceedings/Eusipco/1996/paper/pde_13.pdf

What these have in common is that they perform some kind of
optimization in the time domain instead of transforming and then
looking for peaks.

But if you want to keep the frequency approach, there are some things
you can try. If you have an estimate of the frequencies, and know that
the spectrum is clean a few hz around, there are algorithms that let
you calculate just a part of the spectrum. One easy approach is to
simply filter and resample the signal... But I am not sure if that

Another thing you might like to try is using a Kalman filter that
estimates the frequencies as it read each new sample. Do you have a
model of the system you are studying?... What kind of noise is your
recording subject to, and how stable are those frequencies?

See you,
++nicolau

On Mon, Nov 29, 2010 at 04:19:14PM -0600, Seth Nickell wrote:
> I'm trying to measure the frequency of several sin 'tones' in a signal
> to within a hundredth of a Hz. I've made a 200s recording of the
> signal (44100 Hz wav file), but find that I cannot reasonably take an
> fft of the entire signal (takes 'forever'). The size of fft that seems
> to not take forever only gives me a resolution of a tenth of a Hz. The
> sin tones have the highest amplitudes by a long shot (i.e. the signal
> isn't very noisy). I've considered using a sin tone generator and
> using my ears+destructive interference to find the tones, but I'd like
> to be able to re-run this procedure on hundreds of signals, and I
> wouldn't be confident in the precision I could achieve.
>
> Can anyone suggest a straightforward technique in scipy to measure
> these frequencies more accurately?
>
> Thanks,
>
> -Seth
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user

--
Nicolau Werneck <nwerneck@gmail.com>          C3CF E29F 5350 5DAA 3705
http://www.lti.pcs.usp.br/~nwerneck           7B9E D6C4 37BB DA64 6F15
Linux user #460716
"Object-oriented programming is an exceptionally bad idea which could only have originated in California."
-- Edsger Dijkstra

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
Url : http://mail.scipy.org/pipermail/scipy-user/attachments/20101129/d6a68d5b/attachment.bin
```