Searching \ for '[PIC]: Guitar input' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ios.htm?key=input
Search entire site for: 'Guitar input'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Guitar input'
2002\06\09@032038 by Dale Botkin

flavicon
face
Hi,

Well, my youngest just bought himself a bass guitar.  Anyway, along with
the amp we're building I thought I'd toss in a tuning indicator.  Found a
nice example of one done with an Atmel part, code in C, so I'm most of the
way there.  The only gotcha seems to be the PIC listening to the bass
pickups.  Input is via a series .02uF cap to the base of a 2N2222a, 330K
resistor to Vcc, 56K resistor to ground, PIC input is from the collector
with a 4.7K pullup, emitter to ground.  It does what it's supposed to
(amplify).  I get a nice pulse to ground at the primary frequency of the
string...  but I'm also getting what looks like some harmonics (or maybe
just noise) that are apparently getting amped enough to trigger the PIC
input (Schmitt trigger, A0 on a 12CE674).  Result is that the PIC almost
always says the string freq. is too high, even when it's ridiculously low.
Tried a few different resistor values on the base of the transistor, but
no improvement.

Well, blast it, I just broke a string playing with it...  Obviously
there's a better way to handle picking up the base frequency of the
string...  anyone got a bright idea that doesn't involve op amps and a
hundred components?

Dale
(yes, I **KNOW** I can buy a tuner for $12.  So?)
--
"Curiosity is the very basis of education and if you tell me that
curiosity killed the cat, I say only the cat died nobly."
         - Arnold Edinborough

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spam_OUTlistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body


2002\06\09@052109 by Jinx

face picon face
> Well, blast it, I just broke a string playing with it...  Obviously
> there's a better way to handle picking up the base frequency
> of the string...  anyone got a bright idea that doesn't involve
> op amps and a hundred components?

My God, man of steel. I've NEVER managed to break a bass
guitar string

Looking at my bass on the scope the fundamental is very
strong when the string is first struck, and then deteriorates
into harmonics as the volume dies down. In the past I've
tried sub-harmonic generators (using a 4024, wow, talk
about rumble you can feel) and synth  inputs with varying
degrees of success, principally due to the very poor "A2D"
conversion of string to electronic. Some fuzz boxes will
square up a guitar signal, especially the crude ones that
are basically diode-clippers, perhaps in conjunction with a
noise gate or constant volume amp (simple op amp designs,
I know I know, but you could do it with transistors/FETs)
you could get better results. The easy answer I think would
be to keep striking the string to keep it putting out the fundamental

One possible alternative is a device called an E-bow,

http://www.ebow.com/

which is an electromagnetic thing that causes the string to vibrate.
I haven't tried one on a bass but they work very well on 6-strings,
been around for years

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam@spam@mitvma.mit.edu with SET PICList DIGEST in the body


2002\06\09@075153 by Dave Tweed

face
flavicon
face
Dale --

> Input is via a series .02uF cap to the base of a 2N2222a, 330K resistor
> to Vcc, 56K resistor to ground, PIC input is from the collector with a
> 4.7K pullup, emitter to ground.  It does what it's supposed to
> (amplify). I get a nice pulse to ground at the primary frequency of the
> string...  but I'm also getting what looks like some harmonics (or maybe
> just noise) that are apparently getting amped enough to trigger the PIC
> input (Schmitt trigger, A0 on a 12CE674).

The input cap, along with the input resistance of the amplifier (bias
network in parallel with the transistor itself), is creating a high-pass
filter with a cutoff of a few hundred Hz, so you're already emphasizing
harmonics over the fundamental. First step would be to increase this
cap to to 0.1 uF or even 0.47 uF. It might also help to raise the input
impedance of the amplifier by putting about 100 ohms or so in series with
the emitter, although this will reduce the gain somewhat.

Another thing to try would be to add some higher-frequency rolloff to help
kill off harmonics and noise. This could be done by adding either a
capacitor from the collector to ground (about 0.15 uF for a cutoff
frequency of 225 Hz) or a capacitor from the collector to the base
(negative feedback - about 0.02 uF would do it here).

Hope this gets you going.

-- Dave Tweed

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservspamKILLspammitvma.mit.edu with SET PICList DIGEST in the body


2002\06\09@082745 by Russell McMahon

face
flavicon
face
> Well, blast it, I just broke a string playing with it...  Obviously
> there's a better way to handle picking up the base frequency of the
> string...  anyone got a bright idea that doesn't involve op amps and a
> hundred components?

Your existing design is high pass in characteristic. The component values
give about a 1 kHz knee BUT the transistor input impedance is uncertain with
no emitter resistor and bypass and is probably rather low so true high pass
point is probably even higher. Try a MUCH larger input capacitor for
starters (say 10 to 100 uF).

A low pass filter with reasonable cutoff and Q MAY help.
You can achieve low pass filters with two poles per stage using a single
transistor as an emitter follower per stage. Component count is 3 Rs and 2
Cs per stage (2 x RC plus an R for emitter resistor). You could get two pole
slow pass by adding a few Rs and Cs to your exiting input stage and 4 poles
with another transistor.

I could provide component values for say 2 and 4 poles of low pass if you
are interested.



           Russell McMahon

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam.....mitvma.mit.edu with SET PICList DIGEST in the body


2002\06\09@082914 by Olin Lathrop

face picon face
> Well, my youngest just bought himself a bass guitar.  Anyway, along with
> the amp we're building I thought I'd toss in a tuning indicator.  Found a
> nice example of one done with an Atmel part, code in C, so I'm most of the
> way there.  The only gotcha seems to be the PIC listening to the bass
> pickups.  Input is via a series .02uF cap to the base of a 2N2222a, 330K
> resistor to Vcc, 56K resistor to ground, PIC input is from the collector
> with a 4.7K pullup, emitter to ground.  It does what it's supposed to
> (amplify).  I get a nice pulse to ground at the primary frequency of the
> string...  but I'm also getting what looks like some harmonics (or maybe
> just noise) that are apparently getting amped enough to trigger the PIC
> input (Schmitt trigger, A0 on a 12CE674).  Result is that the PIC almost
> always says the string freq. is too high, even when it's ridiculously low.
> Tried a few different resistor values on the base of the transistor, but
> no improvement.

It would help to look at the pickup output on a scope before designing the
circuit to receive it.  I'm not familiar with guitar pickups so I have no
idea what level this signal is.  I always assumed it was a low level signal
like a microphone, but that wouldn't get thru the circuit you described.
Apparently a full signal is a volt or two peak to peak, probably from an
amplifier built into the guitar somewhere.

In any case, you want to find the fundamemtal frequency of an audio signal.
This signal can be up to a volt or two in amplitude and may contain
significant harmonics.  You do not just want to detect zero crossings,
because the harmonics can create extra zero crossings causing exactly the
symptom you describe.  What is the frequency range of the fundamental
signals you want to measure?  The first thing to do is to put one or two
poles of low pass filtering starting at the highest fundamental frequency
you want to measure.  That should sufficiently attenuate the higher
harmonics.  Such a low pass filter can be made from two resistors and two
capacitors.  If the desired frequency range is large, then the low harmonics
of the lowest tones will still be within the pass range.  I would start by
putting one more low pass filter pole (one more R and C) with a rolloff a
bit below the lowest frequency of interest.  That guarantees that another
6dB attenuation of all first harmonics with respect to their fundamentals.
That may be enough to detect the fudamental by using a bit of hysterisis
(like a schmitt trigger, but I would use an opamp to get more control of the
exact levels).  The limiting factor will be the amplitude of the highest
frequency of interest coming out of the filter.  Adjust the hysterisis
levels for 1/4 and 3/4 of the peak to peak of this signal and hope that the
harmonics don't get thru for the low tones.

This is a simple approach that has a chance of being good enough.  There are
more fancy ways of doing this that are more robust, but I would start with
this and see what it gets you.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email EraseMElistservspam_OUTspamTakeThisOuTmitvma.mit.edu with SET PICList DIGEST in the body


2002\06\09@091534 by Jinx

face picon face
Dale, these are the correct frequencies for a bass guitar,
if it helps any

http://www.contrabass.com/pages/frequency.html

E = 41.20Hz, A = 55.00, D = 73.42, G = 98.00

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservspamspam_OUTmitvma.mit.edu with SET PICList DIGEST in the body


2002\06\09@103715 by rusque (listas)

face
flavicon
face
Hello Dale,

> the amp we're building I thought I'd toss in a tuning indicator.  Found a
> nice example of one done with an Atmel part, code in C, so I'm most of the
> way there.  The only gotcha seems to be the PIC listening to the bass

   where did you find this example?

   I think it would be hard to make it without an active filter. Depending
