0.1.1 • Published 5 years ago

music-instrument-js v0.1.1

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

Music Instrument JS

Play any musical instrument from the browser

Install

  yarn add music-instrument-js

Usage

import { getInstrument, startNote, stopNote, instrumentNames } from "music-instrument-js";

const delay = ms => new Promise(resolve => setTimeout(resolve, ms))

async function main() {
  await startNote('acoustic_grand_piano', 'A3', {})
  await delay(500)
  stopNote('acoustic_grand_piano', 'A3')
  
  instrumentNames // list of supported instruments

  await getInstrument('banjo') // Loads banjo instrument
  startNote('banjo', 'A3', {})
  await delay(500)
  stopNote('banjo', 'A3')
  
}