How to Loopback sound with ALSA

Alfs Kurmis via Alsa-user <[email protected]> Sun, 14 Mar 2021 15:20:32 +0200
Newsgroups gmane.linux.alsa.user
Message-ID <[email protected]>
Good Day @all !

I can easily record and play microphone sound using

arecord --vumeter=mono --device="default:CARD=PCH" -f cd rec-test-mic.wav

aplay --vumeter=mono --device="plughw:0,0" rec-test-mic.wav

Now i wanna play sound to my laptop speakers/headphones using ALSA (and only ALSA),

and at same time record this sound !

It means that any sound played to default:CARD=PCH or sysdefault:CARD=PCH or plughw:0,0 or hw:0,0

is routed also to Loopback device, and capturerd from Loopback (i guess) .

I have manually loaded # modprobe snd-aloop .

After this, 8 Loopback devices was created, and i have play sound with command

mpg123 test.mp3 .

Now i try to route/clone my sound to Loopback FIFO one end

alsaloop -P hw:1,0,1 -C sysdefault:CARD=PCH

and record from Loopback FIFO another end

arecord --vumeter=mono --device="hw:1,0,0" rec-test-mic.wav

vumeter shows constant zero and records silence .

How i can manually route/clone ALSA sound to Loopback, and make it available for recording ?

BTW - in this case alsaloop works as FIFO daemon (i guess) ?

Is it possible to connect/disconnect sound routing using one-shot commands ?

Probably i wanna sound routing make not permanent, but On-Demand.

First i wanna manually test it , an only after successful test write to configs !

Is it possible (at begin) to test sound routing on-da-fly without rewrite any config files ?

After manual config will be OK, how i must rewrite my configs ?

ls /usr/share/alsa/pcm/

center_lfe.conf dpl.conf hdmi.conf rear.conf surround40.conf surround51.conf

default.conf dsnoop.conf iec958.conf side.conf surround41.conf surround71.conf

dmix.conf front.conf modem.conf surround21.conf surround50.conf

Thanks a lot @ all

Im voraus besten Dank

Alfs Kurmis

aplay -lL

null

Discard all samples (playback) or generate zero samples (capture)

default:CARD=PCH

HDA Intel PCH, CX20751/2 Analog

Default Audio Device

sysdefault:CARD=PCH

HDA Intel PCH, CX20751/2 Analog

Default Audio Device

front:CARD=PCH,DEV=0

HDA Intel PCH, CX20751/2 Analog

Front speakers

surround21:CARD=PCH,DEV=0

HDA Intel PCH, CX20751/2 Analog

2.1 Surround output to Front and Subwoofer speakers

surround40:CARD=PCH,DEV=0

HDA Intel PCH, CX20751/2 Analog

4.0 Surround output to Front and Rear speakers

surround41:CARD=PCH,DEV=0

HDA Intel PCH, CX20751/2 Analog

4.1 Surround output to Front, Rear and Subwoofer speakers

surround50:CARD=PCH,DEV=0

HDA Intel PCH, CX20751/2 Analog

5.0 Surround output to Front, Center and Rear speakers

surround51:CARD=PCH,DEV=0

HDA Intel PCH, CX20751/2 Analog

5.1 Surround output to Front, Center, Rear and Subwoofer speakers

surround71:CARD=PCH,DEV=0

HDA Intel PCH, CX20751/2 Analog

7.1 Surround output to Front, Center, Side, Rear and Woofer speakers

hdmi:CARD=PCH,DEV=0

HDA Intel PCH, HDMI 0

HDMI Audio Output

default:CARD=Loopback

Loopback, Loopback PCM

Default Audio Device

sysdefault:CARD=Loopback

Loopback, Loopback PCM

Default Audio Device

front:CARD=Loopback,DEV=0

Loopback, Loopback PCM

Front speakers

surround21:CARD=Loopback,DEV=0

Loopback, Loopback PCM

2.1 Surround output to Front and Subwoofer speakers

surround40:CARD=Loopback,DEV=0

Loopback, Loopback PCM

4.0 Surround output to Front and Rear speakers

surround41:CARD=Loopback,DEV=0

Loopback, Loopback PCM

4.1 Surround output to Front, Rear and Subwoofer speakers

surround50:CARD=Loopback,DEV=0

Loopback, Loopback PCM

5.0 Surround output to Front, Center and Rear speakers

surround51:CARD=Loopback,DEV=0

Loopback, Loopback PCM

5.1 Surround output to Front, Center, Rear and Subwoofer speakers

surround71:CARD=Loopback,DEV=0

Loopback, Loopback PCM

7.1 Surround output to Front, Center, Side, Rear and Woofer speakers

**** List of PLAYBACK Hardware Devices ****

card 0: PCH [HDA Intel PCH], device 0: CX20751/2 Analog [CX20751/2 Analog]

Subdevices: 0/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 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: 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

----

_______________________________________________
Alsa-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-user