I'm writing a guitar tuner application for mobile. Captured audio samples are passed to fft routine. HSP is done for frequency spectrum. HSP step by step: -audio samples are passed to fft -frequency spectrum magnitudes are computed -downsample 2x, 3x , 4x power spectrum - multiply downsampled spectra It recognizes frequencies between 440+ down to 150. Below 150hz frequencies are recognized as twice high as it should be. For example frequency of 140 hz is recognized as 280 and so on. How can i fix it?
primary frequency of guitar string
Started by ●December 30, 2010
Reply by ●December 30, 20102010-12-30
On Dec 30, 9:01�am, "cartoon_20" <cartoonmail20@n_o_s_p_a_m.gmail.com> wrote:> I'm writing a guitar tuner application for mobile. Captured audio samples > are passed to fft routine. HSP is done for frequency spectrum. HSP step by > step: > -audio samples are passed to fft > -frequency spectrum magnitudes are computed > -downsample 2x, 3x , 4x power spectrum > - multiply downsampled spectra > > It recognizes frequencies between 440+ down to 150. Below 150hz frequencies > are recognized as twice high as it should be. For example frequency of 140 > hz is recognized as 280 and so on. How can i fix it?For Christ's sake, forget about FFT FFT is no longer a benefit but a detriment to the kind of problem you are trying to address Even on mobile phone Trust me on this :-)
Reply by ●December 30, 20102010-12-30
On Thu, 30 Dec 2010 08:01:35 -0600, "cartoon_20" <cartoonmail20@n_o_s_p_a_m.gmail.com> wrote:>I'm writing a guitar tuner application for mobile. Captured audio samples >are passed to fft routine. HSP is done for frequency spectrum. HSP step by >step: >-audio samples are passed to fft >-frequency spectrum magnitudes are computed >-downsample 2x, 3x , 4x power spectrum >- multiply downsampled spectra > >It recognizes frequencies between 440+ down to 150. Below 150hz frequencies >are recognized as twice high as it should be. For example frequency of 140 >hz is recognized as 280 and so on. How can i fix it?Hi cartoon_20, What is "HSP"? Exactly what do you mean by "downsample 2x, 3x , 4x power spectrum"? Exactly what is meant by "multiply downsampled spectra"? [-Rick-]
Reply by ●December 30, 20102010-12-30
On Dec 30, 10:29�am, Rick Lyons <R.Lyons@_BOGUS_ieee.org> wrote:> � �What is "HSP"?Sounds like Harmonic Product Spectrum analysis, which for certain certain kinds of data gives similar gross results to time domain autocorrelation, but can be done on frequency domain data. The OP may need to use a wider/longer initial FFT window before applying HPS analysis. IMHO. YMMV. -- rhn A.T nicholson d.0.t C-o-M http://www.nicholson.com/rhn/dsp.html
Reply by ●December 30, 20102010-12-30
On Dec 30, 6:33�am, fatalist <simfid...@gmail.com> wrote:> On Dec 30, 9:01�am, "cartoon_20" <cartoonmail20@n_o_s_p_a_m.gmail.com> > wrote: > > I'm writing a guitar tuner application for mobile. Captured audio samples > > are passed to fft routine....> For Christ's sake, forget about FFT > > FFT is no longer a benefit but a detriment to the kind of problem you > are trying to address > > Even on mobile phone > > Trust me on this :-)Interesting opinion, given that I have successfully sold FFT-based (plus post-processing) guitar tuners on multiple small mobile platforms. Perhaps you have a successful Android or iPhone guitar tuner in one of the app stores which I can buy to compare with my FFT based tuners? IMHO. YMMV. -- rhn A.T nicholson d.0.t C-o-M HotPaw Productions: http://www.hotpaw.com/rhn/hotpaw
Reply by ●December 30, 20102010-12-30
>On Thu, 30 Dec 2010 08:01:35 -0600, "cartoon_20" ><cartoonmail20@n_o_s_p_a_m.gmail.com> wrote: > >>I'm writing a guitar tuner application for mobile. Captured audiosamples>>are passed to fft routine. HSP is done for frequency spectrum. HSP stepby>>step: >>-audio samples are passed to fft >>-frequency spectrum magnitudes are computed >>-downsample 2x, 3x , 4x power spectrum >>- multiply downsampled spectra >> >>It recognizes frequencies between 440+ down to 150. Below 150hzfrequencies>>are recognized as twice high as it should be. For example frequency of140>>hz is recognized as 280 and so on. How can i fix it? > >Hi cartoon_20, > What is "HSP"? > > Exactly what do you mean by "downsample 2x, 3x , > 4x power spectrum"? > > Exactly what is meant by "multiply downsampled spectra"? > >[-Rick-] >HSP is Harmonic Product Spectrum. After the fft routine (array) is done: -take every second bin from array and put it into array1 array -take every third bin from array and put it into array2 array -take every forth bin from array and put it into array3 array then multiply array[i] * array1[i] * array2[i] * array3[i] after that the first four partials overlaps and I can find primary frequency. Unfortulately, for low frequencies below 150 hz first partials are weak and further partials with higher magnitude contrubutes to higher final partial. So lower frequencies are recognized as higher ones. What algorithm would you recommend for pitch detection (frequency spectrum)?
Reply by ●December 30, 20102010-12-30
>On Dec 30, 10:29=A0am, Rick Lyons <R.Lyons@_BOGUS_ieee.org> wrote: >> =A0 =A0What is "HSP"? > >Sounds like Harmonic Product Spectrum analysis, which >for certain certain kinds of data gives similar gross >results to time domain autocorrelation, but can be done >on frequency domain data. > >The OP may need to use a wider/longer initial FFT window >before applying HPS analysis. > >IMHO. YMMV. >-- >rhn A.T nicholson d.0.t C-o-M > http://www.nicholson.com/rhn/dsp.html >hmmmm... I tried rectangular, triangular, hanning and hamming windows. But I don't know if I did it well. I multiply audio samples (512 samples) by window function. Or maybe should I split 512 audio samples into smaller arrays, multiply each of them by window fuction? My window is large enough to capture 512 audio samples. Is it too small?
Reply by ●December 30, 20102010-12-30
On Thu, 30 Dec 2010 11:58:48 -0800 (PST), "Ron N." <rhnlogic@yahoo.com> wrote:>On Dec 30, 10:29�am, Rick Lyons <R.Lyons@_BOGUS_ieee.org> wrote: >> � �What is "HSP"? > >Sounds like Harmonic Product Spectrum analysis, which >for certain certain kinds of data gives similar gross >results to time domain autocorrelation, but can be done >on frequency domain data. > >The OP may need to use a wider/longer initial FFT window >before applying HPS analysis.Thanks Ron. I'll have to Google that to see what it's all about. [-Rick-]
Reply by ●December 30, 20102010-12-30
>I'm writing a guitar tuner application for mobile. Captured audio samples >are passed to fft routine. HSP is done for frequency spectrum. HSP stepby>step: >-audio samples are passed to fft >-frequency spectrum magnitudes are computed >-downsample 2x, 3x , 4x power spectrum >- multiply downsampled spectra > >It recognizes frequencies between 440+ down to 150. Below 150hzfrequencies>are recognized as twice high as it should be. For example frequency of140>hz is recognized as 280 and so on. How can i fix it? > > >Sorry for HSP, it was supposed to be HPS :P. Below link to power spectrum for frequency of 146hz: http://img255.imageshack.us/i/graphf.jpg/
Reply by ●December 30, 20102010-12-30
On 30/12/2010 22:40, cartoon_20 wrote: ..> hmmmm... I tried rectangular, triangular, hanning and hamming windows. But > I don't know if I did it well. I multiply audio samples (512 samples) by > window function. Or maybe should I split 512 audio samples into smaller > arrays, multiply each of them by window fuction? > > My window is large enough to capture 512 audio samples. Is it too small?I don't recall seeing a sample rate mentioned anywhere. That question can't be answered without it. All you have said is that this is for a mobile app; and plenty of mobiles (iPhone etc) support 44100 these days. In which case, I would suggest that 512 is borderline at best - you may find you need a window that can span ~two~ cycles of the lowest frequency of interest. But I have to ask - is it really so hard simply to try it out and see if it improves things? Richard Dobson






