DIY Digitally-Controlled Analog Filter Design

In the Beginning

For the Rockit Synth, I designed a digitally-controlled analog filter.  I went down this path after a good amount of thinking, learning, and design attempts.  First, I looked into cribbing a filter design from some reputable synthesizer.  I found a few problems with this approach.  Primarily, voltage-controllable analog filters tend to be part-count heavy.  Look at most designs and you’ll find dozens of components, many of them requiring trimming to work properly, and many of them requiring many dollars to purchase.  The designs also tend to require high rail voltages, like +/- 15V.  And some require all of the above. Take a look at an old Moog filter.  It’s got boatloads of parts, high rail voltages, and in the end is only a low pass filter.  Sure, it sounds sweet, but my goal was to make an affordable kit synth.  Maybe one day, I’ll splurge and build a no holds barred filter, but it turned out to be interesting to live with some limitations and make my own filter.  Click through for a detailed discussion of the filter in the Rockit Synth.

Filter Requirements

The design requirements for my filter were:

1. Digitally controllable analog. I wanted the filter to be controllable from external sources. Namely, I wanted the filter to be controlled digitally via MIDI.  It would’ve been easy to make a filter that was only knob controllable with no external MIDI control and believe me, I thought about it.

2. Low cost. I wanted to make a synth kit for a reasonable price.

3. Low part count. I wanted to make the kit buildable.  More parts = more difficult to build.

4. Awesome sound. Of course, I want the filter to sound amazing.  This turns out to be the hardest specification to meet.  Believe me, it sounds sweet, but if some of the other requirements were eliminated, like part count and digital control, it could sound even better.

5. Decent range. A synth filter is only worth anything if it can cover most of the audio range. This is pretty tied to the awesome sound and suffers the same limitations.

6. Low-pass, band-pass, and high-pass. The filter needs to be able to change between these three filter types.  This turned out to be pretty easy to accomplish, although it’s a big factor in the cost.

7. Gnarly resonance/Q control.  Filter resonance is where all the magic is in the sound of an audio filter and I’m glad to report that this filter resonance is gnarly.

8. 5 Volt – The filter needs to be able to function from a single-ended 5V rail. No +/-15V or anything of the sort. This keeps part cost down and makes it possible to interface the filter directly with the microcontroller, not requiring any level shifting, and once again more parts.

Technically, there ended up being more specifications, but those were the main criteria. It costs a little more than I’d like and the range isn’t totally perfect, but all in all, I’m pretty proud of my baby. With a different ear and a different set of compromises, a larger range is easily achievable and I leave it to the hackers among you to adjust it to your pleasure.

Implementation

Generic Sallen-Key Low Pass Filter

The filter is a Two-Pole Sallen-Key type topology.  This filter type has some great advantages and some notable disadvantages. On the plus side, the part count is low and the filter’s cutoff and resonance are easily adjustable. On the negative side, it’s not really voltage-controllable. You can’t inject some voltage somewhere and alter the filter response.  This is where digital potentiometers come in. The digital potentiometers are Microchip MCP42050 devices, each with two digital potentiometers with 256 steps and a maximum resistance of 50k. The 256 steps are linearly divided from minimum to maximum.  Instead of resistors or analog pots, you substitute digital pots. R1 and R2 are the digital potentiometers for setting the filter cutoff. R3 is another digital potentiometer which sets the filter resonance.  The high-pass filter is just like the low-pass filter except that R1 changes places with C1 and R2 changes places with C2.  And the band-pass filter is made by passing the output of the low-pass filter through the high-pass filter. Finally, this filter is a two-pole filter. The image at the beginning of this article is an idealized view of the stopband and passband characteristic of a filter. In reality, the cutoff is not a cliff and the number of poles of the filter describes the steepness of the cutoff. Some people demand a minimum of four poles which is a common limit for synthesizers. One can easily take this basic filter design and make a four-pole filter. If you take the circuit above as a building block, and put two of them in series, you’ll get a four-pole filter. And if your heart desires, you needn’t stop there. 32 poles or more are just a few op amps away. I decided to make it two-pole to limit the part count and keep this thing easily buildable.

In My Schematic

Filter Schematic

So, parts count got a little higher than I’d hoped when I started, but other factors, like functionality and sound quality got the better of it.  Only two of the op amps are filter op amps, the others are being used as buffers to control which filter is active.  The MCP6023 is an op amp which has an enable input which allows you to shut down or turn on the op amp.  This enables the low pass to be the output, or the high-pass, or for the low-pass signal to be sent to the high-pass input to form the band-pass filter. The three MCP42050 are across the top.  One 42050 is the low pass filter resistors. One is the high pass filter resistors, and the third is the resonance setting resistors, one potentiometer for the low-pass filter and one potentiometer for the high-pass filter.  The filter is followed by the master volume control. Also, the filter input shows up on the left and is merged into the filter with a summing amplifier.

Circuit Notes

One of the most challenging aspects of this filter design is setting and limiting the range.  The maximum and minimum cutoff frequencies of the filter are tied together and limited by the chosen capacitor values and the range of potentiometer values. On the low end, the potentiometer is limited by the wiper resistance. In this case, it’s about 125 Ohms.  As mentioned, the maximum value is 50kOhms.  The formula for the cutoff frequency of the filter is f = 1/(2*pi*R*C). C is fixed and in the low-pass filter is 33nF. The R is the digital potentiometer and the resistors around it. If the resistance of the potentiometer is not adjusted by using external series and parallel resistors, the range is too extreme and very logarithmic, or non-linear.   Here’s a graph to show how bad it is.

