Searching \ for '[EE] Detecting frequency from a single audio sourc' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: piclist.org/techref/io/audio.htm?key=audio
Search entire site for: 'Detecting frequency from a single audio sourc'.

Exact match. Not showing close matches.
PICList Thread
'[EE] Detecting frequency from a single audio sourc'
2012\04\07@082251 by V G

picon face
Hi all,

What algorithms/filters/whatever would I start looking into to use a
microcontroller/FPGA/digital ICs/analog components to detect the frequency
of a single audio source such a as an electric guitar input? I don't really
even need the actual frequency number, I just somehow need to convert the
input wave into a square wave/pulse that can be used to pulse an LED, for
example.

I used my oscilloscope to look at the signal generated by the guitar, and
it's pretty clean, but it:

1. doesn't look exactly like a sin wave
2. decreases in amplitude over time (and becomes almost exactly like a
sawtooth wave at low amplitudes)

How would I go about extracting the frequency out of this, or getting a
clean pulse corresponding to the frequency (like a square wave, or
whatever)

2012\04\07@153502 by Yigit Turgut

picon face
Use DFT or Wavelet Transform, signal doesn't have to be clean/ideal. I
did it in VHDL, don't know about PIC implementation, -maybe- dsPIC.

On Sat, Apr 7, 2012 at 3:21 PM, V G <spam_OUTx.solarwind.xTakeThisOuTspamgmail.com> wrote:
{Quote hidden}

>

2012\04\07@160039 by John Ferrell

face
flavicon
face
Could it be as simple as amplifying into cut off with a transistor or op amp? That should give you a square wave...
watch out for ringing though...
On 4/7/2012 8:21 AM, V G wrote:
> Hi all,
>
> What algorithms/filters/whatever would I start looking into to use a
> microcontroller/FPGA/digital ICs/analog components to detect the frequency
> of a single audio source such a as an electric guitar input? I don't really
> even need the actual frequency number, I just somehow need to convert the
> input wave into a square wave/pulse that can be used to pulse an LED, for
> example.
>
> I used my oscilloscope to look at the signal generated by the guitar, and
> it's pretty clean, but it:
>
> 1. doesn't look exactly like a sin wave
> 2. decreases in amplitude over time (and becomes almost exactly like a
> sawtooth wave at low amplitudes)
>
> How would I go about extracting the frequency out of this, or getting a
> clean pulse corresponding to the frequency (like a square wave, or
> whatever)?

-- John Ferrell W8CCW
“During times of universal deceit,
  Telling the TRUTH becomes a revolutionary act”
     George Orwell

2012\04\07@193648 by Sergey Dryga

flavicon
face
V G <x.solarwind.x <at> gmail.com> writes:

> How would I go about extracting the frequency out of this, or getting a
> clean pulse corresponding to the frequency (like a square wave, or
> whatever)?
>
Getting a clean pulse: use comparator, it will give you a clean digital signal.
It's possible to use a comparator in a PIC and do processing using the same PIC.
Extracting frequency is more problematic, but can be done in e.g. dsPIC, as
others suggested.  If you need to detect a specific frequency, LM565
phase-locked loop is good for audio frequencies.  
Sergey Dryga
http://beaglerobotics.com


2012\04\08@103241 by V G

picon face
On Sat, Apr 7, 2012 at 3:35 PM, Yigit Turgut <.....y.turgutKILLspamspam@spam@gmail.com> wrote:

> Use DFT or Wavelet Transform, signal doesn't have to be clean/ideal. I
> did it in VHDL, don't know about PIC implementation, -maybe- dsPIC.
>

DFT on a PIC32 would be amazing. I think that's the way to go.

I'm going to look at the principles behind "wavelet transform". Never heard
of this before

2012\04\08@103820 by V G
picon face
On Sat, Apr 7, 2012 at 7:36 PM, Sergey Dryga <sergeyspamKILLspamdryga.us> wrote:

