Model the circuit.
Describe a real analog circuit, part by part, and Maru solves it sample by sample. The knobs move real component values, so controls, saturation and accents respond the way the hardware does.
The idea
Model the parts, and the sound follows
A hand-written effect imitates what a circuit sounds like. A circuit model starts from the schematic instead: every resistor, capacitor, diode and transistor, wired the way the board is. The sound is what that circuit does to the signal, so it keeps the behavior nobody wrote down.
Controls that interact
Knobs share one circuit, so turning one changes what the others do, as it does on the hardware.
Saturation where it happens
Diodes and transistors bend the signal at the voltages their own equations give, not where a curve was drawn.
Accents and dynamics
Drive the circuit harder and it answers differently: a louder hit has a different shape, not just more level.
Values you can check
Every part carries the value printed on the schematic, so the model can be compared with the circuit it came from.
How it works
From schematic to sound
The solver uses the nodal DK method, published by Yeh, Abel and Smith in 2010 and generalized by Holters and Zölzer in 2015. Maru’s implementation is written from those papers.
Schematic
Start from a circuit diagram: a published schematic, a service manual or your own design.
Netlist
Write each part as one line, as in SPICE: what it is, the nodes it connects and its value.
Equations, once
When the circuit is prepared, the solver turns the netlist into a compact set of equations and settles it at its resting voltages.
Each sample
Only the diodes and transistors need solving, a few unknowns at a time. Everything else is a fixed matrix product.
Real knobs
A pot is a real resistor in the circuit. Moving it changes that value, rebuilds the equations once, and the circuit carries on from where it was.
The clipper as a netlist
One line per part. The pot is a parameter named drive, with an audio taper.
* Diode clipper with a drive pot
Vin in 0 INPUT=in ; audio input, volts
P1 0 x in 100k NAME=drive VALUE=0.5 TAPER=log
R1 x mid 2.2k
C1 mid 0 10n
D1 mid 0 IS=2.52n N=1.752
D2 0 mid IS=2.52n N=1.752
.output out mid 0Running it in a module
Parse and allocate once, rebuild when the pot moves, then one call per sample.
const netlist = parseCircuitNetlist(`
Vin in 0 INPUT=in
P1 0 x in 100k NAME=drive VALUE=0.5 TAPER=log
R1 x mid 2.2k
C1 mid 0 10n
D1 mid 0 IS=2.52n N=1.752
D2 0 mid IS=2.52n N=1.752
.output out mid
`)
const DRIVE = circuitParameterIndex(netlist, "drive")
// createState: allocate once for this topology
const circuit = initCircuit(netlist)
// prepare: build the model at the host rate and settle at DC
prepareCircuit(circuit, 48000)
// control path: move the pot, rebuild once
setCircuitParameter(circuit, DRIVE, 0.8)
updateCircuit(circuit)
// process: one call per sample, volts in, volts out
for (let frame = 0; frame < frameCount; frame++) {
output[frame] = circuitTick(circuit, 0.5 * input[frame])
}Try it
Turn the knob, watch the circuit
This page runs the solver on the clipper netlist above, in your browser, and draws what it computes. Turn Drive, the netlist’s pot, or change the sine going in. Nothing plays: the demo is silent.
Running the circuit…
Build
What you can build with it
The solver handles resistors, capacitors, inductors, pots, switches, diodes, bipolar transistors, op-amps (ideal, finite-gain, or a macro-model with gain-bandwidth, slew rate and rails), voltage and current sources, audio inputs and output probes. That covers a wide range of classic circuits.
Drum voices
Resonant drum circuits of transistors, op-amps, resistors and capacitors, like those in a classic analog drum machine, where the trigger itself shapes the hit.
Filters
RC and RLC networks and op-amp stages such as a Sallen-Key low-pass, with pots that move the real cutoff and resonance parts.
Pedals and clippers
Diode clippers, transistor drive stages and op-amp stages that round off as you dig in. An op-amp can be ideal, or a macro-model with gain-bandwidth, slew rate and soft supply rails where its clipping matters.
A circuit can have up to 64 unknowns (its nodes, plus one for each voltage source and op-amp), 32 capacitors and inductors, and 16 device junctions, where a diode has one and a transistor two. Devices outside that list, such as tubes and field-effect transistors, are not part of the solver.
The solver runs at the rate you give it. When a circuit’s treble or its distortion must match the analog original, its oversampled runner steps it at 2, 4 or 8 times the host rate, with a fixed latency of whole samples. Move pots at control rate rather than audio rate.
Choosing an approach
One of several ways to model a sound
Maru has several modeling approaches, and one module can combine them. Pick the one that matches where the sound comes from.
Circuit modeling
Solves the electronics part by part.
Pick it when you have a schematic and want the controls, drive and accents to behave as the circuit does.
Learn circuit modelingPhysical modeling
Simulates something that vibrates.
Pick it when the sound comes from strings, bars or membranes rather than from electronics.
Learn physical modelingNeural captures
Learns a device from recordings.
Pick it when you want the sound of one amp or pedal at one setting, and you can record the gear.
Learn about neural ampsClassic DSP
Designs the effect for its sound.
Pick it when there is no hardware to match, or you want something light and predictable.
Explore DSP building blocks
Checked
Measured against known answers
The solver’s tests render circuits through the real solver and compare them with answers worked out independently: the expected responses of an RC low-pass, an RLC resonator and a Sallen-Key low-pass; the voltages of a divider and a pot sweep; op-amp gain; a diode clipper integrated separately; and a transistor stage’s operating point and gain, solved by hand. Other tests drive it with hot inputs and check that the realtime path allocates no memory.
The output is always a finite number. When a sample’s solve does not settle within its bounded number of steps, the solver keeps the last answer it reached and counts the miss, so a model can report it.
These checks show that the solver solves the circuit correctly. Whether a model sounds like a particular piece of hardware is a separate question, answered by measuring the model against that hardware and by listening.
Circuit models built from published schematics are independent software. They are not made or endorsed by the original manufacturers.
Start from the schematic
Learn how circuit models work, or start building with the solver.