midia

Crates.iomidia
lib.rsmidia
version0.1.1
sourcesrc
created_at2024-04-26 06:05:06.697546
updated_at2024-04-26 06:05:06.697546
descriptionA simple wrapper for writing the midi file easier.
homepage
repositoryhttps://github.com/levinion/midia
max_upload_size
id1221093
size17,252
Maruka (levinion)

documentation

https://docs.rs/midia

README

MIDIA

A simple wrapper for writing the midi file easier.

Usage

fn main() {
    let mut writer = MidiWriter::new(TrackType::Single, 1, 120);
    let mut track = MidiTrack::new();
    track
        .set_bpm(120)
        .set_tonality(Tonality::G)
        .change_instrument(InstrumentType::AcousticGrandPiano)
        .note(0.5, Pitch::A4, 90)
        .note(0.5, Pitch::B4, 90)
        .note(2., Pitch::C5, 90)
        .note(0.5, Pitch::B4, 90)
    // ...
        .note(1., Pitch::F5, 90)
        .note(1., Pitch::E5, 90)
        .note(1., Pitch::D5, 90)
        .note(1., Pitch::C5, 90)
        .repeat(5);
    writer.add_track(track);
    writer.write("...");
}
Commit count: 10

cargo fmt