RustAudio / cpal

Cross-platform audio I/O library in pure Rust
Apache License 2.0
2.55k stars 344 forks source link

example on how to record output device to wav #896

Closed louis030195 closed 2 weeks ago

louis030195 commented 2 weeks ago

hi, I'm trying to record output device and do speech to text, it works with input device but not for output device with similar code

do you have examples of using output device for example to record wav?

my code is here just in case: https://github.com/louis030195/screen-pipe/blob/17c3a5b34d017ba45dc51da64aa60ccdd396151a/screenpipe-audio/src/core.rs#L83

my impl do like this:


if its an input device

use default host

use input config

use input stream


if its an output device

use default host

use output config

use output stream

right? or misunderstand something

louis030195 commented 2 weeks ago

not sure how this relate to https://github.com/RustAudio/cpal/pull/894

louis030195 commented 2 weeks ago

this is how i do it: https://github.com/louis030195/screen-pipe/blob/9e0476a373326dfbeab455dbc729004470299f58/screenpipe-audio/src/core.rs#L93

make sure to be on same ref of cpal