You are not logged in.

#1 2010-12-01 11:34:09

the_isz
Member
Registered: 2009-04-14
Posts: 280

Alsa: Need help setting up 2 sound cards.

Hi all,

I recently bought a USB headset for the first time. Now I'm having trouble
setting up Alsa so that both my mainboard's builtin soundcard and the headset
play all sounds simultaneously.

I intensely googled for the subject, read Alsa documentation and searched these
forums but couldn't find a fitting solution and meanwhile, I doubt it exists.
You are my last hope before giving up on this, so to say smile

This is what I came up with so far. I kept my comments in, so maybe you can spot
a flaw in my understanding and so that others looking for a solution may profit
from them:

# Use card "both" as default through the plugin "plug" which automatically
# converts channels, rate and format.
pcm.!default plug:both

ctl.!default {
  type hw
  card "Intel"
}

# Creates a card named "both", which is basically a wrapper around a plugin, in
# this case "route".
pcm.both {
  # The "route" plugin routes channels from its input card to its output.
  type route

  # Slave is the input card.
  slave {
    # The virtual input card has 4 channels. Yes, this is circumstantial and
    # also must be specified explicitly.
    channels 4

    # Unnamed definition of the input card.
    pcm {
      # The "multi" plugin merges several cards into one. This is necessary,
      # because the "route" plugin can only handle one card.
      type multi
  
      # Definition of the child cards.
      slaves {
        # Definition of child card "a".
        a {
          pcm {
            # The "hw" plugin communicates directly with the ALSA kernel
            # driver.
            type hw
            # Card name as identified by alsa. See output of "aplay -l".
            card "Intel"
            channels 2
          }
          channels 2
        }
        b {
          pcm {
            type hw
            card "Headset"
            channels 2
          }
          channels 2
        }
      }

      # Definition of the card's channels.
      bindings {
        # Channel 0...
        0 {
          # ... bound to child card "a"'s...
          slave a
          # ... channel 0.
          channel 0
        }
        1 {
          slave a
          channel 1
        }
        2 {
          slave b
          channel 0
        }
        3 {
          slave b
          channel 1
        }
      }
    }
  }

  # FIXME: Does this route the left channel to one card and the right channel
  #        to the other?

  # Definition of transfer table for the card's output.
  ttable {
    # Channel 0...
    0 {
      # ... bound to child card's channel 0 at full volume...
      0 1.0
      # ... AND child child card's channel 1 at full volume.
      1 1.0
    }
    1 {
      2 1.0
      3 1.0
    }
  }
}

# This defines the controls for the card "both", which is what tools such as
# alsamixer refer to.
ctl.both {
  type hw
  card "Intel"
}

With this as my /etc/asound.conf, all sounds are played on both my builtin card
and my headset, but only one sound at a time.

I understand that I need to use a dmix plugin to achieve the desired effect but
don't know how to apply it. This is what I got so far (it doesn't work!):

--- asoundrc.a    2010-12-01 11:28:38.000000000 +0100
+++ asoundrc.b    2010-12-01 11:29:38.000000000 +0100
@@ -48,20 +48,19 @@
         # Definition of child card "a".
         a {
           pcm {
-            type hw
-            card "Intel"
-            channels 2
+            type dmix
+            ipc_key 1024
+            ipc_key_add_uid true
+            slave.pcm {
+              type hw
+              card "Intel"
+              channels 2
+            }
           }
           channels 2
         }
         b {
           pcm {
-            type hw
-            card "Headset"
-            channels 2
+            type dmix
+            ipc_key 2048
+            ipc_key_add_uid true
+            slave.pcm {
+              type hw
+              card "Headset"
+              channels 2
+            }
           }
           channels 2
         }

When trying to play a wav file through aplay with this config, I get the
following output:

ALSA lib pcm_params.c:2150:(snd1_pcm_hw_refine_slave) Slave PCM not usable
aplay: set_params:1031: Broken configuration for this PCM: no configurations available

So, my questions are:

  1. Does anyone have an idea on how to fix my asoundrc so that all sounds are
    played on both cards?

  2. If that is not possible: Is there a way to switch the default sound card
    during runtime?

