Expand description
Optimised conversion: fit the two filters so the pedal itself sounds like the model (docs/05).
The official converter designs G1 and G2 from two measurements and never looks at what the pedal does with them. This module simulates the pedal instead and adjusts G1/G2 until the simulated output matches the model’s on a test signal:
- The pedal (fitted from re-amp recordings, accurate to the rig’s own repeatability):
y = G2 ⊛ f(G1 ⊛ x), with both filters cut toPEDAL_TAPSandfthe fixed saturation curvesaturation. - The target: the model’s output for the same signal (input −12 dB, DC-blocked, scaled to the pedal’s output level).
- The filters: smooth log-magnitude curves at 41 control points (20 Hz × 2^(i/4)), each made minimum-phase, as the official converter’s filters are.
- The fit: Adam on a multi-resolution STFT log-magnitude distance over sweeps, tones and pink
noise at several levels, starting from the
Measure::Cleanconversion. Gradients are written out by hand (no ML framework).
A port of tools/pedalsim (PyTorch); tests/data/optim holds its reference
values.
Structs§
- Optimised
- The result of
optimise. - Options
- Optimiser settings (the defaults are the ones validated on hardware).
- Segment
- A named part of the
TestSignal. - Simulator
- The pedal simulator for one input signal (its block spectra are computed once).
- Test
Signal - The signal the optimiser matches the pedal to the model on (all at
SR).
Enums§
- Weighting
- How the loss weights the STFT bins.
Constants§
- CURVE_
POINTS - Control points of the filter curves: 41, a quarter octave apart from 20 Hz (to 20.48 kHz).
- SR
- Sample rate of the test signal and the simulation.
Functions§
- optimise
- Fit G1/G2 so the simulated pedal matches
model, starting from the responses ininit(2048 floats of upload data, normally aMeasure::Cleanconversion). Runs the model over the test signal once, thenoptions.stepssimulations; about a minute per 300 steps in an optimised build. - optimise_
with_ progress optimise, callingon_step(done, total)after each step (the model render before the first takes about a sixth of the time). Returningfalsestops early with the best result so far.- render_
target - What the pedal should output for
x: the model’s output (input −12 dB, from its reset state), through the app’s DC blocker, at the pedal’s output level. - saturation
- The pedal’s fixed saturation curve
f, applied between G1 and G2 (piecewise linear). - simulate
- The pedal’s output for
xwith user AMPdata(2048 floats as uploaded). - test_
signal - The test signal (about 53 s): the re-amp signal the pedal model was fitted on (log sweeps at −36/−24/−12/−6 dBFS, bass tones at three levels, pink noise at −18 dBFS) followed by pink noise at −36, −24 and −12 dBFS. The fit uses everything but the −18 dBFS pink noise.