0.3.1 • Published 2 years ago

@ondas/drum-machine v0.3.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

DrumMachine

A self-container mono-sample piano

npm version npm version

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