Skip to content

Unable to get record_wav example to listen to sound card instead of microphone #310

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
linclelinkpart5 opened this issue Jul 28, 2019 · 3 comments

Comments

@linclelinkpart5
Copy link

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

@ishitatsuyuki
Copy link
Collaborator

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.

@nestarz
Copy link

nestarz commented Oct 17, 2021

@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).

@ishitatsuyuki
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants