Module midi_file::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

  • Represents the MIDI channel. The minimum value is 0, the maximum value is 15. This type will clamp values to the valid range.
  • 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.
  • 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.
  • Represents the data that is common, and required for both Message::NoteOn and Message::NoteOff messages.
  • 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.
  • 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.
  • 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.
  • The port number. The minimum value is 0, maximum value is 255 (i.e. u7). The default value is 0.
  • 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.
  • Provides the ability to change an instrument (sound, patch, etc.) by specifying the affected channel number and the new program value.
  • 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

  • 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.
  • 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 is used when specifying the denominator of a crate::file::TimeSignatureValue. When defining time signatures, the MIDI file spec says:
  • GeneralMidi represents the standard set of instruments that are intended to be available by all MIDI implementations.
  • Represents the status byte types in Table I “Summary of Status Bytes” from the MIDI specification.