'no audio recorded from alsa loopback device
I've been trying to get an alsa loopback device working (to test an application that reads audio) following the instructions here:
https://sysplay.in/blog/linux/2019/06/playing-with-alsa-loopback-devices/
The device is enabled using:
modeprobe snd-aloop
As can be seen from:
>aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC269VB Analog [ALC269VB Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 1: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM]
Subdevices: 7/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
I am supposed to be able to play and record audio using:
aplay -D hw:1,0 foo.wav
&
arecord -D hw:1,0 bar.wav
However the audio recorded is completely silent. This is more visible when I use sox:
AUDIODEV=hw:1,0 play -V foo.wav
AUDIODEV=hw:1,0 rec -V -c 1 -r 8000 bar.wav
As it provides a convenient ascii-art volume indicator:
In:100% 00:10:00.00 [00:00:00.00] Out:4.80M [ =|= ] Clip:0
Solution 1:[1]
The loopback device actually creates pairs of devices. One device is the read end and a separate device is the write end. What you actually need is:
aplay -D hw:1,0 foo.wav
&
arecord -D hw:1,1 bar.wav
or using sox:
AUDIODEV=hw:1,0 play -V foo.wav
AUDIODEV=hw:1,1 rec -V -c 1 -r 8000 bar.wav
I discovered this by accident when I copied an .asoundrc configuration that worked as below. The asound configuration is not required however:
pcm.loopin {
type plug
slave.pcm "hw:1,0,0"
}
pcm.loopout {
type plug
slave.pcm "hw:1,1,0"
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
