cpal
cpal copied to clipboard
Unable to get record_wav example to listen to sound card instead of microphone
Hello, I'm having trouble with the record_wav example on my laptop, which has a built-in microphone. I can't seem to get cpal to capture my sound card audio, instead of recording through the microphone. On my desktop, which has no mic, it works as I hoped, recording from the sound card output. Is there a way to enforce that cpal always uses the sound card output?
I'm on Ubuntu 16.04 on the laptop, and 18.04 on my desktop. cpal 0.10 on both
Can you elaborate a bit on this? The record_wav example was designed to capture audio from mic, and I'm not sure if ALSA provides a loopback device by default, which provides the behavior of capturing system output.
Anyway, the examples uses the default device it finds; you may want to modify the code to make it select the device of your preference.
@ishitatsuyuki do you know if we can record an audio output stream from cpal/Rust only, not doing a loopback and not setting the audio output as a mic ? It's related to this issue https://superuser.com/questions/1495091/pyaudio-in-docker-on-cloud-server-alsa-jack
I am asking this mainly because I can't run modprobe snd-aloop
to create a loopback in my environment (bc its a linux container on an arbitrary kernel that will not support module snd-aloop and netiher its host).
The Linux audio architecture unfortunately isn't container friendly. That's why one of PipeWire's goals is to make it easy to use audio from a sandboxed application in Flatpak. You need to use a snd-aloop device (which is global), or you might have some luck using JACK (but only if the application natively supports it).
Also this is kinda off-topic for the issue tracker. Please consider asking on Stack Exchange or the RustAudio Discord.