Home:ALL Converter>How to specify Web MIDI channel?

How to specify Web MIDI channel?

Ask Time:2018-11-28T04:00:25         Author:Hoff

Json Formatter

How can I specify which channel to send a midi message on, with the MIDI Web API?

This example from the official docs shows how to send a message on channel 1. But in the code snippet, I don't find any reference to that.

// This example sends a middle C note on message immediately on MIDI channel 1 
function sendMiddleC( midiAccess, portID ) {
  var noteOnMessage = [0x90, 60, 0x7f];    // note on, middle C, full velocity
  var output = midiAccess.outputs.get(portID);
  output.send( noteOnMessage );  //omitting the timestamp means send immediately.
}

How can I send that same message, on say channel 2?

Author:Hoff,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/53507238/how-to-specify-web-midi-channel
yy