npm

Don't miss out on this year's npm Pride t-shirt designs!Order your favorites here »

midi-clock

0.0.1 • Public • Published

midi-clock

Creates a virtual midi clock ticking at 24 PPQ

Install

$ npm install midi-clock

Example

var MidiClock = require('midi-clock')
 
// in node just do this (uses process.hrtime):
var clock = MidiClock()
 
// in browser
var audioContext = new webkitAudioContext()
var clock = MidiClock(audioContext)
 
clock.start()
 
clock.on('position', function(position){
 
  // log on each beat, ignore the rest
  var microPosition = position % 24
  if (microPosition === 0){
    console.log('Beat:', position / 24)
  }
 
})
 
setTimeout(function(){
  // change to 120bpm after 10 seconds
  clock.setTempo(120)
}, 10000)
 

install

npm i midi-clock

Downloadsweekly downloads

7

version

0.0.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability