Alsa Config: multi / route - can duplicate sound and send to card, but cannot send to plug?
The aim is to set asound.conf so that audio file being played can be heard from the speaker while being recorded via 'arecord -D plughw:2,1 -f cd recording.wav'.
The idea is to duplicate the sound being played and send it to the loopback card (plughw:2,0), so that the audio can be recorded from plughw:2,1. ('plughw:2,1' is a loopback card.)
My system utilizes dmix and equal like this:
audio player ---> plug equal ---> dmix ---> sound card
The catch is, when I send the duplicate sound to 'dmix:1,0', audio plays and can be recorded. But if the duplicate sound is sent to 'plugequal', audio fails to play with error:
Code: Select all
SDL_OpenAudio (2 channels, 44100 Hz): ALSA: Couldn't get hardware config: Invalid argument
ALSA lib pcm_params.c:2226:(snd1_pcm_hw_refine_slave) Slave PCM not usable
SDL_OpenAudio (1 channels, 44100 Hz): ALSA: Couldn't get hardware config: Invalid argument
This is the alsa config file:
Code: Select all
defaults.pcm.card 1
defaults.ctl.card 1
defaults.pcm.device 0
ctl.equal { type equal; }
pcm.plugequal { type equal; slave.pcm 'plug:dmix' }
pcm.!default
{
type asym
playback.pcm { type plug; slave.pcm 'router_1to2' }
capture.pcm { type plug; slave.pcm 'plughw:1,0' }
}
pcm.quad {
type multi
slaves.a.pcm 'dmix:1,0' ### 'dmix:1,0' works fine. But if it is changed to 'plugequal', audio fails to play.
slaves.a.channels 2
slaves.b.pcm 'plughw:2,0'
slaves.b.channels 2
bindings.0 { slave a; channel 0; }
bindings.1 { slave a; channel 1; }
bindings.2 { slave b; channel 0; }
bindings.3 { slave b; channel 1; }
}
pcm.router_1to2 {
type route
slave.pcm 'quad'
ttable.0.0 1
ttable.1.1 1
ttable.0.2 1
ttable.1.3 1
}
I hope to keep using pure alsa, without pulseaudio, pipewire, etc.