Vox/Crybaby Wah Transfer Function

Started by Transmogrifox, May 19, 2018, 02:14:08 AM

Previous topic - Next topic

Transmogrifox

I have seen this asked for from time to time, but have yet to see anybody actually produce a transfer function for the classic inductor wah.  As far as I can find searching the interwebs I have only found qualitative analysis or quackery.

Here is one simplified rendering of it:

More complete computation sheet:
http://cackleberrypines.net/transmogrifox/src/bela/Inductor_Wah_Octave_Matlab_Files/InductorWah.pdf
Done with Smath Studio.  For those familiar, here is the file:
http://cackleberrypines.net/transmogrifox/src/bela/Inductor_Wah_Octave_Matlab_Files/Inductor_Wah.sm
Ri = input resistor, typically 68k
Ci = input capacitor, typically 10nf
Rs = resistor from first BJT base to LRC tank, typically 1.5k
Rp = resistor parallel to inductor, typically 33k
Cf = feedback capacitor, typically 10nF
g = gpot = pot position, 0...1
gf = voltage gain on transistor gain stage, typically 20 to 35.

The main thing I had wanted to get to, which we can now see plainly, is to see "Cf" multiplied directly by a factor controlled by the pot "g". 

This serves as a mathematical confirmation of something RG posted in "The Technology of Wah Pedals" about the secret of the capacitor:
http://www.geofex.com/Article_Folders/wahpedl/wahped.htm#secretcap


Here's how a plot of the transfer function overlays a simulation of the full circuit once "gf" is twiddled correctly.  This serves as a baseline for errors due to simplifications made in synthesizing the transfer function.





trans·mog·ri·fy
tr.v. trans·mog·ri·fied, trans·mog·ri·fy·ing, trans·mog·ri·fies To change into a different shape or form, especially one that is fantastic or bizarre.

Transmogrifox

I let this fall off my TODO list, but here is the scan from my notebook:
https://github.com/transmogrifox/Hardware/blob/master/Wah_Analysis/Wah_Analysis.pdf

I was planning to do a more tidy web page with the derivation, but never got around to it.  The notebook pages do what I wanted to document into a nicer web page, but anybody who is interested in that level of analysis can follow the notebook easily enough.

One may notice the notebook final transfer function is slightly different from what is posted in the initial post.  The initial post ignores the 3rd-order term and adds it back in as a first-order filter cascaded with the input.

The notebook derivation includes the 3rd-order effect and it looks a little different.  In the end it is apparent the first-order high-pass cascaded with the 2nd-order filter is a reasonably good approximation.  Anybody interested can plot the 2 transfer functions over one another.

The second-order effect, I think, is the part that explains how a wah workds. The 3rd order effect (input cap) is often one of the tweaks by wah-modders.

The fourth order effect of the low-frequency bypass cap with the inductor is sometimes tweaked, and I have not taken this into consideration.

It is unlikely the AC bypass caps (5th and 6th order) around the pot have any audible effect on the sound of the wah.

I think 3rd order is enough to inform modders about what does "waht".   ;D
trans·mog·ri·fy
tr.v. trans·mog·ri·fied, trans·mog·ri·fy·ing, trans·mog·ri·fies To change into a different shape or form, especially one that is fantastic or bizarre.

Eb7+9

#2
Quote from: Transmogrifox on November 21, 2018, 06:52:12 PM
... cascaded with the 2nd-order filter is a reasonably good approximation

unfortunately, some players are looking for an audibly good approximation ...

if it looks sorta good in graphical form, but we know that WAH pedal afficionado's are willing to look at every last component in the original circuit for a possible tweak to improve the audible side of things (hello Dave Weyer) - one must choose which is the real goal here

I will not argue with you that you've isolated the primary (two) poles that move in relation to the WAH pot
but I will say that on your way to your so-called 5th and 6th WAH pot cap poles you missed the one that will make your curves line up perfectly - ie., without that little gap on the side

