Lab

dsp

The audio.js processors the registry's devices are built on, from @audio-ui/engine: compressor and expander models, the gain curves of dynamics, filter circuits, reverbs and biquad shelves, under one dependency.

pnpm add @audio-ui/engine
import { highshelf, lowshelf, magnitude, compandStream, compressorGain, /* … */ } from "@audio-ui/engine/dsp";
audio.js@audio/biquad, @audio/dynamics-compand, @audio/dynamics-compressor, @audio/dynamics-deesser, @audio/dynamics-expander, @audio/dynamics-fet, @audio/dynamics-limiter, @audio/dynamics-opto, @audio/dynamics-unlimit, @audio/dynamics-varimu, @audio/dynamics-vca, @audio/effect-distortion, @audio/filter-diode-ladder, @audio/filter-korg35, @audio/filter-moog-ladder, @audio/filter-oberheim, @audio/reverb-dattorro, @audio/reverb-fdn, @audio/reverb-freeverb, @audio/reverb-schroeder, @audio/reverb-spring
ExportKindWhat it is
highshelffunctionHigh-shelf.
lowshelffunctionLow-shelf.
magnitudefunction|H(f)| of one section at frequency f — analysis/plotting.
compandStreamfunction{ write, flush } streaming primitive underlying the default export's streaming form.
compressorGainfunctionSoft-knee downward compression curve.
compressorconstThe smooth compressor's manifest: an AudioWorklet processor's parameters and state, as its package publishes them.
deesserconstThe de-esser's manifest: its processor's parameters and latency.
expanderGainfunctionSoft-knee downward expansion curve.
upwardExpanderGainfunctionSoft-knee upward expansion curve — the above-threshold complement of expanderGain.
expanderconstThe expander's manifest: its processor's parameters and modes.
fetconstThe FET compressor model's manifest.
limiterLatencyfunctionSamples the output trails the input by: the lookahead, and 96 with truePeak.
optoconstThe opto compressor model's manifest.
unlimitDeficitGainfunctionadaptive (default) pure mapping: transient deficit (crestTarget − peak-held transientness) → target lift (dB), gated by onset presence.
unlimitGainfunctionadaptive:false pure mapping: transientness (fast-over-slow envelope gap, dB) → target lift (dB), before ballistic smoothing.
unlimitconstThe de-limiter's manifest: its processor's parameters.
varimuconstThe vari-mu compressor model's manifest.
vcaconstThe VCA compressor model's manifest.
distortionfunctionMutates data in place and returns the same reference.
diodeLadderfunctionThe diode ladder filter, run over a buffer in place.
korg35functionThe Korg35 filter, run over a buffer in place.
moogLadderfunctionThe Moog ladder filter, two or four poles, run over a buffer in place.
oberheimfunctionThe Oberheim SEM state-variable filter, run over a buffer in place.
dattorrofunctionProcess in place.
fdnfunctionProcess in place.
freeverbfunctionProcess in place.
schroederfunctionProcess a mono buffer in place; returns the same array.
springfunctionProcess a mono buffer in place; returns the same array.

Usage

A device describes its parameters itself, and takes the processors it is made of from here: the models a compressor offers, the gain curve a panel draws, the circuits of a filter, the reverbs a room is rendered with. They are the audio.js atoms' own, under the names the devices use, so a project depends on @audio-ui/engine and not on each atom:

import { compressorGain, moogLadder } from "@audio-ui/engine/dsp";

// At -10 dB in, a -20 dB threshold, 4:1 and a 6 dB knee: -7.5 dB of gain.
compressorGain(-10, -20, 4, 6);
WhatExports
Dynamics models, each the manifest of an AudioWorklet processorcompressor, fet, opto, varimu, vca, deesser, expander, unlimit
Gain curves, for a panel's transfer curvecompressorGain, expanderGain, upwardExpanderGain, unlimitGain, unlimitDeficitGain, compandStream
Filter circuitsmoogLadder, diodeLadder, korg35, oberheim
Reverbsdattorro, fdn, freeverb, schroeder, spring
Shaping and filtersdistortion, lowshelf, highshelf, magnitude, limiterLatency

A device's engine runs the same atoms in an AudioWorklet through kernels.

Built by Ouest Labs, the source code is available on GitHub.
RSS