Saturator

A saturator device: four curves, a drive, a mix and an output, a panel that draws the transfer curve, a Web Audio engine and tools for agents.

Audio UI

Adds warmth or dirt. The drive pushes the signal into one of four curves: a soft clip, a hard clip, a wavefold or an asymmetric tube. It is a device: a state, a panel, an engine and tools, each its own file.

Installation

pnpm dlx shadcn@latest add @audio-ui/saturator

It installs the device's state, its engine and its panel to components/audio-ui/devices/saturator/. The demo above, which wires them to a loop, is @audio-ui/block-saturator.

Controls

Controls · 5

Panel

The panel draws the transfer curve against the straight line of a clean sound. saturate(curve, input) is one curve and saturatorCurve(state) is the whole transfer curve with the mix and the output.

import { SaturatorPanel } from "@/components/audio-ui/devices/saturator/panel";
import { saturatorDevice } from "@/components/audio-ui/devices/saturator/device";

const [state, setState] = useState(() => saturatorDevice.defaults());

<SaturatorPanel onValueChange={setState} value={state} />;

Engine

Create it, connect it and update it as for any device: see The engine.

The drive is a gain before the table of the curve, so turning it never rebuilds the table. Only picking another curve does. The shaper oversamples 4x to keep the clip from aliasing, which is the latency of the device.

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