notator / WebMIDISynthHost

Hosts software Web MIDI Synths that implement a superset of the Web MIDI API Output Device interface.
Other
18 stars 3 forks source link

Custom Controls and Aftertouch #15

Closed notator closed 8 years ago

notator commented 8 years ago

I've made the rather controversial decision to use WebMIDI.constants.COMMAND 0xA0 to mean CUSTOMCONTROL_CHANGE rather than AFTERTOUCH (as in standard MIDI).

The MIDI standard was conceived before the advent of software synthesizers, so it has a few shortcomings...

This decision means

  1. that custom controls can be defined freely by software synthesizers, without conflicting with the normal, standard controls (defined under WebMIDI.constants.COMMAND.CONTROL_CHANGE).
  2. software synthesizers that implement aftertouch (such as the cwMIDISynth) can do so as follows:
    • define the following two custom controls in the synth's controls[] attribute:
      { name: "aftertouchKey", index: 126, defaultValue:0 }
      { name: "aftertouchPressure", index: 127, defaultValue:0 }
    • set aftertouch by sending these two control messages in sequence. (This is rather like the standard MIDI approach to sending hi- and lo-byte values for a control.)

Host software that needs to send messages to both hard- and software synthesizers can set aftertouch by calling the setAftertouch(...) function defined in WebMIDI/utilities.js.

notator commented 8 years ago

This mistake has been corrected.