pnpm dlx shadcn@latest add @audio-ui/instrument-rack
import { chainInstrument, createInstrumentRackEngine } from "@/lib/instrument-rack";| Files | lib/instrument-rack.ts |
|---|---|
| Depends on | arrangement, device-library, rack, voice-pool |
| npm | @audio-ui/engine |
| Used by | arrangement-engine, drum-rack |
| Export | Kind | What it is |
|---|---|---|
chainInstrument | function | The instrument a chain of an instrument rack plays: its first device, when it is an instrument of the library. |
InstrumentRackEngine | interface | An instrument rack playing on a context: a note player, its sound out at output. |
createInstrumentRackEngine | function | Plays 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.