receive input from MIDI devices in the browser
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

a library for capturing midi hardware input in the browser. it is a nodejs middleware which listens for midi input on and forwards the midi message to the client via


$ npm install  

use's primary functionality is on the server. it is responsible for creatting http and websocket routes your client can use to learn about midi devices. additionally, serves a backbone client library to use for accessing these resources. the server and client components can be used together or independently. a full client and server example is contained in the repository for reference.

a basic server creates the following resources:

  • GET /midi/devices - show all active midi devices
  • GET /midi/devices/:id - show details for a specific midi device
  • WS /midi/devices/:id - a namespace for receiving midi messages from a specific device

getting started (server)

to enable, simply pass it into your http server as a middleware, with your instance as it's first argument. the following example is the complete code for a simple server:

var connect = require('connect'),
  socketio = require(''),
  midi = require('');

var server = connect.createServer(),
  io = socketio.listen(server);


getting started (client)

the client library is served via / and requires backbone. it creates a single model and a single collection used to manage your midi devices:

  • MidiDevice - a backbone model which emits midi events
  • MidiDevices - a backbone collection used to browse and select midi devices

the following code shows the client library in action:

var devices = new MidiDevices(),
  midi_device = new MidiDevice({ id: 1 });

// get all active midi devices
  success: function() {
    console.log('found devices', devices.models);

// tie the next inbound midi message to a specific function
devices.learn(function() {
  console.log('the next midi button pressed will always log me!');

// log all midi events for all devices
devices.on('midi', function(msg) {
  console.log('got midi', msg);

// only log midi events from device 1
midi_device.on('midi', function(msg) {
  console.log('got midi from device 1', msg);

building documentation

formatted documentation is available and can be built using groc:

npm install -g groc
groc lib/**/*.js src/**/*.js