Audio Programming in Rust?

Anyone here doing any lower-level audio programming in Rust?

I’ve been interested in trying to build/prototype my own eurorack modules using micro-controllers, yet am wary of diving into C/C++. I’ve used Rust before and it’s much more to my liking… Was curious if there are people out there using it for this sort of stuff. It seems to have good micro-controller / embedded systems support.

Thanks!

2 Likes

Yes, I’ve been doing quite a lot of Rust on Bela, and also, a sizeable portion of Firefox’s audio code (100% of the low latency audio IO code on Linux, for example, soon also on OSX) is written in Rust. Another team at Mozilla (I do audio work there) is reimplementing the whole Web Audio API in Rust, that works well. It’s indeed very well suited for this kind of work.

All that is on top of a either a real-time kernel or a normal general purpose kernel, but Rust works well, for example, without an allocator, and, as you note, there are lots of resources for embedded development, including support for stm32f, that people like to use in eurorack.

It’s quite refreshing to use Rust compared to C or C++ as you say, I heartily recommend it for any work where very high performance and/or real-time is a requirement. It’s takes bit longer to learn than C or C++ (at least that’s my experience), but this is very easily paid back by the fact that most bugs that are not logic bug are caught at compile time. Also I find the final code much more robust than what I usually do in C++. Usually, when it compiles, it works.

The compiler is very helpful in pointing out possible solution to problems, and the community is very welcoming. The package manager is a game changer compared to C or C++, all the very nice data structures and algorithms are just a package away, and there are thousands of packages, implementing cutting edge lock-free data structures, various DSP bits, bindings to tons of libraries and system APIs, etc.

9 Likes