RYEWIRED Docs

How the simulation works

RYEWIRED doesn’t play back canned effects. It solves your circuit as an electrical network, then builds the audio you hear from the results. Understanding the basic process helps explain what the simulation does well, and where its limits are.

Three stages, every tick

About 100 times per second, RYEWIRED performs three operations:

  1. Resolve the connections. Every hole, jumper, and closed switch is mapped into a set of electrical nets.
  2. Solve the DC operating point. Nodal analysis across the network calculates the steady voltage at every net.
  3. Solve the small-signal response. The network is linearized around that operating point and solved again to calculate the gain from the input to every other net.

The audio graph uses these results to build the sound you hear: gain stages for amplifying elements and clipping curves based on the available output swing.

Nets

Before the circuit can be solved, RYEWIRED needs to know which holes are electrically connected.

Column strips connect holes within each half of the board. Power rails connect across the board’s width. Jumpers connect the holes at their ends, and closed switches connect their terminals.

Components are different. Their terminals are not directly connected to each other. Current must pass through the component according to its electrical model. If a jumper connects both terminals of a component, it bypasses the component and effectively shorts it out.

The DC solve

Nodal analysis builds a matrix from the network and solves for the voltage at every net. Nonlinear components require iteration: the solver estimates their operating states, solves the network, checks the results against those estimates, and repeats until the solution settles.

This produces the readings shown by the voltage meter and establishes the circuit’s bias conditions.

A transistor’s operating state, such as cutoff, active, or saturation, is determined during this process. RYEWIRED requires a state decision to hold for two consecutive iterations before committing to it. This helps prevent a circuit sitting near a state boundary from switching back and forth between two answers.

Converging is not the same as being right

A solver can settle on an answer that doesn’t match what a real circuit would do. If a transistor appears saturated in RYEWIRED but published measurements for the same circuit show otherwise, investigate the discrepancy rather than assuming the simulation is correct.

The small-signal solve

Gain isn’t calculated using a separate formula for each component. After the DC solve, RYEWIRED linearizes the network around its operating point and solves it again.

For this calculation, the supply is treated as AC ground, coupling capacitors are treated as shorts, and transistors are replaced with their small-signal equivalents. The input is driven by an ideal 1 V source.

The resulting voltage at each net represents its gain relative to the input. This network-wide approach has several advantages:

  • Feedback works. The solver handles loops in the network. In a Fuzz Face-style circuit, for example, the collector-to-base resistor affects the first stage’s gain as the Fuzz pot moves.
  • Loading works. A 10 k volume pot and a 1 M volume pot produce different gains in the stage driving them because the pot is included in the network calculation.
  • Potentiometers are modeled consistently. Volume, tone, gain, and rate controls all behave according to their electrical connections, rather than relying on separate rules for each application.

Frequency response

RYEWIRED also uses nodal analysis to calculate frequency response. This calculation uses complex arithmetic, with capacitors represented by frequency-dependent admittances. The network can therefore be evaluated at different frequencies.

Coupling-capacitor corner frequencies are found by repeatedly evaluating the network to locate its actual −3 dB point. This includes the source and load impedances configured on the workbench. Changing the source impedance can therefore shift the frequency at which the circuit’s bass begins to roll off.

The source impedance also affects the signal level entering the circuit. Transistor and op-amp gains are calculated relative to an ideal 1 V input. The actual source impedance interacts with the circuit’s input impedance, reducing the signal that reaches it. RYEWIRED calculates this reduction and applies it once at the input. The calculation is updated as the controls change.

Building the audio

The audio graph is a chain of Web Audio nodes, including gain nodes, filters, and a waveshaper for each clipping stage.

The clipping curves are particularly important. Each transistor stage has limits on how far its output can swing in either direction. Those limits are calculated from the DC operating point in volts, rather than guessed from a normalized signal level.

The limits are often unequal, producing asymmetric clipping. For example, a stage that can swing 1.4 V in one direction but 7.4 V in the other will clip differently on each half of the waveform. This asymmetry can introduce even harmonics into the output.

Oversampling

Each clipping stage runs at 4× oversampling. Hard clipping generates harmonics beyond the audio sample rate. Without oversampling, those harmonics can fold back into the audible range as inharmonic distortion, often heard as unwanted fizz.

Before oversampling was added, tests measured 16 to 21 dB of folded energy. Running the clipping stages at a higher sample rate reduces this aliasing.

Live updates

Changes take two different paths, depending on what changed.

  • Value changes update the existing audio graph. New gain values and clipping curves replace the previous ones without rebuilding the graph.
  • Topology changes require a rebuild. In normal operation, this happens when a switch is toggled, since other editing is locked while the pedal is engaged. RYEWIRED resolves the new connections and rebuilds the audio graph without restarting the audio source.

What is deliberately not modeled

RYEWIRED focuses on how a pedal sounds and responds, not on laboratory completeness. Some aspects of circuit behavior are outside its scope:

  • Per-sample nonlinear solving: A true SPICE-style transient simulation would solve nonlinear behavior at audio rate, with a substantial ongoing CPU cost in a browser. RYEWIRED updates its operating-point and gain calculations at block rate instead.
  • Amplifiers, speakers, and cabinets: The goal is to simulate the pedal under realistic input and output conditions. Modeling what comes after the pedal is a much larger problem.
  • Inductors: There is no inductor component to place on the board. A guitar pickup’s coil inductance is modeled through the signal input’s Source Inductance setting in the frequency-response calculation, but the level loss at the input uses its resistance only.
  • General impedance interactions: Some circuit arrangements, such as a shunt capacitor beside a series resistor, are handled as recognized cases rather than derived from the complete network in every situation.

Where a tradeoff is necessary, RYEWIRED prioritizes the electrical characteristics that have the greatest influence on the sound and response of a pedal.