pulse

pulse is a small node.js server and client that pipes MIDI Clock messages to your browser through a WebSocket. It also interpolates the bpm and current phase. This means you pick up the beat from a drumcomputer, a DAW or DJ software, and use this information to sync up all sorts of cool stuff in a browser!

Installation

Grab the code from GitHub. To run the server you'll need node.js using midi and socket.io. The client is pure JavaScript.

Usage

pulse.connect('http://yourserver:9000'); 

This will sync up pulse to the MIDI Clock provided by the server. You have a number of ways to use this information:

pulse.bpm
The currently detected beats per minute.
pulse.beat()
This function returns the current beat pluse phase: e.g. 12.4 means that we're about halfway through the thirteenth beat. Use a modulo of 1 to get only the phase.
pulse.pulse()
This convenient function supplies a pulsing value between 0 and 1 that reaches a peak on every whole beat, and decays after that.

You want to see it in action, don't you? Well, if you are running the server, connect to it below. Oh, you're not? You can just tap a beat to see the time tracking in action. Check out the source code to this page to see how the data provided by pulse is used to animate the page. Everything is on GitHub.