Skip to content

sweepMatchesIndependent

sweepMatchesIndependent(program, points, options?, toleranceDb?): boolean

Defined in: packages/runtime/src/settle.ts:1123

Does sharing a runtime change the answer? Compare a sweep against independent renders.

This replaces an order check, which was the wrong question. sweepIsOrderIndependent asked whether sweeping forwards and backwards agreed, and on boss-lm-2 — a limiter — it answered true while the sweep was wrong by 84 dB:

swept: 1.067e-6 1.057e-6 1.067e-6 1.058e-6
independent: 1.821e-2 1.056e-6 1.821e-2 1.056e-6

The hazard is not the sequence of points, it is sharing state at all. settledSweep settles once before the first point, and for an envelope circuit that initial settle drives the compressor into gain reduction that no later point recovers from — so every point is poisoned equally, forwards and backwards alike, and an order check sees perfect agreement.

The only sound validation is against the thing the sweep is an optimisation of. Circuits at risk are the ones carrying state across a control change: compressors, limiters, noise gates, envelope filters, slow LFOs, anything with a long-tailed bias.

Program

readonly readonly readonly [string, number][][]

SettledRenderOptions = {}

number = 0.5

boolean