DSPRelated.com
Forums

5th harmonic or something else

Started by noodle22 February 21, 2009
I have been working on a pitch detector (thanks to all who have helped me
along so far) and I have just noticed something when I play a low not on my
keyboard.

http://www.studypipe.com/Shared/images/oddpeak.png

This looks like I am dealing with the 5th harmonic (4 small peaks and then
a big one) but they are not evenly spaced.  I did use the "piano" sound
which may have some special features I am not aware of.  Any idea why they
are not evenly spaced?

Here are some details
-peaks in time domain, used autocorrelation and average mean distance
function to get my peaks as shown.
-so the center point is the starting position for counting peaks (where
signals are perfectly correlated) and from there, count to the left or
right
-I zeroed the center peak
-Only testing for a single note
On Feb 21, 12:04&#4294967295;pm, "noodle22" <jw970...@yahoo.com> wrote:
> I have been working on a pitch detector (thanks to all who have helped me > along so far) and I have just noticed something when I play a low not on my > keyboard. > > http://www.studypipe.com/Shared/images/oddpeak.png
what's the green and what's the orange? what is the specific math used to generate the plot?
> This looks like I am dealing with the 5th harmonic (4 small peaks and then > a big one) but they are not evenly spaced. &#4294967295;I did use the "piano" sound > which may have some special features I am not aware of. &#4294967295;Any idea why they > are not evenly spaced? > > Here are some details > -peaks in time domain, used autocorrelation and average mean distance > function to get my peaks as shown.
you mean "average magnitude difference function"? never heard of "average mean distance function", at least in the context of pitch detection.
> -so the center point is the starting position for counting peaks (where > signals are perfectly correlated) and from there, count to the left or > right > -I zeroed the center peak
what's a "center peak"?
> -Only testing for a single note
that's good, because you'd really be screwed if it were multiple notes. r b-j
On Feb 21, 12:04 pm, "noodle22" <jw970...@yahoo.com> wrote:
> I have been working on a pitch detector (thanks to all who have helped me > along so far) and I have just noticed something when I play a low not on my > keyboard. > > http://www.studypipe.com/Shared/images/oddpeak.png > > This looks like I am dealing with the 5th harmonic (4 small peaks and then > a big one) but they are not evenly spaced. I did use the "piano" sound > which may have some special features I am not aware of. Any idea why they > are not evenly spaced? > > Here are some details > -peaks in time domain, used autocorrelation and average mean distance > function to get my peaks as shown. > -so the center point is the starting position for counting peaks (where > signals are perfectly correlated) and from there, count to the left or > right > -I zeroed the center peak > -Only testing for a single note
Yes, this is interesting. I think there is something to learn here. Your image is a bit hard to see. You might try providing a higher resolution image. It looks like each of the peaks is actually multiple peaks. If you consider a central point of this group of peaks, the spacing appears to be about 58 or so bins. The interesting part is that the sequence of the peaks in a cluster reverses on each harmonic. This is exactly the effect you see when a signal is undersampled and you get aliasing in the spectrum. I'm not saying that is what you are seeing, but it may have similar causes. To get a better understanding of what you should expect to see, what is the sample rate? What is the frequency of the note you used? I'm also curious about why you are using a correlation that shifts both positive and negative. For your application do you need the negative shift? Isn't that going to always produce a reflection about the zero when used with real data? I guess you used a canned program and didn't want to muck with it? Rick
>what's the green and what's the orange?
green = my processed signal orange = peaks that the computer has identified
>you mean "average magnitude difference function"? never heard of >"average mean distance function", at least in the context of pitch >detection.
you are correct
> what's a "center peak"
> For your application do you need the negative > shift? Isn't that going to always produce a reflection about the zero > when used with real data? I guess you used a canned program and > didn't want to muck with it?
I can answer both of these at the same time. I am doing my correlation by "sliding" an array of data across another array of data and each time I slide it, I sum the multiplication of all the cooresponding elements. Ie ...|1|3|4| |1|3|4| .|1|3|4| |1|3|4| |1|3|4| |1|3|4| |1|3|4| .|1|3|4| |1|3|4| ...|1|3|4| so the end result is |4|15|26|15|4 The center peak I was referring to was the "26" point where the signals are perfectly correlated. I set up the library so that I could correlate any two signals (not a canned program but something I wrote myself) but I did not really think about it a whole lot and I see that I only need half to correlate half of it if I am doing an auto correlation. Thanks for the tip. I will update my program and I think it will significantly improve performance if I cut my data in half.
>Yes, this is interesting. I think there is something to learn here. >Your image is a bit hard to see. You might try providing a higher >resolution image. It looks like each of the peaks is actually >multiple peaks. If you consider a central point of this group of >peaks, the spacing appears to be about 58 or so bins. The interesting >part is that the sequence of the peaks in a cluster reverses on each >harmonic. This is exactly the effect you see when a signal is >undersampled and you get aliasing in the spectrum. I'm not saying >that is what you are seeing, but it may have similar causes.
To be honest, I don't know a whole lot about aliasing. After reading your comment, I increased the sampling frequency to 44100Hz and had the same problem. However, you are absolutely right about there being groups of peaks. This was even more evident at the 44100 sampling rate. Does this sound like it could still be aliasing?
>To get a better understanding of what you should expect to see, what >is the sample rate?
12300Hz. I am trying to cover a frequency range of about 25 hz to 500hz
>What is the frequency of the note you used?
I think it was supposed to be around 40Hz
there is a 60 Hz hum. Could that have anything to do with it?
>http://www.studypipe.com/Shared/images/oddpeak.png
uploaded another peak. Basically the same thing but at a bit better resolution http://www.studypipe.com/Shared/images/oddpeak2.png
For anyone wondering, I never did figure out the cause of this but I did
use a work around that solved the issue.  Basically, just took the largest
peak if certain conditions were met.