on the instrument, you could have a lot of harmonics. A third harmonic 10dB
above the fundamental isn't very uncommon. This is one of the reasons older
tuners have a "string select" slider. If the tuner "knows" the expected
frequency, it could tune a very sharp lowpass filter just above the string
frequency.

   I think most of the modern digital tuners use some smart DSP algorithm
to detect the fundamental with a FFT and then implement a very steep filter
to get the exact frequency.

   EPE "PIC A Tuner" project could be found at
http://homepages.nildram.co.uk/~starbug/files/tuner.zip. I have the artiche
scanned if you want.

   Both Matthias Wientapper and David Thomas have published their tuners on
the net, but I can't find it anymore. The links are all broken.

   What you will see is that this projects have filters to atenuate the
harmonics. I think with bass it will be even more complex to develop a
suitable filter.

   Good luck,

   Brusque

-----------------------------------------------------------------
Edson Brusque                 C.I.Tronics Lighting Designers Ltda
Researcher and Developer               Blumenau  -  SC  -  Brazil
Say NO to HTML mail                          http://www.citronics.com.br
-----------------------------------------------------------------

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email @spam@listservKILLspamspammitvma.mit.edu with SET PICList DIGEST in the body


2002\06\09@113810 by Dale Botkin

flavicon
face
On Sun, 9 Jun 2002, Olin Lathrop wrote:

> > Well, my youngest just bought himself a bass guitar.
8< snip...

> It would help to look at the pickup output on a scope before designing the
> circuit to receive it.  I'm not familiar with guitar pickups so I have no
> idea what level this signal is.  I always assumed it was a low level signal
> like a microphone, but that wouldn't get thru the circuit you described.
> Apparently a full signal is a volt or two peak to peak, probably from an
> amplifier built into the guitar somewhere.

No amp in the guitar, just the mag pickups.  The signal when the string is
first plucked is surprisingly strong, up to a couple Volts with no load.
Needless to say it varies a LOT.

> In any case, you want to find the fundamemtal frequency of an audio signal.
> This signal can be up to a volt or two in amplitude and may contain
> significant harmonics.  You do not just want to detect zero crossings,
> because the harmonics can create extra zero crossings causing exactly the
> symptom you describe.  What is the frequency range of the fundamental
> signals you want to measure?

Well, it's a 4-string bass, so they range from 41 to 98 Hz.

> This is a simple approach that has a chance of being good enough.  There are
> more fancy ways of doing this that are more robust, but I would start with
> this and see what it gets you.

Thanks, that pretty much agrees with the other responses I've seen.  I'll
hack around a bit to try to add some LP filtering to the input, and maybe
integrate some of the other suggestions as well.  I am mostly a digital
guy with just enough RF knowledge to keep me out of trouble, but I very
seldom do anything with audio, so I'm partly lost in this area.  Learning
quickly, though.

Dale

PS - Of course I'll be posting complete code & schematics once I get this
working perfectly...

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email KILLspamlistservKILLspamspammitvma.mit.edu with SET PICList DIGEST in the body


2002\06\09@114418 by Dale Botkin

flavicon
face
On Sun, 9 Jun 2002, Jinx wrote:

> > Well, blast it, I just broke a string playing with it...  Obviously
> > there's a better way to handle picking up the base frequency
> > of the string...  anyone got a bright idea that doesn't involve
> > op amps and a hundred components?
>
> My God, man of steel. I've NEVER managed to break a bass
> guitar string

Heh... this makes two.  The kid broke that monster of an E string within a
few hours trying to tune it, and the D string popped last night as I was
tuning it up with the organ-that-thinks-it's-a-piano.  I suspect this
particular bass saw quite a bit of demo traffic in the shop.  Of course I
know absolutely *nothing* about musical instruments, which doesn't help.
But then I didn't know a thing about women when I got married, either...
hope the learning curve isn't as tough.

> you could get better results. The easy answer I think would
> be to keep striking the string to keep it putting out the fundamental

That actually seemed to kind of work, but it was very inconsistent.

I'll keep hacking at it... two more strings to go!  <grin>

Dale

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body


2002\06\09@114841 by Dale Botkin

flavicon
face
On Sun, 9 Jun 2002, Dave Tweed wrote:

