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!

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

1 Answers1

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).

CL.
  • 1,745