First create the loopback:
Code: Select all
modprobe snd-aloop
lsmod|grep aloop
snd_aloop 36864 0
snd_pcm 135168 5 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec,snd_aloop,snd_hda_core
snd_timer 49152 2 snd_aloop,snd_pcm
snd 110592 13 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hwdep,snd_hda_intel,snd_hda_codec,snd_hda_codec_realtek,snd_timer,snd_aloop,snd_pcm
Code: Select all
aplay -l
[…]
card 2: 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 2: Loopback [Loopback], device 1: 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
- [sysdefault:2] Loopback (shared)
- [hw:2,0] Loopback: Loopback PCM
- [hw:2,1] Loopback: Loopback PCM
If I tell speaker-test or mpd to play into hw:2,0 then simplescreenrecorder can capture it in the loopback device
Code: Select all
cat /etc/mpd.conf
audio_output {
type "alsa"
name "My ALSA Device"
device "hw:2,0"
}
/etc/init.d/mpd restart
mpc play
Code: Select all
speaker-test -D hw:2,0
If I loop device hw:0,0 to hw:0,0, the microphone input is copied to the headphones (in alsamixer, I also have to make sure that card0 has "Input source" set to the "Front Mic" and not Rear Mic or Line).
Code: Select all
alsaloop -C hw:0,0 -P hw:0,0
Code: Select all
alsaloop -C hw:0,0 -P hw:2,0
What does not work:
Playing into the loopback using aplay in all possible loopback devices and subdevices.
Code: Select all
for i in 0 1 ; do for j in `seq 0 9` ; do aplay -c 2 -D hw:2,${i},${j} /usr/share/sounds/alsa/Front_Left.wav ; done ; done
In alsamixer, a loopback capture control exists and is set to 100%.
I tried changing ~/.asoundrc like in the sources below, but this is arcane to me and I thought it could be done with command-line.
What I read is below.
https://lichtmetzger.de/en/2014/11/29/s ... o-no-jack/
https://sysplay.in/blog/linux/2019/06/p ... k-devices/
https://bbs.archlinux.org/viewtopic.php?id=147852
(and people who cite this work:)
https://noisybox.net/blog/2016/01/alsa_ ... ice_output
https://dt.iki.fi/record-system-output-alsa
So I'm still looking for a solution to push the headphones playback into a loopback.
