by chaosprint · 4y ago · 0 comments
How about Rust audio (https://github.com/RustAudio) and then FFI?
I am developing the audio lib for the music live coding language I design in Rust and I think the experience of Rust is really good, because of `cargo` (the package management), the community, the syntax and compiler, the ergonomics, and so on. For one of my usages, the audio lib in Rust compiles to wasm and runs in browsers smoothly. I can also write VST plugins with the same audio library in Rust:
https://github.com/chaosprint/glicol
There are also many other Rust audio libs such as dasp, fundsp and hexosynth, all worth checking out. Before I became addicted to Rust audio, I had checked some C++ audio project, such as the Maximillian lib especially the JS bindings, the source code of SuperCollider and the JUCE for VST. But apparently I have made my decision for the reasons abovementioned.
Which the author did quite alright, minus the issue I discussed on separate comment.
You will have better luck moving the audio industry from bad C practices into modern C++, than making most learn a complete new language.
JUCE rules in the audio industry for example.
Also, I don't think the JUCE "rules in the audio industry". First, the most typical use case for JUCE is to write VST plugins. Second, the company ROLI was trying to develop another language called SOUL. Although its progress seems to stop now, it somehow shows that they are trying to provide something different from C++.
So while it is nice for the security of the IT stack, we also need to keep things in perspective.
#[no_mangle]
pub extern "C" fn process(
in_ptr: *mut f32,
out_ptr: *mut f32,
size: usize,
result_ptr: \*mut u8
) {
let _in_buf: &mut [f32] = unsafe { std::slice::from_raw_parts_mut(in_ptr, size) };
}