Filter

A filter device: a type, a cutoff and a resonance, a panel with a handle on the curve and a live spectrum, a Web Audio engine and tools for agents.

Audio UI

Takes part of the spectrum out: a low-pass, a high-pass, a band-pass or a notch. It is a device: a state, a panel, an engine and tools, each its own file.

Installation

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

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

Controls

Controls · 4

Panel

The panel draws the curve of the filter, with a handle on it. Pass a spectrum to the panel to see what comes out behind the curve. filterCurve(state) is the curve it draws.

import { FilterPanel } from "@/components/audio-ui/devices/filter/panel";
import { filterDevice } from "@/components/audio-ui/devices/filter/device";

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

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

Engine

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

The node is the filter the curve draws. A low-pass and a high-pass read their resonance in decibels, so the device gives it to the node in that unit, and the curve and the sound agree. filterSettings(state) is what goes on the node.

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