I have an Ubuntu 16.04.3 LTS system with

  • an ASUS Xonar DGX soundcard, and
  • a generic USB sound card.

At our church, we want to be able to broadcast a service as well as record it as a WAV file. To accomplish this, I have the 3.5mm audio output cable from the sound board connected to a splitter, so that there are two cables to plug into the "Line In" connector on each soundcard.

Then, I use "arecord" to record the audio on one card, and "darkice" to create an MP3 stream on the other.

Ideally, I'd like to be able to have one soundcard handle both the recording and streaming simultaneously. Is such a thing possible? Or am I stuck using two soundcards with two applications?

  • To split piped input, use the tee command. e.g.: "echo hi | tee output.txt >> output2.txt" or "echo hi | tee output.txt | tee output2.txt" or "echo hi | tee output.txt output2.txt"
    – TOOGAM
    Sep 8, 2017 at 4:51

2 Answers 2


Yes, it's easily possible. Are you really only running only ALSA, or are you also running Pulseaudio (the default on basically all distros for many years)?

With Pulseaudio, it should work out of the box.

With ALSA, make sure you are using the plughw device name (which internally adds a dsnoop pluging) instead of the hw device name. The dsnoop plugin will split the input stream into multiple streams for different applications.


As I said, instead of -D hw:0 etc. (modify for your hardware address), just use -D plughw:0 for arecord, and similar for the device name in darkice.

A condition is that no other program uses hw:0 directly. All of them must use plughw:0.

You don't really need to know details about dsnoop, ALSA does this automatically for you. (But you can read up details on the plugin page I linked).

You don't have to setup your own ~/.asoundrc, you don't have to modify any configuration files.

  • No, I just use plain old ALSA, not PulseAudio. This is a server, so no audio output is needed, and in fact there is almost no custom configuration for ALSA - I just use the devices with "arecord" and "darkice" as they are loaded automatically by modprobe. Can you give me a few more details about how to use plughw/dsnoop? I see some configuration details in /etc/modprobe.d/alsa-base.conf, but I am not sure how to apply what you mentioned within that file. Sep 10, 2017 at 1:39
  • 1
    perhaps I still have something not quite right? I'm using arecord -D plughw:0 -f S16_LE -c2 -r 44100 -vv foo.wav and also using a darkice config that specifies device = plughw:0, but there still appears to be blocking. One program can start, but the other will die with DarkIce: DarkIce.cpp:1273: can't open connector [0] or arecord: main:722: audio open error: Device or resource busy (depending on which one I started second). What am I missing? Thanks again. Sep 13, 2017 at 18:31
  • Are you sure that the plughw adds dsnoop? What worked for me was doing arecord -D dsnoop:0,0 which allowed me to run multiple listeners at the same time without modifying the alsa config. Jan 14, 2018 at 18:38

I accepted dirkt's answer which got me most of the way there. Turns out I needed to create a dsnoop interface:


pcm.custom_snoop_card {
    type dsnoop
    ipc_key 420042
    ipc_key_add_uid 1
    slave {
        pcm "hw:0,0"   # the actual device
        format S16_LE
        channels 2
        rate 44100

Now I can specify device = custom_snoop_card in my darkice config, and simultaneously make a WAV recording with arecord -D custom_snoop_card -f S16_LE -c2 -r 44100 -vv myfile.wav

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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