Crates.io | ruhear |
lib.rs | ruhear |
version | 0.1.0 |
source | src |
created_at | 2024-02-07 23:05:18.914308 |
updated_at | 2024-02-07 23:05:18.914308 |
description | A library for capturing audio from the system. |
homepage | |
repository | https://www.github.com/aizcutei/ruhear |
max_upload_size | |
id | 1131074 |
size | 55,370 |
A simple crate that allows you to capture system output audio (what aRe yoU HEARing).
See examples folder for simple example.
use ruhear::{Ruhear, RUBuffers, RUCallback};
fn main() {
// Create a callback that will be called every time the audio buffers are ready
// RUBuffers is a multichannel Vec<f32>. Default sampleRate is 48000Hz on Windows and macOS and 44100Hz on Linux.
let callback = |data: RUBuffers| {
println!("{:?}", data);
};
// Create a Ruhear instance and start capturing audio, use RUCallback! macro to create a thread-safe callback
let mut ruhear = RUCallback!(callback);
// Start capturing audio
ruhear.start();
std::thread::sleep(std::time::Duration::from_secs(5));
// Stop capturing audio
ruhear.stop();
}