Module core

Source
Expand description

The core module is for types and concepts that are not strictly related to MIDI files. These types and concepts could be used for realtime MIDI as well. !

Structs§

Channel
Represents the MIDI channel. The minimum value is 0, the maximum value is 15. This type will clamp values to the valid range.
ControlValue
Represents a MIDI control value. The minimum value is 0, the maximum value is 127 (i.e. u7). This type will clamp values to the valid range.
LocalControlValue
A parameter found on most MIDI keyboards that have built-in sounds. Local Control can be set on or off, and is normally found in the global parameters for a particular instrument. When enabled the keyboard is electronically connected to the internal sounds of the instrument. This is the “normal” or default mode for most instruments. When turned off the keyboard only transmits MIDI to the MIDI out jack. The built-in sounds can then only be accessed from a MIDI input (or an internal sequencer where applicable). When people use keyboards with external sequencing equipment local control is normally turned off, and the sounds are just driven through the sequencer. This prevents a phenomenon known as MIDI echo, where a sound is triggered directly by the keyboard, and then a very short time later the same note is played again due to the data being passed through the sequencer.
MonoModeChannels
Represents the number of channels in mono mode. The minimum value is 0, the maximum value is 127 (i.e. u7). This type will clamp values to the valid range.
MonoModeOnValue
When Mono mode is selected, a single voice is assigned per MIDI Channel. This means that only one note can be played on a given Channel at a given time.
NoteMessage
Represents the data that is common, and required for both Message::NoteOn and Message::NoteOff messages.
NoteNumber
Represents the MIDI note number (C4 is 60, for example). The minimum value is 0, the maximum value is 127 (i.e. u7). This type will clamp values to the valid range.
PitchBendMessage
Provides the ability to pitch bend a channel by specifying a pitch bend value between 0 and 16383 where 8192 (the middle) is no pitch bend. Above 8192 bends the note up and below bends the note down. The actual pitch change depends upon the device (e.g. synth) but by default the range is +/- 2 semitones around the standard note pitch.
PitchBendValue
Represents the MIDI pitch bend value. The minimum value is 0, the maximum value is 16383 (i.e. u14). This type will clamp values to the valid range.
PortValue
The port number. The minimum value is 0, maximum value is 255 (i.e. u7). The default value is 0.
Program
Represents the MIDI program number. The minimum value is 0, the maximum value is 127 (i.e. u7). This type will clamp values to the valid range.
ProgramChangeValue
Provides the ability to change an instrument (sound, patch, etc.) by specifying the affected channel number and the new program value.
Velocity
Represents the MIDI velocity. The minimum value is 0, the maximum value is 127 (i.e. u7). This type will clamp values to the valid range.

Enums§

Clocks
There are 24 MIDI Clocks in every quarter note. (12 MIDI Clocks in an eighth note, 6 MIDI Clocks in a 16th, etc). One example of using this enum is in the TimeSignature, where we can specify the frequency of the metronome click.
Control
Represents the control byte in a [ControlChangeValue]. Values greater than one byte require sending two messages, one with the most-significant byte and one with the least-significant byte. Control values greater than 31 are for the Lsb in these two-byte messages.
DurationName
DurationName is used when specifying the denominator of a crate::file::TimeSignatureValue. When defining time signatures, the MIDI file spec says:
GeneralMidi
GeneralMidi represents the standard set of instruments that are intended to be available by all MIDI implementations.
Message
A MIDI message is made up of an eight-bit status byte which is generally followed by one or two data bytes. There are a number of different types of MIDI messages. At the highest level, MIDI messages are classified as being either Channel Messages or System Messages. Channel messages are those which apply to a specific Channel, and the Channel number is included in the status byte for these messages. System messages are not Channel specific, and no Channel number is indicated in their status bytes.
StatusType
Represents the status byte types in Table I “Summary of Status Bytes” from the MIDI specification.