DSPRelated.com
Forums

Finding the main frequency of an input audio signal

Started by Unknown August 29, 2007
If it is known harmonic signal model, using a parametric method like
MUSIC for spectral estimation should work best.  But it would be
tougher to implement. Use google for "MUSIC spectral estimation"

Regards
Piyush

On Aug 30, 6:29 am, wi...@yahoo.com wrote:
> Thanks everyone for answering. > > @Richard Owlett> What is YOUR definition of "best/easiest"? > > Can be implemented (including understanding why the implementation > works like that - just the main concepts) in day or two. > > > Why does FFT confuse you? > > Misunderstanding: I am confused which option to use. There are many - > which is best/easiest in the previous sense? > > > How do you define "simple"? > > That you don't actually need to know how it works to understand the > main concepts behind it. This is a little vague. > > > You are *ALMOST* asking the "RIGHT" questions. > > :) > > > This answer is *NOT* a put down. !!!! > > Got that. Thanks. > > > I'm a fellow newbie who has learned that asking RIGHT question is > 1/2 > > the battle. > > I agree. > > @glen>I think first you have to define "main frequency". > >... > >Maybe you just want the frequency with the most power, though. > > The last one would suffice. > > @r b-j> but if the OP wants to know the fundamental frequency of a reasonably > > harmonic musical note, the thing he/she wants is called a "pitch > detector". > < > This seems interesting. Do you have any pointers where I can learn > this from (i.e. something you consider a good thing for a start)?
@VLV
Are you trying to sell something? I am trying to learn something.

