Crates.io | midia |
lib.rs | midia |
version | 0.1.1 |
source | src |
created_at | 2024-04-26 06:05:06.697546 |
updated_at | 2024-04-26 06:05:06.697546 |
description | A simple wrapper for writing the midi file easier. |
homepage | |
repository | https://github.com/levinion/midia |
max_upload_size | |
id | 1221093 |
size | 17,252 |
A simple wrapper for writing the midi file easier.
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("...");
}