Thursday, June 3, 2010

Guitar Tone Circuit Analysis

Introduction
In keeping with my guitar circuit project, I wanted to delve into what the tone circuit actually does.  The results were very surprising to me.  I discovered several things about the tone circuit and its implications to the design of my new active circuit.

Voltage Divider and Resistor/Impedance Combination
Let me make sure we're all on the same page with voltage dividers.  This is a very basic idea for anyone familiar with electronics, but for those who aren't, it isn't very complicated.  Recall the idea of voltage drop, that voltage across a resistor is distributed along its length evenly.  If you tap the resistor at a specific point (which is what a pot does), then you will get the voltage at that point.  What you're actually doing is dividing the resistor into two resistors in series, which is also known as a voltage divider.

This is your standard voltage divider.


The two resistors can be two halves of a pot, two separate resistors, or theoretical equivalents to several resistors combined according to the following techniques.

Series Resistors
Parallel Resistors

OR


Quick definitions:
 Series resistors are connected such that one lead on R1 is connected to one lead on R2 with no other components in between.  (such as those in the voltage divider above)

Parallel resistors are connected such that each lead of R1 is connected to exactly 1 lead of R2 with no other components in between.  (Take out the voltage source in the voltage divider, and the resistors are in parallel.


Finally, recall that impedance is resistance generalized over all frequencies.  Capacitors and inductors have frequency dependant impedance.  Resistors have frequency independant impedance with is equal to their resistance (ideally).  Impedances combine exactly like resistances (series and parallel, that is)



Tone Circuit

Here I will simplify the pickup model to just an ideal voltage source and a series resistance (R int).  The tone circuit is next in line and is parallel to the volume circuit.

As you can see, only two terminals of the tone pot are connected to the circuit.  The third does nothing.  This makes the pot a simple variable resistor.  I will show the effect of the resistor later.


I have said that the capacitor impedance varies with frequency.  The capacitor in my guitar is a 0.22uF.  This is the plot of the magnitude of its impedance vs frequency.  Strictly speaking, impedance has an imaginary component, so I am always graphing magnitude.  But I will just use the term impedance to mean "magnitude of impedance."

So to analyze this circuit intuitively, let's first consider just the tone circuit and the pickup model.  Crank the tone pot all the way down, so now we have just Rint in series with Ctone.  This is a basic low pass filter.  Look at it as a voltage divider.  At low frequencies, the capacitor has a higher impedance, but as you move up the frequency range, the capacitor is a smaller and smaller proportion of the total load.  So the filter passes low frequencies and attenuates high frequencies.

The tone circuit requires pickup resistance

One thing that I didn't realize until doing this analysis is that the tone circuit depends heavily on the resistance of the pickup itself.  The half power frequency or cutoff frequency of the RC filter is


If you replace the pickup with an opamp, as I have done in the Active Circuit described in a previous post, then R=0, and your filter won't work.  The cutoff frequency will be infinity.  Ideally, the whole tone circuit will have no effect on the signal at all!


The Response of the Circuit

I pulled out trusty old Matlab and made a simulation of this circuit.  My measured values on my guitar were as follows.

Rint     = 10.87 KOhms
Ctone  =   0.22 uF
Rtone  = 0 Ohms - 500 KOhms
Rvol     = 0 Ohms - 500 KOhms

The x axis is frequency from 20Hz to 20KHz (the entire audible range).   The y axis is gain.  A gain of 0 indicates no effect on the circuit.  A gain less than zero indicates some attenuation to the volume at that frequency.  The different lines represent different settings on the tone pot (i.e. different values of Rtone).

Short Graph Discussion
For those familiar with the Bode plot of an RC Filter, the bottom line should look familiar.  It rolls off at 20dB per decade from the cutoff frequency of about 66Hz.  (Maybe this is why my tone sounds terrible when turned all the way down).  As we increase the value of Rtone, the frequency response flattens out until there is no attenuation at all to speak of.

If we were to remove the capacitor all together, then the filter would be a simple voltage divider.  So when the capacitor's impedance becomes negligable compared to the impedance of Rtone, then the gain flattens out to approximately what a voltage divider would be.  As Rtone increases, the range of effectiveness of Ctone becomes smaller and smaller until it doesn't really affect the signal at all.

Log vs. Linear Tone Pot
I've heard some debate about log vs linear pots on tone circuits.  Let me show you the difference.  The original plot above is for a log pot.  The steps on Rtone are spaced logarithically from 0 to 500K.  The next plot is for a linear spacing between 0 and 500K.
 

Notice that the available responses are all grouped towards the top.  There are very few response curves that are not practically flat.  There are 50 steps between 0 and 500K in the simulation.  Notice the vast difference between 0 ohms and the first step (10K or 1/50th setting on the pot).  You will be pretty much unable to get any responses between those two, unless you have very very steady hands.  

So I believe this is pretty strong evidence that maximum control over the tone can be had using a logarithmic pot instead of a linear pot. 

The Meaty Part: Analyzing the Effect of Rtone

Here's where things get a little more difficult to explain intuitively.  I worked and worked to get an analytical solution to this circuit.  I probably should not admit that, because it's a very simple circuit.  But part of my problem was that I was convinced that my answer was wrong when it was not.  Let me explain.  The equation for the gain of the circuit is


 Obviously, this is a not very intuitive.  But how about an equation for the cutoff frequency?


Ok, this is a little bit better, but still not great.  I can see that the equation is very similar to the original, except that R is replaced by an uninviting square root.  Wait!  Notice that under the right circumstances, the quantity under the square root is actually negative.  If you're reading this blog, then you probably know that negative square roots will not produce real numbers.

This was the point at which I kept checking and rechecking my work.  But then I realized, that this is exactly what we observe in the response plot above.  After a certain setting on the tone pot, the response never dips below -3 dB.  Just what is this setting?  If we set the quantity under the square root greater than 0, then we get...
Very interesting!  So pretty much all frequency responses of note fall within the range of 0-26KOhms on Rtone.  That's only the first 5.2% of the pot!
To verify this result, I altered the simulation to graph only from 0-30KOhms.  Here is the graph.

Obviously, we've spanned all of the useful range of frequency responses in the first 5.2% of the pot.  But what is the effect on the cutoff frequency?
 
Answer: Pretty dismal.  Yes there is a big peak at about 17KOhms, but if you look at the x axis, the majority occurrs between 15Kohms and 17Kohms.  Other than that, the response is pretty flat.  So we're taking about most of the change in frequency is between 3% and 3.4% of the pot.  Not very practical.

By the way, the reason for the descrepancy between 17KOhms as the cutoff and 26KOhms is because I neglected Rvol in my analytical solution.

Apparently, adjusting Rtone is a crappy way to move the cutoff frequency.  

Load Presented to the Pickup
I also checked the load impedance to the pickup.  As I've shown in a previous post, the values of the pots greatly affect the signal strength and frequency output of the pickups.  So it is of interest to us how adjusting the tone pot will affect the load on the pickups.  Here is the chart.

If you do the math, the parallel combination of the two pots is 250K.  Looking at the plot, the larger Rtone becomes, the more closely the load approaches 250K.  The impedance of the capacitor was shown early in this post.  So basically, low tone pot settings will cause a double whammy effect on cutting the highs.  Since I didn't model the pickup with any inductance, this is not shown in the simulation, but you can combine the earlier article on pot resistances with this one to see that the effect will be heightened.  Both the low impedance load and the low pass filter will tend to cut the highs out of the signal. 


Conclusion
That was a lot of information about the tone circuit in a guitar.  Here's the source code for my simulation...
% tone control simulation % 0.022 uF capacitor Ctone = 0.22e-6; % 500 Kohms Tone Pot Rtone = 500e3; % 500 Kohms Volume Pot Rvol = 500e3; % pickup resistance 10.87 Kohms Rpickup = 10.87e3; %actual guitar value %Rpickup = 10; %opamp output impedance worst case %Rpickup = 100e3; %for more cutoff frequency change % steps on the tone resistor %toneres = logspace(0, log10(Rtone)); %toneres = linspace(0, Rtone, 50); %toneres = logspace(1,log10(30e3)); toneres = linspace(0,30e3,50); % steps in frequency %freq = [ 20:10:20000]; freq = logspace(log10(20), log10(20e3), 100); ZCtone = repmat( (-j./(2*pi*Ctone.*freq)) , size(toneres,2),1); Ztone = repmat(toneres',1,size(ZCtone,2)) + ZCtone; Zeq = Ztone .* (Rvol*ones(size(Ztone))) ./ (Ztone + Rvol*ones(size(Ztone))); gain = abs(Zeq ./ ( Zeq + Rpickup*ones(size(Zeq))))'; fc = 1./(2*pi*Ctone*sqrt(Rpickup^2*ones(size(toneres)) + Rpickup*toneres - toneres.^2)); % look at the capacitor impedance figure(1); semilogx(freq,abs(ZCtone)/1000); xlabel('Frequency (Hz)'); ylabel('Magnitude of Capactior Impedance (KOhms)'); % total magnitude of load presented to pickup figure(2); semilogx(freq,abs(Zeq)/1000); xlabel('Frequency (Hz)'); ylabel('Magnitude of Load Impedance (kOhms)'); % plot gain of circuit figure(3); semilogx(freq,20*log10(gain)); xlabel('Frequency (Hz)'); ylabel('Gain (dB)'); % plot fc of circuit figure(4); plot(toneres/1000,real(fc)); xlabel('Rtone (KOhms)'); ylabel('Cutoff Frequency (Hz)'); I hope that this has been enlightening to you. It certainly was for me. Basically tone control circuits are pretty crappy. I have done some research into better circuits, especially active ones. You can directly adjust the cutoff frequency using Sallen-Key filters by adjusting the two resistors and keeping the capacitors constant. This is a good thing, since variable capacitors are not very practical for guitar circuits. I will post more on this topic when I have come to some more conclusions. As always, thanks for reading. Bill

16 comments:

  1. Your very first equation is wrong. VOut-VIn when R1=0 and VOut=0 when R2=0. Didn't read the rest.

    ReplyDelete
  2. Your following "tone circuit" has a resistor in series after the signal so that, even at full volume, the signal is attenuated. Bad design and not what is found in the vast majority of electric guitar circuits.

    ReplyDelete
    Replies
    1. this emulates de serial internal resistance of the coils, typical 10k to 13K ohm

      Delete
  3. The first anonymous comment is correct. I did have a typo in that equation. I'm in the process of fixing it now. I wish he'd read the rest, ha ha. Anybody can make a typo.

    ReplyDelete
  4. @Anonymous and @JK,

    Rint is the internal resistance of the pickup. This is on the order of 10K on my pickups. Of course, a real pickup will have more complicated behavior, but I doubt that it's really relevant to this level of analysis.

    Jk, I see you already knew that.

    ReplyDelete
  5. Not To Bad . Still I have a BETTER ONE watch me.

    ReplyDelete
  6. I was hoping to gain some insight to the tone circuit by reviewing your work. However, I have found that at least one of your results is incorrect. Since (in the "Meaty Part") you have given a gain and frequency equation without reference, I had to assume they are correct, but I am not so sure of that. You state that the if the tone resistance is greater than 26.242Kohm, the radical quantity in the frequency equation is negative and hence causes the filter to provide no additional attenuation. If you plug 26.242Kohm into the radical equation, it IS a negative result. The value to make this radical quantity positive is ~17.587Kohm. I don't know how you obtained your value of 26.242Kohm. While I do not consider your work to be complete, I think there may be some useful ideas here. I wish your conclusion was a bit more comprehensive.

    ReplyDelete
    Replies
    1. I know it's been a while since this comment, but I just happened to read over them. Obviously, I haven't been posting on the blog for a while...

      In answer to the questions raised: I did use wxMaxima to compute the gain and cutoff frequency equations. At least, I just verified those equations with wxMaxima. I really can't remember what I did originally, but I doubt that I did them by hand. The analytical solution is the gain for the tone filter and internal pickup resistance alone. The output voltage is what is passed on to the volume pot. Using standard AC circuit analysis yields two equations (one for Vin and one for Vout) which I divided. Then I take the magnitude of the resulting complex gain. The cutoff frequency is found by setting that gain magnitude equal to -3 dB and solving for frequency. wxMaxima is the tool I use for complex manipulations that I probably couldn't complete by hand without mistakes.

      I don't agree about the tone resistance. If sufficient precision is used, the result is indeed zero. Recall that the slope of the curve is very large at the zero crossing, so precision matters. Not sure about the 17.587 KOhm number. I just checked my math several times. Technically the result would round to 26.243 KOhm, but you need a lot more precision than that to verify the zero result. I've always tended to truncate decimals rather than round them, a bad habit I developed at a very young age.

      Delete
  7. I have tested it in Pspice, in my opinion works fine, better with the level potenciometer about 80 - 90% up, I have used linear potenciometer for the filter, and the progression is not very linear, maybe´d be better with logaritmic potenciometer

    ReplyDelete
  8. This comment has been removed by a blog administrator.

    ReplyDelete
  9. One thing you are missing is the coil inductance of the pickup. When the tone pot is rolled off the capacitor and the coil inductance form a resonant circuit, creating a mid boost.

    Your gain equation would be neater if you gave in and set w = 2 pi f (Let it go!)

    I also find it useful to think of the circuit as a high-pass connected in parallel, providing a short circuit path to ground for high-frequency content. This series-parallel construction can be extended into what's called a ladder circuit for more complex filters.

    Very nice article!

    ReplyDelete
  10. Most guitar tone circuits use a 0.022uF cap with 500k pots, not 0.22uF ...

    ReplyDelete
    Replies
    1. This is inconsistent in the post and makes me question the results. The text says 0.22uF, the comment in the code says 0.022uF, and the variable is initialized to 0.22e-6

      Delete
  11. This short article posted only at the web site is truly good.

    ReplyDelete
  12. Your blog is so interesting and very informative,the quality of information you used in this is excellent. Thanks for posting this.
    get more: Circuit Analysis


    ReplyDelete