I wrote a "guitar tuner" application that detects which guitar string is
being played, then tells you if it's sharp of flat. I have yet to come
up with the analog interface, but if you feed in nice clean square waves,
it works. I'll send it to anyone who's into it.
My basic approach to counting frequency is to have a nice fast xtal
clock, then have the RTCC prescaled by about 32, 16 at least. During
execution you poll the input pin once every RTCC tick, and count how long
from one low-to-high transition to the next. That's your period. I used
a lookup table to determine the frequency, but you could also do the
math, if you were truly adventurous.
> I wrote a "guitar tuner" application that detects which guitar string is
> being played, then tells you if it's sharp of flat. I have yet to come
> up with the analog interface, but if you feed in nice clean square waves,
> it works. I'll send it to anyone who's into it.
That's sounds pretty cool. I wouldn't mind a copy of it. I was thinking
about something very similar. An interface from guitar to midi. I could
use this as the front end! I'm not sure what the interface would sound
I guess your circuit just picks up the fundamental note. What happens
when you play a chord? It's probably quite hard to pick more than one
note. Hmmm, I guess a fourier transform would have to be involved and
that would probably blow the PIC capacity. Just a thought.
> An interface from guitar to midi. I could
> use this as the front end! I'm not sure what the interface would sound
> I guess your circuit just picks up the fundamental note. What happens
> when you play a chord? It's probably quite hard to pick more than one
> note. Hmmm, I guess a fourier transform would have to be involved and
> that would probably blow the PIC capacity. Just a thought.
Well, how do the existing MIDI guitars work? Do they have 6 channel pickups
or do they just have regular pickups and some heavy-duty DSP? For all I know,
both techniques are in use. Quite possibly others that I haven't thought of,
too. I wouldn't mind having a box to plug my guitar into that picks apart the
analog signal and produces MIDI. That would probably render the volume and
tone controls useless, though.
The square wave approach described in the posting that started this thread
wouldn't work very well for serious music, even if it can be made to handle
chords. There are other parameters such as the envelope which are lost in the
1 bit digitization. But then again, the original application was a tuner, not
The goal of my guitar tuner project was not to be able to detect notes in
a chord or even to be particularly good at following a single melody
line. It was just to be able to identify a nice loud, steady pitch and
tell you if the string is sharp or flat.
So far I've never gotten it to work in practice, but I have a plan for
how to make it work. I tried using an amplifier and schmidt trigger to
eliminate harmonics and give a squared output. This works, but only for
the first second or so after the string is struck. If you look on a
scope when you hit a guitar string, you'll see that the fundamental is
reasonably strong initially, but it is soon eclipsed by harmonics. I
think it's the second harmonic that was the real killer but I can't
remember for sure right now.
Anyway my plan is to detect the frequency the same way I do now, but if I
start seeing that the pitch appears to increase suddenly, I'll just
ignore any transitions that don't arrive near the expected times. This
should have the effect of discarding the harmonics and yielding a longer
useful tuning time.
It would be interesting to also pursue the generation of MIDI from a
guitar signal, though I think many serious applications would require DSP
horsepower. My detector is reasonably fast at identifying the pitch.
I have some code that sends MIDI (a nice little subroutine) if anyone is
Hmm that's two programs I've volunteered to pass around. What's the best
way to do this? I can put them up on my web page, in an ftp directory,
post them to the list, or email them to individuals. How is this best
In message <m0sTjoW-0000mjCKILLspamdc.cis.okstate.edu>, Paul Nolan writes:
>I guess your circuit just picks up the fundamental note. What happens
>when you play a chord? It's probably quite hard to pick more than one
>note. Hmmm, I guess a fourier transform would have to be involved and
>that would probably blow the PIC capacity. Just a thought.
There is a more fundamental problem, here. Whether the frequency
counter is made from a PIC, vacuum-tubes, or mechanical relays salvaged from
old soda machines, it will probably work on the same principle in that
there will be a counting device that is stepped through its count by the
incoming signal until the time base times out and the count on the counting
device is needed. The time base will reset the counter and put the last count
on the display and the count starts all over again until the next reset.
The whole system is based on the idea that the signal is composed of a single
periodic wave form. A chord would produce a more complex series of patterns
that would definitely make the counter count, but the result would be
worthless because the pulses did not arrive in a steady procession.
Imagine an extreme case in which a counter with a 1-second time base
is connected to a signal that consists of 5 pulses of a 1Mhz carrier every
10 seconds. For 9 of 10 seconds, the counter will read 0 because it saw
nothing. During that tenth second, it will see the five pulses and show
5 Hertz because that's what the counter had in it when reset. The output
can't even tell you if those 5 pulses were really 1us apart or 20us.
Maybe the time base caught the counter just as it got a couple of the pulses
such that the display reads two and then three during the next sample. It
might be a bit confusing.
I am sorry to have taken so much band-width, but this has been a very
good discussion that has touched on some fundamental issues which come up
when we want to digitally read signals and try to make sense of them.
Martin McCormick WB5AGZ Stillwater, OK 36.7N97.4W in Tornado Ally
OSU Center for Computing and Information Services Data Communications Group
try Terry Weeder http://www.infinet.com/~dhoehnen/weeder/wtcnt-k.htm, He
has a kit that has all the parts and a really nice pcb board. at $46us it
would be hard to trace down the parts for this project let alone figure out
the neat preamp etc. Mine works great!
I have just finished a 7 digit auto ranging frequency counter
that uses an lcd display
I have use a design from the net published 1994 in popular electronics
by Terry J. Weeder an sold as a kit by him at http://www.weedteck.com
for a very good price.
I did not get the kit (postage to Greece, forget it)
Anyway I have fixed the typo's and ommisions and ported it to a
It looks good and works well
If anyone wants the code let me know
PS: anyone in the US it would be better to get the kit,
the kit price looks cheaper than the sum of all the parts.
email: cousensspam_OUTher.forthnet.gr phone: + 3081 380534
snailmail: Folia, Agia Fotini, Karteros, Heraklion Crete, Greece.
Is it true that they have, on the new version of windows
managed to increase the MTBF from 95 to 98 minutes ?
(That's why they called it 95)
Darren, I use the parallax assembly language and I want something thats
in that language
thank you for all your help. Does ant one out there have such routine
written i parallax assemblers language?
> From: Darren Logan <RemoveMEDAZLOGANTakeThisOuTAOL.COM>
> To: spamBeGonePICLISTspamBeGoneMITVMA.MIT.EDU
> Subject: Re: frequency counter
> Date: Sunday, December 13, 1998 4:00 PM
> Use the PIC BASIC Pro compiler.
> It has a 16-bit COUNT function built in !!!.
> Here's an example of how easy it is to count the number of pulses on a
> over a 100mS period:
> COUNT Pinnumber, Period, IntoVariable
> Or COUNT 0,100,Word
> Easy or what ??
I'm looking for some code that written in parallax language for a freqency
couter using a
PIC16F84. I was told the scott edwards has such code on how to count pulse
increments using parallax asm. Help!
H. Ross wrote:
> Hi, Guys:
> I'm looking for some code that written in parallax language for a freqency
> couter using a
> PIC16F84. I was told the scott edwards has such code on how to count pulse
> in 10us
> increments using parallax asm. Help!
There's a good project, uses a 16F84, that I grabbed a while ago - does
up to 50MHz using the prescaler on the 'F84 (don't see the URL in my
bookmarks here - Folks? Might use a 'C84 also.) I can just e-mail it
to you, if you want, off-list, once I find it; I found another that
uses a 16C54, here in a small file. (I'll have to drop to DOS to find
it, Windows just gets in the way / crashes. Need to run mail stuff,
will be back in 2-3 hours.)
Mitchel - task wrote:
> Please, I need a project Frequency Counter with PIC and low coast.
> Does anybory know where I can find it ?
> Mitchel Monteiro
I do small package shipping for small businesses, world-wide.