subch.us pedal lab

Pedal Lab

A guitar pedal is a handful of parts on a board. This page simulates the actual circuit, part by part, on the audio thread of your browser: change a resistor, swap a diode, turn a knob, and hear what the electrons do. Pick a pedal, press Power, then start poking.

Bench pick a pedal, power up, play

The first lesson
Clipper
ON

Signal

Press Power to start the audio engine.

Engine

Running in
–
CPU
–
Newton / sample
–
Matrix
–
Rate
–

Look what the circuit does to the signal

Scope in out
Spectrum in out
Frequency response stock pedal yours small-signal, at the circuit's bias point

Circuit click a part to change it

Parts list
Netlist (JSON) — edit anything, add parts, paste a circuit

Types: R C L (value), V (volts), IN, POT [a, wiper, b] with taper lin/log/rlog, D [anode, cathode] with model si/ge/schottky/led/none, Q [c, b, e] with model si-npn/si-pnp/ge-npn/ge-pnp, OPAMP [in+, in−, out] with rails. Ground is gnd. The output node gets a 1 MΩ load (the amp). Parts not on the drawing still simulate.

How it works the DSP under the paint

It is a circuit simulator, not an effect

Most amp and pedal plug-ins are a chain of filters and waveshapers tuned to sound like the real thing. This page does it the other way around: it takes the schematic, writes Kirchhoff's current law at every node, and solves that system of equations 48,000 times a second (96,000 with 2× oversampling). Swap a part and the equations change; nothing here was tuned by ear.

Modified nodal analysis

Every resistor, capacitor and source is stamped into a matrix: G · x = b, where x holds the node voltages. Capacitors become a conductance plus a current source that remembers the last sample (the companion model: trapezoidal or backward Euler, your pick above). Since the linear part only changes when you touch a value, its matrix is inverted once and reused.

Newton on the nonlinear bits

Diodes, transistors and op-amp saturation don't fit in a matrix. Each sample, the solver guesses their junction voltages, linearises the exponential curves there, solves, and repeats until the guess stops moving: Newton-Raphson, usually two or three rounds. Only those few junction voltages are iterated (the "DK method"), which is what makes it cheap enough for real time in JavaScript.

The plots

The scope and spectrum are the live audio. The frequency response is different: it's the circuit linearised at its DC bias point and solved in the complex domain (jωC for every cap), the way an AC analysis works in SPICE. It tells you what the pedal does to a quiet signal; the scope tells you what it does to a loud one.

Diode and transistor models are simplified SPICE (Shockley, Ebers-Moll); the op-amp is a macro-model with gain, gain-bandwidth and slew rate. Circuit topologies of classic pedals are widely published; names here are generic. Everything runs in your browser; nothing is uploaded, including live input.

Read the notes: the models, the sources, and what each part does to the sound →