> > Input is via a series .02uF cap to the base of a 2N2222a, 330K resistor
> > to Vcc, 56K resistor to ground, PIC input is from the collector with a
> > 4.7K pullup, emitter to ground.  It does what it's supposed to
> > (amplify). I get a nice pulse to ground at the primary frequency of the
> > string...  but I'm also getting what looks like some harmonics (or maybe
> > just noise) that are apparently getting amped enough to trigger the PIC
> > input (Schmitt trigger, A0 on a 12CE674).
>
> The input cap, along with the input resistance of the amplifier (bias
> network in parallel with the transistor itself), is creating a high-pass
> filter with a cutoff of a few hundred Hz, so you're already emphasizing
> harmonics over the fundamental.

As others have also noted.  I just followed the original design to the
extent possible...  except looking at it again, I think I misplaced a
decimal point.  The original used a 100nF cap, I tried 10 and 20.  Duh.

{Quote hidden}

I'll try that, thanks.

Dale

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spamBeGonelistservspamBeGonespammitvma.mit.edu with SET PICList DIGEST in the body


2002\06\09@115045 by Dale Botkin

flavicon
face
Got 'em, thanks.

Dale
--
"Curiosity is the very basis of education and if you tell me that
curiosity killed the cat, I say only the cat died nobly."
         - Arnold Edinborough

> Dale, these are the correct frequencies for a bass guitar,
> if it helps any

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email TakeThisOuTlistservEraseMEspamspam_OUTmitvma.mit.edu with SET PICList DIGEST in the body


2002\06\09@115510 by Dale Botkin

flavicon
face
On Sun, 9 Jun 2002, Edson Brusque (listas) wrote:

> > the amp we're building I thought I'd toss in a tuning indicator.  Found a
> > nice example of one done with an Atmel part, code in C, so I'm most of the
> > way there.  The only gotcha seems to be the PIC listening to the bass
>
>     where did you find this example?

http://www.myplace.nu/avr/gtuner/

>     What you will see is that this projects have filters to atenuate the
> harmonics. I think with bass it will be even more complex to develop a
> suitable filter.

That's what I'll be trying today...

Dale

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistservspamTakeThisOuTmitvma.mit.edu with SET PICList DIGEST in the body


2002\06\09@130036 by Dave Dilatush

picon face
part 1 561 bytes content-type:text/plain; charset=us-ascii (decoded 7bit)

Dale wrote...

>Obviously
>there's a better way to handle picking up the base frequency of the
>string...  anyone got a bright idea that doesn't involve op amps and a
>hundred components?

What's the matter with opamps?  They're handy.  They WORK.  :)

Whatever.  Attached is a 3-pole lowpass active filter using about
a dozen components that might do the trick.  It's flat out to
about a hundred hertz and drops off to about -50db at a
kilohertz.  That oughtta kill your harmonics.

Hope this helps...

Dave D.



part 2 2263 bytes content-type:image/gif; name=filter.gif (decode)


part 3 136 bytes
--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservEraseMEspam.....mitvma.mit.edu with SET PICList DIGEST in the body


2002\06\09@131445 by Dale Botkin

flavicon
face
> What's the matter with opamps?  They're handy.  They WORK.  :)

Yeah, but I don't have but one or two around, and I'm sure they're not the
ones everyone will recommend.  I almost never use 'em for anything, I very
rarely do analog stuff, and every project I look at that uses them specifies
different parts, hence I don't keep any around.

> Whatever.  Attached is a 3-pole lowpass active filter using about
> a dozen components that might do the trick.  It's flat out to
> about a hundred hertz and drops off to about -50db at a
> kilohertz.  That oughtta kill your harmonics.
>
> Hope this helps...

It all helps.  I'll be trying several things today, will publish the end
result.

Thanks!

Dale

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email EraseMElistservspammitvma.mit.edu with SET PICList DIGEST in the body


2002\06\10@065335 by Russell McMahon

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

> Attached is a 3-pole lowpass active filter using about
> a dozen components that might do the trick.  It's flat out to
> about a hundred hertz and drops off to about -50db at a
> kilohertz.  That oughtta kill your harmonics.

I offered to supply values and circuits for simple 2 and 4 pole low pass
filters but Dave has got on with the job and actually done it. His design is
a single stage 3 pole circuit (1 more RC input pair) which is the most you
can reasonably stretch out of 1 transistor.

Adding another stage like this one on the end with adjusted component values
& without R1 & R2 equivalents would give you up to 6 poles which is far more
than needed here. 3 as given here is probably ample. I haven't checked
Dave's component values but I assume this is a 3 pole Butterworth which has
a reasonably smooth response curve (could be several other things instead).

