#midi #sampling #recording #manifest-file #sampler #file-format #api-bindings

dot-multisample

Bindings to the .multisample manifest file format

1 unstable release

0.1.0 Oct 21, 2023

#748 in Audio


Used in multirec

MIT/Apache

24KB
543 lines

dot-multisample

Bindings for the .multisample manifest file format

Usage

The provided bindings have been created for use with quick-xml as (at time of writing) it has the best Serde support for XML documents.

See the "load" example for a more practical demonstration, but here is a short snippet:

let path: &std::path::Path = "path/to/Instrument.multisample".as_ref();
let manifest = std::fs::read_to_string(path.join("multisample.xml")).unwrap();

let config: Multisample = quick_xml::de::from_str(&manifest).unwrap();

println!("{} by {}", config.name(), config.creator());

lib.rs:

.multisample format domain model

Matches schema on GitHub as of commit 4e7971f1.

Example

let multi = Multisample::default()
    .with_name("My Instrument")
    .with_generator("Rust")
    .with_category("Piano")
    .with_creator("Me")
    .with_description("Toy piano I found at the second hand shop")
    .with_keywords(["noisy", "dirty", "metallic"])
    .with_samples([
        Sample::default()
            .with_file(path.join("C2.wav"))
            .with_key(Key::default().with_root(36)),
        Sample::default()
            .with_file(path.join("C3.wav"))
            .with_key(Key::default().with_root(48)),
        Sample::default()
            .with_file(path.join("C4.wav"))
            .with_key(Key::default().with_root(60)),
    ]);

Dependencies

~0.4–1MB
~23K SLoC