Convert MIDI commands to raw bytes
Summary
Types
A MIDI channel number
The duration in milliseconds for which to hold down a note.
A 7-bit integer
A MIDI note
A MIDI program
The velocity to strike the note.
A channel volume
Functions
Change the MIDI controller value of a channel.
Change the current program (e.g. instrument) of a channel.
Change the sound bank of a channel.
Change the volume of a MIDI channel. This change is applied to all playing and future notes.
Turn a note in a channel off.
Turn all active notes in a channel off.
Turn a note in a channel on.
Change the panoramic (pan) of a channel. This shifts the sound from the left or right ear in when playing stereo. Values below 64 moves the sound to the left, and above to the right.
Bend the pitch of notes playing in a channel. Values below 0x2000 will decrease the pitch, and higher values will increase it.
Types
@type channel() :: 0..15
A MIDI channel number
@type duration() :: non_neg_integer()
The duration in milliseconds for which to hold down a note.
@type int7() :: 0..127
A 7-bit integer
@type note() :: int7()
A MIDI note
For non-percussion instruments, the frequency of a note
is 440 * 2^((n − 69) / 12) where n is the note number.
Middle C is 60
@type program() :: int7()
A MIDI program
@type velocity() :: int7()
The velocity to strike the note.
127 = maximum velocity
@type volume() :: int7()
A channel volume
Functions
Change the MIDI controller value of a channel.
Change the current program (e.g. instrument) of a channel.
Change the sound bank of a channel.
Change the volume of a MIDI channel. This change is applied to all playing and future notes.
Turn a note in a channel off.
@spec note_off_all(channel()) :: <<_::24>>
Turn all active notes in a channel off.
Turn a note in a channel on.
Change the panoramic (pan) of a channel. This shifts the sound from the left or right ear in when playing stereo. Values below 64 moves the sound to the left, and above to the right.
Bend the pitch of notes playing in a channel. Values below 0x2000 will decrease the pitch, and higher values will increase it.