[alsa-devel] Need help on getting raw audio stream from a dummy sound card

Santo Chow santo_chow at yahoo.com
Tue Mar 17 07:22:25 CET 2009

Hi Takashi,

I have followed your suggestion and now i'm faced with another problem. So, right now, i have a Loopback soundcard as my default. My .asoundrc looks like this:

   type hw
   card 1

0 is my actual soundcard (that can actually produce sound). Card 1,
when i checked on the /proc/asound/cards actually pointing to Loopback
card. So right now, the way i test the card 1, is to call arecord from
card 1, and play it to card 0. Right now, i'm still developing this in
my ubuntu PC.

so i ran this
arecord -f cd -D hw:1,1 | aplay -f cd -D hw:0

one terminal, and in the other terminal i can play mplayer, watching
youtube, etc.. and the sound would come out nicely. (Thanks to all of
your efforts, nevertheless)

But I notice that, when i play
mplayer, then i open a web-browser, and surf youtube, the sound from
youtube is gone. But if i close the browser, close the mplayer, then
reopen the browser, go to youtube and play a video, i can hear the
sound nicely. but then, if during the time i start mplayer, it will
complain about 'no sound'. Turns out, I have to use dmix. So, i modify
my .asoundrc like this:

pcm.!default {
   type plug
   slave.pcm "dmixer"

pcm.dmixer  {
   type dmix
   ipc_key 1025
   slave {
      pcm "hw:0,0"
      rate 44100
   bindings {

  0 0
      1 1
i put 'pcm "hw:0,0" ' over there, because i want to make sure that this setting works with my actual sound card first. If it works with my card 0, it should work with my card 1. with
the above .asoundrc file, i can play multiple sound from different
application at the same time. I even tried to remove the "bindings"
tag, and it still able to play multiple sound very well. so i guess,
this should work on my card 1.

then i change the .asoundrc become like this again:

pcm.!default {
   type plug
   slave.pcm "dmixer"

pcm.dmixer  {
   type dmix
   ipc_key 1025
   slave {
      pcm "hw:1,1"
      period_time 0
      period_size 881
      buffer_size 3524
      rate 44100

}the value for perio_time,
period_size, and buffer_size have been adjusted by me to suits my
hardware requirement. This is the setting that works on my machine.
It's just that, in the end, I'm still ended up with one sound at a
time. I can't run mplayer + youtube at the same time. I can only run
one of them. And furthermore, if i just paused the mplayer, the audio device is still locks. It will be good enough if someone can hint me a way to unlock the audio device.

what i want to ask is.. can this Loopback card handle more than 1 sound
at a time? Have anyone tried this before? I have tried changing the
value of .asoundrc, switching the slave pcm to pcm "hw:1,0" (not
working) pcm "hw:1" (works, but only 1 sound too). Any idea guys?


From: Takashi Iwai <tiwai at suse.de>
To: Santo Chow <santo_chow at yahoo.com>
Cc: alsa-devel at alsa-project.org
Sent: Tuesday, March 10, 2009 11:25:03 PM
Subject: Re: [alsa-devel] Need help on getting raw audio stream from a dummy sound card

At Thu, 5 Mar 2009 08:34:03 -0800 (PST),
Santo Chow wrote:
> Hi everyone :)
> I'm currently assigned to a task that requires me to capture raw audio stream from a dummy sound card. Is this even possible?

You can use aloop driver in alsa-driver tree for such a purpose.
Then you can capture streams freely from the currently running playbacks.



More information about the Alsa-devel mailing list