Sending MIDI
MIDIOutput.send(data, timestamp?) accepts a number[] or Uint8Array of raw MIDI bytes and an optional send timestamp in milliseconds (performance.now() domain).
Basic sends
Section titled “Basic sends”import { requestMIDIAccess } from "react-native-midi-api";
const midi = await requestMIDIAccess();const output = [...midi.outputs.values()][0];
if (!output) { console.warn("No MIDI output connected"); return;}
// Note On — channel 1, note 64 (E4), velocity 100.output.send([0x90, 64, 100]);
// Note Off — same note, velocity 0.output.send([0x80, 64, 0]);
// Control Change — channel 1, CC 7 (volume), value 127.output.send([0xb0, 7, 127]);
// Program Change — channel 1, patch 0.output.send([0xc0, 0]);Scheduled / timestamped sends
Section titled “Scheduled / timestamped sends”Pass performance.now() + offsetMs as the second argument to schedule delivery:
const now = performance.now();
// Note On immediately.output.send([0x90, 60, 127], now);
// Note Off 1 second later.output.send([0x80, 60, 0], now + 1000);Clearing the send queue
Section titled “Clearing the send queue”output.clear() discards all pending scheduled messages:
output.clear();SysEx sends
Section titled “SysEx sends”SysEx requires { sysex: true } at access time — see the SysEx guide.