150 points by soundsincode 5 months ago flag hide 12 comments
johnson33 5 months ago next
Just started learning Rust and was wondering if anyone here knows any existing real-time audio processing libraries? #newbie #rustlang
coder1988 5 months ago next
Hey @Johnson33, there are a couple of audio processing libraries in Rust. However, for real-time processing, I know of only one: Hound (http://hound-rust.github.io/doc/hound/). Let me know if you give it a spin! #rustlang #audio #realtime
earthwalker 5 months ago next
I've used Hound before; it's great! For real-time, you may need to tweak the settings to avoid dropouts. Glad to see more people exploring Rust for audio processing. #rustlang #audio #realtime
johnson33 5 months ago next
@earthwalker I see, I'll definitely look into optimizing the library settings. Appreciate the tip! #rustlang #audio #realtime
earthwalker05 5 months ago next
@Johnson33, no problem! make sure any settings change you make matches your sampling rate. Check out https://doc.rust-lang.org/book/ch16-00-concurrency.html for help on Rust's threading capabilities! Good luck! #rustlang #audio #realtime
theob 5 months ago prev next
@earthwalker Have you experimented with Lapce (<https://github.com/lapce/lapce>), the open-source text editor that leverages Rust's capabilities for building responsive and efficient editors? It's getting better every day and can be used as an excellent example for real-time audio processing. #rustlang #audio #realtime #lapce
sgibson 5 months ago next
@theob, I haven't tried Lapce yet, but I've seen it in the news. I'll be reviewing the codebase in-depth -- that's a cool use case! Can't wait to see where the project goes. #rustlang #audio #realtime #lapce
johnson33 5 months ago prev next
@coder1988 thanks! I'll check it out. I'm really interested to learn more about real-time audio processing, especially since there seems to be a lack of resources for it in Rust #rustlang #audio #realtime
grubber12 5 months ago prev next
If you want to roll your own implementation, you'll have a fun time combining the Rust audio-tools crate <https://github.com/Rust-Audio/audio-tools> with crossbeam-channel <https://github.com/crossbeam-rs/crossbeam-channel>. Good luck! #rustlang #audio #realtime
solaris 5 months ago next
I'd be careful when using crossbeam-channel for real-time audio processing: you might face some latency, especially in multi-threaded scenarios. Make sure to profile your application to quantify any performance hit. #rustlang #audio #realtime
grubber12 5 months ago next
Good call, @solaris. The performance hit will depend on the user's use-case. For an audio processing library, can't beat the built-in thread-pool on the standard library. This is my current go-to: https://doc.rust-lang.org/std/thread/struct.ThreadPool.html #rustlang #audio #realtime
freelance 5 months ago prev next
Implementing a real-time audio processing library in Rust can be overwhelming for beginners. If you're looking for a starting point, here's the Rust the Hard Way guide (<https://rust-the-hard-way.github.io/>) that you might find helpful. Remember, patience and trying different approaches are key! #learningrust