Skip to Content
Soundor Skills

DSP debugging

A reference of the soundor-debug-plugin skill.

soundor-debug-plugin reads this reference when a task needs it. Source on GitHub

Reproduce audio bugs in a Rust test with soundor::testing::TestProcessor first: it is fast, deterministic, and isolates the processor from the host and UI. If the test passes but the plugin is wrong, the problem is in the wiring (see architecture debugging) or depends on what the host does (block sizes, sample rate, layout): reproduce that in the test.

Measure, don't listen: compute peak, RMS, the dominant frequency, the first non-finite sample, the largest sample-to-sample jump.

SymptomLikely causesEvidence to gather
Silenceoutput not written; written to a copy; gain or mix at 0; a panic silenced the instance; wrong layoutoutput RMS in a test; the parameter values the processor sees; host log for a panic; ctx.layout
Silence after a whileNaN or infinity in filter state; a panic; a voice or envelope never retriggeredfind the first non-finite sample; process long signals; extreme parameters
Wrong gaindB used as linear (or the reverse); gain applied twice; channels summed without scalingRMS ratio at a known input; the parameter's unit and the conversion
Distortionclipping from excess gain; aliasing from a nonlinearity; wrong coefficients; integer or f32 precisionspectrum of a sine through it (extra partials, folded ones); output peak
Clicks on parameter changesno smoothing; smoothing restarted each block; coefficients jumping in a direct-form filterlargest jump between consecutive samples while automating
Clicks at block boundariesstate reset per block; ramp computed from the wrong start; buffer indexing off by onewhole versus irregular-block processing ([1, 37, 512]) must match
Runaway or unstable feedbackloop gain ≥ 1 at some setting; filter poles outside the unit circle at extreme cutoff or Qimpulse response that grows; sweep the parameter extremes
Wrong frequency responsesample rate not used in the design; Nyquist not clamped; degrees for radians; Q or bandwidth confusiongain at several frequencies against the design; repeat at 44.1 and 96 kHz
Different at other ratesconstants in samples instead of seconds; coefficients computed once for 48 kHzthe same test at several sample_rates
One channel wrong or silentshared filter state between channels; loop over a fixed two channels; mono layout not handledleft-only input; mono and stereo layouts
Wrong after reset or repreparestate not cleared, or buffers not resized for the new rateprocess, reset(), silence in; prepare() at another rate
Dropouts, crackles under loadallocation, locks, logging, I/O or unbounded work in process(); denormals in decaying tailsCountingAllocator test across all paths; read the call path; CPU over a long silent tail
High CPUper-sample transcendental functions; recomputing coefficients per sample; debug builds; denormalsa release-mode benchmark test (cargo test --release -- --ignored)
Native and web differf32/f64 math differences in transcendental functions; a dependency behaving differently on wasmcompare outputs with a small tolerance; assert the signal is not silent

Real-time problems

Allocation and blocking on the audio thread show as occasional dropouts, not wrong values. To find them:

  1. Add or extend a CountingAllocator test that runs every code path (each mode, bypass, extreme parameters, resource changes) and asserts allocations() == 0.
  2. Read every function process() calls, including dependencies, for allocation, Mutex, channels, logging, I/O, Arc drops, Vec growth.
  3. Move what you find to prepare(), the controller, or resources.

Never debug by adding println! or logging to process(). Publish the value you want to see through a stream (ctx.streams.debug.publish(x)) in a Debug build, or assert it in a test.

Fix and verify

Fix the cause (not the symptom: do not clamp NaNs at the output and stop). Re-run the failing test and the whole crate's tests, then the end-to-end audio check that showed the bug. Keep the reproducing test.

On this page