Searching \ for '[EE] Fundamental frequency from a whistle' in subject line. ()
Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=fundamental+frequency
Search entire site for: 'Fundamental frequency from a whistle'.

Exact match. Not showing close matches.
'[EE] Fundamental frequency from a whistle'
2005\04\04@090745 by

Hello all
How can I extract a fundamental frequency from a complex wave, like a whistle? I
know that use FFT is a solution, but there something more simple that could be
implemented using a microcontroller and/or analog IC's? If I put a low-pass filter, and
transform the resultant wave in a quadratic wave, in a form that I could count the pulses,
would work?

Thanks a lot,

Dagmar
Many years ago I made a device where you could sing a note into a microphone
or play an instrument and it would get the fundamental frequency by running
the signal through a zero crossing detector.  From there I had a 5V square
wave of the fundamental frequency.  It worked very well.  I would imagine
you could do a search on projects such as a guitar tuner and find some ideas
on this as well.

I was able to put that through a frequency to voltage converter and then to
an A/D converter and finally output to a midi port.  This was done back in
the 1980s on a Commodore 64 so I could sing or play an instrument into the
device and send out the appropriate midi data to have a midi module play the
same note.  It was wierd to hum into a microphone and have a trumpet sound
come out.
Good luck,
FJ

On Mon, 2005-04-04 at 10:08 -0300, dagmarcnrc.unesp.br wrote:
>        Hello all
>        How can I extract a fundamental frequency from a complex wave, like a whistle? I
> know that use FFT is a solution, but there something more simple that could be
> implemented using a microcontroller and/or analog IC's? If I put a low-pass filter, and
> transform the resultant wave in a quadratic wave, in a form that I could count the pulses,
> would work?

You mention something simpler, but if you want to go simpler just
because you don't think you can do FFT on a micro-controller have a look
at the dsPIC. It can easily do the FFT you need (there are even
libraries from MChip that are plug and play), and the dsPIC makes a very
good micro-controller as well. TTYL

-----------------------------
Herbert's PIC Stuff:
http://repatch.dyndns.org:8383/pic_stuff/

It sounds like a great project, very interesting. I will try your sugestions, thanks!

On 4 Apr 2005 at 8:48, fred jones wrote:

{Quote hidden}

> --
Herbert Graf wrote:
> You mention something simpler, but if you want to go simpler just
> because you don't think you can do FFT on a micro-controller have a look
> at the dsPIC. It can easily do the FFT you need (there are even
> libraries from MChip that are plug and play), and the dsPIC makes a very
> good micro-controller as well.

While a dsPIC may be able to do a FFT on the fly, maybe even at the required
frequency resolution, it seems like swatting a fly with a sledgehammer.

The ease of doing this depends on the harmonic content.  With no harmonics
you just look a the zero crossings and you're done.  My strategy would be to
attenuate harmonics to the point where there are no extra zero crossings.
The more is known up front about the signal, the easier this will be.

*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com
On Apr 4, 2005 9:43 AM, Herbert Graf <mailinglist2farcite.net> wrote:
> On Mon, 2005-04-04 at 10:08 -0300, dagmarcnrc.unesp.br wrote:
> >       Hello all
> >       How can I extract a fundamental frequency from a complex wave, like a whistle? I
> > know that use FFT is a solution, but there something more simple that could be
> > implemented using a microcontroller and/or analog IC's? If I put a low-pass filter, and
> > transform the resultant wave in a quadratic wave, in a form that I could count the pulses,
> > would work?
>
> You mention something simpler, but if you want to go simpler just
> because you don't think you can do FFT on a micro-controller have a look
> at the dsPIC. It can easily do the FFT you need (there are even
> libraries from MChip that are plug and play), and the dsPIC makes a very
> good micro-controller as well. TTYL

I've recently, but briefly, looked into this sort of thing.  I found
that the DSP term is "frequency estimation," if anyone wants to go
that route.  "Frequency detection" is, apparently, what you use if you

> While a dsPIC may be able to do a FFT on the fly, maybe even at the
> required
> frequency resolution, it seems like swatting a fly with a
> sledgehammer.

My brief investigations of this sort of thing some years ago suggest
it is a coconut sized problem if the tone generator is not able to be
well constrained. Depends on what "a whistle" is. If he means a person
whistling then an FFT may be an entry level solution. Even an eg steam
whistle or similar would be exceptionally hard to handle. A referees
whistle with a 'pea" therein could be expected to be challenging. A
fixed orifice and air chamber whistle (ala wood wind instruments -
flute/piccolo/ ..., tin whistle etc) may be OK if the operator is
aware of the instruments needs. It's very easy for the user to add
"extras" to such instruments. An automatic air driven whistle may be
OK.

Phase lock loop and similar solutions DO work for eg guitar or piano
tuners - but the waveform is liable to be cleaner.

