Drum racks: an instrument whose chains are pads, each answering a note with the instrument at its head, such as a Drum Synth, or else a voice of the drum synthesis or a recording, into its own devices, a pad of a choke group cutting the others short; the engine that plays one on a MIDI track.
pnpm dlx shadcn@latest add @audio-ui/drum-rack
import { padsOf, createDrumRackEngine } from "@/lib/drum-rack";| Files | lib/drum-rack.ts |
|---|---|
| Depends on | arrangement, drum-synthesis, instrument-rack, rack, voice-pool |
| npm | @audio-ui/engine |
| Used by | arrangement-engine |
| Export | Kind | What it is |
|---|---|---|
PadRecording | type | A recording a pad plays: an AudioBuffer, or its channels decoded. |
padsOf | function | The pads of a drum rack that a note plays: the chains that answer it. |
DrumRackEngine | interface | A drum rack playing on a context: a note player whose note on plays the pads of its pitch, as loud as its velocity, and rings for their decay; a note off lets nothing go, and release takes back the hits that start after its time, as a stop does, those sounding ringing out. |
createDrumRackEngine | function | Plays drum racks on ctx. |
Usage
An instrument of pads: each chain answers a note with the instrument at its head (a Drum Synth, say), or a voice of the drum synthesis or a recording, into its own devices, summed as a rack with its macros. A pad of a choke group cuts the others short.
import { createDrumRackEngine, padsOf } from "@/lib/drum-rack";
const drums = createDrumRackEngine(ctx, libraryDevice);
drums.output.connect(destination);
drums.update(rack, { tempo });
const pads = padsOf(rack, 36); // the chains a note playsStart a rack from drum-kit; its face is the Drum rack panel, and the arrangement engine plays it on a MIDI track.