SynthMaker Manual Help Open SynthMaker (opens in a new tab)
Signal processing · Chapter 1

Write your own filter, and watch what it does

One line of maths is a low-pass filter. The figures on this page run that line in your browser: they show what it does to every frequency and to a single click, and they change as you turn its knob. Press Play it to hear the same filter on a bass line.

1One line

Every sample, the output y moves a share a of the way from where it was, y', towards the input x:

OnePole · its code
module OnePole  in x  out y  setting a: 0.08, from 0.005 to 1  y = y' + a * (x - y')end

A fast wiggle in x is gone before y has moved far, and a slow one is followed almost exactly. Slow passes, fast doesn't: that's a low-pass filter.

Open in SynthMaker ↗ (opens in a new tab) Turn a and watch both views.
Figure 1.1 The one-line low-pass, running. Response is its gain at every frequency: 0 dB at the bottom, falling above a corner that moves up as a grows. Impulse is what one click becomes: a, then a(1 − a), then a(1 − a)², each sample a little less. A bigger a starts higher and dies away sooner, so more of the highs get through.

2Why the click tells you everything

Send in one click, a single 1 and then silence. The first output is a. After that the input is 0, so each sample keeps 1 − a of the one before: a fade that never quite ends. That fade is the filter's impulse response.

Any sound is a row of clicks of different sizes, so the filter's output is its impulse response added up for each one. The Response view is worked out from the impulse response itself (SynthMaker plays the module one click and measures it), so what you see is what you hear.

3Four in a row, and feedback

Put four of the same line in a row and you get a steeper low-pass. Now take the last output, one sample ago, and subtract a share of it from the input, feedback * y':

Ladder · its code
module Ladder  in x  out y  setting a: 0.1, from 0.005 to 1  setting feedback: 0, from 0 to 4.4  s1 = s1' + a * (x - feedback * y' - s1')  s2 = s2' + a * (s1 - s2')  s3 = s3' + a * (s2 - s3')  y = y' + a * (s3 - y')end

Each stage lags a little behind its input, and at one frequency the four lags add up to half a cycle: there the part fed back is upside down, so subtracting it adds to it. Turn feedback up and that frequency grows a peak.

Open in SynthMaker ↗ (opens in a new tab) Turn feedback slowly up to the top.
Figure 1.2 Four one-poles in a row, the last fed back into the first. As feedback goes up, two of the four poles slide out towards the unit circle, the Response grows a peak near 800 Hz, and the Impulse rings: one click becomes a short tone. At the top of the knob the poles are just inside the circle, and the filter rings for a long time.

4Watch a module of your own

An Analyzer passes the sound through untouched and shows it. Put one straight after a Code module and three of its views show what the module itself does: Response, Impulse and Poles. They're worked out from the module at its settings now, so there's no need to play a note, and they move as you turn its knobs.

  1. Open Smooth Pluck and choose Code. Under smooth = Smooth(cutoff: 1.2 kHz), add look = Analyzer().
  2. In the first wire line, put look straight after smooth.
  3. Choose Patch. The Analyzer's card is with the others (beside the Patch on a computer, under it on a phone); in the menu under its picture, choose Response.
  4. Turn Smooth's Cutoff on its card: the curve slides with it.
  1. Step 1: Add an Analyzer after it. look = Analyzer(), and look straight after smooth in the first wire line. (larger)
  2. Step 2: Response: every frequency. The Analyzer's Response: Smooth's gain and phase at every frequency. (larger)
  3. Step 3: Impulse: one click. The Analyzer's Impulse: one click in, and how Smooth answers. (larger)
  4. Step 4: Poles: where it rings. The Analyzer's Poles: Smooth's one pole, inside the circle. (larger)
The two lines · the rest of Smooth Pluck stays as it is
smooth  = Smooth(cutoff: 1.2 kHz)look    = Analyzer()  …voice -> osc1 -> filter1 -> smooth -> look -> vca1 -> out
ViewWhat it shows
ResponseThe module's gain at every frequency, 20 Hz on the left to 20 kHz on the right, in dB (the bright line; the lines across are 12 dB apart), and its phase (the amber line).
ImpulseWhat the module puts out after one click, sample by sample. Under it, choose 64, 512 or 4096 samples.
PolesIts poles (×) and zeros (○), drawn with the unit circle.
Scope and SpectrumThe sound itself as it passes, while you play: its wave, or its frequencies.

Read Smooth's Response from the left: flat at 0 dB, so the lows pass as they are. At the cutoff it's 3 dB down, and above it the curve falls about 6 dB for every octave higher. One pole, one gentle slope. Turn the cutoff down and the × slides towards the circle, the fade gets longer and the curve falls sooner.

Ready-made

Smooth Pluck with the Analyzer already after Smooth. It starts as a Scope: choose Response, Impulse or Poles in its menu.

Open the example sound: Smooth, watched ↗ (opens in a new tab)

Try it

  1. In figure 1.1, turn a right down: the corner drops below 200 Hz and the click becomes a slow fade.
  2. In figure 1.2, play it and turn feedback up while the bass line plays: the filter starts to sing.
  3. Open either in SynthMaker, open the filter's code, and change a line: play it and hear what your change does.

Remember