How we build

What does component-modeled mean?

We call almost everything we make component-modeled. It is a precise claim, and a limited one. This page says exactly what it means and where it stops. It also shows the part of it nobody can see from the outside: how an oscillator draws its edges between two samples.

The claim

Each circuit is modeled as the idealized equations of its topology. These are capacitor currents, the exponential law of a junction, the hyperbolic tangent of a differential pair, the Shockley law of a diode and the recombination of carriers in a photocell. The equations are integrated with the trapezoidal rule, with the cutoff prewarped so that a filter's corner lands where its converter puts it.

Wherever a nonlinearity sits inside a feedback loop, the whole loop is solved simultaneously at every sample, by Newton's method on the node voltages. Examples are a ladder's resonance path, the damping path of a state-variable filter and a diode pair in a Sallen-Key loop. The loop is not broken with a sample of delay. The delay-free loop is what lets a resonant filter's pitch, loudness and saturation depend on one another as the circuit's do.

This claim is precise but limited. Not every resistor on a schematic is simulated. Parts that set a gain or a bias are folded into the idealized equation of the stage they belong to. The parts drawn individually are those whose tolerance changes what is heard.

Which instrument this describes

The examples on this page come from Realgar Red, the instrument in which every piece of the method is in place. Our other instruments are built from the same engine, but they were built over time, and not every one of them has every piece described here. Each product page says what its own instrument does, and that is the page to hold us to.

The parts are one example of the difference. In most of our instruments the parts are drawn once, from a fixed bin, so every copy is the same instrument: the same slightly-off resistors and the same mismatched pairs, on every computer. In Realgar Red they are drawn from a serial number that belongs to your copy, so your nine voices disagree with each other, and with everybody else's.

Edges drawn between two samples

An analog oscillator is continuous. Its capacitor empties at some instant and its comparator trips at some instant, and none of those instants lines up with a digital sample clock. The obvious way to build a digital oscillator ignores that. It works out the wave at each sample, and when an edge falls between two samples, it jumps on the next one. Much of the harshness of a cheap digital oscillator starts there.

Why a sampled edge is a problem

A jump in value, such as a saw's reset or a pulse's edge, has a spectrum that falls at only 6 dB per octave. A corner, where the wave keeps its value but changes direction, falls at 12 dB per octave: a triangle does this at its peaks, and a wavefolder at every fold. Both reach far above the highest frequency a sample rate can carry. Sampled naively, everything above that limit folds back down into the audible band as tones that are not harmonics of the note. They move the wrong way when you bend the pitch. They are loudest exactly where synthesizers spend their time: high notes, bright waves and hard sync.

Running everything at a higher sample rate helps, but slowly: each doubling of the rate buys roughly 6 dB against a jump and 12 against a corner. That is why the edges are drawn instead.

Finding the instant

Realgar Red's oscillators work out where each event falls inside the sample. They do it from the circuit, not by estimating from the samples either side:

  • Between events, a saw core's capacitor, a triangle core's integrator and a counter's phase all move in straight lines, at the frequency the converter gives for that sample. The time until the next threshold is a division.
  • A capacitor charging through a resistor approaches its rail exponentially, and the moment it crosses a threshold is a logarithm.
  • A counter knows on which tick of its clock an edge falls. Only the edge's position inside the sample needs working out.
  • A sync arrives carrying the instant at which the master reset. The slave resets, reverses or restarts at that instant, not on the next sample.

Several events can land in one sample, say a reset, then a pulse edge, then a sync. Each is placed where it falls. The instants are exact for the frequency the board is running at during that sample.

Drawing the event

Once the instant is known, the ideal event is replaced with a band-limited one. A step becomes a smooth rise four samples wide, centered on the instant. A corner becomes the smooth bend you get by integrating that rise. The shape is the cubic B-spline and its integrals, a published family of kernels for exactly this job. The output is read two samples late, so the kernel can be centered on an instant that lies between samples.

A STEP (A RESET, AN EDGE, A WRAP)-3-2-10+1+2+3+4the instantA CORNER (A TURN, A FOLD, A KNEE)-3-2-10+1+2+3+4the instantsamples, counted from the one before the event
A step and a corner falling 0.4 of the way between two samples. Dashed: the ideal event. Hollow squares: the ideal event sampled, which is where aliasing comes from. Solid dots: the event as the kernel draws it. Worked out from the kernel's formula, not measured.

