Expand description
This crate provides types and functions for abstracting MIDI files.
This crate works alongside with the midly and midir crates. However you can implement your own Connection, instead of using midir.
§A Basic Workflow
- Use midly to parse a MIDI file. (midly is re-exported).
- Create a Timer from the
header
. - Create a Sheet from the parsed tracks.
- Initialize a MIDI connection using midir. You could also implement Connection on your custom type if you don’t want to use midir.
- Create a Player from the connection and the timer.
- Play the sheet using the player.
§Examples
Check out /examples/play_midi.rs
for a basic midi player.
I started developping this crate because I needed the features it now offers. Here are some real-world examples of nodi in action:
§Crate Features
Features enabled by default:
hybrid-sleep
: A more accurate sleep, mixing regular sleep with spin locking efficiently. With this feature enabled the default implementations of Timers in this crate will use this. Highly recommended for Windows users but it may also increase precision on other platforms.
Optional features:
midir
: Adds implementations ofConnection
formidir::MidiOutputConnection
.midir-jack
: Same withmidir
but uses the Jack backend.midir-winrt
: Same withmidir
but uses the WinRT backend.
Re-exports§
Modules§
Structs§
- Bars
- An iterator over bars in a MIDI Sheet.
- Midi
Event - Represents a MIDI message. An instance of this type can sometimes be converted from a TrackEventKind with the TryFrom trait. This type can be fed to a synthesizer.
- Moment
- Represents a single moment (tick) in a MIDI track.
- Player
- A type that orchestrates playing of MIDI tracks.
- Sheet
- Holds every moment in a MIDI track, each moment representing a MIDI tick.
Enums§
- Event
- Represents a single MIDI event.
Traits§
- Connection
- Any type that can play sound, given a MidiEvent.
- Timer
- Used for timing MIDI playback.