>  Getting a clean pulse: use comparator, it will give you a clean digital
> signal.
> It's possible to use a comparator in a PIC and do processing using the
> same PIC.
>
> Extracting frequency is more problematic, but can be done in e.g. dsPIC, as
> others suggested.  If you need to detect a specific frequency, LM565
> phase-locked loop is good for audio frequencies.
>


I was thinking about the comparator, but since the amplitude of the signal
gradually falls over a period of a few seconds, how would I constantly
follow and update the cutoff

2012\04\08@125841 by Matt Bennett

flavicon
face
On Sun, April 8, 2012 9:38 am, V G wrote:
> On Sat, Apr 7, 2012 at 7:36 PM, Sergey Dryga <.....sergeyKILLspamspam.....dryga.us> wrote:
>
>>  Getting a clean pulse: use comparator, it will give you a clean digital
>> signal.
>> It's possible to use a comparator in a PIC and do processing using the
>> same PIC.
>>
>> Extracting frequency is more problematic, but can be done in e.g. dsPIC,
>> as
>> others suggested.  If you need to detect a specific frequency, LM565
>> phase-locked loop is good for audio frequencies.
>>
>
>
> I was thinking about the comparator, but since the amplitude of the signal
> gradually falls over a period of a few seconds, how would I constantly
> follow and update the cutoff?

If you want to do it computationally, look at the Goertzel algorithm. It
is, in essence, a single point DFT (discrete Fourier transform). For only
doing a few bins (frequency points), it can take a less cycles than a full
DFT/FFT.

Regards,

Matt

Matt Bennett
Just outside of Austin, TX
30.51,-97.91

The views I express are my own, not that of my employer, a large
multinational corporation that you are familiar with

2012\04\08@130532 by alan.b.pearce

face picon face
> > Extracting frequency is more problematic, but can be done in e.g.
> > dsPIC, as others suggested.  If you need to detect a specific
> > frequency, LM565 phase-locked loop is good for audio frequencies.
> >
>
>
> I was thinking about the comparator, but since the amplitude of the
> signal gradually falls over a period of a few seconds, how would I
> constantly follow and update the cutoff?

This is where using a dsPic instead of a PIC32 would make sense. Microchip has an AGC library that would maintain the level AIUI in a similar manner to some of the fuzz boxes.
-- Scanned by iCritical.

2012\04\09@010515 by Sergey Dryga

flavicon
face
V G <x.solarwind.x <at> gmail.com> writes:

>
> On Sat, Apr 7, 2012 at 7:36 PM, Sergey Dryga <sergey <at> dryga.us> wrote:
>
> >  Getting a clean pulse: use comparator, it will give you a clean digital
> > signal.
> > It's possible to use a comparator in a PIC and do processing using the
> > same PIC.
> >
> > Extracting frequency is more problematic, but can be done in e.g. dsPIC, as
> > others suggested.  If you need to detect a specific frequency, LM565
> > phase-locked loop is good for audio frequencies.
> >
>
> I was thinking about the comparator, but since the amplitude of the signal
> gradually falls over a period of a few seconds, how would I constantly
> follow and update the cutoff?
>
Set the trigger level at some low value which you would still consider to be a
signal.  Anything above that level will produce "1", below - "0".  This way you
eliminate the problem of decay in the amplitude.  For an AC-coupled signal
(through a capacitor) the level can be 1/2 V+.  Essentially, this will be a
zero-crossing detector.  If the noice is too high, increase the trigger level
just above the noise.
Sergey Dryga
http://beaglerobotics.com

2012\04\09@070722 by V G

picon face
On Mon, Apr 9, 2012 at 1:04 AM, Sergey Dryga <EraseMEsergeyspam_OUTspamTakeThisOuTdryga.us> wrote:

>  Set the trigger level at some low value which you would still consider
> to be a
> signal.  Anything above that level will produce "1", below - "0".  This
> way you
> eliminate the problem of decay in the amplitude.  For an AC-coupled signal
> (through a capacitor) the level can be 1/2 V+.  Essentially, this will be a
> zero-crossing detector.  If the noice is too high, increase the trigger
> level
> just above the noise.
>

