pub fn event_bytes(
event_type: EventType,
channel: i64,
parameter1: Option<&Param>,
parameter2: Option<&Param>,
) -> MidiResult<Vec<u8>>Expand description
An event as MIDI writes it, from its type, its channel counted from one
and its two parameters: music21’s MidiEvent.getBytes.
use music21::midi::base::{EventType, Param, event_bytes};
let written = event_bytes(
EventType::ChannelVoice(0x90),
10,
Some(&Param::Int(60)),
Some(&Param::Int(127)),
);
assert_eq!(written.unwrap(), b"\x99<\x7f");