# kernels

> The audio.js kernels each device of the registry runs in an AudioWorklet, from @audio-ui/engine: every module as published, in a string, since a worklet cannot import.

```bash
npm install @audio-ui/engine
```

```ts
import { BASS_ENHANCER_KERNELS, BINAURAL_PANNER_KERNELS, CHORUS_KERNELS, COMPANDER_KERNELS, COMPRESSOR_KERNELS, /* … */ } from "@audio-ui/engine/kernels";
```

- audio.js: [`@audio/biquad`](https://audio.js.org/modules/biquad/), [`@audio/dynamics-compand`](https://audio.js.org/modules/dynamics-compand/), [`@audio/dynamics-compressor`](https://audio.js.org/modules/dynamics-compressor/), [`@audio/dynamics-deesser`](https://audio.js.org/modules/dynamics-deesser/), [`@audio/dynamics-ducker`](https://audio.js.org/modules/dynamics-ducker/), [`@audio/dynamics-envelope`](https://audio.js.org/modules/dynamics-envelope/), [`@audio/dynamics-expander`](https://audio.js.org/modules/dynamics-expander/), [`@audio/dynamics-fet`](https://audio.js.org/modules/dynamics-fet/), [`@audio/dynamics-gate`](https://audio.js.org/modules/dynamics-gate/), [`@audio/dynamics-limiter`](https://audio.js.org/modules/dynamics-limiter/), [`@audio/dynamics-opto`](https://audio.js.org/modules/dynamics-opto/), [`@audio/dynamics-transient-shaper`](https://audio.js.org/modules/dynamics-transient-shaper/), [`@audio/dynamics-unlimit`](https://audio.js.org/modules/dynamics-unlimit/), [`@audio/dynamics-varimu`](https://audio.js.org/modules/dynamics-varimu/), [`@audio/dynamics-vca`](https://audio.js.org/modules/dynamics-vca/), [`@audio/effect-autowah`](https://audio.js.org/modules/effect-autowah/), [`@audio/effect-bitcrusher`](https://audio.js.org/modules/effect-bitcrusher/), [`@audio/effect-chorus`](https://audio.js.org/modules/effect-chorus/), [`@audio/effect-exciter`](https://audio.js.org/modules/effect-exciter/), [`@audio/effect-freqshift`](https://audio.js.org/modules/effect-freqshift/), [`@audio/effect-graindelay`](https://audio.js.org/modules/effect-graindelay/), [`@audio/effect-lofi`](https://audio.js.org/modules/effect-lofi/), [`@audio/effect-multitap`](https://audio.js.org/modules/effect-multitap/), [`@audio/effect-noiseshaper`](https://audio.js.org/modules/effect-noiseshaper/), [`@audio/effect-phaser`](https://audio.js.org/modules/effect-phaser/), [`@audio/effect-pingpong`](https://audio.js.org/modules/effect-pingpong/), [`@audio/effect-ringmod`](https://audio.js.org/modules/effect-ringmod/), [`@audio/effect-rotary`](https://audio.js.org/modules/effect-rotary/), [`@audio/effect-stutter`](https://audio.js.org/modules/effect-stutter/), [`@audio/effect-subbass`](https://audio.js.org/modules/effect-subbass/), [`@audio/effect-wah`](https://audio.js.org/modules/effect-wah/), [`@audio/eq-crossover`](https://audio.js.org/modules/eq-crossover/), [`@audio/eq-tilt`](https://audio.js.org/modules/eq-tilt/), [`@audio/filter-diode-ladder`](https://audio.js.org/modules/filter-diode-ladder/), [`@audio/filter-korg35`](https://audio.js.org/modules/filter-korg35/), [`@audio/filter-moog-ladder`](https://audio.js.org/modules/filter-moog-ladder/), [`@audio/filter-oberheim`](https://audio.js.org/modules/filter-oberheim/), [`@audio/spatial-binaural`](https://audio.js.org/modules/spatial-binaural/), [`@audio/spatial-microshift`](https://audio.js.org/modules/spatial-microshift/)

| Export | Kind | What it is |
| --- | --- | --- |
| `BASS_ENHANCER_KERNELS` | const | audio.js kernels, each module as published, in its own scope, for an `AudioWorklet`, which cannot import them: - `@audio/effect-subbass` 1.2.0 (MIT, Dmitry Iv.): `subbass` |
| `BINAURAL_PANNER_KERNELS` | const | audio.js kernels, each module as published, in its own scope, for an `AudioWorklet`, which cannot import them: - `@audio/spatial-binaural` 0.1.1 (MIT, Dmitry Iv.): `binaural` |
| `CHORUS_KERNELS` | const | audio.js kernels, each module as published, in its own scope, for an `AudioWorklet`, which cannot import them: - `@audio/effect-chorus` 2.0.2 (MIT, Dmitry Iv.): `chorus` |
| `COMPANDER_KERNELS` | const | audio.js kernels, each module as published, in its own scope, for an `AudioWorklet`, which cannot import them: - `@audio/dynamics-envelope` 0.1.4 (MIT, Dmitry Iv.): `timeCoef`, as `module0` - `@audio/dynamics-envelope` 0.1.4 (MIT, Dmitry Iv.): `envelope`, as `module1` - `@audio/dynamics-compand` 0.1.7 (MIT, Dmitry Iv.): `writer`, `concat`, `db2lin`, `lin2db`, as `module2` - `@audio/dynamics-compand` 0.1.7 (MIT, Dmitry Iv.): `compandStream`, as `module3` - `@audio/dynamics-compand` 0.1.7 (MIT, Dmitry Iv.): `compand` |
| `COMPRESSOR_KERNELS` | const | audio.js kernels, each module as published, in its own scope, for an `AudioWorklet`, which cannot import them: - `@audio/dynamics-envelope` 0.1.4 (MIT, Dmitry Iv.): `timeCoef`, as `module0` - `@audio/dynamics-envelope` 0.1.4 (MIT, Dmitry Iv.): `envelope`, as `module1` - `@audio/dynamics-compressor` 0.2.1 (MIT, Dmitry Iv.): `writer`, `concat`, `db2lin`, `lin2db`, as `module2` - `@audio/dynamics-compressor` 0.2.1 (MIT, Dmitry Iv.): `compressorGain`, as `module3` - `@audio/dynamics-vca` 0.2.5 (MIT, Dmitry Iv.): `writer`, `concat`, `db2lin`, `lin2db`, `timeCoef`, as `module4` - `@audio/dynamics-vca` 0.2.5 (MIT, Dmitry Iv.): `vcaStream`, as `module5` - `@audio/dynamics-vca` 0.2.5 (MIT, Dmitry Iv.): `vca` - `@audio/dynamics-fet` 0.2.5 (MIT, Dmitry Iv.): `writer`, `concat`, `db2lin`, `lin2db`, `timeCoef`, as `module7` - `@audio/dynamics-fet` 0.2.5 (MIT, Dmitry Iv.): `fetStream`, as `module8` - `@audio/dynamics-fet` 0.2.5 (MIT, Dmitry Iv.): `fet` - `@audio/dynamics-opto` 0.2.5 (MIT, Dmitry Iv.): `writer`, `concat`, `db2lin`, `lin2db`, `timeCoef`, as `module10` - `@audio/dynamics-opto` 0.2.5 (MIT, Dmitry Iv.): `optoStream`, as `module11` - `@audio/dynamics-opto` 0.2.5 (MIT, Dmitry Iv.): `opto` - `@audio/dynamics-varimu` 0.2.4 (MIT, Dmitry Iv.): `writer`, `concat`, `db2lin`, `lin2db`, `timeCoef`, as `module13` - `@audio/dynamics-varimu` 0.2.4 (MIT, Dmitry Iv.): `varimuStream`, as `module14` - `@audio/dynamics-varimu` 0.2.4 (MIT, Dmitry Iv.): `varimu` - `@audio/dynamics-compressor` 0.3.1 (MIT, Dmitry Iv.): `writer`, `concat`, `db2lin`, `lin2db`, `timeCoef`, as `module16` - `@audio/dynamics-compressor` 0.3.1 (MIT, Dmitry Iv.): `compress`, `compressorState`, as `module17` - `@audio/dynamics-compressor` 0.3.1 (MIT, Dmitry Iv.): `compressor` |
| `DEESSER_KERNELS` | const | audio.js kernels, each module as published, in its own scope, for an `AudioWorklet`, which cannot import them: - `@audio/dynamics-envelope` 0.1.4 (MIT, Dmitry Iv.): `timeCoef`, as `module0` - `@audio/dynamics-envelope` 0.1.4 (MIT, Dmitry Iv.): `envelope`, as `module1` - `@audio/dynamics-compressor` 0.2.1 (MIT, Dmitry Iv.): `writer`, `concat`, `db2lin`, `lin2db`, as `module2` - `@audio/dynamics-compressor` 0.2.1 (MIT, Dmitry Iv.): `compressorGain`, as `module3` - `@audio/biquad` 1.2.2 (MIT, Dmitry Iv.): `lowpass`, `highpass`, `step`, `state`, as `module4` - `@audio/dynamics-deesser` 0.4.1 (MIT, Dmitry Iv.): `writer`, `db2lin`, `timeCoef`, `smoother`, as `module5` - `@audio/dynamics-deesser` 0.4.1 (MIT, Dmitry Iv.): `deesserStream`, `latency`, as `module6` - `@audio/dynamics-deesser` 0.4.1 (MIT, Dmitry Iv.): `deesser` |
| `DELAY_KERNELS` | const | audio.js kernels, each module as published, in its own scope, for an `AudioWorklet`, which cannot import them: - `@audio/effect-pingpong` 1.1.5 (MIT, Dmitry Iv.): `pingPong` - `@audio/effect-multitap` 1.1.6 (MIT, Dmitry Iv.): `multitap` - `@audio/effect-graindelay` 1.1.6 (MIT, Dmitry Iv.): `graindelay` |
| `DUCKER_KERNELS` | const | audio.js kernels, each module as published, in its own scope, for an `AudioWorklet`, which cannot import them: - `@audio/dynamics-envelope` 0.1.4 (MIT, Dmitry Iv.): `timeCoef`, as `module0` - `@audio/dynamics-envelope` 0.1.4 (MIT, Dmitry Iv.): `envelope`, as `module1` - `@audio/dynamics-compressor` 0.2.1 (MIT, Dmitry Iv.): `writer`, `concat`, `db2lin`, `lin2db`, as `module2` - `@audio/dynamics-compressor` 0.2.1 (MIT, Dmitry Iv.): `compressorGain`, as `module3` - `@audio/dynamics-ducker` 0.1.9 (MIT, Dmitry Iv.): `db2lin`, `lin2db`, as `module4` - `@audio/dynamics-ducker` 0.1.9 (MIT, Dmitry Iv.): `ducker` |
| `EXCITER_KERNELS` | const | audio.js kernels, each module as published, in its own scope, for an `AudioWorklet`, which cannot import them: - `@audio/effect-exciter` 1.2.1 (MIT, Dmitry Iv.): `exciter` |
| `EXPANDER_KERNELS` | const | audio.js kernels, each module as published, in its own scope, for an `AudioWorklet`, which cannot import them: - `@audio/dynamics-envelope` 0.1.4 (MIT, Dmitry Iv.): `timeCoef`, as `module0` - `@audio/dynamics-envelope` 0.1.4 (MIT, Dmitry Iv.): `envelope`, as `module1` - `@audio/dynamics-expander` 0.2.2 (MIT, Dmitry Iv.): `writer`, `concat`, `db2lin`, `lin2db`, as `module2` - `@audio/dynamics-expander` 0.2.2 (MIT, Dmitry Iv.): `expanderGain`, `upwardExpanderGain`, as `module3` - `@audio/dynamics-expander` 0.2.2 (MIT, Dmitry Iv.): `expander` |
| `FILTER_KERNELS` | const | audio.js kernels, each module as published, in its own scope, for an `AudioWorklet`, which cannot import them: - `@audio/filter-moog-ladder` 1.2.0 (MIT, Dmitry Iv.): `moogLadder` - `@audio/filter-diode-ladder` 1.2.2 (MIT, Dmitry Iv.): `diodeLadder` - `@audio/filter-korg35` 1.2.1 (MIT, Dmitry Iv.): `korg35` - `@audio/filter-oberheim` 1.2.1 (MIT, Dmitry Iv.): `oberheim` |
| `FREQUENCY_SHIFTER_KERNELS` | const | audio.js kernels, each module as published, in its own scope, for an `AudioWorklet`, which cannot import them: - `@audio/effect-freqshift` 1.1.6 (MIT, Dmitry Iv.): `frequencyShifter` - `@audio/effect-ringmod` 1.1.5 (MIT, Dmitry Iv.): `ringMod` |
| `GATE_KERNELS` | const | audio.js kernels, each module as published, in its own scope, for an `AudioWorklet`, which cannot import them: - `@audio/dynamics-envelope` 0.1.4 (MIT, Dmitry Iv.): `timeCoef`, as `module0` - `@audio/dynamics-envelope` 0.1.4 (MIT, Dmitry Iv.): `envelope`, as `module1` - `@audio/dynamics-gate` 0.1.7 (MIT, Dmitry Iv.): `writer`, `concat`, `db2lin`, `timeCoef`, as `module2` - `@audio/dynamics-gate` 0.1.7 (MIT, Dmitry Iv.): `gateStream`, as `module3` - `@audio/dynamics-gate` 0.1.7 (MIT, Dmitry Iv.): `gate` |
| `LIMITER_KERNELS` | const | audio.js kernels, each module as published, in its own scope, for an `AudioWorklet`, which cannot import them: - `@audio/dynamics-limiter` 0.2.1 (MIT, Dmitry Iv.): `writer`, `concat`, `db2lin`, `timeCoef`, as `module0` - `@audio/dynamics-limiter` 0.2.1 (MIT, Dmitry Iv.): `limiterStream`, `latency`, as `module1` - `@audio/dynamics-limiter` 0.2.1 (MIT, Dmitry Iv.): `limiter` |
| `LOFI_KERNELS` | const | audio.js kernels, each module as published, in its own scope, for an `AudioWorklet`, which cannot import them: - `@audio/effect-lofi` 1.1.6 (MIT, Dmitry Iv.): `lofi` |
| `MID_SIDE_KERNELS` | const | audio.js kernels, each module as published, in its own scope, for an `AudioWorklet`, which cannot import them: - `@audio/spatial-microshift` 1.1.3 (MIT, Dmitry Iv.): `shifter` |
| `PHASER_KERNELS` | const | audio.js kernels, each module as published, in its own scope, for an `AudioWorklet`, which cannot import them: - `@audio/effect-phaser` 1.1.6 (MIT, Dmitry Iv.): `phaser` |
| `REDUX_KERNELS` | const | audio.js kernels, each module as published, in its own scope, for an `AudioWorklet`, which cannot import them: - `@audio/effect-bitcrusher` 1.1.5 (MIT, Dmitry Iv.): `bitcrusher` - `@audio/effect-noiseshaper` 1.1.5 (MIT, Dmitry Iv.): `noiseShaping` |
| `ROTARY_KERNELS` | const | audio.js kernels, each module as published, in its own scope, for an `AudioWorklet`, which cannot import them: - `digital-filter` 2.4.3 (MIT, Dmitry Iv.): `polesSos` - `digital-filter` 2.4.3 (MIT, Dmitry Iv.): `butterworth` - `digital-filter` 2.4.3 (MIT, Dmitry Iv.): `linkwitzRiley` - `@audio/eq-crossover` 1.0.2 (MIT, Dmitry Iv.): `crossover` - `@audio/biquad` 1.2.2 (MIT, Dmitry Iv.): `step`, `state` - `@audio/effect-rotary` 0.1.2 (MIT, Dmitry Iv.): `rotary` |
| `STUTTER_KERNELS` | const | audio.js kernels, each module as published, in its own scope, for an `AudioWorklet`, which cannot import them: - `@audio/effect-stutter` 1.1.6 (MIT, Dmitry Iv.): `stutter` |
| `TILT_EQ_KERNELS` | const | audio.js kernels, each module as published, in its own scope, for an `AudioWorklet`, which cannot import them: - `@audio/biquad` 1.2.2 (MIT, Dmitry Iv.): `lowshelf`, `highshelf`, `filter` - `@audio/eq-tilt` 1.2.3 (MIT, Dmitry Iv.): `tilt` |
| `TRANSIENT_KERNELS` | const | audio.js kernels, each module as published, in its own scope, for an `AudioWorklet`, which cannot import them: - `@audio/dynamics-transient-shaper` 0.1.6 (MIT, Dmitry Iv.): `transientShaper`, as `module0` - `@audio/dynamics-transient-shaper` 0.1.6 (MIT, Dmitry Iv.): `transientShaper` |
| `UNLIMITER_KERNELS` | const | audio.js kernels, each module as published, in its own scope, for an `AudioWorklet`, which cannot import them: - `@audio/dynamics-envelope` 0.1.4 (MIT, Dmitry Iv.): `timeCoef`, as `module0` - `@audio/dynamics-envelope` 0.1.4 (MIT, Dmitry Iv.): `envelope`, as `module1` - `@audio/dynamics-expander` 0.2.2 (MIT, Dmitry Iv.): `writer`, `concat`, `db2lin`, `lin2db`, as `module2` - `@audio/dynamics-expander` 0.2.2 (MIT, Dmitry Iv.): `upwardExpanderGain`, as `module3` - `@audio/dynamics-unlimit` 0.1.2 (MIT, Dmitry Iv.): `writer`, `concat`, `db2lin`, `lin2db`, as `module4` - `@audio/dynamics-unlimit` 0.1.2 (MIT, Dmitry Iv.): `unlimitGain`, `unlimitDeficitGain`, as `module5` - `@audio/dynamics-unlimit` 0.1.2 (MIT, Dmitry Iv.): `unlimit` |
| `WAH_KERNELS` | const | audio.js kernels, each module as published, in its own scope, for an `AudioWorklet`, which cannot import them: - `@audio/effect-autowah` 1.1.5 (MIT, Dmitry Iv.): `autoWah` - `@audio/effect-wah` 1.1.5 (MIT, Dmitry Iv.): `wah` |

## Usage

An `AudioWorklet` cannot import a module, so a processor that runs audio.js code carries it with it. Each constant here is a device's kernels, every module as published in its own scope, with its package's name, version and license in the comment above it. A device writes its processor after them and loads the whole with [`loadWorklet`](/docs/engine/worklet):

```ts
import { DELAY_KERNELS } from "@audio-ui/engine/kernels";
import { loadWorklet } from "@audio-ui/engine/worklet";

const DELAY_WORKLET = `${DELAY_KERNELS}
class DelayProcessor extends AudioWorkletProcessor { /* calls pingPong, multitap, graindelay */ }
registerProcessor("audioui-delay", DelayProcessor);`;

await loadWorklet(ctx, DELAY_WORKLET);
```

The strings are written from the installed packages by `bun run kernels:build` in `packages/engine`, and a test fails when one no longer matches its package, after a version bump.
