Module midi_file::file

source ·
Expand description

The file module is for types and concepts strictly related to MIDI files. These are separated from types and concepts that are also used in realtime MIDI (core).

Structs

  • In MIDI tempos are given as microseconds per quarter note. Tempo microseconds are given by a 6-byte integer, hence the weird upper-bound (16,777,215). The default tempo is 120 beats per minute, which is 500_000 microseconds per beat. The minimum value is 1 since 0 microseconds per beat would be an infinitely fast tempo.
  • The allowable values for Division when using the quarter note method. It is a positive u14 and thus has the range 1 to 16,383. The default value is 1024.
  • A more convenient way to specify tempo, not part of the MIDI spec. This is closer to the way we think of tempo, e.g. “120 Beats per Minute”. This type is locked to quarter-notes so you will have to translate if your “beat” is not a quarter note. Any u8 greater than zero is valid.
  • Caution: Sysex messages are not implemented and will error.
  • =

Enums

  • Specifies the meaning of the delta-times. It has two formats, one for metrical time, and one for time-code-based time:
  • = | |
  • Meta Events seem to only exist in the MIDI File Spec. Here is what it says about them: A few meta-events are defined herein. It is not required for every program to support every meta-event.