Forums

Pitch recognition of a musical note on a smart phone

Started by mzincali September 22, 2009
Hi.  With limited resources such as slower CPUs, code size and RAM, how
best to detect the pitch of a musical note, similar to what a tuner would
do?

Should I use:

- Kiss FFT
- FFTW
- autocorrelation
- zero crossing analysis
- octave-spaced filters

other?

Thank you in advance.

-mz



mzincali wrote:

> Hi. With limited resources such as slower CPUs, code size and RAM, how > best to detect the pitch of a musical note, similar to what a tuner would > do? > > Should I use: > > - Kiss FFT > - FFTW > - autocorrelation > - zero crossing analysis > - octave-spaced filters > > other? > > Thank you in advance.
A young guy and young girl came to the rabbi to ask for his advice. A girl: "Tomorrow is my first night with my fiance. What kind of night dress should I put on? Should it be a long dress, or a short dress, or an open dress, or a closed dress, or whatever?" A boy: "I got some money. Will you please give me an advice what to do with it: maybe, invest into something, or buy some real estate, or gold, or put it in a bank?" The rabbi: "My dear children, I have one answer for both of you: whatever you do, you will certainly be fucked." Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
Vladimir Vassilevsky <nospam@nowhere.com> wrote in
news:OvGdnUIafaakaCXXnZ2dnUVZ_tqdnZ2d@giganews.com: 

> > > mzincali wrote: > >> Hi. With limited resources such as slower CPUs, code size and RAM, >> how best to detect the pitch of a musical note, similar to what a >> tuner would do? >> >> Should I use: >> >> - Kiss FFT >> - FFTW >> - autocorrelation >> - zero crossing analysis >> - octave-spaced filters >> >> other? >> >> Thank you in advance. > > > A young guy and young girl came to the rabbi to ask for his advice. > > A girl: > > "Tomorrow is my first night with my fiance. What kind of night dress > should I put on? Should it be a long dress, or a short dress, or an > open dress, or a closed dress, or whatever?" > > A boy: > > "I got some money. Will you please give me an advice what to do with > it: maybe, invest into something, or buy some real estate, or gold, or > put it in a bank?" > > The rabbi: > > "My dear children, I have one answer for both of you: whatever you do, > you will certainly be fucked." >
> Vladimir Vassilevsky > DSP and Mixed Signal Design Consultant > http://www.abvolt.com
Since it is clear that neither age nor experience have brought you any wisdom, the rabbi's answer applies to you as well.
Hi mz.

You cannot use FFTW, smartphones do not run on processors with
floating point unit. Emulation is just too slow to be usable on slower
devices.
Kiss FFT could be configured to use fixed point arithmetics.
You may get an exaple of the fft and spectrogram code for Pocket PC
platform at http://pocketdigi.sourceforge.net It uses some fixed point
real valued FFT.
The real valued fixed point FFT will certainly work and you may use
the phase differences between the FFT bins of successive FFT
transforms to calculate more precise estimate of the tone captured by
the FFT bin.

Zero crossing will be sensitive to noise. I suppose you want to detect
tone from internal microphone?

Vojtech
On Oct 1, 10:15=A0am, ok1iak <bubn...@seznam.cz> wrote:
> You cannot use FFTW, smartphones do not run on processors with > floating point unit. Emulation is just too slow to be usable on slower > devices.
This is not true on many current smartphones. I've benchmarked a short float FFT on an iPhone as faster than a scaled integer FFT (actual milage will depend on how much you optimize each). The newer Android smartphones use similar ARM CPUs which includes a VFP pipelined or NEON vector floating point unit. The real problem is that musical pitch is very often not related to peak frequency bin results from an FFT at all. Disclaimer: I have several musical pitch estimation and tuning assist apps in the iPhone App store. Search for "HotPaw". IMHO. YMMV. -- rhn A.T nicholson d.0.t C-o-M http://www.nicholson.com/rhn/dsp.html
> > You cannot use FFTW, smartphones do not run on processors with > > floating point unit. Emulation is just too slow to be usable on slower > > devices. > > This is not true on many current smartphones. =A0I've benchmarked > a short float FFT on an iPhone as faster than a scaled integer FFT > (actual milage will depend on how much you optimize each). > The newer Android smartphones use similar ARM CPUs which > includes a VFP pipelined or NEON vector floating point unit.
How many of current smartphones implement FPU? Would you please provide more information on the CPU you are referencing? It is certainly new to me. Real valued fixed point FPU displays 4kHz spectrogram with 4Hz resolution on 206MHz StrongARM using about 1/4 of available clock cycles. The same device would most probably not be able to run floating point FFT with emulated FPU. 400MHz ARM is able to do it, but it will certainly not be battery friendly. Vojtech
On Oct 1, 5:37=A0pm, ok1iak <bubn...@seznam.cz> wrote:
> > > You cannot use FFTW, smartphones do not run on processors with > > > floating point unit. Emulation is just too slow to be usable on slowe=
r
> > > devices. > > > This is not true on many current smartphones. =A0I've benchmarked > > a short float FFT on an iPhone as faster than a scaled integer FFT > > (actual milage will depend on how much you optimize each). > > The newer Android smartphones use similar ARM CPUs which > > includes a VFP pipelined or NEON vector floating point unit. > > How many of current smartphones implement FPU? Would you please > provide more information on the CPU you are referencing? It is > certainly new to me.
Correction: the current generation of Android phones don't seem to have VFP enabled. But the Palm Pre does have an FPU, as do over 20 million iPhones (2G, 3G, 3Gs). There's a bunch of frequency/pitch estimation ideas on my web page below. IMHO. YMMV. -- rhn A.T nicholson d.0.t C-o-M http://www.nicholson.com/rhn/dsp.html