@all others
Thanks to all of you. I will take a look at these, hopefully I will
find something that is not so hard to implement. I don't really
require it to work very precisely (it's not a neurosurgery type of
thing). Consider, for example, recording some audio which contains
very simple single frequency sounds (besides all the noise) - like
playing, one at a time, notes on a piano or recording car honking (one
car) or baby alarm buzzers or such. I just need to determine their
frequencies - quite simple requirements. I am not at all into DSP yet
(I don't even know if I will ever be), that's why all these options
seem all good and all bad at the same time - I just don't understand
why some is better then the others, takes some experience for that.

<wimxa@yahoo.com> wrote in message
news:1188478089.466491.118320@r34g2000hsd.googlegroups.com...
> @VLV > Are you trying to sell something?
If you want a solution that works good...
> I am trying to learn something.
No, you don't: "but I wouldn't like to spend more then a day or two learning the maths and so" Judjung on your extremely naive questions, you will have to spend another year or two.
> thing). Consider, for example, recording some audio which contains > very simple single frequency sounds (besides all the noise) - like > playing, one at a time, notes on a piano or recording car honking (one > car) or baby alarm buzzers or such. I just need to determine their > frequencies - quite simple requirements.
What is the purpose of that?
> I am not at all into DSP yet > (I don't even know if I will ever be), that's why all these options > seem all good and all bad at the same time - I just don't understand > why some is better then the others, takes some experience for that.
It depends. Better for what? VLV
 Consider, for example, recording some audio which contains
> very simple single frequency sounds (besides all the noise) - like > playing, one at a time, notes on a piano or recording car honking (one > car) ....
Actually many car horns are 2 tones... Mark
On Aug 29, 10:32 pm, "Vladimir Vassilevsky"
<antispam_bo...@hotmail.com> wrote:
> "robert bristow-johnson" <r...@audioimagination.com> wrote in message > > news:1188434404.548513.153610@r34g2000hsd.googlegroups.com... > > > On Aug 29, 8:24 pm, glen herrmannsfeldt <g...@ugcs.caltech.edu> wrote: > > > wi...@yahoo.com wrote: > > but if the OP wants to know the fundamental frequency of a reasonably > > harmonic musical note, the thing he/she wants is called a "pitch > > detector". > > Pitch detector! Magic word! You said it! > Topes! Topezz! Where is Topezzz?
you mean D'mitry? i think it's Terez.
On Aug 30, 6:09 am, "Vladimir Vassilevsky"
<antispam_bo...@hotmail.com> wrote:
> <wi...@yahoo.com> wrote in message > > news:1188478089.466491.118320@r34g2000hsd.googlegroups.com... > > > @VLV > > Are you trying to sell something? > > If you want a solution that works good...
The OP did not say that a professional or academic research grade (or homework grade :) solution was required. He hasn't defined his measure of "goodness" yet, and it might be surprisingly different from your more professionally oriented definition.
> > I am trying to learn something. > > No, you don't: > > "but I wouldn't like to spend more then a day or two learning > the maths and so" > > Judjung on your extremely naive questions, you will have to > spend another year or two.
I seem to remember visiting a science museum as a grade school child. They had a oscilloscope hooked up to an audio frequency generator (or two?). One could eyeball relative frequencies by holding a tape-measure up to the display. IMHO. YMMV. -- rhn A.T nicholson d.0.t C-o-M
On Aug 30, 3:21 am, Rob <robert.bie...@xponaut.se> wrote:
> On Aug 30, 3:29 am, wi...@yahoo.com wrote: > > > @r b-j > > > but if the OP wants to know the fundamental frequency of a reasonably > > > harmonic musical note, the thing he/she wants is called a "pitch > > > detector". > > > > This seems interesting. Do you have any pointers where I can learn > > this from (i.e. something you consider a good thing for a start)? > > Check for: Autocorrelation, AMDF (average mean difference function),
i think it's "magnitude" instead of "mean".
> Peak picking in the FFT is good.
unless there is no energy at the fundamental (but there is for other odd harmonics).
> Wavelets should work to (but I > have no idea how because I consider them too abstract, but that's just > me) > > All of these alas do require some checking of the math, but more > importantly (several years ago when I asked > the group almost the same question, and r b-j said I asked the right > questions :)
all of life's anwers are questions. r b-j
On Aug 30, 5:48 am, wi...@yahoo.com wrote:
> @VLV > Are you trying to sell something? I am trying to learn something. > > @all others > Thanks to all of you. I will take a look at these, hopefully I will > find something that is not so hard to implement. I don't really > require it to work very precisely (it's not a neurosurgery type of > thing). Consider, for example, recording some audio which contains > very simple single frequency sounds (besides all the noise) - like > playing, one at a time, notes on a piano or recording car honking (one > car) or baby alarm buzzers or such.
Alas, you picked some sounds that are not at all simple, nor single frequency, even though you might think they are. The notes a piano makes can be far more spectrally complicated, than, say, a tuning fork or flute. Same with may car horns and buzzers. Might want to start out by looking at these sound waveforms on a 'scope, or spectrum analyzer. IMHO. YMMV. -- rhn A.T nicholson d.0.t C-o-M
@VLV
> If you want a solution that works good...
< How do you define "good"?
> No, you don't:
"but I wouldn't like to spend more then a day or two learning the maths and so" Judjung on your extremely naive questions, you will have to spend another year or two. < How do you know what I mean by "something"? Maybe "something" is much different then your presumption that I want to learn something from your field of specialization. Obviously, you are wrong. Not everything I learn must be related to deep math. If I could, I would like to compare this to the very same computers we use to write these posts. Many people have absolutely no idea how 99% of them work, what they contain, how they are built, etc. However, almost everybody can run programs. My questions are in this range. I don't know 99% of DSP-related stuff. I can learn some little piece to solve my problem, but that doesn't have to include solving differential equations. I want to learn how to use, not how to build. I want to learn why this is better then the other one. I want to learn how much time I need to implement something. To answer all questions I posted, somebody skillful might need no more then 30 minutes. That is what I needed. Some people gave some good things to search for and quickly analyze. Anyway, don't take this personally, but I think your attitude of "You are stupid, I know everything and can sell you the right solution" is a little off. Thanks for the offer, I will choose not to have you help me. @Mark
>Actually many car horns are 2 tones...
< Didn't know that... Well, disregard this in that case - or record only one-tone horns :) Or bikes? @Ron N.
>The OP did not say that a professional or academic research
grade (or homework grade :) solution was required. He hasn't defined his measure of "goodness" yet, and it might be surprisingly different from your more professionally oriented definition. < Correct. In fact, I think it's obvious that I want almost completely the opposite - a simple solution with just the quality I need...
>I seem to remember visiting a science museum as a grade
school child. They had a oscilloscope hooked up to an audio frequency generator (or two?). One could eyeball relative frequencies by holding a tape-measure up to the display. < :)))
>Alas, you picked some sounds that are not at all
simple, nor single frequency, even though you might think they are. The notes a piano makes can be far more spectrally complicated, than, say, a tuning fork or flute. Same with may car horns and buzzers. Might want to start out by looking at these sound waveforms on a 'scope, or spectrum analyzer. < Yes. To correct myself - by "single frequency" I meant "single strong frequency". Maybe I am still wrong, but I think most of these have a very strong frequency which I called "main frequency" in my previous posts, while the other frequencies are much weaker. Although I know they cannot be left aside, the other frequencies have the strength that can be distinguished from the stronger main frequency. Is this correct? If it is not, how often do you encounter these cases in real life? If it's < 5% of time, it's OK for me to just disregard them. All of you guys, thanks a lot for a discussion. At the end, I found one relatively simple FFT-based way to do it. Although I didn't implement the solution, I think this will work fine. Here is the link to the explanation: http://local.wasp.uwa.edu.au/~pbourke/other/dft/. This is a good, layman's explanation I needed. I might need something more, but this is a good start.
On Aug 30, 8:45 pm, wi...@yahoo.com wrote:
> >Alas, you picked some sounds that are not at all > simple, nor single frequency, even though you might > think they are. The notes a piano makes can be far > more spectrally complicated, than, say, a tuning > fork or flute. Same with may car horns and buzzers. > > Might want to start out by looking at these sound > waveforms on a 'scope, or spectrum analyzer. > < > Yes. To correct myself - by "single frequency" I meant "single strong > frequency". Maybe I am still wrong, but I think most of these have a > very strong frequency which I called "main frequency" in my previous > posts, while the other frequencies are much weaker. Although I know > they cannot be left aside, the other frequencies have the strength > that can be distinguished from the stronger main frequency. Is this > correct? If it is not, how often do you encounter these cases in real > life? If it's < 5% of time, it's OK for me to just disregard them.
For the low third or so of a piano keyboard, the "stronger main frequency" is different from the note of the piano key more often than 5% of the time, at least with my cheap piano and when using a built-in laptop mic. Of course, YMMV. -- http://www.nicholson.com/rhn/dsp.html