I thought about this too, but the signal is not a clean sin wave. It's
unpredictable and has lots of different signals mixed in, so a fluctuation
mid-period from a wave other than the fundamental frequency can cause a
false trigger.

If I had my camera with me, I'd take a picture of the oscilloscope

2012\04\09@094819 by jim

flavicon
face

You could use an op amp and run it open loop.  Anything greater than
the offset voltage will cause it to switch.

Regards,

Jim

> ---{Original Message removed}

2012\04\09@110631 by Bob Blick

face
flavicon
face
I just did a design that used a Maxim part:

http://www.maxim-ic.com/datasheet/index.mvp/id/5822

It uses a threshold that is a proportion of the output of a peak
detector.

Neat idea, this part makes it easy. MAX9924.

Bob

On Mon, Apr 9, 2012, at 07:07 AM, V G wrote:
{Quote hidden}

> -

2012\04\09@115442 by Herbert Graf

picon face
On Sat, 2012-04-07 at 08:21 -0400, V G wrote:
> Hi all,
>
> What algorithms/filters/whatever would I start looking into to use a
> microcontroller/FPGA/digital ICs/analog components to detect the frequency
> of a single audio source such a as an electric guitar input? I don't really
> even need the actual frequency number, I just somehow need to convert the
> input wave into a square wave/pulse that can be used to pulse an LED, for
> example.
>
> I used my oscilloscope to look at the signal generated by the guitar, and
> it's pretty clean, but it:
>
> 1. doesn't look exactly like a sin wave
> 2. decreases in amplitude over time (and becomes almost exactly like a
> sawtooth wave at low amplitudes)
>
> How would I go about extracting the frequency out of this, or getting a
> clean pulse corresponding to the frequency (like a square wave, or
> whatever)?

Do a transform in to the frequency space (DFT or others depending on
what hardware you've got) and usually just select the biggest peak.

You might have program a little more intelligence then that if you the
guitar is being put through distortion stuff, but I doubt it.

If you're update rate is low (say 5Hz) you have lots of options.

TTYL

2012\04\09@124530 by V G

picon face
On Mon, Apr 9, 2012 at 11:54 AM, Herbert Graf <@spam@hkgrafKILLspamspamgmail.com> wrote:

>  Do a transform in to the frequency space (DFT or others depending on
> what hardware you've got) and usually just select the biggest peak.
>
> You might have program a little more intelligence then that if you the
> guitar is being put through distortion stuff, but I doubt it.
>
> If you're update rate is low (say 5Hz) you have lots of options.
>

I'm leaning towards this option the most. It feels the most logical. I'll
probably use a dsPIC or a PIC32 depending on which chip can give me the
most DSP performance.

5Hz seems like a very reasonable update frequency, I'll probably go with
10Hz or so. What do you mean by "lots of options"?

Around what update frequency should I expect if I use a modern dsPIC or a
PIC32 at full speed

2012\04\09@172520 by Robin Bussell

flavicon
face
I seem to recall you have an iPhone, check out the free app "n-track tuner" which does a real time fft and displays the spectrum along with the detected note. It will give you some good insight into what you'll have to deal with in the way of strong overtones on a guitar signal.

Cheers,
       Robin.

On 9 Apr 2012, at 17:53, "V G" <KILLspamx.solarwind.xKILLspamspamgmail.com> wrote:

{Quote hidden}

> -

2012\04\09@192813 by V G

picon face
On Mon, Apr 9, 2012 at 5:12 PM, Robin Bussell <spamBeGoneRobinBspamBeGonespamexcelerate.info>wrote:

> I seem to recall you have an iPhone, check out the free app "n-track
> tuner" which does a real time fft and displays the spectrum along with the
> detected note. It will give you some good insight into what you'll have to
> deal with in the way of strong overtones on a guitar signal.
>

Thanks for the tip. I also tried TrueRTA software on my computer on a
signal directly from my electric guitar. The amplitudes of the harmonics
are significant, and sometimes higher(?) than the fundamental frequency.
That's okay. I'll just isolate the lowest frequency peak on the spectral
analysis, since that will be the fundamental frequency

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