Am I still interested in the cause if anyone knows but I don't "need" to
know :)
On Feb 22, 12:15&#4294967295;am, "noodle22" <jw970...@yahoo.com> wrote:
> For anyone wondering, I never did figure out the cause of this but I did > use a work around that solved the issue. &#4294967295;Basically, just took the largest > peak if certain conditions were met. > > Am I still interested in the cause if anyone knows but I don't "need" to > know :)
if you want any help from me, you need to be much more explicit mathematically in how you are calculating the points of the plot. just saying that it's the "autocorrelation" ain't good enough. i can think of about 4 or 5 different ways of calculating that. r b-j
>I have been working on a pitch detector (thanks to all who have helped me >along so far) and I have just noticed something when I play a low not on
my
>keyboard. > >http://www.studypipe.com/Shared/images/oddpeak.png > >This looks like I am dealing with the 5th harmonic (4 small peaks and
then
>a big one) but they are not evenly spaced. I did use the "piano" sound >which may have some special features I am not aware of. Any idea why
they
>are not evenly spaced? >
Hi, A piano has multiple strings for one note and they can produce heavy beating. The beating widenes the peaks and could also lead to multiple close-by peaks at the positions of the harmonics. The harmonics of a piano are also a bit stretched out. I doubt that this is an explanation for the picture. Could it maybe be that the autocorrelation is taken around the attack of the sound? The strike of the hammer adds quite a bit of noise and inharmonic components. Bjoern
banton wrote:
>> I have been working on a pitch detector (thanks to all who have helped me >> along so far) and I have just noticed something when I play a low not on > my >> keyboard. >> >> http://www.studypipe.com/Shared/images/oddpeak.png >> >> This looks like I am dealing with the 5th harmonic (4 small peaks and > then >> a big one) but they are not evenly spaced. I did use the "piano" sound >> which may have some special features I am not aware of. Any idea why > they >> are not evenly spaced? >> > > Hi, > A piano has multiple strings for one note and they can produce heavy > beating. > The beating widenes the peaks and could also lead to multiple close-by > peaks at the positions of the harmonics. The harmonics of a piano > are also a bit stretched out. > I doubt that this is an explanation for the picture. > Could it maybe be that the autocorrelation is taken around the > attack of the sound? The strike of the hammer adds quite a bit > of noise and inharmonic components.
The beats occur only if the strings are tuned differently enough. With normal tuning, the common bridge ensures that they vibrate in synchrony. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;