Filter without External Curve Shaping Resistors

You can see that the filter cutoff frequency is very low for most of the range of the potentiometer and then as the resistance of the potentiometer reaches its minimum, the filter cutoff suddenly swings to its maximum.

To resolve this problem, we add a resistor in series with the wiper of the potentiometer to limit the minimum resistance and bring the maximum cutoff frequency down.  The filter cutoff is still non-linear, but at least the range is where we want it.  We will still be able to occasionally hear steps in the filter frequency response near the top of the range, but it’s not terrible. If more range is required, the parts can be adjusted to achieve it. The capacitors basically set the bottom of the filter range. Higher capacitor values will achieve lower minimum frequencies and lower capacitor values will shift the range higher. Reducing the size of the wiper series resistance will increase the range and increasing the resistor value will reduce the range and make the filter sweep more linear. Any adjustments you make should be gradual. All the values I chose are very particular, so adjustments should be made in the 10-20% value change range rather than anything larger and more dramatic. Here’s the present low pass filter characteristic with 33nF capacitors and 1.5k resistors.

Final Filter Characteristic

The resonance is really just the gain of the circuit, but it’s a frequency dependent gain. It is set the same way that it would be if you were just trying to make a circuit with gain, by adjusting the feedback path to get the desired gain. In this case, the gain is adjustable with one of the digital potentiometers. The maximum and the minimum gains are limited in much the same way that the filter cutoff is limited.  The resonance is much more sensitive though. The formula which defines it has the ability to have asymptotes in the response if the wrong ratios of parts are chosen. So, tread carefully. Very small adjustments to the value can very easily cause the filter to oscillate, self-resonate, or alternatively, to have no resonance whatsoever. The resistors that determine the resonance are all around the resonance digital pot, U9. R75 sets the minimum for the digital potentiometer/resistor parallel/series combination and R27 shapes the resonance-to-digital potentiometer curve just like the resistors described above for the frequency. When this combination of resistors and the digital pot are considered with R22 for the low pass, you can determine

Resonance = -1/((R22/Rpot))-2)

There are some characteristics of note to the formula. Negative values are not tolerated. So, the denominator must remain negative. It is also possible to make a 0 in the denominator which we all know is a no-no according to all the mathematical laws we call holy. If you try to create a circuit which causes these no-nos to occur, you’ll hear it and it won’t be happy. Your filter will oscillate and distort.

The values here give the resonance a range from about .71 to about 3. The value of .707 is considered basically a 0 resonance because it yields a filter which has no peak around the cutoff frequency. Going up from there, the resonance value of 3 means that frequencies exactly at the cutoff frequency will have a gain of 3. The higher the resonance value, the higher the gain, and also the narrower the band which is gained. Thus higher resonance values get more and more of a screaming super-gained and potentially distorted sound. I experimented with a lot of ranges and this came out the best. The downside of having only 5V to play with is that it’s very easy to run out of room, so higher resonances will probably not work. The filter runs into oscillation and distortion.

That’s All Folks

So, if you find you’d like the Rockit filter to behave differently or you’d like to make your own version, feel free to use it. If you run into anything unresolvable or have questions, drop me a note. I may even play with it some more myself to see if I can improve it.

Posted in Filter Design, Rockit and tagged , , , , , .

6 Comments

  1. Thanks for putting this up Matt, I was a little curious about your filter design and I was thinking that the digipots would work great for this. I’ve wanted to design a filter to put on the out of an Atari Punk Console to get more variance in the sound, and this info is just what I needed, and just when I was looking for it too.

    Also, I got my Rockit in the mail the other day and have been playing with it a lot. Your hardwork on this is definitely appreciated, thanks for a great synth and all the source information!

    • You’re welcome. You could use the same filter design with some analog pots if you want quick and easy. A dual pot would work for the frequency setting pot and a single pot for the resonance. Otherwise, it would be easy to get another Rockit board and only populate the filter components. Then, you could use the filter audio in and not connect the synthesis portion. If you’d like, I could make a quick BOM for such a project. Otherwise, build up a four pole version and let me know how it goes. One thing I left off was the part about the code that gives it life. Looks like the recipe for another post. Check back.

  2. Definitely would be interested in the BOM for a project like this. It might be interesting to see what I could do with just the filter circuit.

    I’m thinking the digipots would be useful for having a controller dynamically change the filter without user intervention. I’m also thinking the filter + filter envelope might make an interesting guitar effect as well. I still have to plugin my guitar to the Rockit, to try it out as well…

    I could go on several tangents here, but its fun to think of the possibilities…

  3. Upon reading this, I am now confused if I can substitute 50K log pots for the ones specified in your components list…I was hoping to spread out the pots on a new template to make the RockIt more ‘playable’…everything is so crunched in there (I assume to keep costs low).

    Is this not possible??

    • The digital pots are the mcp42050 parts in the parts list and they aren’t related to the other 50k pots which are used for control. Don’t substitute log pots for the analog pots. They should be linear pots.

  4. Groovy! I scored a soundgin and will be making my own version of the Notes and Volts NaV-1, I’m thinking I’ll use your filter circuit here to tack on an analog filter at the end of the signal chain, somewhat similar to what the Shruthi did.

Leave a Reply