Thanks in advance, any help is greatly appreciated!

Offline

#2 2010-12-01 12:57:00

Darksoul71
Member
Registered: 2010-04-12
Posts: 319

Re: Alsa: Need help setting up 2 sound cards.

In regard to playback sound on both "soundcards" I would go for pulseaudio rather than using dmix.

In regard to your second question:
I would choose the pragmatic approach and first unload both modules required for the USB headset plus soundcard. In the second place you can load the modules in inverted row to "switch" your default sound card.


My archlinux x86_64 host:
AMD E350 (2x1.6GHz) / 8GB DDR3 RAM / GeForce 9500GT (passive) / Arch running from 16GB USB Stick

Offline

#3 2010-12-01 13:32:53

the_isz
Member
Registered: 2009-04-14
Posts: 280

Re: Alsa: Need help setting up 2 sound cards.

Darksoul71 wrote:

In regard to playback sound on both "soundcards" I would go for pulseaudio rather than using dmix.

Oh, so pulseaudio can do such stuff? Interesting, I should check it out then.
That's a very helpful info!

Darksoul71 wrote:

In regard to your second question:
I would choose the pragmatic approach and first unload both modules required for the USB headset plus soundcard. In the second place you can load the modules in inverted row to "switch" your default sound card.

Hmm... I haven't been able to do a proper module unload yet, I either get a
"module is in use" answer or I remove so many sound modules that I don't know
which ones to reload afterwards...

But the idea sounds good. I'm using a file in /etc/modprobe.d/ to fixate the
sound card index anyway and I could write a script changing that file. Something
like:

/etc/rc.d/mpd stop
modprobe -r snd_hda_intel snd_usb_audio
sed -i -e 'something' /etc/modprobe.d/50-sound.conf
modprobe snd_hda_intel snd_usb_audio
/etc/rc.d/mpd start

Is that what you mean? Wouldn't that require all sound-playing applications to
be stopped beforehand? Meh, probably yes, it's a hackish approach anyway, but it
would save me from learning pulseaudio and from software mixing...

Thanks for your answers so far, they seem promising!

Offline

#4 2010-12-01 15:05:29

Darksoul71
Member
Registered: 2010-04-12
Posts: 319

Re: Alsa: Need help setting up 2 sound cards.

Yes, pulse audio is able to re-route/copy sound streams. Other options are dmix or jack.
IMO PA is easier handable for the end user. Try it out and judge yourself.

In regard to your script I had something like this in mind. The modulenames sound reasonable to me.
There might be other options though:
http://gleamynode.net/articles/1508/


My archlinux x86_64 host:
AMD E350 (2x1.6GHz) / 8GB DDR3 RAM / GeForce 9500GT (passive) / Arch running from 16GB USB Stick

Offline

#5 2010-12-02 10:22:08

the_isz
Member
Registered: 2009-04-14
Posts: 280

Re: Alsa: Need help setting up 2 sound cards.

Whoa, I wouldn't have thought that's possible, but pulseaudio seems even harder
to configure than alsa... Could you maybe give me some hints on how to do this
right?

What I've done so far:

- Installed pulse-alsa, pavucontrol and mpd-pulse
- Configured mpd to use pulse (works so far)

Now, when mpd is playing, the music goes to my intel card only and when I start
mpg123 additionally, its music automatically goes to my headset and pavucontrol
only shows the headset's controls.

How do I go on now? I keep reading about a tool called PA device chooser which
seems to do a lot of magic, but the only thing I can find is an obsoleted
package in AUR...

Last edited by the_isz (2010-12-02 10:30:00)

Offline

#6 2010-12-02 11:34:02

Darksoul71
Member
Registered: 2010-04-12
Posts: 319

Re: Alsa: Need help setting up 2 sound cards.

Please keep in mind that archlinux is considered a hands-on distribution. Thus you'll need to elaborate a lot yourself wink
At least compared to other distributions such as OpenSuse or Ubuntu.