RM

Russell McMahon wrote:
> My brief investigations of this sort of thing some years ago suggest
> it is a coconut sized problem if the tone generator is not able to be
> well constrained. Depends on what "a whistle" is. If he means a person
> whistling then an FFT may be an entry level solution. Even an eg steam
> whistle or similar would be exceptionally hard to handle. A referees
> whistle with a 'pea" therein could be expected to be challenging. A
> fixed orifice and air chamber whistle (ala wood wind instruments -
> flute/piccolo/ ..., tin whistle etc) may be OK if the operator is
> aware of the instruments needs. It's very easy for the user to add
> "extras" to such instruments. An automatic air driven whistle may be
> OK.

I once did a repetitive noise cancellation project.  The was caused by a fan
that could be lots of different things in the field.  The rotation speed and
number of blades were not known ahead of time.  The fundamental could
therefore vary over about a 5:1 range if I remember right.  In some of the
recordings I got, the second harmonic was about as strong as the first.

I did this by applying several low pass filters with a rolloff frequency at
the lowest expected fundamental.  This would attenuate all harmonics
relative to the fundamental, eventually leaving a signal clean enough so
that there were only two zero crossings per fundamental cycle.  This low
pass filtering also reduced the fundamental by an unknown amount since it
could vary widely in frequency.  To compensate I added a little gain between
some of the filters.  However, since I only needed zero crossings in the
end, the output signal only needed to be strong enough so that quantization
noise didn't hide the zero crossings.

The frequency was calculated from the zero crossings, and a fairly high Q
filter was placed to let thru just that frequency.  This produced nearly a
sine wave, which was used as the master clock for the remaining algorithm.

Since the phase of the input noise signal was now known for each input
sample, a table was kept of the input noise signal.  Each entry in the table
was a low pass filter, so that the table would be just the repetive recent
noise signal.  The table would contain the complete repetitive noise, not
the low pass filtered version used to determine its frequency.  This was
subtracted from the input signal to yield the noise-reduced signal.

This worked quite nicely, with noise reductions of about 12dB being typical.
With a computer generated noise the reduction was much higher, but in the
real world the fan noise wasn't perfectly repetative.

*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com
The application that I have in mind is to estimate the frequency of a human
whistle, or even a human voice vocalizing a tone. I would make a microcontrolled
(PIC16F628) circuit that would be able to reproduce a simple sequencing of notes
whistleds by a human, like a "electronic whistler parrot", heheheh :) Seems to me that's far
more simple than voice recognition. I think that searching for a electronic tuner circuit, like
a guitar tuner, will bring me an answer (or clues...)

On 5 Apr 2005 at 4:17, Russell McMahon wrote:

{Quote hidden}

> --
Aren't these very common circuits for MIDI instruments?  For example a MIDI guitar will convert the pitch (and ADSR) to a MIDI signal, which would allow you to play anything from a flute sound to a gong on the guitar.

{Original Message removed}
>         The application that I have in mind is to estimate the frequency of a human
> whistle, or even a human voice vocalizing a tone. I would make a microcontrolled
> (PIC16F628) circuit that would be able to reproduce a simple sequencing of notes
> whistleds by a human, like a "electronic whistler parrot", heheheh :) Seems to me that's far
> more simple than voice recognition. I think that searching for a electronic tuner circuit, like
> a guitar tuner, will bring me an answer (or clues...)

In which case, FFT isn't bad.  I wrote a very simple FFT program for
SciLab a few years back which accepted a .wav as the input, and
the difference for the peak frequency of a human (me) whistling
was easily detectable.

If you can use a DSPic, and have access to an easy to a library with
FFT so you don't have to write a lot of gory code yourself, it may be
the easiest way to go.

Mike H.

On Mon, 4 Apr 2005 dagmarcnrc.unesp.br wrote:

>        Hello all
>        How can I extract a fundamental frequency from a complex wave,
> like a whistle? I know that use FFT is a solution, but there something
> more simple that could be implemented using a microcontroller and/or
> analog IC's? If I put a low-pass filter, and transform the resultant
> wave in a quadratic wave, in a form that I could count the pulses,
> would work?

Use a pll. The pll should lock on the highest component frequency. Its
output will be a single tone which you can measure easily with the
micro. Note that most whistles make a lot of harmonics, not necessarily
weaker than the fundamental. If you mean a human whistle, then it is
easier.

Peter
dagmarcn@rc.unesp.br wrote:

