MIDI Output Overview
MIDIValOutput
class provides a lot of functionality to send MIDI messages.
Overview
To connect to new MIDI device, instantiate MIDIValOutput
based on the one of the outputs returned by the access object.
import { MIDIVal, MIDIValOutput } from "@midival/core";
MIDIVal.connect()
.then(access => {
const output = new MIDIValOutput(access.outputs[0]);
// Now you can start sending MIDI messages
});
Sending notes on
To send note on, you can call the following method:
output.sendNoteOn(64, 127);
Sending note off
To send note off message:
output.sendNoteOff(64);
Sending Control Change (CC)
To send control change message:
output.sendControlChange(5, 50); // increasing portamento time.
Using named CC
Most of the times it is easier to use named CC messages. To do so, you can use @midival/constants
utility package that provides easy conversion map:
import { ControlChange } from '@midival/constants'
output.sendControlChange(ControlChange.ModulationWheel, 30);