HACKER Q&A
📣 endorphine

Sound-related project suggestions for learning Rust?


I'm looking to start a pet project in Rust, as a means to learn the language. I was thinking something related to sound processing.

Do you think this is a good idea? The goal is to learn the language while also learning something about sound processing (e.g. noise cancellation module for PulseAudio).

Of course, other suggestions unrelated to sound are also appreciated.


  👤 satvikpendem Accepted Answer ✓
If you already know a lot about audio processing, then go for it. If not, you might still learn a lot from the experience. You might want to start with a small project in the space then grow from there.

👤 sonoprob
I try and learn Rust by glueing all things together (MIDI, Open Sound Control, Audio I/O) into little commandline utilities (e.g. routers), it's mostly to keep myself happy; quick results keep me pushing. Whether it's a good idea to start with a plugin depends on your experience (e.g. writing such things in C or C++).

Active noise cancellation would be too involved for a first attempt (at least for me). Here's an unfinished project: https://github.com/materoy/noice For regular denoising there's these (haven't tried them): https://github.com/jneem/nnnoiseless https://github.com/bennetthardwick/rust-obs-plugins/blob/mas....

Here's an aggregate for sound related things: https://rust.audio/ Overviews/libraries: https://github.com/kfrncs/awesome-rust-audio https://crates.io/keywords/audio

• Some videos: - Rust for audio developers: https://www.youtube.com/watch?v=Yom9E-67bdI - The nannou framework: https://www.youtube.com/watch?v=JPFv3adyLB4

• Here's a real good article by Ross Bencina that goes into the intricacies of realtime audio, don't allocate/free in the hot parts of your code ! http://www.rossbencina.com/code/real-time-audio-programming-...

Other things to check out:

fundsp - a compact library with DSL for typical dsp things https://github.com/SamiPerttu/fundsp

nih-plug - a plugin framework https://github.com/robbert-vdh/nih-plug/

Nannou a creative coding library that glues the needed parts together in a very clean way, will get you results quickly; the more difficult parts are already implemented, and it's a good place to learn.

I started trying to understand and use obvious libraries like `cpal` for cross-platform audio I/O, `midir` for midi I/O, and `rosc` for OSC.

Finally, I found `Programming Rust`, by Blandy and Orendorff a real nice condensed read. TRPL by Klabnik and Nicols is very readable as well, but I prefer Blandy/Orendorf. All in all, plenty of information, just a bit scattered over github / youtube and other places. Any way, my advice would be to take things step by step, learn from examples, and you could do worse than embrace chatgpt for rs pair programming as well (at least to get started) :)