Since I moved away from Ubuntu because of issues I had with pulseaudio (latency / high cpu load / system hickups) you can safely bet that I will NOT install pa unless someone is pointing a gun at me to make me do so. lol

A quick google-fu reveals:
http://www.pulseaudio.org/wiki/FAQ#CanI … ltaneously

Can I use PulseAudio to playback music on two sound cards simultaneously? ¶

    Yes! Use module-combine for that.

    load-module module-alsa-sink device="front:Intel" sink_name=output0
    load-module module-alsa-sink device="front:HDA" sink_name=output1
    load-module module-combine sink_name=combined master=output0 slaves=output1
    set-sink-default combined

    This will combine the two sinks output0 and output1 into a new sink combined. Every sample written to the latter will be forwarded to the former two. PulseAudio will make sure to adjust the sample rate of the slave device in case it deviates from the master device. You can have more than one slave sink attached to the combined sink, and hence combine even three and more sound cards.

Much fancier is to use the automatic mode. To make use of that simply check the "Simultaneous Output" checkbox in paprefs.

Esp. pay attention to the last sentence.

Edit2: Checkout paprefs:
http://www.archlinux.org/packages/extra/i686/paprefs/

There is an extra tab for simultaneous output:
paprefs910.png

Edit: For more details on PA CLI read here:
http://pulseaudio.org/wiki/CLI

HTH,
D$

Last edited by Darksoul71 (2010-12-02 13:05:05)


My archlinux x86_64 host:
AMD E350 (2x1.6GHz) / 8GB DDR3 RAM / GeForce 9500GT (passive) / Arch running from 16GB USB Stick

Offline

#7 2010-12-02 15:20:41

the_isz
Member
Registered: 2009-04-14
Posts: 280

Re: Alsa: Need help setting up 2 sound cards.

Hi Darksoul71,

thank you very much for putting so much effort into this. I haven't created a
topic on these forums for a rather long time (no problems anymore smile), but you
remind me of why I love these forums so much. But I digress...

Darksoul71 wrote:

Please keep in mind that archlinux is considered a hands-on distribution. Thus you'll need to elaborate a lot yourself wink
At least compared to other distributions such as OpenSuse or Ubuntu.

Yes, I know that. I've been using Arch for several years now and didn't use one
of the "fancier" distributions before (came from gentoo). So I'm really not
expecting any GUI stuff, did my research using google (see below) and created a
lot of testing configs. It's just that I don't have much experience with audio
yet and had my head stuffed with all the Alsa crap that I had learned the days
before.

Darksoul71 wrote:

Since I moved away from Ubuntu because of issues I had with pulseaudio (latency / high cpu load / system hickups) you can safely bet that I will NOT install pa unless someone is pointing a gun at me to make me do so. lol

Hehe... I can see why, it's really not painless to set up.

Darksoul71 wrote:

I found that site, too. The problems are, that this syntax seems to be partially
outdated and I didn't know about the pa console when I asked where to continue
looking. Now that I know it, I was able to configure pa through it just the way
paprefs does. The proper syntax is:

load-module module-combine sink_name=combined slaves=0,1
set-sink-default combined

