Lab

instrument-rack

Instrument racks: an instrument whose chains each start with an instrument of the library, then effects, all played by every note in layers and summed as a rack with its macros; the engine that plays one on a MIDI track.

pnpm dlx shadcn@latest add @audio-ui/instrument-rack
import { chainInstrument, createInstrumentRackEngine } from "@/lib/instrument-rack";
Fileslib/instrument-rack.ts
Depends onarrangement, device-library, rack, voice-pool
npm@audio-ui/engine
Used byarrangement-engine, drum-rack
ExportKindWhat it is
chainInstrumentfunctionThe instrument a chain of an instrument rack plays: its first device, when it is an instrument of the library.
InstrumentRackEngineinterfaceAn instrument rack playing on a context: a note player, its sound out at output.
createInstrumentRackEnginefunctionPlays instrument racks on ctx: each chain's instrument with voices voices into the chain, its effects in series after it, the chains summed as any rack's.

Usage

An instrument whose chains each start with an instrument of the library, then effects, played by every note whose key and velocity fall in a chain's zone, in layers, and summed as a rack with its macros: a split, or soft and hard layers.

import { createInstrumentRackEngine } from "@/lib/instrument-rack";

const instrument = createInstrumentRackEngine(ctx, libraryDevice, 8); // 8 voices a chain
instrument.output.connect(destination);
instrument.update(rack, { tempo });

chainInstrument finds the instrument at the head of a chain. Zones come from inZone and FULL_ZONE in arrangement; the arrangement engine plays it on a MIDI track.

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