WMIDI

Midi encoding and decoding library suitable for real-time execution.

crates.io docs.rs

License: MIT Build Status

Usage

```rust use std::convert::TryFrom;

// Decoding messages from bytes. fn handlemidimessage(bytes: &[u8]) -> Result<(), wmidi::FromBytesError> { let message = wmidi::MidiMessage::tryfrom(bytes)?; if let wmidi::MidiMessage::NoteOn(, note, val) = message { let volume = u8::from(val) as u8 / 127.0; println!("Singing {} at volume {}", note, volume); } Ok(()) }

// Encoding messages to bytes. fn miditobytes(message: wmidi::MidiMessage<'>) -> Vec { let mut bytes = vec![0u8; message.bytessize()]; message.copytoslice(bytes.asmutslice()).unwrap(); bytes } ```

Testing & Benchmarking

Changelog

4.0.0

3.1.0

3.0.0