Distortion

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

Audio UI

Bends the sound. The more the drive, the more the peaks round off. It is a device: a state, a panel, an engine and tools, each its own file.

Installation

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

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

Controls

Controls · 5

Panel

The panel draws the transfer curve, the output for each input, against the straight line of a clean sound. softClip(input, drive) is the clip and distortionCurve(state) is the whole curve with the mix and the output.

import { DistortionPanel } from "@/components/audio-ui/devices/distortion/panel";
import { distortionDevice } from "@/components/audio-ui/devices/distortion/device";

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

<DistortionPanel 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 one fixed soft-clip table, so turning it never rebuilds the table. The shaper oversamples 4x to keep the clip from aliasing, which is the latency of the device.

More Shadcn Distortion components

Browse 4 production-ready audio/ui Distortion components for players, mixers, and synth interfaces. These examples use the headless primitives from @audio-ui/react and stay fully compatible with Shadcn Create so radius, color, and typography match your configured theme.

Browse all 4 Shadcn Distortion components for copy-ready layouts, dashboards, and forms built with Tailwind CSS in the audio/ui library.

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