MIDISynth.Command (midi_synth v0.4.2)

Copy Markdown View Source

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

channel()

@type channel() :: 0..15

A MIDI channel number

duration()

@type duration() :: non_neg_integer()

The duration in milliseconds for which to hold down a note.

int7()

@type int7() :: 0..127

A 7-bit integer

note()

@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

program()

@type program() :: int7()

A MIDI program

velocity()

@type velocity() :: int7()

The velocity to strike the note.

127 = maximum velocity

volume()

@type volume() :: int7()

A channel volume

Functions

change_control(channel, control_number, control_value \\ 0)

@spec change_control(channel(), int7(), int7()) :: <<_::24>>

Change the MIDI controller value of a channel.

change_program(channel, prog)

@spec change_program(channel(), program()) :: <<_::16>>

Change the current program (e.g. instrument) of a channel.

change_sound_bank(channel, bank)

@spec change_sound_bank(channel(), integer()) :: <<_::48>>

Change the sound bank of a channel.

change_volume(channel, volume)

@spec change_volume(channel(), int7()) :: <<_::24>>

Change the volume of a MIDI channel. This change is applied to all playing and future notes.

note_off(channel, note)

@spec note_off(channel(), note()) :: <<_::24>>

Turn a note in a channel off.

note_off_all(channel)

@spec note_off_all(channel()) :: <<_::24>>

Turn all active notes in a channel off.

note_on(channel, note, velocity)

@spec note_on(channel(), note(), velocity()) :: <<_::24>>

Turn a note in a channel on.

pan(channel, pan)

@spec pan(channel(), int7()) :: <<_::24>>

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.

pitch_bend(channel, bend)

@spec pitch_bend(channel(), integer()) :: <<_::24>>

Bend the pitch of notes playing in a channel. Values below 0x2000 will decrease the pitch, and higher values will increase it.