I'm playing with a console sound visualiser which wants its own ALSA device to listen on. I'm editing ~/.asoundrc. I know I'll need the multi plugin to split the sound data onto separate devices. However, my soundcard has no hardware mixing, so I'll also need a dmix plugin in there somewhere, for software mixing.If I try to add a multi as a slave of the dmix, I get this error (line-wrapped):ALSA lib pcm_direct.c:1525:(_snd_pcm_direct_get_slave_ipc_offset)Invalid type 'multi' for slave PCMI tried creating a dummy middleman plug with the multi as a slave, and pointing the dmix to that, but still get the same error. Looks like dmix wants the whole chain of stuff to be plug or hwIf I try to add a dmix module as a slave of a multi instead, I getDevice or resource busyAs you'd expect when software mixing isn't the first step in the pipeline, but multiple programs try to grab the sound card.Both of these things (dmixing, and multi-ing to a loopback device) work well separately.Why do dmix and multi not work together? How can I make this work?Here's my ~/.asoundrc, with options that give Invalid type 'multi' for slave PCM:# thx# http://wiki.ubuntuusers.de/.asoundrc# http://alsa.opensrc.org/Dmix# http://forums.linuxmint.com/viewtopic.php?f=196&t=94877pcm.snd_card {    type hw    card 1    device 0}# allows multiple programs to output sound simultanously (software mixing)pcm.dmixer {    type dmix    ipc_key 1024    ipc_perm 0666 # allow other users    slave.pcm out    slave {        period_time 0        period_size 1024        buffer_size 4096        ### if having problems        # rate 44100        ### some sound cards need the exact data format        # format S32_LE        ### Available formats: S8 U8 S16_LE S16_BE U16_LE U16_BE S24_LE S24_BE        ###                    U24_LE U24_BE S32_LE S32_BE U32_LE U32_BE        ###                    FLOAT_LE FLOAT_BE FLOAT64_LE FLOAT64_BE        ###                    IEC958_SUBFRAME_LE IEC958_SUBFRAME_BE MU_LAW        ###                    A_LAW IMA_ADPCM MPEG GSM        channels 2 # must match bindings    }    bindings {        0 0        1 1    }}# allows multiple programs to capture simultaneouslypcm.dsnooper {    type dsnoop    ipc_key 2048    ipc_perm 0666     slave.pcm snd_card    slave     {        period_time 0        period_size 1024        buffer_size 4096        channels 2     }    bindings {        0 0        1 1    }}pcm.!default {    type asym    playback.pcm dmixer    capture.pcm dsnooper}pcm.out {    type plug    slave.pcm {        type multi        slaves {            a { channels 2 pcm snd_card }            b { channels 2 pcm hw:Loopback,0,0 }        }        bindings {            0 { slave a channel 0 }            1 { slave a channel 1 }            2 { slave b channel 0 }            3 { slave b channel 1 }        }    }    ttable [        [ 1 0 1 0 ]   # left  -> a.left,  b.left        [ 0 1 0 1 ]   # right -> a.right, b.right    ]}# In case I ever want to use PulseAudio, for bluetooth speakers or such.#pcm.!default {#    type pulse#}#ctl.!default {#    type pulse#}
How can I use ALSA dmix and multi plugins together?
audio;alsa
Turns out each output device needs its own dmix:[!default]  multi  dmix  hw [normal]                    dmix  hw [loopback]I was missing a second dmix between the multi and loopback-hw, so although my usual card would have been fine, the loopback card had no mixing.Many thanks to CL. for patience and expertise.For the technical details, here's my ~/.asoundrc now:pcm.snd_card { # my usual sound card    type hw    card 2}ctl.!default { # default control; alsamixer and such will use this    type hw    card 2}# software mixer for sound cardpcm.dmixer {    type dmix    ipc_key 1024    ipc_perm 0666 # allow other users    slave.pcm snd_card    slave {        period_time 0        period_size 1024        buffer_size 4096        channels 2 # must match bindings    }    bindings {        0 0        1 1    }}# software mixer for loopback devicepcm.dmixerloop {    type dmix    ipc_key 2048    ipc_perm 0666 # allow other users    slave.pcm hw:Loopback,0,0    slave {        period_time 0        period_size 1024        buffer_size 4096        channels 2 # must match bindings    }    bindings {        0 0        1 1    }}# allows multiple programs to capture simultaneouslypcm.dsnooper {    type dsnoop    ipc_key 2048    ipc_perm 0666     slave.pcm snd_card    slave     {        period_time 0        period_size 1024        buffer_size 4096        channels 2     }    bindings {        0 0        1 1    }}pcm.!default {    type asym    playback.pcm out    capture.pcm dsnooper}# Multi, splitting onto usual card and loopbackpcm.out {    type plug    slave.pcm {        type multi        slaves {            a { channels 2 pcm dmixer }            b { channels 2 pcm dmixerloop }        }        bindings {            0 { slave a channel 0 }            1 { slave a channel 1 }            2 { slave b channel 0 }            3 { slave b channel 1 }        }    }    ttable [        [ 1 0 1 0 ]   # left  -> a.left,  b.left        [ 0 1 0 1 ]   # right -> a.right, b.right    ]}