Search code examples
alsa

ALSA : pcm devices and asoundrc


I'm trying to record currently played sound using alsa snd-aloop Here is my asound.conf

pcm.multi {
    type route;
    slave.pcm {
        type multi;
        slaves.a.pcm "output";
        slaves.b.pcm "loopin";
        slaves.a.channels 2;
        slaves.b.channels 2;
        bindings.0.slave a;
        bindings.0.channel 0;
        bindings.1.slave a;
        bindings.1.channel 1;
        bindings.2.slave b;
        bindings.2.channel 0;
        bindings.3.slave b;
        bindings.3.channel 1;
    }

    ttable.0.0 1;
    ttable.1.1 1;
    ttable.0.2 1;
    ttable.1.3 1;
}

pcm.!default {
        type plug
        slave.pcm "multi"
}

pcm.output {
        type hw
        card 0
}

pcm.loopin {
        type plug
        slave.pcm "hw:1,0,0"
}

pcm.loopout {
        type plug
        slave.pcm "hw:1,1,0"
}

Now when I'm running such command :

play sound.mp3

and :

arecord -c 2 -f S16_LE -r 48000 -D loopout test.wav

Sound is played on soundcard 0 and recorded as test.wav Now my default PCM routes sound to loopin an output.

But when I'm listing PCM devices :

aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
sysdefault:CARD=ALSA
    bcm2835 ALSA, bcm2835 ALSA
    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

I do not see added pcm from asound.conf Is it normal? My problem is that I have an application configured using this list that does not use my default pcm.


Solution

  • aplay -L can show only those devices that define such a description string. (This is somewhat undocumented.)

    pcm.multi {
        ...
    
        hint.description "My Little Device"
    }