MIDIx
A suite of tools used to read, modify, and manage MIDI-related systems
NOTE: The main branch is in development. Stable versions are on their own branches.
Overview
midix provides users with human readable MIDI structures without invariant states. That is, the midi 1.0 specification has been strongly typed such that programatic commands built with this crate are not invariant.
midix provides a parser (Reader) to read events from .mid files.
calling Reader::read_event will yield a FileEvent.
Additionally, midix provides the user with LiveEvent::from_bytes, which will parse events from a live MIDI source.
You may also make your own MIDI representation using the provided structs. A significant portion of
this library lives within the bevy feature. See details below on usage with the bevy engine.
Goal
midix is NOT designed to be as fast as possible. It is designed for a user to navigate the MIDI format to read and write to. Instead of working directly with bytes, use language to define what your MIDI is supposed to do.
Getting Started
MIDI can be interpreted in two main ways: through LiveEvents and regular file Events.
Example
To read from a file, use the Reader:
use *;
let midi_header = ;
let mut reader = from_byte_slice;
// The first and only event will be the midi header
let Ok = reader.read_event else ;
// format 0 implies a single multi-channel file (only one track)
assert_eq!;
assert_eq!;
To parse a LiveEvent
use *;
/* Ch.3 Note On C4, forte */
let note_on = ;
// NoteOn is a channel voice message
// Alternatively, use VoiceEvent::read_bytes(¬e_on)
let Ok = from_bytes else ;
let NoteOn = channel_voice_msg.event else ;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
Bevy Support
Midix has been built with the bevy engine in mind. this feature uses rustysynth to play midi sounds under the hood!
Note
When running the examples, try using cargo run --example <EXAMPLE_NAME> --features example --release for the best results!
Example
use *;
use Duration;
use ;
use *;
/// Take a look here for some soundfonts:
///
/// <https://sites.google.com/site/soundfonts4u/>
See /examples for details.
Semantic Versioning and Support
midix will adhere to semantic versioning. This means that I've opted to use major versions, even if this crate does not consider itself feature complete (you might get a midix v29.3.1 someday)
The current MSRV is rust 1.87
Acknowledgments
This crate was originally forked from bevy_midi. Please check them out if this crate doesn't suit your needs!
MIDIx feature roadmap
no_std- Streamer (midir ext)
- Interfaces between
MidiSourceandMidi(some representable MIDI type, like a file, events, etc.) - MIDI writers
- Streamer (async timed stream event via midir)
- MidiFile
General feature schedule
The SUPPORT.md file denotes the length of time major revisions are supported.
When the major version of the crate is incremented, new features for the previous version(s) will likely be neglected. If you need a non-breaking feature for an older version before the end of its maintenence period, please let me know!
Feature roadmap
no_std- Streamer (midir ext)
- Interfaces between
MidiSourceandMidi(some representable MIDI type, like a file, events, etc.) - MIDI writers
- Streamer (async timed stream event via midir)
- MidiFile
Acknowledgments
A lot of the documentation is copied directly from this documentation.
This reference states "This document may be freely copied in whole or in part provided the copy contains this Acknowledgement.":
This document was originally distributed in text format by The International MIDI Association.
© Copyright 1999 David Back.
EMail: david@csw2.co.uk
Web: http://www.csw2.co.uk
Inspired by/copied from
midix
inspired by midly
and quick-xml.
If you are in need of a MIDI writer, I highly
recommend using midly, as this midix does not yet
support file writing.
Thanks to these mainters and contributors for inspiration!
bevy feature
Forked originally from bevy_midi. Huge thank you for the examples and docs!
hidden synth feature
Forked originally from rustysynth.