Implement `App.Midi` for mapping MIDI inputs and emitting MIDI data as JavaScript Events
Marak opened this issue · 5 comments
To start, we require a simple MIDI Mapper that will emit MIDI data as JS events.
The basic concept is that a buddy can open App.Midi
, plug in a MIDI device, and begin playing keys / pressing buttons on the MIDI Device.
App.Midi
will then take the incoming MIDI data and emit something like desktop.emit("midi", noteData)
The expectation is that other Apps will be able to subscribe to this event using desktop.on("midi", "piano-plays-notes", fn)
This should be relatively simple to implement. The Event Emitter pattern is already built into desktop.on
and desktop.emit
.
Was relatively easy to implement. We now have App.Midi
which can be opened from the Profile page or from any text area by typing /midi
.
Was able to successfully connect a MIDI device and broadcast MIDI events on desktop.emit
.
Next steps will be connecting the existing App.MidiFighter
and App.Piano
to optionally accept the MIDI data. Feel free to join us in #Alpha
room if you are interested in MIDI support.
Was able to connect App.Piano
input to the desktop.emit("midi-message")
event.
This means now if a Buddy connects a MIDI Controller they should be able to play the Piano! Awesome!
The mappings are currently very basic, but we can build on this pattern for other instruments.
Hey Marak, this is IceGuye. The midi setup is okay, but the piano does work like what it should be. So, the controller ID should be the note (pitch), the value should be the volume or if it doesn't support velocity/volume, that is fine, you should put 0 to sound off and positive 1 - 127 to sound on. Right now, you put the value as the note, so it doesn't work right.