Expand description

Interfaces, data structures and utilities for dealing with MIDI messages.

Features

  • Complete support for the following message types:
    • Short messages (3 bytes)
    • 14-bit Control Change messages
    • (N)RPN messages
  • Scanners for extracting 14-bit Control Change and (N)RPN messages from a stream of short messages
  • Suitable for real-time usage (no heap allocation, no dynamic dispatch, no locking)
  • Unified API to work with different short message data structures (see ShortMessage trait)
  • Uses wording which is as close as possible to the MIDI 1.0 specification

Not yet implemented

Data structures and utilities for dealing with System Exclusive messages are not yet implemented. They will be added eventually as separate structures on top of the existing ones (similar to (N)RPN and 14-bit Control Change).

Examples

See how to …

Modules

Contains predefined controller numbers.

Contains convenience functions for creating messages with minimum boilerplate

Structs

A MIDI channel (0 - 15).

A 14-bit MIDI Control Change message.

Scanner for detecting 14-bit Control Change messages in a stream of short MIDI messages.

A controller number (0 - 127) of a MIDI Control Change message.

An error which can occur when trying to create a ShortMessage from raw bytes.

A key number (0 - 127), e.g. of a MIDI Note On message.

A MIDI Parameter Number message, either registered (RPN) or non-registered (NRPN).

Scanner for detecting (N)RPN messages in a stream of short messages without polling.

An error which can occur when parsing a string to one of the MIDI integer types.

Scanner for detecting (N)RPN messages in a stream of short messages with polling.

A short message implemented as a tuple of bytes.

An error which can occur when converting from a type with a greater value range to one with a smaller one.

A 4-bit integer (0 - 15).

A 7-bit integer (0 - 127).

A 14-bit integer (0 - 16383).

Enums

The desired byte order of a data entry value.

Type of the value that is encoded in a parameter number message.

Like MessageSuperType but without distinction between different channel messages.

The most high-level classification of MIDI messages.

A more coarse-grained classification of MIDI messages than ShortMessageType.

The most fine-grained classification of short MIDI messages.

A short message implemented as an enum where each variant contains exactly the data which is relevant for the particular message type.

Possible contents of a MIDI Time Code Quarter Frame message.

Possible time code types of a MIDI Time Code Quarter Frame message.

Traits

A single short MIDI message, where short means it’s made up by a maximum of 3 bytes.

Static methods for creating short MIDI messages.