Signal and Sensation

The Acid Line

A 303 slide is a lag on the pitch in semitones, so it takes the same time whatever the interval. Measured off the sound, a semitone and an octave both get 63% of the way in 59.8 ms and 95% in 180 ms, and an octave covers twelve times the ground in that time rather than taking twelve times as long. The accent opens the filter 1.4 octaves and adds 3.5 dB, and leaving the level out makes an accented note measure quieter than a plain one.

Open fullscreen →

What it is

A TB-303, and the slide that makes it one.

A saw through a resonant lowpass with an envelope that opens the filter and lets it fall back, an accent that opens it further and plays louder, and a slide that ties one note to the next. Here it’s on A2 with the slide time switchable between 30, 60 and 120 milliseconds, and an acid pattern on the demo. Hold one key and press another and it slides between them. Strike a key near its bottom edge and you get an accent.

How it works

The 303’s portamento is a lag on its control voltage. The voltage is one volt per octave, so it is pitch in semitones, and lagging it gives an exponential approach in semitones with one fixed time constant. Which means the time doesn’t depend on the interval at all: every slide covers 63% of its distance in one time constant and 95% in three, whether that distance is a semitone or an octave.

The page measures it off the sound rather than off the setting. Rising zero crossings give a pitch reading on every cycle, each crossing placed between the two samples that straddle it, and the reading is turned into semitones and searched for the moment it passes 63% of the way. At the 60 ms setting a semitone slide reads 59.8 ms and an octave slide reads 59.7. At 30 ms both read 30.0, at 120 ms both read 119.3. The predicted figure, minus tau times the log of 0.37, is 59.7.

So an octave slide is not a longer slide, it’s a faster one: same time, twelve times the distance, twelve times the rate in semitones per second. That’s why a 303 line with a big interval tied into it sounds like it lunges, and why the slide knob feels like it changes the character of a pattern rather than its timing.

The filter envelope opens three octaves above the 300 Hz cutoff, to 2400 Hz, and falls back with a 180 ms time constant. An accent adds 1.4 octaves, to 6334 Hz, and 3.5 dB.

What surprised me

The obvious way to build this in a browser is wrong, and it’s wrong by an amount you can hear.

Web Audio’s setTargetAtTime on an oscillator’s frequency gives an exponential approach in hertz. A 303 lags semitones. On a semitone slide the two are indistinguishable, 30.4 ms against 30.1, because over a small interval hertz and semitones are nearly the same shape. On an octave they are not: the hertz version reached the 63% mark in 48.7 ms instead of 59.7, running 18% fast, because hertz are stretched at the top of an interval so covering 63% of the hertz gets you further than 63% of the semitones. It’s also asymmetric, sliding up and down at different rates, which a 303 never does.

The fix is to put the pitch in detune instead, which is in cents and so is linear in semitones, and lag that. Then all six combinations of slide time and interval match the arithmetic to about a millisecond. I had actually written a comment claiming the code lagged detune while the code lagged frequency, which is its own lesson: the comment described the thing I meant to build and the measurement described the thing I had built.

The accent caught me too. I gave it the filter opening and not the level, and measured an accented note as 0.6 dB quieter than a plain one. Opening a resonant filter moves its peak off the harmonics that were feeding it, so brightness on its own can cost you loudness. An accent on a real 303 does two things, and the second one is not decoration.

What I would do next

The real filter. A 303’s is a diode ladder, four poles with a particular non-linearity, and this is a two pole biquad standing in for it. The measurable difference is the resonance: a ladder filter’s resonance steals from the passband as it rises, so the note gets thinner as the squelch gets louder, and a biquad’s does not. That trade is a curve and nobody has drawn it for me.

Then the sequencer’s own timing, because a 303 ties, rests and accents on a sixteenth grid with a swing that is not adjustable and not quite even, and measuring that grid off a real 303 would be a day.