DrumMachine
A self-container mono-sample piano
Sampled drum-machine.
import { DrumMachine, DrumMachineKits } from "@ondas/drum-machine";
const audioContext = new AudioContext();
// Create a new instrument
const kit = DrumMachineKits["CR-78"];
const drums = new DrumMachine(audioContext, kit);
// Wait until the audio is loaded
await drums.ready();
drums.start("kick");
// Schedule
const now = audioContext.currentTime;
drums.start({ name: "kick", time: now });
drums.start({ name: "snare", time: now + 1 });
drums.start({ name: "kick", time: now + 2 });
drums.start({ name: "snare", time: now + 3 });
Install
npm i @ondas/drum-machine