>
>        How can I extract a fundamental frequency from a complex wave, like a whistle? I
>know that use FFT is a solution, but there something more simple that could be
>implemented using a microcontroller and/or analog IC's? If I put a low-pass filter, and
>transform the resultant wave in a quadratic wave, in a form that I could count the pulses,
>would work?
>
>
>
Before electronics it was done by Helmholtz resonators:
physics.kenyon.edu/EarlyApparatus/Rudolf_Koenig_Apparatus/Helmholtz_Resonator/Helmholtz_Resonator.html
> The application that I have in mind is to estimate the frequency of
> a human
> whistle, or even a human voice vocalizing a tone. I would make a
> microcontrolled
> (PIC16F628) circuit that would be able to reproduce a simple
> sequencing of notes
> whistleds by a human, like a "electronic whistler parrot", heheheh
> :) Seems to me that's far
> more simple than voice recognition. I think that searching for a
> electronic tuner circuit, like
> a guitar tuner, will bring me an answer (or clues...)

Why not find a guitar etc tuner and try whistling to it and see what
it does?

FFT is not really very hard once you have enough crunching power - you
just plug the data into the black box and it spits out more data.  It
would make the task far easier, but even then be tricky due to
'windowing". have fun.

Gives me butterflies just thinking about it.
(When you understand that joke you know you're making FFT progress).

RM

Lindy Mayfield wrote:
> Aren't these very common circuits for MIDI instruments?  For example a MIDI guitar will convert the pitch (and ADSR) to a MIDI signal, which would allow you to play anything from a flute sound to a gong on the guitar.

MIDI systems for guitars generally use 6 piezo pickups, one for each
string. That way you get one very strong frequency with few harmonics.

--
Martin K
http://wwia.org/sgroup/biofuel/
Though not a human whistle, I understand that the whistle that came with
Captain Crunch cereal was 2600 Hz.

Harold

--
FCC Rules Updated Daily at http://www.hallikainen.com
I recommend that you play with algorithms on a PC in C before trying to
write the PIC code. You can record a WAV file with similar sample
rate/resolution to what you will use on the PIC. You can then play with the
samples in the WAV file to your hearts content. For example: you can run an
FFT to get the frequency distribution, so that you will know when your
algorithm is working.

Bob Ammerman
RAm Systems

{Original Message removed}
There is a company called Precision Time that uses a whistle to start and
stop the play clock in college and pro basketball.
These remote beltpacks are worn by the refs and when they blow their FOX 40
whistle, it will stop the clock. A push button on the beltpack remotely
starts the clock.

The beltpacks have a mic that is mounted in a clip on the lanyard next to
the whistle. In talking with the company the FOX 40 was the best to get a
consistant sound (freq). Whistles with a pea inside cannot be used.

Hope this helps give some direction.

Bill N8HKI

{Original Message removed}
> Though not a human whistle, I understand that the whistle that came
> with
> Captain Crunch cereal was 2600 Hz.

Top posting is a pain to follow, BUT

Nullo posting is utterly unfathomable.
One has to regenerate the question from no information.
Could we please have at least a hint of what's being replied to in
responses?

RM

I've just tried whistle to a guitar tuner and yes, it shows me if I'm whistling in the
right tone. :) So, seems that the guitar tuner circuit works. I wonder if it uses FFT, I don't
think so. I've simulated some zero-crossing circuits in Circuit Maker, using as input the
sum of three sine-wave generators with differents frequencys and amplitudes to give me a
complex wave, but the virtual osciloscope shows in the output of circuit (using op-amp) a
"deformed" sine-wave and not a fair pulse train as I hope. Someone have a link with a
suggestion for a good zero-crossing detector circuit, that works with small signals (from
electrect microphone amplified by a op-amp)? I think that's seems a good solution, if I
could count the pulses spited out from the ZC circuit.

Thanks,

Dagmar

On 5 Apr 2005 at 10:28, Russell McMahon wrote:

{Quote hidden}

> --
At 07:12 PM 4/5/05 +1200, you wrote:
>>Though not a human whistle, I understand that the whistle that came with
>>Captain Crunch cereal was 2600 Hz.
>
>
>Top posting is a pain to follow, BUT
>
>Nullo posting is utterly unfathomable.
>One has to regenerate the question from no information.
>Could we please have at least a hint of what's being replied to in responses?
>
>    RM

Actually that is the most efficient for me.  But I can "grab" all
same-titled messages into a thread and read them together.  Then I usually

As I recall, the whistle was more like 2000 Hz.  The pitch could be raised
by heating it and squeezing the tube a bit.

Does that help?  I didn't think so :-)

Barry

Dagmar Carnier Neto wrote:

> I've simulated some zero-crossing circuits in Circuit Maker, using as
> input the sum of three sine-wave generators with differents frequencys
> and amplitudes to give me a complex wave, but the virtual osciloscope
> shows in the output of circuit (using op-amp) a "deformed" sine-wave and
> not a fair pulse train as I hope. Someone have a link with a suggestion
> for a good zero-crossing detector circuit, that works with small signals
> (from electrect microphone amplified by a op-amp)?

