# [SciPy-User] Accurate Frequency Measurement

Seth Nickell snickell@gmail....
Tue Nov 30 00:30:41 CST 2010

```I'm indeed evaluating partials, analyzing some of the interesting
analog sine tone installations of the composer La Monte Young. S/N of
most of the recordings is favorable, and the recordings are long, so I
have good material to work with. I've achieved good enough frequency
estimation using power of 2 length (sigh, should have done this before
asking for help) with an fft, but I greatly appreciate the ideas
charles and anne have raise as I analyze these further.

I'm finding Anne's suggestion very interesting because padding is
allowing me to analyze the nature of the analog oscillators in more
depth; they certainly aren't perfect.

Young's compositions are so dependent on minutia such as oscillator
drift that it wouldn't surprise me if some aspects of the effects he
evokes are dependent on e.g. the amplitude stability of an oscillator.
Certainly frequency drift is something he utilizes.

SNTLN is very interesting in its own right and I'm enjoying reading up on it.

Thanks very much!

On Mon, Nov 29, 2010 at 7:41 PM, Nicolau Werneck <nwerneck@gmail.com> wrote:
> 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
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
>
> iEYEARECAAYFAkz0VmUACgkQ1sQ3u9pkbxVgGgCglXkNjDgSOFKxeiSYuzGrIvsJ
> 3OcAoJzwmnCuiGX9LMH3DcTINN85dOeA
> =NX+L
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
>
```