#music #musicxml #verovio #engraving

rustovio

bindings to verovio, an engraving library

1 unstable release

0.1.0 Jun 26, 2021

#740 in Audio

MIT/Apache

7.5MB
189K SLoC

C++ 186K SLoC // 0.1% comments XSL 1K SLoC // 0.7% comments Python 653 SLoC // 0.1% comments JavaScript 320 SLoC // 0.1% comments Bitbake 311 SLoC // 0.8% comments Shell 214 SLoC // 0.2% comments QML 188 SLoC // 0.1% comments Java 111 SLoC // 0.3% comments Rust 82 SLoC // 0.0% comments Prolog 78 SLoC // 0.1% comments SWIG 33 SLoC // 0.4% comments C 11 SLoC

Contains (WOFF font, 22KB) verovio/fonts/VerovioText-1.0.woff

Rustovio

CI docs crates.io

Rust bindings to Verovio. It offer the raw bindings and a limited wrapper.

Limitations

This currrently does not work on Windows, mostly because I don't have one to check how to do the setup.

To use this library, you need to have a C++ runtime available for dynamic linking.

Wrapper

let mut tk = VerovioToolkit::new("verovio/data").unwrap();
tk.load_data_from_file(filename);
println!("{}", tk.render_to_svg(1).unwrap());

Bindings

let data = fs::read_to_string(filename).expect("Something went wrong reading the file");
let cdata = CString::new(data).unwrap();

let resource_folder = CString::new("verovio/data").unwrap();

let svg_str = unsafe {
    let tk = bindings::vrvToolkit_constructorResourcePath(resource_folder.as_ptr());
    bindings::vrvToolkit_loadData(tk, cdata.as_ptr());
    let svg = bindings::vrvToolkit_renderToSVG(tk, 1, std::ptr::null::<i8>());
    CStr::from_ptr(svg)
};
println!("{}", svg_str.to_str().unwrap());

No runtime deps