After properly amplifying the input signal, run it through a Schmitt
trigger (comparator). For such a simple circuit you don't have to use a
bipolar supply, so you probably won't. Which means that you may amplify
your input signal and shift it so that 0 input is at, say, 2.5V. Then you
put your comparator threshold at 2.5V.

I have no links, but National Semiconductors (and other op amp
manufacturers) have quite a number of application notes that show audio
amplifiers, filters and Schmitt trigger/comparator circuits.

Gerhard
Would you mind giving me a hint of what or where to look to understand how to shift the input as you mention below?

Kind regards,
Lindy

>
> After properly amplifying the input signal, run it through a Schmitt
> trigger (comparator). For such a simple circuit you don't have to use a
> bipolar supply, so you probably won't. Which means that you may amplify
> your input signal and shift it so that 0 input is at, say, 2.5V. Then you
> put your comparator threshold at 2.5V.

part 1 465 bytes content-type:text/plain; (decoded 7bit)

> Would you mind giving me a hint of what or where to look to
> understand how to shift the input as you mention below?
>
> Kind regards,
> Lindy

See the thread "[EE] TL081 on Gnd/+9V, PIC on Gnd/+5V ?" in
the middle of February 05 for how this works and how to choose
an opamp for it

===============================================
If you aren't part of the solution, you're part of the precipitate

part 2 1280 bytes content-type:image/gif; (decode)

part 3 35 bytes content-type:text/plain; charset="us-ascii"
(decoded 7bit)

I've been studying this all day. (It was a slow day in mainframe land.)

By Schmitt trigger do you mean one that was built using an op-amp and not an IC?  I got stuck because I was looking at Schmitt-Trigger IC datasheets (like a monkey with a math puzzle) and all I could see was A1 in and Y1 out and no way so adjust the trigger value.  Is this correct?

{Original Message removed}
> By Schmitt trigger do you mean one that was built using an op-amp
> and not an IC?  I got stuck because I was looking at Schmitt-Trigger
> IC datasheets (like a monkey with a math puzzle) and all I could see
> was A1 in and Y1 out and no way so adjust the trigger value.  Is this
> correct?

You can make an ST, eg with a couple of transistors, that has a movable
trigger voltage. ST ICs (4093, 74xx14, PIC i/ps etc) are made with fixed
thresholds. A comparator or op-amp with high gain should be OK as an
ST in an analogue application

Jinx wrote:

>> By Schmitt trigger do you mean one that was built using an op-amp
>> and not an IC?  I got stuck because I was looking at Schmitt-Trigger
>> IC datasheets (like a monkey with a math puzzle) and all I could see
>> was A1 in and Y1 out and no way so adjust the trigger value.  Is this
>> correct?
>
> You can make an ST, eg with a couple of transistors, that has a movable
> trigger voltage. ST ICs (4093, 74xx14, PIC i/ps etc) are made with fixed
> thresholds. A comparator or op-amp with high gain should be OK as an
> ST in an analogue application

I meant a ST made with an op amp and positive feedback. National has a few
app notes with 100s of op amp circuits, and you find them in there. These
have the advantage over logic ST inputs that you can control both the
threshold and the hysteresis. This is desirable in most analog
applications. And by selecting the op amp (and the circuit and the other
components) properly, you can also control the precision of threshold and
hysteresis -- again something that isn't really possible with digital ST
inputs.

Vcc
|
|
R1     input signal---- inv in opamp
|                                 opamp out--+--- ST output
+--------------------- noninv in opamp       |
|                                            |
|                                            |
+-------------------------R2-----------------+
|
R3
|
Gnd

That's the basic opamp ST circuit. R1 and R3 determine the threshold, and
R2 (together with R1 and R3) determine the hysteresis.

Gerhard
Now I understand better, thanks.

You probably know all this stuff cold, but for me I found this link that figures out the trigger voltages based on the resistor and Vref values.

http://hyperphysics.phy-astr.gsu.edu/hbase/electronic/schmitt.html#c2

> {Original Message removed}
Lindy Mayfield wrote:

> Now I understand better, thanks.
>
> You probably know all this stuff cold, but for me I found this link that
> figures out the trigger voltages based on the resistor and Vref values.
>
> http://hyperphysics.phy-astr.gsu.edu/hbase/electronic/schmitt.html#c2

That's a nice page. Usually though you would resolve the formulas in

http://hyperphysics.phy-astr.gsu.edu/hbase/electronic/schmitt.html#c3

so that you can plug in your required voltages and calculate the resistors
from them.

(This of course leaves you with two equations for three resistors, which
means that you have one degree of freedom, which is basically a multiplier
for all resistors.)

Gerhard

More... (looser matching)
- Last day of these posts
- In 2005 , 2006 only
- Today
- New search...