My main reason for posting (apart from commenting on Dave's commendable
promptness :-) ) is to note that you can move the frequency within reason by
scaling components. You don't touch C1, R1, R2, R6.

By increasing C2, C3, C4 in the same proportion you decrease the cutoff
frequency proportionately.
By increasing R3, R4, R5 you do the same thing.
Alter them the other way and the frequency increases.
Do both together for greater effect. egg if increasing C's by 10 times and
R's by 2 x the net frequency would drop by 2 x 10 = 20 times.

You can't do this indefinitely without problems but it will work a decade or
maybe two either way.

R6 should be small compared to the impedance of C3 at the frequencies of
interest.
R1 in parallel with R2 should be large compared to R3.
C1 impedance should be low compared to R1.

DC output voltage is ABOUT R2/(R1+R2) x Vcc - 0.6 volt.



       RM


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


part 3 105 bytes
--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestEraseMEspamEraseMEmitvma.mit.edu


2002\06\10@120740 by Peter L. Peres

picon face
On Sun, 9 Jun 2002, Olin Lathrop wrote:

>It would help to look at the pickup output on a scope before designing the
>circuit to receive it.  I'm not familiar with guitar pickups so I have no
>idea what level this signal is.  I always assumed it was a low level signal
>like a microphone, but that wouldn't get thru the circuit you described.
>Apparently a full signal is a volt or two peak to peak, probably from an
>amplifier built into the guitar somewhere.

No, from a steel string vibrating with up to 1cm peak amplitude across the
gap of a strong electrodynamic transducer with 5000+ turns of wire and a
strong magnet ;-) Normally the coil is hardly damped and plays a big role
in the produced sound.

There is no amplifier in normal electric guitars, unless it's an effect
amp. Some have a transformer to make 600 Ohms output suitable for stage
use and some tone controls.

Looking at a scope will not help much, you need a DSO to make sense of
what is going on. A PC sound card based one will do for start. The string
has a ADSR behavior when plucked. The R part is what you need when
measuring frequency, up to a point. The spectrum changes with amplitude as
Jinx has said. This is due to the higher Q of higher resonance modes.
Also spiraled bass strings induce deliberate harmonics when plucked hard
(adjacent spiral coils touch at high amplitudes). The guitar signal is
very complex and very hard to imitate right. The 'fundamental' to be tuned
is the strongest amplitude signal in the beginning of the R phase, but
after the initial plucking sound has died down.

Dale, maybe you should look into using a PLL to lock onto the highest
available amplitude. A CMOS4047 comes to mind. It will lock onto signals
of 100mV or more without trouble and spans the frequency range you need.
This and a 3-6dB low pass (your current transistor stage modified and a
3dB RC lowpass) should do it imho.

Peter

--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestspam_OUTspamKILLspammitvma.mit.edu


2002\06\10@131713 by Peter L. Peres

picon face
Use a lowpass filter with -6dB/octave or so. You will NOT get rid of the
string plucking sound like this. You need to remove it in software. Delay
the freq. measurement start a fixed time (or periods) after the signal
starts.

Remember that saying about nothing meing so simple when you look at it
from close enough ? <g>. I'm having a great deal of fun with rotary
encoders (cheap ones) along these lines now.

good luck,

Peter

--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestTakeThisOuTspamspammitvma.mit.edu


2002\06\10@171932 by Dave Dilatush

picon face
Russell wrote...

>His design is
>a single stage 3 pole circuit (1 more RC input pair) which is the most you
>can reasonably stretch out of 1 transistor.

Yes, mainly because that emitter follower has somewhat less than
unity gain, as well as a non-zero output impedance.  Using an
opamp, or an NPN/PNP boosted follower, getting five poles is
pretty easy provided you can accept a slightly "non-classical"
response.

>I haven't checked
>Dave's component values but I assume this is a 3 pole Butterworth which has
>a reasonably smooth response curve (could be several other things instead).

I synthesized that filter the easy way: I let Microchip's
FilterLab program design it for me.  The response is more or less
a Butterworth.

{Quote hidden}

One thing to bear in mind when changing the resistors in that
filter circuit is their effect on the transistor bias; R1 or R2
might require tweaking to bring the output quiescent voltage back
to Vcc/2 (if that's important; it might not be).

DD

--
http://www.piclist.com hint: To leave the PICList
EraseMEpiclist-unsubscribe-requestspamspamspamBeGonemitvma.mit.edu


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