Get The Decibel Level From A Mic In Rust
This is what I'm using for ASCII _ BEAR to move the mouth when I speak into the mic with enough volume :
#!/usr/bin/env cargo +nightly -Zscript
//! ```cargo
//! [dependencies]
//! anyhow = "1.0.75"
//! clap = "4.4.7"
//! cpal = "0.15.2"
//! ```
use ;
- This outputs the dB level to the terminal
- The samples happen non - stop. I put a check in place so the values only output if they are greater than 0.006
- I've seen negative numbers coming from the float values as well. I'm not sure what's happening with those (I've only got a single channel in my setup so I don't think it's a stereo thing)
- There's a very slight delay on my setup from the time I speak until the output shows up. I got through a DAC which might have something to do with it, or that might just be how it works. I'm not super worried about it for now
Footnotes And References
- •ASCII_BEAR
My virtual avatar for streaming on Twitch. I set it up when I moved computers and didn't have a wire to connect the camera to the new machine and have just kina been running with it