Auto pan

An auto pan device: a pan or tremolo mode, a wave shape, a rate or a note value and a depth, a panel that draws the movement, a Web Audio engine and tools for agents.

Audio UI

Moves the sound with a slow oscillator. In Pan mode it moves from one speaker to the other. In Tremolo mode its level goes up and down. It is a device: a state, a panel, an engine and tools, each its own file.

Installation

pnpm dlx shadcn@latest add @audio-ui/auto-pan

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

Controls

Controls · 7

Panel

The panel draws the movement over two seconds. autoPanWave(shape, phase) is the wave and autoPanSweep(state) is what the panel draws.

import { AutoPanPanel } from "@/components/audio-ui/devices/auto-pan/panel";
import { autoPanDevice } from "@/components/audio-ui/devices/auto-pan/device";

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

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

Engine

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

One oscillator feeds both a stereo panner and a gain, and the mode sets which of the two depths is on. In Tremolo mode the level swings around the middle of its range, so a depth of 100 % goes from silence to full level.

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