For the past couple of years, I’ve been teaching myself analog guitar electronics. (I previously wrote about fixing an old tube amplifier.) It’s nice to have a hobby that is “material” in nature — a departure from my usual world of data and software — but that also complements my musical interests. In fact, two of the seven pedals on my delicious pastries live gig rig are now DIY effects.
I had the final week of 2015 off from work, so I spent part of it building a few clones of some classic effect pedals. The only one I had time to complete was a MXR Phase 45 clone, using a circuit board layout from madbeanpedals that was small enough to cram into this cute little 1590A enclosure!
What’s more, the project presented a fun data analysis opportunity, since the effect uses two transistors that need to be matched. I’ll talk here a little about the phaser circuit, the matching process, and how I came to use an hierarchical clustering approach to identify the best components for my final build of the pedal! You can hear the effect in action in the following video.
The Phaser Effect
The phaser is a phase-shifter effect (with its big brother the flanger) and, more generally, a modulation effect (with its cousins tremolo, chorus, and vibrato). The phaser is what creates the swirling otherworldly guitars we hear on pscyhed-out recordings by Pink Floyd, The Rolling Stones, Sex Pistols, Queen, Van Halen, Radiohead, Tame Impala, and countless others.
The phaser pedal I built is pretty much the simplest variant: a “two-stage” phaser. Each stage is an all-pass filter, which doesn’t alter the audio volume, but does change the phase of the audio signal at a certain frequency (pitch). In particular, it delays the sound by 90° at the target frequency (or 1/4 of the sound wave’s 360° cycle), and if you string up two of these back-to-back, you shift the signal by a total of 180° (or a 1/2 cycle). This phase shift in and of itself isn’t very noticeable to human ears. But if you mix it together with a copy of the original unaltered signal, the two sound waves “cancel out” at the target frequency where the 180° shift happens.
This creates a “notch” at the target frequency that is noticeable. Phasers don’t stop there, though… they also vary the target frequency so that the notch moves up and down the spectrum. This creates that sweeping, spacey sound.
Adding another pair of stages (i.e., 90° all-pass filters) creates another notch that can be swept up and down the spectrum, too. The Phase 90 and Univibe pedals use the more common four-stage circuit (two notches), while the Phase 100 uses six stages (three notches). Those sounds get wacky and distorted compared to the smooth phasing of the two-stage phaser I built. I found these articles by R.G. Keen (a giant in the world on DIY guitar effects) and the ElectroSmash blog to be very helpful in understanding how phasers work.
JFET Transistor Matching
In order to get that sweet automated sweep, the circuit includes a low-frequency oscillator (LFO) which drives the target frequency using a smooth, inaudible pulse of volts. The rate of this pulse is controlled by the one big knob on the final pedal above. The LFO voltage feeds into some JFET transistors that have been added to the filters at each phasing stage.
The two JFETs are highlighted in red. All you need to know about them here is that they act like variable resistors: the more voltage that gets pumped into the gate terminal (the middle one with the arrow), the less current is allowed to flow between the other two terminals (drain to source). The transistors are sort of like knobs that get turned up and down by the LFO voltage instead of your fingers. So, as the LFO pulses up and down in voltage, each JFET causes more and less resistance, which in turn moves the notch up and down in pitch! But in order for all this to work, the JFETs have to change their resistance exactly the same way in response to the LFO (using the knob analogy, you’d have to be perfectly synchronized turning them up and down). Otherwise, the two 90° shifts occur at different frequencies, and we don’t get much cancellation: no notches, and no cool effect. Sadly, it turns out that JFETs are hard to manufacture consistently, so there is a lot of variation from one to the next.
The traditional way to “match” JFETs for phasers comes from this article (also by the infamous R.G. Keen). The idea is to find the “pinch-off” voltage for several JFETs — i.e., where the transistor stops all current flow from drain to source — and choose pairs with similar values. Since as the LFO swings between zero volts (no JFET resistance) and (infinite JFET resistance), matching on the latter supposedly tells us which pairs are similar enough for the circuit to sound awesome. However, when I implemented the testing circuit from the article on my breadboard, I couldn’t get it to work. I probably just bugged it up, but in the meantime with a little more research I learned that the relevant “drain-to-source” resistance is a function of two JFET attributes, not one:
The new parameter is the JFET’s “drain-to-source saturation” current ( just refers to the voltage of the pulsing LFO). Some folks argue that you should match JFETs using both and so I soldered up this much simpler testing circuit on some leftover stripboard and it worked!
Clustering for Matched Pairs
I had ten 2n5457 JFETs on hand, which I ordered last summer in hopes of finding a good match for this project. I numbered them 1-10 and measured both and for each, using the circuit above and a digital multimeter. But then I wondered: how do I decide what makes a “matched pair” when the attribute space has two dimensions? Using alone, you can simply sort everything by that value and choose the pairs that are closest. But and need to be combined somehow, so I decided to cluster the JFETs using R and plot dendograms of the relationships to get some quick visuals…
We can quickly see from this clustering that there are four pretty closely-matched pairs: 2-5, 4-8, 6-10, and 1-3. Transistor 7 doesn’t have a great match, and 9 is a total outlier. The dendogram above uses the default complete-linking with Euclidean distance, but trying other linking methods or distance metrics gave essentially the same results. Even though 4-8 were the closest match, I decided to use 2-5 in my final build, since the clustering shows that 4-8-6-10 would make a nice matched quartet for a four-stage phaser some day!
Overall, I’m quite happy with the final result, and it was a fun application of clustering for a real project. In practice, using alone might be good enough for matching, since it seems to be very correlated with anyway (r=0.984, psocketed phaser circuit to test drive several pairs, subjectively comparing the best matches from one clustering approach to another. This would reveal the best clustering method for transistor-matching to taste.
Regardless of which attributes you use, the general clustering approach seems like a great way to find intuitively good matches for two-, four-, six-, or even eight-stage phasers. Particularly if you have a large pool to draw from!
On an unrelated note: I like the aesthetics of this small, simple, one-knob pedal. It tempts me to squeeze some other effects into a 1590A enclosure, and modify them to only have one knob. For example, lots of modulation effects can get by with just a speed dial, and fuzz/distortion pedals could just be built to maximum grit with just a volume knob….