Crates.io | simple-pulse-desktop-capture |
lib.rs | simple-pulse-desktop-capture |
version | 0.1.1 |
source | src |
created_at | 2023-02-12 20:25:29.148881 |
updated_at | 2023-02-12 20:29:07.130215 |
description | Easily capture PulseAudio PCM audio from the default playback device |
homepage | |
repository | |
max_upload_size | |
id | 783465 |
size | 11,608 |
Capture PulseAudio desktop audio with ease.
This crate exports the DesktopAudioRecorder struct, simply instantiate it with new and call .read_frame()
in a loop to start recieving PCM audio data.
This example captures desktop audio and prints the PCM data for 5 seconds before quitting.
use std::time::Instant;
let mut recorder = DesktopAudioRecorder::new("Experiment").unwrap();
let start = Instant::now();
loop {
match recorder.read_frame() {
Ok(data) => println!("{:?}", data),
Err(e) => eprintln!("{}", e)
};
if Instant::now().duration_since(start).as_millis() > 5000 {
break;
}
}