1

I have 2 soundcards, and I want the sound that is played to play on both. I know how to do this via the GUI (Play sound through two or more outputs/devices), but my case is different:

  • I don't use pulseaudio, it's alsa directly
  • I want to use the commandline

Any ideas? Thx!

  • In case both cards are recognized you should be able to simply unmute both using alsamixer. – Takkat Dec 5 '16 at 11:32
0

You could define a new device in your ~/.asoundrc or in /etc/asound.conf:

pcm.both {
    type plug
    slave.pcm {
        type multi
        slaves.a {
            pcm "hw:0"   # or whatever
            channels 2
        }
        slaves.b {
            pcm "hw:1"   # ...
            channels 2
        }
        bindings [
            { slave a channel 0 }
            { slave a channel 1 }
            { slave b channel 0 }
            { slave b channel 1 }
        ]
    }
    ttable [
        [ 1 0 1 0 ]
        [ 0 1 0 1 ]
    ]
}

Then use the both device name: aplay -D both something.wav.

If the clock speeds of these devices do not exactly match, the multi plugin will eventually over-/underrun one of the device's buffers (PulseAudio would be able to resample on the fly).

  • that works! do you have any idea how to set this device as default? – Jonathan Vervaeke Dec 5 '16 at 13:27
  • Name it default instead. – CL. Dec 5 '16 at 13:31
  • appreciated! (for the record, it appears to be pcm.!default) – Jonathan Vervaeke Dec 5 '16 at 13:38

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.