Visualizations
A reference of the soundor-plugin-design skill.
soundor-plugin-design reads this reference when a task needs it. Source on GitHub
Graphs and meters make a plugin understandable. They also run every frame, so they must be cheap.
Data from the audio side
Declare a native stream for each live value (native.streams in
soundor.config.ts): a number for a level, a buffer<float32> with a
maxLength for a spectrum. The processor publishes; the UI receives the
latest, at most once a frame.
- For text and simple markup,
useNativeStream(streams.peak)from@soundor/reactre-renders when a newer value arrives. - For anything drawn (spectra, waveforms, meters at 60 fps), do not put the data in React state: pass it to a component that draws it, or subscribe in an effect and draw into a canvas:
import { useEffect } from 'react';
import { streams } from 'soundor:native';
useEffect(() => streams.spectrum.subscribe((bins) => draw(bins)), []);Soundor Components' Plot, LevelMeter and Spectrogram are built for
live data; see "Live plot data" in the Components docs.
Frequency response graphs
- Log frequency axis, 20 Hz to 20 kHz (or Nyquist), with gridlines at decades and labels at 100, 1k, 10k; linear dB axis with a range that fits the controls (±12, ±24 dB).
- Draw the curve the DSP actually implements: compute it from the same design formulas, and test that graph and audio agree (Prism holds its graph and its filters to the same designs, and tests them together).
- Band handles are draggable markers, numbered and color-coded, with the frequency and gain readable while dragging. Keyboard-movable.
Spectrum
- Window and average in the processor or the UI (fast, medium, slow ballistics); show a floor (for example −90 dBFS) rather than drawing noise to −∞.
- Optional tilt (4.5 dB/octave is common) so pink-ish music looks flat.
- Draw behind the response curve, lower contrast than it.
Meters
- Peak and RMS, in dBFS, on a scale that compresses low levels (for example −60 to 0 dB with more resolution near 0).
- Ballistics: fast attack, slower release (a few hundred ms), and a peak hold. Do the smoothing where it is consistent: in the processor before publishing, or in the UI per frame, not both.
- A clip indicator that latches and clears on click.
- Gain-reduction meters grow downward from 0 dB.
Envelope editors
Handles for each stage, times on a log or adaptive axis, values shown while
dragging, each handle keyboard-adjustable. EnvelopeEditor does this.
Performance
- Never allocate per frame in drawing code: reuse arrays and paths.
- Draw only what changed; static grids and labels go in a separate layer that is not redrawn.
- Keep stream buffers small (a few hundred points for a spectrum is enough for a display).