Skip to content
Jean-Philippe Côté edited this page Nov 17, 2021 · 212 revisions

WebMidi.js Wiki

This page may grow to include more information but, for now, its sole purpose is to gather suggestions for enhancements which I hate to see linger in the "Issues" section.

Enhancements for upcoming v3

Work on v3 has started in the develop branch. It will be a major overhaul. Here is the list of stuff planned for this version:

  • Publish TypeScript definitions to DefinitelyTyped when v3 is stable (https://definitelytyped.org/guides/contributing.html)

  • Add filter option to allow listening to only a subset of events (e.g. specific controller change or NRPN messages, discussed in PR #88)

  • Add a way to forward inbound messages on an Input object to an Output (to behave like a physical MIDI THRU port). This could be expanded to a more elaborate filtering and routing system (example)

  • Add mechanism to Generate TypeScript type definitions (.d.ts files)

  • Add getNoteState() method to InputChannel so it it is possible to check if a note is currently playing or not. This allows to check for chords when a noteon message is received.

  • Properly handle when a laptop's lid is closed then reopened (Issue #140)

  • As suggested by users, allow sending MSB and LSB at once when sending control change messages (Issue #57). This would have to be done for CC messages 0-31 which all have a matching LSB.

  • Rewrite the NRPN parsing mechanism in InputChannel. I do not think it works correctly. Here are starting points:

  • Allow sendSysex() to accept Uint8Array (Issue #124, forum thread) or perhaps to accept a Message object that can be built from a Uint8Array (this needs to be carefully examined)

  • Add a Message object

  • Add the ability to set default values for attack velocity, release velocity, etc. ( see forum discussion)

  • * Various utility methods should probably be stashed in a Utils class (e.g. getCcNameByNumber(), etc.)

  • * Add convenience method to convert float and 7 bit: to7bit() and toNormalized()

  • Add the ability to individually transpose Input, Output, InputChannel and OutputChannel.

  • Add InputChannel and OutputChannel objects (Issue #20)

  • Use ES6+ modern syntax and add default export so library can be imported with import (Issues #49 and #89)

  • Move to Rollup for packaging the library (Issue #61)

  • Drop support for Bower (Issue #60)

  • Extend a proper event library to allow for modern event support (probably djipevents).

  • Implement port statechange events (connected and disconnected)

  • Make WebMidi a singleton (see example here)

  • WebMidi should dispatch 'enabled' and 'disabled' event

  • Check that disable() really does disable everything

  • Add methods for channel mode messages

  • Implement clear() method (Issue #52) [this will automatically work when browsers add support for it but will show a warning in the console until then).

  • Added the new (software) parameter for requestMIDIAccess [this will automatically work when browsers add support for it).

  • Emit events for all channel mode messages

  • Add statusByte and dataBytes properties to the event triggered when receiving messages (#109)

  • Deprecate the ability to send on all channels (default behaviour). This clogs up the MIDI stream and I do not really see a good use case for it.

  • Create a Note object with duration and velocity property

  • Add official support for Node.js (Issue #15)

  • Allow specifying different note durations and velocities in playNote() when using arrays (Issue #75 and #90). (this is now possible with Note objects).

  • Add editorconfig file

  • Complete test suite for all objects

  • Add sendRaw() method accepting either list of integers or Uint8Array.

  • Allow send() to accept Uint8Array

Questions

  • Should parameters (e.g. velocity) be specified and reported as 7bit values (0-127) or as normalized floats (0-1) ? See forum discussion and GitHub Discussion.

    These are the methods where the problem surfaces (by default, they expect a float):

    • Output.setKeyAftertouch() (pressure)
    • Output.setChannelAftertouch() (aftertouch)

    Currently, these methods accept a 7bit value directly, through the rawValue option parameter or by specifying a pair of [msb, lsb]

    • Note() constructor (attack, release)

    • OutputChannel.playNote() (note number, attack, release)

    • OutputChannel.sendNoteOff() (release)

    • OutputChannel.sendNoteOn() (attack)

    • OutputChannel.setMasterTuning() (msb/lsb)

    • OutputChannel.setPitchBend() (msb/lsb)

    • OutputChannel.setPitchBendRange() (msb/lsb)

    • OutputChannel.setModulationRange() (msb/lsb)

    • Output.setSongPosition() (value: 1-16383)

    • OutputChannel.setTuningBank() (value: 0-127)

    • OutputChannel.setTuningProgram() (value: 0-127)

    • OutputChannel.setProgram() (value: 0-127)

    • OutputChannel.sendControlChange() (value: 0-127)

    • Output.setSong() (value: 0-127)

    We also need to look at methods of the Output object

  • What should be the default channel value for listening and sending? I think listening on all channels will help beginners and doesn't risk clogging the system. Sending to all channels by default is kinda weird, though.

  • Should all values be zero-indexed (MIDI channels, bank numbers, etc.)

Enhancements for the website and documentation

  • Add discussion forum

  • Evaluate moving to GitHub Discussions from Vanilla Forums (see this forum post)

  • Add several usage examples:

    • Vanilla JS
    • React/Next.js/Svelte/etc.
    • How to interface with other MIDI software on macOS, Windows and Linux
    • Typescript, with examples such import and bundling (see Issue #82)
  • Electron/NW.js

  • The examples' source should be available in the examples folder of the repo

  • Add 2.x -> 3.x migration guide

  • Add a CONTRIBUTING.md file

Enhancements to evaluate

  • Calculate BPM from clock messages (Discussion #177)

  • Allow the first argument of output.playNote( ) to be ‘0:0’ as ‘A0’, ‘7:3’ as ‘E:3’ and so on.

  • Add a "mute" button for inputs/outputs

  • Include the ability to add MIDI event listeners at the WebMidi.js level (Issue #138)

  • Emit events on send() so outbound MIDI messages can be listen for (Discussion #171)

  • Add a stopAllNotes() method

  • Calculate time values and make them directly available for songposition and timecode message

  • Make Istanbul (nyc) break down the coverage stats by test file.

  • Add the ability to send grouped messages for CC events (and potentially others)

  • Add support for MIDI Polyphonic Expressions.

  • Add explicit support for Universal System Exclusive Messages

    • This would include a sendIdentityRequest() method to the output object (perhaps with a getIdentity() companion method that waits for the response) (Issue #117)

    • This could also include the capability to query device for make/model (similar to jzz-midi-gear)

    • Implement show control protocol subset

  • Add ability to inject Jazz-Plugin code for browsers with no native Web MIDI API support.

  • Add the option to create sysex plugins for various devices forum thread

  • Add issue and PR templates

  • Add continuous integration tool

  • Add ability to read/write MIDI files

  • Add site to js.org (i.e. webmidi.js.org)

  • Solid timing, midi clock, sync, transport functionality

  • Helper functions that help to deal with sysex checksum from specific manufacturer (Roland checksum etc)

  • Add explicit support for Sample Dump Format (see discussion on forum)

  • Allow third-party developers to develop modules that facilitate encoding and decoding of device-specific sysex messages (see forum discussion)

  • Add timing capabilities such as syncing with Tone.js or being able to schedule events using musical notes.

  • Add the ability to export a MIDI file (perhaps with another lib such as MidiWriterJS or Jazz-Soft

  • SMF Support

  • Piano roll

  • Check if something specific needs to be done to support Electron (this discussion).

Enhancements that have been put on hold for now

Clone this wiki locally