Implements a MIDI (file) parser/serializer using nom
and cookie-factory
combinators.
Thanks to the combinators this library requires no allocation for serialization/de-serialization into/from the MIDI types provided.
(This is part of augmented-audio)
Based on MIDI 1.0 specification. MIDI 1.0
There's a Bach MIDI file used from piano-midi.de
linked here. This file is licensed as described
in http://www.piano-midi.de/copy.htm. Name: Bernd Krueger
The distribution or public playback of the files is only allowed under identical license conditions.
The scores are open source.
We can parse MIDI messages as follows:
```rust use augmentedmidi::{MIDIMessage, MIDIMessageNote, MIDIParseResult, parsemidi_event, ParserState};
// Initialize parser state let mut state = ParserState::default();
// We'll parse this &[u8] buffer. This could be a vec let inputbuffer = [0x98, 0x3C, 0x44];
// We parse a message borrowing from the input buffer. We could use MIDIMessage<Vec<u8>>
to
// allocate owned messages. This is only relevant for variable size messages like SysEx.
let parseresult: MIDIParseResult
asserteq!(midimessage, MIDIMessage::NoteOn(MIDIMessageNote { channel: 8, note: 60, velocity: 68 })); ```
```rust use augmentedmidi::{serializemessage, MIDIMessage};
let mut writer = [0u8;3]; // This could be a vec.
let message: MIDIMessage
assert_eq!(writer, [0xB0, 0x37, 0x7F]); ```
License: MIT