[alsa-devel] Using dmix/dsnoop/dshare to access individual channels

Takashi Iwai tiwai at suse.de
Tue Dec 18 14:10:50 CET 2007

At Wed, 12 Dec 2007 16:04:37 -0700,
Steve Strobel wrote:
> I am using a 4-input, 8-output codec (AD1938) in an application similar to a live sound mixing 
> board, where a combination of the input signals get mixed for each output.  I can mix four 
> inputs to four outputs with a command like:
>         arecord --file-type raw --channels=4 --format=S32_LE --rate=16000 \
>          | crosspoint \
>          | aplay  --file-type raw --channels=4 --format=S32_LE --rate=16000
> where crosspoint is a simple program that reads from stdin, does some mixing, and outputs 
> to stdout.
> My next step is to play and record wave files from the various channels, while the crosspoint 
> is running.  For example, I might need to play message1.wav to channel 2 and message2.wav 
> to channel 3 while recording channel 1 to message3.wav.  I am looking for advice about the 
> best way to accomplish that.
> It seems like it should be possible using a combination of dmix, snoop, and dshare, as follows:
>   - Use dsnoop to split the 4-channel input to the crosspoint and another virtual sound input, call it "A".
>   - Use dshare to split "A" into four mono sources.  Then can use arecord normally to capture wave files.
>   - Use dmix and possibly dshare to similarly let the crosspoint continue to use the multi-channel 
>     output while also providing a mono sound device for each channel that I can use with aplay.
> Am I on the right track, or would I be better off adding functionality to the crosspoint application 
> to read and write wave files?  Thanks for any suggestions.

Unfortunately this won't work.  d* plugins can have only hw type slave
PCM.  So, dshare cannot have dsnoop as its slave.

I recommend you to use simply JACK for such a purpose.  It's exactly
designed for this kind of work.


More information about the Alsa-devel mailing list