Skip to content
/ midly Public
forked from kovaxis/midly

A pure-rust fast and flexible MIDI parser library, designed for multi-MB files

License

Notifications You must be signed in to change notification settings

femtovg/midly

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Midly

Midly is a Standard Midi File parser and writer designed to be as efficient as possible, making as few allocations as possible and using multiple threads to parse and write MIDI tracks in parallel.

The behaviour of the parser is also configurable through crate features. See the crate-level documentation for the available features and no_std support.

Getting started

First add the following line to your Cargo.toml file, under the [dependencies] section:

midly = "0.4"

Then use the Smf type in the crate root:

use std::fs;
use midly::Smf;

// Load bytes first
let data = fs::read("Pi.mid").unwrap();

// Parse the raw bytes
let mut smf = Smf::parse(&data).unwrap();

// Use the information
println!("midi file has {} tracks!", smf.tracks.len());

// Modify the file
smf.header.format = midly::Format::Sequential;

// Save it back
smf.save("PiRewritten.mid").unwrap();

Most types to be imported are on the crate root and are documented in-place. Check the crate documentation for more information.

About

A pure-rust fast and flexible MIDI parser library, designed for multi-MB files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%