MIDISynth.Command (midi_synth v0.4.1) View Source

Convert MIDI commands to raw bytes

Link to this section 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.

Link to this section Types

Specs

channel() :: 0..15

A MIDI channel number

Specs

duration() :: non_neg_integer()

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

Specs

int7() :: 0..127

A 7-bit integer

Specs

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

Specs

program() :: int7()

A MIDI program

Specs

velocity() :: int7()

The velocity to strike the note.

127 = maximum velocity

Specs

volume() :: int7()

A channel volume

Link to this section Functions

Link to this function

change_control(channel, control_number, control_value \\ 0)

View Source

Specs

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

Change the MIDI controller value of a channel.

Link to this function

change_program(channel, prog)

View Source

Specs

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

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

Link to this function

change_sound_bank(channel, bank)

View Source

Specs

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

Change the sound bank of a channel.

Link to this function

change_volume(channel, volume)

View Source

Specs

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

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

Specs

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

Turn a note in a channel off.

Specs

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

Turn all active notes in a channel off.

Link to this function

note_on(channel, note, velocity)

View Source

Specs

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

Turn a note in a channel on.

Specs

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.

Link to this function

pitch_bend(channel, bend)

View Source

Specs

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.