Slaves for the module-combine module seem to be defined by their index and you
don't need to create extra sinks for them, either. Also, the master option
doesn't exist anymore. In fact, you can skip the slaves option altogether and
get a device that will combine all available sinks automatically (that's exactly
what paprefs' "Simultaneous Output" option does).

The combined sink defined above works as intended and would have solved my
problem if it weren't for multiple users. My mpd is run as the homonymous user
and if it's active playing music (on both soundcards), my desktop user isn't
given access any of the sinks hmm

After a small chat with the nice guys in freenode's #pulseaudio channel, I think
it might be best to get rid of the mpd user. Like this, I wouldn't run into
problems with access rights. I'd just have to start mpd as my desktop user.
Doing that, I'll also try getting Alsa to work again, because I think I ran into
the same problem when setting that up and so I might not need pulse at all.

I'll come back to tell if I succeeded...

Offline

#8 2010-12-02 15:50:01

Darksoul71
Member
Registered: 2010-04-12
Posts: 319

Re: Alsa: Need help setting up 2 sound cards.

Hehe... I can see why, it's really not painless to set up.

Well under Ubuntu (at least any version newer than 9.04) there is no need to setup PA yourself since it's the standard "sound sub-system" for it. It were more those painful effect I experienced:
- Hickups & stuttering during gaming
- Strange peaks in CPU load although I was only listening to MP3 / webradio
- Big latency times plus async AV when watching 720p movies
and so on....

It might be nice if you add your experiences to the arch-wiki. May be some sort of howto setup two sounddevices as one ?

In regard to your multiuser problem:
According to the arch wiki (https://wiki.archlinux.org/index.php/PulseAudio#mpd) there seem to be both options:
Run pa user specific as well as running mpd as daemon.

Wouldn't mpd as daemon solve your issue ?

Sorry, since I have never touched PA under arch I can not provide any practical experience.

Last edited by Darksoul71 (2010-12-02 15:56:12)


My archlinux x86_64 host:
AMD E350 (2x1.6GHz) / 8GB DDR3 RAM / GeForce 9500GT (passive) / Arch running from 16GB USB Stick

Offline

#9 2010-12-02 16:07:18

the_isz
Member
Registered: 2009-04-14
Posts: 280

Re: Alsa: Need help setting up 2 sound cards.

Darksoul71 wrote:

It might be nice if you add your experiences to the arch-wiki. May be some sort of howto setup two sounddevices as one ?

I will consider that if I succeed in doing so smile

Darksoul71 wrote:

In regard to your multiuser problem:
According to the arch wiki (https://wiki.archlinux.org/index.php/PulseAudio#mpd) there seem to be both options:
Run pa user specific as well as running mpd as daemon.

Wouldn't mpd as daemon solve your issue ?

I assume you meant pulseaudio in the bolded places. If not, please let me know.

I refrained from using pulseaudio as a system-wide daemon because it is highly
advised by the pulseaudio creators not to do so. But I guess you're right, maybe
that indeed would solve my problem. I'll think about it again once I've tried
Alsa again...

Offline

#10 2010-12-02 18:47:00

Darksoul71
Member
Registered: 2010-04-12
Posts: 319

Re: Alsa: Need help setting up 2 sound cards.

Yes, I meant pa instead of mpd. Sorry, I was a bit tired when I posted my last reply.
May be jack might be a valid option for you to consider ?

Honestly after I spent some time reading the documention I would rather use pulseaudio than jack. At least I didn´t find a howto which elaborates the options of jack in a way I understood wink


My archlinux x86_64 host:
AMD E350 (2x1.6GHz) / 8GB DDR3 RAM / GeForce 9500GT (passive) / Arch running from 16GB USB Stick

Offline

#11 2010-12-03 10:21:01

the_isz
Member
Registered: 2009-04-14
Posts: 280

Re: Alsa: Need help setting up 2 sound cards.

OK, preliminary report time:

Tried Alsa again, still without luck. Just for reference, I'll post the
.asoundrc I've been trying to use:


# vim: set colorcolumn=80 expandtab shiftwidth=2: #

# Use card "both" as default through the plugin "plug" which automatically
# converts channels, rate and format.
pcm.!default {
  type plug
  slave {
    pcm "both"
    rate 44100
    channels 2
  }
}

ctl.!default {
  type hw
  card "Intel"
}

pcm.Intel {
  type hw
  card "Intel"
  channels 2
  rate 44100
}

ctl.Intel {
  type hw
  card "Intel"
}

pcm.Headset {
  type hw
  card "Headset"
  channels 2
  rate 44100
}

ctl.Headset {
  type hw
  card "Headset"
}

# Creates a card named "both", which is basically a wrapper around a plugin, in
# this case "route".
pcm.both {
  # The "route" plugin routes channels from its input card to its output.
  type route

  # Slave is the input card.
  slave {
    # The virtual input card has 4 channels. Yes, this is circumstantial and
    # also must be specified explicitly.
    channels 4

    # Unnamed definition of the input card.
    pcm {
      # The "multi" plugin merges several cards into one. This is necessary,
      # because the "route" plugin can only handle one card.
      type multi
  
      # Definition of the child cards.
      slaves {
        # Definition of child card "a".
        a {
          pcm {
            type dmix
            ipc_key 1024
            slave.pcm "Intel"
          }
          channels 2
        }
        b {
          pcm {
            type dmix
            ipc_key 2048
            slave.pcm "Headset"
          }
          channels 2
        }
      }

      # Definition of the card's channels.
      bindings {
        # Channel 0...
        0 {
          # ... bound to child card "a"'s...
          slave a
          # ... channel 0.
          channel 0
        }
        1 {
          slave a
          channel 1
        }
        2 {
          slave b
          channel 0
        }
        3 {
          slave b
          channel 1
        }
      }
    }
  }

  # FIXME: Does this route the left channel to one card and the right channel
  #        to the other?

  # Definition of transfer table for the card's output.
  ttable {
    # Channel 0...
    0 {
      # ... bound to child card's channel 0 at full volume...
      0 1.0
      # ... AND child child card's channel 1 at full volume.
      1 1.0
    }
    1 {
      2 1.0
      3 1.0
    }
  }
}

According to my understanding, this should do exactly what I want, but I'm
getting errors when trying to play anything with this .asoundrc about the rate
being restricted and not convertible. I've tried a thousand things to get this
working, but just couldn't get it.

Then I went back to pulseaudio: Installing mpd-pulse, starting mpd as my desktop
user and applying the pulseaudio configuration mentioned above I was able to get
mixed sound on both my builtin card and the headset. Hooray! I thought... Before
I continue, for reference, here are the pulseaudio settings again (appended to
/etc/pulse/default.pa):

load-module module-combine sink_name=combined
set-default-sink combined

This works for all pulse-enabled applications as long as started by the same
user. Now come the bad news: Both WoW through wine and teamspeak3 seem not to be
pulse-enabled applications and these are the most important ones I'm trying to
get this work for sad

While winecfg plays the test sound properly to both devices, WoW doesn't make
any sound by itself. When started with padsp (as suggested by comments on
winehq.org) prepended, WoW does play sounds, but they are stuttering and delayed
as hell. The same accounts both for teamspeak3's playback and recording
features, no matter if I prepend it with padsp or not.

There is a wine-pulse on the AUR, but I hesitate to build it, because it a)
requires me to replace other packages, too (e.g. binutils for binutils-multilib)
and b) takes an immense amount of time to compile and I think I've wasted enough
time compiling packages while still under gentoo... oh, and also it c) wouldn't
change my problem with teamspeak3, though some googling taught me running the
window$ version of it through wine might be a solution.

