Crate coremidi[][src]

Expand description

This is a CoreMIDI library for Rust built on top of the low-level bindings coremidi-sys. CoreMIDI is a macOS framework that provides APIs for communicating with MIDI (Musical Instrument Digital Interface) devices, including hardware keyboards and synthesizers.

This library preserves the fundamental concepts behind the CoreMIDI framework, while being Rust idiomatic. This means that if you already know CoreMIDI, you will find very easy to start using it.

Please see the examples for getting an idea of how it looks like, but if you are eager to see an example, this is how you would send some note:

use coremidi::{Client, Destination, EventBuffer, Protocol};
use std::time::Duration;
use std::thread;

fn main() {
    let client = coremidi::Client::new("example-client").unwrap();
    let output_port = client.output_port("example-port").unwrap();
    let destination = Destination::from_index(0).unwrap();
    let note_on = EventBuffer::new(Protocol::Midi10).with_packet(0, &[0x2090407f]);
    let note_off = EventBuffer::new(Protocol::Midi10).with_packet(0, &[0x2080407f]);
    output_port.send(&destination, &note_on).unwrap();
    thread::sleep(Duration::from_millis(1000));
    output_port.send(&destination, &note_off).unwrap();
}

If you are looking for a portable MIDI library then you can look into:

For handling low level MIDI data you may look into:

Structs

A MIDI object property which value is a Boolean

A MIDI source owned by an entity.

Destination endpoints available in the system.

A MIDI source or source, owned by an entity. See MIDIEndpointRef.

A variable-length list of MIDI event packets See MIDIEventList

An input MIDI port owned by a client.

A MIDI object property which value is an Integer

An output MIDI port owned by a client.

A collection of simultaneous MIDI events. See MIDIPacket.

A mutable PacketList builder.

A list of MIDI events being received from, or being sent to, one endpoint.

The set of properties that might be available for MIDI objects.

A MIDI source owned by an entity.

Source endpoints available in the system.

A MIDI object property which value is an String

A MIDI virtual source owned by a client.

Enums

A message describing a system state change. See MIDINotification.

The MIDI Protocol to use for messages

Traits

Functions

Unschedules previously-sent packets for all the endpoints. See MIDIFlushOutput.

Stops and restarts MIDI I/O. See MIDIRestart.

Type Definitions