First, I appologize because I'm a software developper and it's been a very long time I didn't dive into pure mathematics, so my question might seem dumb. I hope not.

The context is pitch recognition in music.

If you take a musical note, and apply a Fourier transform to it, you will have and infinite sum of amplitudes for given frequencies. For example, if I play a note whose fundamental is $F$, on any instrument, after Fourier transform, I will have harmonics at at $F, 2F, 3F,\ldots,nF$. Every frequency will have a given amplitude which defines the timbre of the instrument (piano, voice, trumpet, ... all follow this loaw, but you'll have different amplitudes for every harmonic)

Now what I'd like to do is from a given audio signal, find $F$. Just that. It's more complicated than it seems because you will always have background noise and so on ... Further more, $F$ isn't necessarilly the frequency with the highest amplitude !

So my idea for finding $F$ is to apply a DFT (well actually an FFT for speed) and find a frenquency $F$, so that $F + 2F +3F + \ldots + nF$ is maximal in the FFT output.

Do you think that's possible at all ? Do you think that's possible in a very short time (let's say < 5 milliseconds) ?

  • $\begingroup$ Probably this could be an answer:edaboard.com/thread197897.html $\endgroup$ – Vinod Dec 21 '11 at 10:10
  • $\begingroup$ Well, yes but that's a different method isn't it ? IMHO, it's easier but much less reliable because it cannot distinguish between harmonic and inharmonic sounds ... $\endgroup$ – Dinaiz Dec 21 '11 at 20:21
  • $\begingroup$ relevant dsp.stackexchange.com/a/2524/29 $\endgroup$ – endolith Aug 26 '12 at 18:48

What you are describing is very similar the the Harmonic Product Spectrum method of pitch estimation, as listed in this Stanford CCRMA paper.

An FFT does not give you an "infinite sum of amplitudes", but a finite number of result bins depending on the length of the FFT.

5 mS is only 1 period of a 200 Hz note, and only a fraction of a period below 200 Hz. Musical pitch recognition usually requires hearing or analyzing a multiple number of periods of the periodicity of a pitched sound. And a lot of music uses notes below G2. If you have a sufficient length of data, computing a pitch estimate from that data might take only on the order of microseconds rather than milliseconds on a modern PC or mobile device.

| improve this answer | |
  • $\begingroup$ Good point. However if you already have 2F and 3F, you don't really need F, do you ? In your example, 2F=400hz and 3F=600hz, so you can probably find out that F was 200 even without hearing enough sound to have a 5 ms period, can't you ? Also I heard about wavelet transform. Do you think it's a better method of doing this ? $\endgroup$ – Dinaiz Dec 21 '11 at 20:19
  • $\begingroup$ @Dinaiz : Depends on the source of the pitched sound, and whether those fragments of overtone frequencies are actually stationary or not. Wavelets are a completely separate question. $\endgroup$ – hotpaw2 Dec 21 '11 at 21:07
  • $\begingroup$ So this method isn't suitable to find f0 in "almost real time" . In the present state of art, is it possible at all, to find f0, in less than a few milliseconds, with any instrument, or is it a lost cause and I should give up my quest ? :D $\endgroup$ – Dinaiz Jul 4 '12 at 16:48

Your Answer