yes, it will sound close, ... but include the pole that isn't included in your linearization (as almost everyone else seems to do as well) and - holy chmoly - you're now bang on

simply, you throw one of the babies out with your bath-water assumptions

run the Kushner-Plunkett circuit, ignoring the WAH pot caps, through a symbolic circuit editor and you get an (very likely) un-factorizable 4th order function ...

make those/your assumptions, and - yes - you can re-write as an (albeit somewhat) approximative factorization ...

doesn't mean the real circuit's transfer function is factorizable per se,

while I have not proved it for myself, I'm not saying that it isn't factorizable either
I'm only suggesting that it isn't by looking at the whole thing
don't make me post it ...

;)

in your KP wah there is no way to re-introduce this terms unfortunately - not that I can see anyway
but in some of the other emulation attempts it's an easier fix

otoh, your assumption of input impedance (as you list at the very end)
is where there are issues with your approach, and same with these other
attempts that I described in another post

a good analysis of the WAH circuit should take into account what happens when a guitar pickup
is directly connected at the input, and not thru a buffer which cancels the PU inductance

the approach you take is a disconnected one, one that does away with a mutual loading that occurs
at one end of the loop ... something the other op-amp guys did as well

three attempts that I know of so far, and all three (you, Hollis and Keen) omit the two components I'm alluding to
leading to an oversimplification - however slight one might want to interpret as ...

lastly, you should at least have your name or ID on that PDF file

Rob Strand

#3
I've had a couple of goes at it in the past with varying degrees of approximations.

I haven't checked your calculations but the way you analysed it looks OK.  My only criticism is you do not include the input impedance of the transistor stage and that might explain the differences.   I think it's enough that you need to include it.

You can get a reasonable approximation by tweaking your existing equations.
However it might be better to re-analyse them.
If Ra is the input impedance:
- For the wah behaviour replace Ri in your equations by Ri // Ra where Ri
- For the input roll-off it's not so simple but replacing Ri + Rs  with Ri + Rs // Ra might work (ie. replace Ri with Ri + Rs//Ra - Rs) but it is definitely an approximation.


The most compact expression I have for the wah transfer function is this:

Vx is the voltage at the input to the transistor,

        Vx/Vi  =  (Ri // Ra // Zx) / Ri
         Vo  = A * Vx

       (To get the input rolloff replace Ri with Ri + 1/(sCi))

where,
   Zx is the impedance looking into Rs,
   Zx = Rs [RQ // sL // (1/(sC(1-Ak)))] / [Rs // RQ // sL // (1/(sC))]

Remember A is negative and represents Vo / Vx.

The // symbol means parallel impedances.

I haven't spent a lot of time verifying it.
If you plug in k = 0 you can see Zx = Rs + {the parallel combination of RQ, L and C}
Which is correct.   

Another source of error is the inductor series resistance.  That needs sL replaced by sL + RDC.

[Edit:
My equation has a couple of symbol differences: 
Rq is the resistor in parallel with the inductor (Rp in Transmogrifox's equation) . 
k is the pot setting (g in Transmogrifox's equation).
A is the amplifier gain (gf in Transmogrifox's equation)
Ra is the amplifier input impedance (not in Transmogrifox's equation)

The pot control doesn't really get to 1 as the buffer gain in the circuit isn't 1.  It's probably 0.99 or so
]
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Eb7+9

Quote from: Rob Strand on November 21, 2018, 11:45:50 PM
Another source of error is the inductor series resistance.  The needs sL replaced by sL + RDC.

you're right in principle,

but on these inductors we're seeing only about 20 ohms series resistance ...
a value whose contribution to the overall math that is basically non-existent

Rob Strand

#5
Quotebut on these inductors we're seeing only about 20 ohms series resistance ...
a value whose contribution to the overall math that is basically non-existent
Surprisingly it is boardering on an audible effect, which justifies people's preferences to certain inductors.  The difference between RDC = 20ohm and RDC = 40ohm is about 1.5dB in the peaks at low frequencies.

Another source of error is the buffer output impedance which appears in series with the resonator Cap.
This resistance is the resistance of the buffer + the resistance of the amplifier stage (about 18k) reflected into the emitter.    The total is about 130ohms or so.   However, the effect on the response is small because this resistance appears in series with the C=10nF cap, not the effective "Miller multiplied' value the circuit sees.

Here's the output of my equations for various inductor DC resistances.  I have made no attempt to match any of the responses to a circuit sim, however, I have simulated the effect in the past and it does do the same thing.

Click to Enlarge:


Notice how the 'tilt' changes with the inductor DC resistance.
[EDIT:  I think I had a high gain transistor and RE=390 ohms on that plot which why the output is a little hotter.]
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

antonis

Never managed to follow any function which implicates "ω" instead of "2πf"..  :icon_redface:
(inherent disability probably due to the very same day prosecution of angular frequency course and snooker contest..)

So, I'd agree with Eb7+9:
<unfortunately, some players are looking for an audibly good approximation ...>
adding the fact that it isn't always (and for all the people) easy to "translate" a function graph to an audible sensation..

P.S.
No intention to trivialize OP's excellent work and/or following discussion.. :icon_wink:


"I'm getting older while being taught all the time" Solon the Athenian..
"I don't mind  being taught all the time but I do mind a lot getting old" Antonis the Thessalonian..

Rob Strand

#7
FWIW, an interesting question is if the high-pass filter at the input can be treated as separate from the wah part, or if the interactions are too much and need to be modelled.

Method 1: matching -3dB point of HPF
- plot difference in the response of the wah with Ci = 10nF and Ci = large value for all values of k. 
- From that observe the variation in the 3dB point.  I got variation of about 223.6Hz to 226.5Hz
- Set the 3dB of the HPF to be in the centre of that range about 225Hz; variation is about +/- 0.7%
- From the 3dB point we can derive an effective Rin *for the  HPF* behaviour assuming C =10nF.
- I got Rin_eff = 70.7k

Method 2:  matching lower frequency of HPF (ie. asymptotic response)
- Here I separated the hpf from the wah. The response is hpf  * wah with Cin=large value.
- I tweaked the cut-off of the hpf so this response matched the Cin=10nF case at low frequencies.
- In this case I got Rin_eff = 69.7k.   Which is very close to Rin(68k)+Rs(1.5k).
  (Maybe if I used a lower frequency I would get 69.5k.)

I then plotted the errors between Method 1 and the Cin=10nF wah and Method 2 and the Cin=10nF wah.

Click to Enlarge:


So we can see Method 1 has a smaller error around 200Hz and Method 2 has a smaller error at lower frequencies.  That's follows from the matching criterion.     What is clear is there is a peak error which is not fixed by tuning the hpf frequency.   The two matching methods differ little here.   This error results from treating the hpf as separate so there are no interactions between the hpf and the wah filter.
The peak errors are just under 1dB and are quite narrow.   It is unclear if these are audible under close scrutiny.   The frequencies of the error peaks are higher than the wah peaks so we can tweak the wah filter peaks to compensate.  We might be able to change something else like RQ or the inductor & cap value to compensate but I haven't checked.

I guess the bottom line is separating the hpf doesn't show-up as a bad thing.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Rob Strand

QuoteHere is one simplified rendering of it:
FYI, as a check I compared this formula to mine and the I found your peaks are about 0.8dB higher than mine.  I've set the amplifier input impedance Ra to a large value and RL_DC to zero to nullify the extra terms in my formulas.

Not sure where the problem is I'll keep plodding along.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Rob Strand

QuoteNot sure where the problem is I'll keep plodding along.

OK. So some of the error comes from the fact my equations keep the interaction between the wah circuit and the input high-pass filter (Ci & Ri).  When I separated the hpf the error was reduced but the results still show differences. I set  Zi = Ri  (ignoring Ci) and Rs = infinite then expanded my equations and I got the following, which does evaluate to the same numbers as my compact equations,

// second order wah part
n2 = C*L;
n1 = L*(1/Rq + 1/Rs);
n0 = 1;
d2 = C*L*(1-A*k*Ri/(Rs+Ri));
d1 = L*(1/Rq + 1/(Rs+Ri));
d0 = 1;
h_wah = (n2*s^2+n1*s+n0)/(d2*s^2+d1*s+d0);

// hpf
w0 = 1/(Ci*(Ri+Rs));     // my improvement/fix for the effective resistance
h_hpf = 1/(1+w0/s)

// gain term
h0 = A * Rs/(Ri+Rs);

// final response
h_total = h0 * h_hpf * h_wah

In my wah equation I didn't write the polynomials with unity s^2 terms (I normally don't), they have unity constant terms instead.  However comparing these equations with your equation in the first post, or your equation under "simplifications" in your PDF,  there are some differences.   I think there's some difference between your two equations as well.

Anyway there's an error somewhere.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Rob Strand

#10
I've been trying to workout which equations have the error.

I just verified my compact equations against spice.  From spice I measured: the gain of the first stage, the gain of the buffer (to determine the range of k) and the input impedance of the amplifier.  I used those numbers in the equations.   From the spice side I made all the 220nF caps large as these are not present in the equations.

There was very good agreement between spice and my equations.  However at first there was a small disagreement at the peaks and at higher frequencies (maybe 0.8dB low at 5kHz).  I suspected the resonator capacitor (C, Cf) was loading down the buffer (as mentioned a few posts back) so I placed an ideal buffer between the capacitor and the output of the transistor buffer.   A high gain transistor isn't good enough as the transistor has a natural output impedance (re).  When I do this the agreement is between spice and the equations is crazy accurate like 0.01dB.

In my simulation code I have the option to add the effect of the buffer output resistance.  I didn't do that because I was just trying to work out where the errors were.   For extreme accuracy the loading effect of the resonator cap on the buffer needs to be included.

Anyway, I'm fairly confident the compact equations I posted are OK.   The second set, the polynomial forms, are OK too however too however these have the high-pass filter separated out which introduces a small but known error.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Rob Strand

#11
OK I went through all your equations in the PDF and they looked fine.
After much checking I found I made one typo when I entered your equations.
So I can confirm that the equation under "Simplifications" in your PDF is correct  :icon_mrgreen:

A slight improvement can be made for the hpf.  It is better to use R=Ri+Ra instead of Ri.

I'm sure there is an error in the equations in the graphic, which are the same as  the postscript file (the extension should be .ps not .pdf).

Beyond that, IMHO for best accuracy the inductor DC resistance should be included.  The input impedance of the amplifier also should be included.  Including the buffer impedance is debatable, it does affect the peaks but the largest error occurs in the hf stop-band where it won' t be noticed.   (This last point I'm not so sure about now.  The whole buffer thing needs a closer look.)
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Eb7+9

#12
Quote from: antonis on November 22, 2018, 07:07:17 AM
No intention to trivialize OP's excellent work and/or following discussion.. :icon_wink:

same here ...

as I said before, I don't agree with the simplifying arguments taken by the author
nor, consequently, the exactness of the conclusion

otherwise I have great admiration for the work involved and presented //

I myself, and most other people I'd say, can hear a difference between THE CLASSIC WAH response and a variable Biquad Filter response, with or without a fixed 1st order stage tacked in front (cf., SK-wah)

the question(s) remains,

what H(s) transfer function defines THE WAH response PlunkettKushner(s) ?!
that is - exactly, in terms of analysis, and also to the highest degree of aural satisfaction

and while we're at it

which/what (how many) circuit(s) can produce that transfer function exactly, using completely alternate means


I know of two stable solutions so far ...
and in the process, discovered what I think must be the starting point for the discovery of the original WAH circuit

again, kudos to Transmogriphox for going down his challenging rabbit hole
without it I might not have revisited my prior work on the KP wah and discovered a mistake in my analysis ...

etc etc

---

for those interested in some good background material, have a look here:

recherche.ircam.fr/pub/dafx11/Papers/21_e.pdf

where there is a quote of interest:

Whether a full-featured non-linear physical model of the wah-wah is really
necessary or simpler approaches (e.g. as described in [3]) suffice
is anyone's choice; but the circuit is well suited to explain the
technique presented in this paper which is why it is used here.

NOTE,

for those who know the theory,
the sentence should be read as follows:

full-featured non-linear (LARGE-SIGNAL) physical MODEL, ... which implies complete SMALL-SIGNAL MODEL

whereas, reference [3] is content at presenting the WAH as a primarily 2nd order system
with graph results mimicking those presented above in this thread

Rob Strand

QuoteI myself, and most other people I'd say, can hear a difference between THE CLASSIC WAH response and a variable Biquad Filter response, with or without a fixed 1st order stage in front

There's different classes of wah:
- Biquad based and you could even split that into three classes of LPF, HPF, BPF (and perhaps BPF + leaked straight signal so it's more like a parametric).  It also covers the funky autowah types.
- "Vocal" sounding like the classic inductored wah
- Others like the Twin T (colorsound inductorless), and "hyper vocal" types which sound more like a talkbox.

Quotethe question(s) remains,
what H(s) transfer function defines THE WAH response PlunkettKushner(s)
um, to the highest degree of aural satisfaction

I suspect that can only be answered *on average*.  Some people prefer the colorsound Twin-T over the classic inductor wah.

If the aim of the game is emulating an existing sound then exactness *is* the goal.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Eb7+9

#14
Rob,

My original goal was to have the uber classic (Zappa/Hendrix/Clapton) WAH response,
... but without any headroom issues // absolutely nothing else altered

(in fact, my current circuit passes about 15vpp without clipping)

I know there are other important WAH's out there, but I'm such a fan of the original KP circuit
no buffers, nothing ... pure

I was keeping the goal clear and specific (for myself)
and speak only in terms of seeing how that goal can be achieved

In the process I've also become interested in seeing exactly how/where other circuits differ from that "reference" response
treating it as (my) design center ...

(sometimes I feel like calling it the "Canonical WAH" ... makes sense, to me)

in the end, trying to describe (again, for myself) what makes the classic KP WAH different than, say,
the more ubiquitous class of biquad responses

---

now, the general class of biquad responses - that's a fascinating study on its own
especially in regards to why one such (well known) Filter seems to stand out from the rest ...

Rob Strand

#15
QuoteIn the process I've also become interested in seeing exactly how/where other circuits differ from that "reference" response
treating it as my design center ...

in the end, trying to describe what makes the WAH different than, say, the more ubiquitous biquad response
A textbook swept biquad usually has a constant Q.   IMHO the thing  that characterizes the classic inductored wah response is how the Q and the various biquad terms vary over the sweep.    That characteristic is largely captured by the transfer function given in this thead.  While it is a biquad, the way all denominator and numerator terms vary with the pedal position takes on the correct form.  You can see how the shape of the low-end response is different to the high-end response in that the high-end has a lower Q.

As far as accuracy goes,  there's many parameters which have mild effects on the peaks.  These are captured in second order terms like, the inductor DC resistance, the resistor RQ, the buffer impedance, and also the 220nF caps which are not specifically modelled in the equations.

As an experiment I built (in spice) a second circuit which had the 220nF caps removed by setting them to very large values.   That circuit then has the form of the equations in this thread in that the 220nF caps are not modelled.  The reference circuit with the caps present used RL_DC = 40 ohms.   I then set-out to tune other parameters in order to compensate for the fact the 220nF caps were not present.  This corresponds to tweaking the model parameters in the equations to produce the same response without the need to model the 220nF caps.

So here's the result, VO is the base-line circuit and VOBG is the circuit with the big caps however I tweaked the inductor DC resistance and parallel resistor Rq to match the response.   It's pretty clear tweaking these two parameters substantially adjusts for fact the 220nF caps are not modelled.

220nF cap set to large value: (higher at HF, lower at LF)


Tweaking RL_DC and Rq to compensate:


The point I'm making here is the basic form of the equations in this thread covers a lot of behaviour.  The second order effects can probably be covered by tweaking the existing parameters.    So even though the equations are substantially biquad  it's biquad in the "right way" and is different to the "theoretical" swept biquad.

As to what *is* the design centre for the golden classical wah.  I don't know.  I do know the transistor gain, the inductor DC resistance, maybe even the inductor's losses (which will appears as a parallel resistance across Rq),  all contribute.   If we had a golden unit we could measure the response.   The gain of the transistor stage affects the sweep range and the peaks.   Another factor is, what exactly is the range of k (the pot control)  ie. do we let the pot get to the ends?
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Rob Strand

#16
Quoteor those interested in some good background material, have a look here:

recherche.ircam.fr/pub/dafx11/Papers/21_e.pdf
Most of the these papers boil down to some form of system identification problem.   They fit the (mathematical) model to the measured data.    One issue for DSP model is get a good fit to the response with the limited sample frequency.    The way I read it, the  DAFX paper is actually modelling the circuit directly, not measuring, but it too is fitting a discrete-time model.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Transmogrifox

Wow! Cool.  This triggered some good discussion after sitting dormant for several months :)

My original graphic was developed based upon only the second-order effect cascaded into the first-order assumption.

The PDF what where I spent more time to show myself how much error the cascaded first-order approximation introduces.

Spice is a great way to explore the effects of things I have (intentionally) neglected. What led me to the simplifications I made was a process of eliminating effects one-by-one in SPICE.  I already knew the amount and type of error I could expect before I even set my pencil to paper, so this is not a case of mindless neglect.  It's simply that I think SPICE (for a first-pass) and my ears (final opinion) are a better tool for considering the things I neglected in the derivation.

If the closed-form expression gets too involved then it becomes impractical -- I struck a balance that I felt was a reasonable representation of the salient characteristics of the circuit.

I may update the graphic to match the PDF (or .ps as was pointed out).
trans·mog·ri·fy
tr.v. trans·mog·ri·fied, trans·mog·ri·fy·ing, trans·mog·ri·fies To change into a different shape or form, especially one that is fantastic or bizarre.

Rob Strand

QuoteWow! Cool.  This triggered some good discussion after sitting dormant for several months
I only noticed by about post 10 #that you posted this with no replies back in May!  So I must have missed it then but to tell you the truth the recent thread on the inductorless colorsound unit has rekindled my interest in the wah.

QuoteWhat led me to the simplifications I made was a process of eliminating effects one-by-one in SPICE.
...
If the closed-form expression gets too involved then it becomes impractical -- I struck a balance that I felt was a reasonable representation of the salient characteristics of the circuit.
Yes I looked at wha in detail back in the early 2000's.  A lot of it was done in spice but I used some approximate analysis to guide my thoughts.   I like the idea of having the inductor DC resistance as it lets you tweak the peaks at the low frequency end.  If you try to use the gain it gets mangled up as the gain changes the range of the sweep.

Your closed form expression looks fine to me.  I don't have a problem with the HPF separated out.  Later on it occurred to me tweaking some of the other parts might actually be able to compensate for the small errors introduced from separating the hpf.

It's true though, simplified closed form expressions let you see into the problem.  Once you make them to generalized they can can get out of hand.  They get to the point where you can no longer visualize how changing a parameter affects the response.  When you get to that point they are just a black box and I can see why fitting a generic model (like a state-space model) to simulation or measured data is just as good - it's just a big number muncher.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Rob Strand

#19
One thing I did notice is if you set the inductor DC resistance to about 50 ohms the peaks are largely level.  Exactly level peaks might not sound level to the ear but it is a good start.   The wah's with DC resistances around 40 to 50 ohms were common in the older wahs.  The modern boutique offerings tend to be around the 30 ohm mark.  That could be explained by the fact the high-Q low-end sounds a bit quieter than the low q high-end.  The lower resistance peaks the low end a bit more to compensate.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.