Metronome
JavaScript metronome library using Web Audio API
See it in action: https://github.com/heroandtn3/pwa-metronome
Installation
npm i musical-metronome
Usage
// ES Module
import { Metronome } from 'musical-metronome';
// CommonJS
const { Metronome } = require('musical-metronome');
//UMD
const Metronome = window.musicalMetronome.Metronome;
const metronome = new Metronome({ tempo: 120 });
metronome.init(); // call on user action, e.g. onClick
setInterval(() => metronome.tick(), 25);
metronome.play();
metronome.stop();
See example in public
directory.
Development
- Clone the repo.
- Install the dependencies
- Run
npm start
then here you go!