Skip to content

johnhooks/midi-kbd

Repository files navigation

Preview of computer keyboard overlaid with musical notes

Web MIDI input keyboard controller

📦 Install

npm install midi-kbd

# or

yarn add midi-kbd

⚡️ Quick start

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
    }
  });

📚 Documentation

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.

Inspiration

AudioKeys

License

MIT @ John Hooks