Frozen (immutable) MIDI message struct with rich API.
Inspired by mido's Message class. Messages are immutable and provide
copy/2, to_bytes/1, to_hex/1, to_string/1, to_map/1, and from_map/1.
Examples
iex> msg = ExMidi.MidiMessage.new(:note_on, channel: 1, pitch: 60, velocity: 100)
iex> ExMidi.MidiMessage.to_bytes(msg)
<<144, 60, 100>>
iex> ExMidi.MidiMessage.to_hex(msg)
"90 3C 64"
iex> msg2 = ExMidi.MidiMessage.copy(msg, channel: 2)
iex> ExMidi.MidiMessage.to_bytes(msg2)
<<146, 60, 100>>
Summary
Functions
Create a copy of the message with overridden attributes.
Create a message from a binary.
Create a message from a hex string.
Create a message from a map.
Check if message is a control change for the given control number.
Check if message is a system realtime message.
Create a new MIDI message. Channel is 1-based (1-16).
Encode message to a binary.
Encode message to a hex string.
Convert message to a map.
Convert message to a human-readable string.
Types
Functions
Create a copy of the message with overridden attributes.
Create a message from a binary.
Create a message from a hex string.
Create a message from a map.
@spec is_cc(t(), non_neg_integer() | nil) :: boolean()
Check if message is a control change for the given control number.
Check if message is a system realtime message.
Create a new MIDI message. Channel is 1-based (1-16).
Encode message to a binary.
Encode message to a hex string.
Convert message to a map.
Convert message to a human-readable string.