| Crates.io | audio-recorder-rs |
| lib.rs | audio-recorder-rs |
| version | 0.1.0 |
| created_at | 2025-07-13 20:14:05.666332+00 |
| updated_at | 2025-07-13 20:14:05.666332+00 |
| description | Cross platform system audio / microphone recording library in Rust |
| homepage | https://github.com/DrSh4dow/audio-recorder-rs |
| repository | https://github.com/DrSh4dow/audio-recorder-rs |
| max_upload_size | |
| id | 1750758 |
| size | 95,322 |
Core library for cross-OS system + input audio recording.
The audio-recorder-rs library provides functionality for recording audio using
various configurations. It supports recording from multiple devices, with or
without resampling, and is designed to be used in a singleton pattern to
ensure only one instance of the recorder is active at any time.
To use the recorder, create an instance of the Recorder struct and
call its start method to begin recording. This will start a background
thread that will record audio from the default input device. The start
function will return a receiver which acts as a stream to receive the
audio data in f32. Call the stop method to stop recording.
use audio_recorder_rs::Recorder;
fn main() {
let mut recorder = Recorder::new();
let receiver = recorder.start().expect("Failed to start recording");
thread::spawn(move || {
while let Ok(d) = receiver.recv() {
for sample in d {
writer.write_sample(sample).ok();
}
}
});
sleep(Duration::from_secs(5));
recorder.stop().expect("Failed to stop recording");
}
Recordernew() -> Recorder
Recorder.start() -> Result<Receiver<TargetFormat>, RecorderError>
stop() -> Result<(), RecorderError>
get_is_recording() -> bool
get_config() -> RecorderConfig