Similar to the MIDI input example, we can output MIDI in node-red as well. The following shows the midi out node, with MIDI data injected for note on and off (both velocity 127), for middle C (60) on channel 1:
For another example check out the example flow from the midi node source code here (can copy+paste the raw text and import it in node-red). Also note that there is a msg.midi
object that contains a number of internal structures that may be useful for manipulating relevant MIDI data, instead of manually parsing and assembling the raw MIDI bytes. See the documentation and info screen of the MIDI nodes for more details.