@ondas/drum-machine
TypeScript icon, indicating that this package has built-in type declarations

0.3.1 • Public • Published

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

Package Sidebar

Install

npm i @ondas/drum-machine

Weekly Downloads

0

Version

0.3.1

License

MIT

Unpacked Size

21.6 kB

Total Files

7

Last publish

Collaborators

  • danigb