@maruaudio/dsp/noise/coloured is a deterministic noise source: white noise from @maru/noise-xorshift32 mapped to [−1, 1) at f32, optional pink or brown colouring, a signed tone tilt and an output level.
- Pink: two one-pole sections (0.99765 and 0.963) plus a direct term, scaled by 0.32.
- Brown:
brown = clamp(brown × 0.995 + white × 0.045, −1, 1). - Tilt: a one-pole split at a fixed 1200 Hz into low and high parts, gains of
∓tone × 0.06dB, normalized by√((low² + high²)/2). Negative tone lowers the top, positive lowers the bottom; neither part is muted.
Parameters
| Setter | Range the setter enforces | Default |
|---|---|---|
seedNoiseNode | seed >>> 0; 0 selects NOISE_DEFAULT_SEED (2463534242) | 2463534242 |
setNoiseNodeType | Rounded, then 0 to 2: NOISE_WHITE, NOISE_PINK, NOISE_BROWN | White |
setNoiseNodeTone | −100 to 100 (±6 dB tilt) | 0 |
setNoiseNodeGain | 0 to 1; read by noiseNodeOutput only | 1 |
Lifecycle
initNoiseNode → seedNoiseNode → setters → noiseNodeTick or noiseNodeOutput. Seeding sets the stream and clears the pink, brown and tone accumulators, so it doubles as reset. noiseNodeTickWhite advances the stream without colour. Ticks allocate nothing and do no I/O; each tick calls pow twice and sqrt once for the tilt.
When to use it
A seeded noise source for synth voices, test signals or modulation, when the same seed must render the same samples on every target, with a coarse brightness control rather than a filter.
Limits
- Mono sample tick, no input.
- The tilt's one-pole coefficient is
clamp(1200 / sampleRate, 0.001, 1); tone is a tilt, not a moving cutoff. - Colour and output samples are rounded to f32; the tilt's low-pass accumulator is a double.
- The clamps are the kernel node's conditional clamp, not the
math/rangepolicy.