Lab

mixer-engine

A mixer on the Web Audio API: a channel per track and return, with its chain, volume, constant-power pan, switch, solo, pre or post-fader sends, delay compensation and meters, into a main track

pnpm dlx shadcn@latest add @audio-ui/mixer-engine
import { createMixer } from "@/lib/mixer-engine";
Fileslib/mixer-engine.ts
Depends onNothing
npm@audio-ui/engine
Used byarrangement-engine
ExportKindWhat it is
StripMixinterfaceWhat a channel does with its sound.
MixerTrackinterfaceA track as the mixer plays it.
MixerReturninterfaceA return track as the mixer plays it.
MixerStateinterface
ChainLinkinterfaceA device's sound path, as a chain links it.
MixerStripinterfaceA channel of the mixer.
Mixerinterface
createMixerfunctionA mixer on the Web Audio API: a channel for each track and each return, and the main track, which goes to destination.

Usage

mixer-engine is the mixing desk the engine plays through, usable on its own with sources of your own: a channel per track and per return (a track that names a group plays into that track's channel), each with a device chain (setChain), a volume, a pan, a switch and a solo, sends taken before or after the volume, pan and switch as each return asks, delay compensation from the latency each chain declares, a meter per channel, and the main track to the output. Nothing limits the main track, so a mix over full scale shows on the meters as it would in the file.

import { createMixer } from "@/lib/mixer-engine";

const mixer = createMixer(context);
mixer.update({
  main: { gain: 1 },
  returns: [{ gain: 1, id: "hall", latency: 0, on: true, pan: 0, pre: false, soloed: false }],
  tracks: [{ gain: 0.8, id: "vox", latency: 288, on: true, pan: -0.2, sends: { hall: 0.3 }, soloed: false }],
});
source.connect(mixer.strip("vox")!.input);
Built by Ouest Labs, the source code is available on GitHub.
RSS