So I guess it's back to the sketch-block again... I'll re-try switching audio
devices through Alsa once more. *sigh* At least now that I'm using mpd as my
desktop user I'll have a chance of writing a non-root script for doing so...

Still, Darksoul71, thank you very much for all your time once more, you have
been very helpful, especially seeing that you lack practical experience with
pulseaudio under Arch.

Offline

#12 2010-12-03 14:17:16

Darksoul71
Member
Registered: 2010-04-12
Posts: 319

Re: Alsa: Need help setting up 2 sound cards.

Still, Darksoul71, thank you very much for all your time once more, you have
been very helpful, especially seeing that you lack practical experience with
pulseaudio under Arch.

You are welcome ! To some aspect I am interested in playing back sound on multiple devices as well. Especially once I get a big flat TV with HDMI input and want to play back movies via the HDMI out of my HD4670 big_smile

While I still like the features and ideas of pulseaudio, in the end I still have the feeling that it will take some more time until it gets more "usable". Not shure how faster CPUs, better multi-threaded code or another architecture will/would help here.

The german ubuntuuser wiki indicates that using padsp with WINE causes "disturbing delays" (which sounds pretty much as what you are describing). The main alternative they refer to is the WinePulse: http://art.ified.ca/?page_id=40

The passage in the perfectsetup page for pulseaudio (http://www.pulseaudio.org/wiki/PerfectSetup#Wine) also lists several issues and possible solutions.

I guess in the end it might be a more suitable solution for you to check out the audioserver jack (mainly since it is targeting professional audio processing with low latencies) or even simply switching between your speakers and your USB headset as default audio device (if this is acceptable).

Last edited by Darksoul71 (2010-12-03 14:22:01)


My archlinux x86_64 host:
AMD E350 (2x1.6GHz) / 8GB DDR3 RAM / GeForce 9500GT (passive) / Arch running from 16GB USB Stick

Offline

#13 2010-12-03 15:26:41

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,356

Re: Alsa: Need help setting up 2 sound cards.

Use wine with ALSA output directly to pulseaudio. You may want to open pavucontrol and leave it open throughout your session, because I'm currently experiencing a bug where wine's alsa output crashes (pulseaudio remains up) due to latency issues.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#14 2010-12-03 15:51:17

the_isz
Member
Registered: 2009-04-14
Posts: 280

Re: Alsa: Need help setting up 2 sound cards.

ngoonee wrote:

Use wine with ALSA output directly to pulseaudio. You may want to open pavucontrol and leave it open throughout your session, because I'm currently experiencing a bug where wine's alsa output crashes (pulseaudio remains up) due to latency issues.

I tried that, too, and as I described, it works in winecfg, but doesn't with
WoW hmm

Offline

#15 2010-12-16 08:10:24

Stuart78
Member
Registered: 2010-12-16
Posts: 2

Re: Alsa: Need help setting up 2 sound cards.

Look at https://bugtrack.alsa-project.org/alsa- … hp?id=5221 where I note how much cpu time the multi plugin uses when I configure alsa to copy (duplicate) audio to 2 identical USB sound cards.

Offline

#16 2010-12-16 08:30:27

the_isz
Member
Registered: 2009-04-14
Posts: 280

Re: Alsa: Need help setting up 2 sound cards.

Stuart78 wrote:

Look at https://bugtrack.alsa-project.org/alsa- … hp?id=5221 where I note how much cpu time the multi plugin uses when I configure alsa to copy (duplicate) audio to 2 identical USB sound cards.

Is there a public link available or could you quote the important passages here?

Offline

#17 2010-12-16 08:36:34

Stuart78
Member
Registered: 2010-12-16
Posts: 2

Re: Alsa: Need help setting up 2 sound cards.

I'm not an expert on the alsa-project web site but you can read the bug report without logging in, just click on "Guest login (view only) is also available."

Offline

#18 2010-12-16 08:56:04

the_isz
Member
Registered: 2009-04-14
Posts: 280

Re: Alsa: Need help setting up 2 sound cards.

Stuart78 wrote:

I'm not an expert on the alsa-project web site but you can read the bug report without logging in, just click on "Guest login (view only) is also available."

Sorry, my bad, didn't read properly.

Thanks for linking your bug report. I'll follow it, but I've already pretty much
given up hope on getting this working any time soon. I'm now using my PCI
soundcard as my default device without any asoundrc and move an .asoundrc in
place if I need to hear my apps on my headset. Not really a great solution,
especially since I need to use dmix when using my headset, but it works for the
time being and keeps me from going crazy over alsa and pulseaudio issues...

Offline

#19 2011-07-06 19:31:59

enteon
Member
Registered: 2011-07-06
Posts: 2

Re: Alsa: Need help setting up 2 sound cards.

Hi.

I just had the same problem and was/am fed up with pulseaudio (after an heroic 3 days big_smile) for various reasons.

I managed to get simultaneous sound from my two sound cards with the following asound.conf

pcm.!default plug:both

ctl.!default {
  type hw
  card 0
}

pcm.both {
  type route;
  slave.pcm {
      type multi;
      slaves.a.pcm "stx";
      slaves.b.pcm "audigy";
      slaves.a.channels 2;
      slaves.b.channels 2;
      bindings.0.slave a;
      bindings.0.channel 0;
      bindings.1.slave a;
      bindings.1.channel 1;

      bindings.2.slave b;
      bindings.2.channel 0;
      bindings.3.slave b;
      bindings.3.channel 1;
  }

  ttable.0.0 1;
  ttable.1.1 1;
  ttable.0.2 1;
  ttable.1.3 1;
}

ctl.both {
  type hw;
  card 0;
}

pcm.audigy {
   type dmix
   ipc_key 1024
   slave {
       pcm "hw:0"
       period_time 0
       period_size 1024
       buffer_size 16384
#       buffer_time 0
#       periods 128
       rate 48000
       channels 2
    }
    bindings {
       0 0
       1 1
    }
}

pcm.stx {
   type dmix
   ipc_key 2048
   slave {
       pcm "hw:1"
       period_time 0
       period_size 1024
       buffer_size 65536
#       buffer_time 0
#       periods 128
       rate 48000
       channels 2
    }
    bindings {
       0 0
       1 1
    }
}

ctl.audigy {
   type hw
   card 0
}

ctl.stx {
   type hw
   card 1
}

The card index is defined via the module option in modprobe config
Note that audigy actually has 6 channels, which is the whole reason i have two soundcards, but defining it as such gives me crashes in almost every application or chirping on one soundcard in smplayer/vlc even depending on the content played, the devil knows why. So the follwing does explicitly NOT work.

pcm.!default plug:both

ctl.!default {
  type hw
  card 0
}

pcm.both {
  type route;
  slave.pcm {
      type multi;
      slaves.a.pcm "stx";
      slaves.b.pcm "audigy";
      slaves.a.channels 2;
      slaves.b.channels 6;
      bindings.0.slave a;
      bindings.0.channel 0;
      bindings.1.slave a;
      bindings.1.channel 1;

      bindings.2.slave b;
      bindings.2.channel 0;
      bindings.3.slave b;
      bindings.3.channel 1;
      bindings.4.slave b;
      bindings.4.channel 2;
      bindings.5.slave b;
      bindings.5.channel 3;
      bindings.6.slave b;
      bindings.6.channel 4;
      bindings.7.slave b;
      bindings.7.channel 5;
  }

  ttable.0.0 1;
  ttable.1.1 1;
  ttable.0.2 1;
  ttable.1.3 1;
  ttable.2.4 1;
  ttable.3.5 1;
  ttable.4.6 1;
  ttable.5.7 1;
}

ctl.both {
  type hw;
  card 0;
}

pcm.audigy {
   type dmix
   ipc_key 1024
   slave {
       pcm "hw:0"
       period_time 0
       period_size 1024
       buffer_size 16384
#       buffer_time 0
#       periods 128
       rate 48000
       channels 6
    }
    bindings {
       0 0
       1 1
       2 2
       3 3
       4 4
       5 5
    }
}

pcm.stx {
   type dmix
   ipc_key 2048
   slave {
       pcm "hw:1"
       period_time 0
       period_size 1024
       buffer_size 65536
#       buffer_time 0
#       periods 128
       rate 48000
       channels 2
    }
    bindings {
       0 0
       1 1
    }
}

ctl.audigy {
   type hw
   card 0
}

ctl.stx {
   type hw
   card 1
}

However, smplayer automatically plays 5.1 sound correctly even though using the default ALSA device, but muting the stereo card, which is fien with me. When i set smplayer to stereo it plays on both cards, as expected. Upmixing of stereo content to all 6 channels on the audigy works automatically in every application. So this is now a perfect setup without all the pulseaudio problems. Me happy :-)

The basic asound.conf was taken from http://alsa.opensrc.org/Asoundrc
I also had to adapt the buffer size for the audigy. Aplay -vvv tells you what size you need, needs to be a power of 2 as documented in http://www.alsa-project.org/alsa-doc/al … ugins.html

Hope this helps someone else. I'd like to edit the alsa wiki but the login/register page doesn't work for me at all.

Ok not perfect at all, now only one application at the same time can play sad At least on stx Oo WTF?
ALSA lib pcm_dmix.c:1018:(snd_pcm_dmix_open) unable to open slave

Last edited by enteon (2011-07-06 20:26:24)

Offline

Board footer

Powered by FluxBB