Web MIDI input keyboard controller
npm install midi-kbd
# or
yarn add midi-kbd
Example of using the keyEvents
observable piped though to MIDI note values.
import {
filterKeyboardEvents,
keyEvents,
mapToMidiEvent
} from "midi-kbd";
keyEvents
.pipe(filterKeyboardEvents())
.pipe(mapToMidiEvent(4))
.subscribe((event) => {
// The MIDI note value is a property o the event, `event.note`
if (event.type === "on") {
// trigger a note
} else if (event.type === "off") {
// release a note
}
});
This is still a work in progress.
Though if you want to checkout an example of what it is/or could be, you can see it in action here, johnhooks/midi-kbd.
The source code for the example above is found in the website
directory of this repo.
MIT @ John Hooks