Skip to main content

Crate midi_io

Crate midi_io 

Source
Expand description

§midi-io

A portable library for encoding, sending, decoding and streaming MIDI

§Features

  • Send and receive strongly-typed MIDI 1 messages
  • Async-first API with any runtime
  • Receive messages as individual streams: MIDI, SysEx, backend notifications, errors
  • Connection management: receive and react to connection/disconnection event notifications

§Supported Platforms

OSPlatformLibrary
macOS 10.15+CoreMIDIcoremidi
iOS 15+CoreMIDIcoremidi
Linux 3.x+ALSA sequenceralsa

If you need a platform that isn’t yet supported, check out midir.

§Example

Connect to the first MIDI source and print every message as it arrives:

use midi_io::Client;

#[tokio::main]
async fn main() -> Result<(), midi_io::Error> {
    let client = Client::new("my-app").await?;
    let sources = client.sources().await?;
    let source = sources.first().expect("no MIDI sources found");
    let mut messages = client.connect_source(source).await?.into_messages();

    while let Some(timed) = messages.recv().await {
        println!("{}", timed.payload);
    }
    Ok(())
}

See examples for more.

§Installation

cargo add midi-io

For codec-only use, disable default features: midi-io = { version = "0.1", default-features = false }.

§License

Licensed under either of

at your option.

§Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Structs§

Clientio
MIDI client for sending and receiving MIDI messages
DataByte
Destinationio
A destination is a receiver of MIDI messages.
DestinationChangesio
DestinationConnectionio
ErrorStreamio
EventStreamio
MessageStreamio
PitchBend
PortIdio
RawMidiMessage
An unparsed MIDI message.
SongPosition
Sourceio
A source is a sender of MIDI messages.
SourceChangesio
SourceConnectionio
Streamsio
SysEx
SysexStreamio
Timedio
VirtualDestinationio
VirtualSourceio

Enums§

Channel
CodecError
Decoded
DestinationChangeio
Indicates when available destinations have changed
Error
IoErrorio
MidiMessage
NameErrorio
ParseError
PlatformErrorio
SourceChangeio
Indicates when available sources have changed
SysExError
ValueError
A value outside the range representable in a MIDI message field.

Functions§

decode