2.1.0 • Published 7 years ago

web-midi v2.1.0

Weekly downloads
8
License
MIT
Repository
github
Last release
7 years ago

web-midi

This module wraps the Web MIDI API into a stream interface.

Web MIDI is currently only available in Chrome, but this module can potentially be used in older browsers with the WebMIDIAPIShim.

For a serverside (Node) based version of the same API check out midi-stream.

Install

$ npm install web-midi

Example

var midi = require('web-midi')
var inStream = midi.openInput('Launchpad')
var outStream = midi.openOutput('Launchpad')

inStream.on('data', function(data){
  // => [146, 32, 127]
})

// send on note
outStream.write([146, 38, 127])

setTimeout(function(){
  // off note
  outStream.write([146, 38, 0])
}, 1000)

// or use pipes
var anotherStream = midi.openOutput('IAC')
inStream.pipe(anotherStream)

Or create a duplex stream (assumes input and output ports are named the same thing)

var midi = require('web-midi')
var duplexStream = midi('Launchpad')

duplexStream.on('data', function(data){
  // => [146, 32, 127]
})

// send on note
duplexStream.write([146, 38, 127])

setTimeout(function(){
  // send off note
  duplexStream.write([146, 38, 0])
}, 1000)

// or use pipes
var anotherStream = midi('IAC')
duplexStream.pipe(anotherStream)
2.1.0

7 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.1.0

8 years ago

1.0.1

9 years ago

0.6.2

9 years ago

1.0.0

9 years ago

0.6.1

9 years ago

0.6.0

9 years ago

0.5.0

9 years ago

0.4.0

10 years ago

0.3.0

10 years ago

0.2.3

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

11 years ago

0.1.0

11 years ago

0.0.0

11 years ago