What it buys, and what it costs

For a wave made of straight segments, correcting the samples around each event is exactly the same as passing the continuous wave through a gentle low-pass filter shaped like the kernel, and then sampling it. That equivalence says precisely what the method buys and what it costs.

What it buys is a small residue. The only aliasing left is what the kernel's tails let through: harmonics far above the limit, already reduced by the kernel, folding back. At A7 (3520 Hz), the loudest line any of Realgar Red's oscillators makes that is not a harmonic stands between 64 and 118 dB under the note. The saw core's saw sits 77.4 dB under.

What it costs is a little top end. A kernel four samples wide rounds the very top of the spectrum slightly. The voices run at twice the host's sample rate, so most of that rounding falls above anything you can hear. Worked out from the kernel's shape, with the host at 48 kHz, an oscillator on its own loses about half a decibel at 10 kHz and two and a half at 20 kHz. A longer kernel would round less, but it would cost more and delay every note further.

Where drawing is not enough

  • An event has to be one you can find. The diode shaper's ladder has 128 knees, each narrower than a sample, too many to draw one by one. It is integrated exactly over each sample instead, which is antiderivative anti-aliasing.
  • A stage placed after an oscillator only ever sees the drawn wave. The wave wrapper receives a saw's reset already smoothed into a steep curve a couple of samples wide, and at high drive it wraps several times inside that curve. That is its weak case: 50.0 dB clean for a saw, against 65.8 dB for a sine.
  • Audio-rate FM spreads a spectrum without leaving any single event to draw. There, the doubled sample rate is what helps. The digital wavetable doubles it again for its FM and RING warps.

What it means, and what it does not

It means

  • Each circuit is its equations, written from its topology. It is not a curve fitted to a recording of one.
  • A loop with a nonlinearity in it is solved all at once, every sample, with no delay put in to make the arithmetic easy.
  • In Realgar Red's oscillators, every edge and corner is placed at its instant between two samples and drawn band-limited. So is every wrap in the wave wrapper and every knee in the resonance folder.
  • Parts have values. They sit a little off nominal, and the ones whose tolerance you can hear are drawn one by one.
  • The measured figures on this page come from Realgar Red's test bench, which re-measures them each time it runs and fails if one moves from the number printed here.

It does not mean

  • That every part of a schematic is simulated. A resistor that only sets a gain lives inside its stage's equation.
  • That we run a general-purpose circuit simulator. Each topology's equations are written out by hand and solved. Nothing reads a netlist.
  • That every magnitude was checked against a hardware specimen. A few were derived from the physics. They behave correctly in kind, and Realgar Red's service manual marks each one.
  • That everything in the instrument is band-limited. Some sources are computed at the sample instants: an LFO's flips, a sample-and-hold's steps, an envelope's corners and the ring modulator's diodes. Driven at audio rate, they alias like any sampled signal.
  • That every oscillator is a circuit. Realgar Red's DIGITAL WAVETABLE and DIGITAL SUPER SAW are digital oscillators, and they say so in their names.
  • That every instrument we make has every piece on this page.
  • That it is a copy of any particular instrument. We name a circuit by what it is, never by whose it was.

If you find one of our pages claiming more than this, tell us.

Aphelion

Further reading

  • V. Välimäki, J. Pekonen and J. Nam, “Perceptually informed synthesis of bandlimited classical waveforms using integrated polynomial interpolation,” J. Acoust. Soc. Am. 131(1), 2012. The kernel family drawn above.
  • V. Välimäki and A. Huovilainen, “Antialiasing oscillators in subtractive synthesis,” IEEE Signal Processing Magazine 24(2), 2007.
  • S. Bilbao, F. Esqueda, J. D. Parker and V. Välimäki, “Antiderivative antialiasing for memoryless nonlinearities,” IEEE Signal Processing Letters 24(7), 2017.
  • V. Zavalishin, The Art of VA Filter Design, 2020. The trapezoidal integration the filters use.

Realgar Red, the synths and why they have so few presets.