Hacker News new | ask | show | jobs
by zduny 1353 days ago
Flutter for the UI. Rust for the listening, and pitch detecting backend. Connected the former with the latter using flutter_rust_bridge.

More details on Rust backend:

For listening (getting audio signal from microphone) I used:

- Android: https://crates.io/crates/oboe

- native desktop/iOS (not currently released): https://crates.io/crates/clap

- Web: https://crates.io/crates/web-sys (so basically JS Web Audio API called from Rust compiled to WASM).

For pitch detection:

- https://crates.io/crates/pitch-detection

4 comments

> - native desktop/iOS (not currently released): https://crates.io/crates/clap

I hope you didn't use a command line parser to stream audio...

I meant https://github.com/RustAudio/cpal (should've checked).
Haha, no worries :) "clap" does indeed sound audio-related, and "clap" is only one transposition from "cpal"!
Heh, I always get those two crates names confused, even now, rereading comments I again thought it was "clap" and not "cpal" (because "clap" like in "clapping").
"clap" IS actually audio related too https://github.com/free-audio/clap :)
>Flutter for the UI. Rust for the listening, and pitch detecting backend. Connected the former with the latter using flutter_rust_bridge.

It's good to see that there is a active project to help with making Android apps using rust.

Why not just dart?
Dart being a GC'd runtime makes it quite hard to use for low latency audio applications, probably not as critical for audio input as output, but still potential issue, for more details see: https://github.com/dart-lang/sdk/issues/46943
Then why bother with Flutter at all?
It's amazing for UI (and portable).

Rust - not so much (or more like not at all) at the moment.

And has a GC running all the time, including when the called Rust code is executing, making it pointless to avoid using Dart in first place.
Awesome, thanks!