simple-pulse-desktop-capture

Crates.iosimple-pulse-desktop-capture
lib.rssimple-pulse-desktop-capture
version0.1.1
sourcesrc
created_at2023-02-12 20:25:29.148881
updated_at2023-02-12 20:29:07.130215
descriptionEasily capture PulseAudio PCM audio from the default playback device
homepage
repository
max_upload_size
id783465
size11,608
(jorikvanveen)

documentation

README

Simple pulse desktop audio capture

Capture PulseAudio desktop audio with ease.

Getting started

This crate exports the DesktopAudioRecorder struct, simply instantiate it with new and call .read_frame() in a loop to start recieving PCM audio data.

Example

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;
    }
}
Commit count: 0

cargo fmt