You are not logged in.

#1 2008-07-13 07:59:24

Grimn
Member
Registered: 2006-12-23
Posts: 136

Two soundcards + ALSA = help

Hey, I am having trouble setting the system to use my sound card along with my on-board sound card.

The thing is I need to use the on-board card to output sound to the headphones that are connected on a front panel (which connects it to the mobo hence why I need to have it work) but can't find a way to configure it.

I search and found this post which was the most useful I could find: I could use aplay -d hw:x,y to have the desired output! (unfortunely it didnt work with the name of the device...)

I forgot to mention, I also need to use the on-board card to capture sound from the headphone's microphone.
So my problem, to sum it up, is how to configure ALSA to use my sblive card to output sound in my colums (which already does) along with using my on-board card to output sound to the headphones and input sound through the headphone's mic?


So can anyone help me configure this pls? I was wondering if this can be done by editing the /usr/share/alsa/alsa.conf file changing some default value? Looked into it but couldn't figure out anything :?
Thanks!

Offline

#2 2008-07-13 09:26:59

daneel971
Member
Registered: 2008-03-28
Posts: 197

Re: Two soundcards + ALSA = help

I use my SB and the onboard card almost the same way as you want: the first for all apps, the second when I need headphones.
Take a look at my ~/.asoundrc - I hope it helps.

pcm.Audigy {
   type hw
   card 0
}

ctl.Audigy {
   type hw
   card 0
}

ctl.mixer {
   type hw
   card 0
}

pcm.!default {
  type plug
  slave.pcm ch40dup
}
#
pcm.ch21dup {
   type route
   slave.pcm surround41
   slave.channels 5
   ttable.0.0 1
   ttable.1.1 1
   ttable.0.4 1
   ttable.1.4 1
}
pcm.ch40dup {
   type route
   slave.pcm surround40
   slave.channels 4
   ttable.0.0 1
   ttable.1.1 1
   ttable.0.2 1
   ttable.1.3 1
}
pcm.ch41dup {
   type route
   slave.pcm surround41
   slave.channels 5
   ttable.0.0 1
   ttable.1.1 1
   ttable.0.2 1
   ttable.1.3 1
   ttable.0.4 1
   ttable.1.4 1
}
pcm.ch51dup {
   type route
   slave.pcm surround51
   slave.channels 6
   ttable.0.0 1
   ttable.1.1 1
   ttable.0.2 1
   ttable.1.3 1
   ttable.0.4 0.5
   ttable.1.4 0.5
   ttable.0.5 0.5
   ttable.1.5 0.5
}
pcm.mono-4-dup {
   type route
   slave.pcm surround40
   slave.channels 4
   ttable.0.0 1
   ttable.0.1 1
   ttable.0.2 1
   ttable.0.3 1
}

# onboard audio chip for headphones
pcm.headphones {
   type hw
   card 1
   device 0
}

Offline

#3 2008-07-13 10:26:46

Grimn
Member
Registered: 2006-12-23
Posts: 136

Re: Two soundcards + ALSA = help

Thanks for the reply!

I didn't have a .asoundrc file so I create one with the following (checking which card was 0 and 1 with aplay -l):

pcm.SBLive {
   type hw
   card 0
}

ctl.SBLive {
   type hw
   card 0
}

ctl.mixer {
   type hw
   card 0
}


# onboard audio chip for headphones
pcm.headphones {
   type hw
   card 1
   device 0
}

I really don't understand how to configure this file so I was kinda afraid to include all that x_x
This managed to let me use alsaplayer -d headphones to get sound on the phones but that's the only way :\
How can I make it so when I have the headphones plugged I can hear anything my system outputs (music players, games, team speak, etc)? Also how can I make possible to regulate volume with kmix as well as capture of sound through its mic?

Thanks once again!

PS - Do I have to restart the computer each time I change the file or can I just restart alsa daemon?

Last edited by Grimn (2008-07-13 10:47:38)

Offline

#4 2008-07-13 10:51:49

VGib
Member
Registered: 2008-03-15
Posts: 8

Re: Two soundcards + ALSA = help

hello , you can find help here
http://alsa.opensrc.org/.asound

if you want to configure your global alsa config file, you should use asoud.conf.

here is my asound.conf:

pcm.!default {
        type hw
        card Intel
        device 0
        }

ctl.!default {
        type hw
        card Intel
        device 0
        }

 pcm.casque {
        type hw
        card Headset
        device 1
        }

ctl.casque {
        type hw
        card Headset
        device 1
        }
/etc/asound.conf (END)

.default is your default device, eg the one your alsa will use first

device and cards are deifned in pcm.!default

device and card are defined in /etc/asound.conf,   i think

hope it will help you and sorry for my ( very) bad english

Offline

#5 2008-07-13 11:05:12

Grimn
Member
Registered: 2006-12-23
Posts: 136

Re: Two soundcards + ALSA = help

Thanks for the reply!

I have read that entry but it wasn't helpful since it doesn't say how can I configure ALSA to use both cards at the same time (eg. while using a music player I want the sound to output to both cards so if I have headphones plugged in I can turn off the columns or use the kmix to disable the output I don't want at that time).
I managed to have kmix regulate the volume of the headphones though smile

Also the capture of sound is still an issue.

Offline

#6 2008-07-13 12:11:43

daneel971
Member
Registered: 2008-03-28
Posts: 197

Re: Two soundcards + ALSA = help

I didn't have a .asoundrc file so I create one with the following checking which card was 0 and 1 with aplay -l)

You can use the index option in modprobe.conf like this for a persistent soundcards order (check the modules you're using - this is mine):

alias snd-card-0 snd-emu10k1
options snd-card-0 index=0
options snd-emu10k1 index=0
alias snd-card-1 snd-hda-intel
options snd-card-1 index=1
options snd-hda-intel index=1

I really don't understand how to configure this file so I was kinda afraid to include all that x_x

Every "pcm" entry defines a custom device; in my case, almost all manipulate channels (so that I can play stereo files with all my 6 speakers). A wrong asoundrc will prevent you from using the soundcard, but it won't damage at all your system - in the worst case, just delete it and start from scratch smile

This managed to let me use alsaplayer -d headphones to get sound on the phones but that's the only way. How can I make it so when I have the headphones plugged I can hear anything my system outputs (music players, games, team speak, etc)?

make the headphones plugin your default output device (my default, for instance, is ch40dup); alternatively, configure your programs to use that particular device (you can do it for all xine based players and for mplayer as well)

Also how can I make possible to regulate volume with kmix

right click on the kmix icon in the systray -> select master channel

as well as capture of sound through its mic?

no idea, sorry

Do I have to restart the computer each time I change the file or can I just restart alsa daemon?

Neither of them is needed.

Offline

#7 2008-07-13 12:28:11

Grimn
Member
Registered: 2006-12-23
Posts: 136

Re: Two soundcards + ALSA = help

Thanks for the reply and the information!

I think I explained wrong: I want to configure my SBLive card to be the default but to switch the default to headphones when they are plugged.

I think the 'easy' way would to make both cards output sound so whenever I needed just need the headphones I would plugged it in and turn off the columns (which are connected to the SBlLive card).

So I can't just put headphones as default because that way the columns never output any sound even if the headphones are unplugged neutral

Offline

#8 2008-07-13 13:39:09

daneel971
Member
Registered: 2008-03-28
Posts: 197

Re: Two soundcards + ALSA = help

You definetely made me curious, so I just found this:
http://ph.ubuntuforums.com/showthread.php?t=353099
I tried, and it worked - output from speakers on card 0 (SB) and from headphones on card 1 (onboard chip).
I have to admit, I have no idea how exactly it works... big_smile

Offline

#9 2008-07-13 15:00:37

Grimn
Member
Registered: 2006-12-23
Posts: 136

Re: Two soundcards + ALSA = help

Kudos!
That did the trick to output on both cards! Now the problem is the same of that post's guy: I can't get mixing so can't have two applications playing at the same time.

I think I understand how it works, but not the syntax exactly: it declares a plugin with one pcm slave (multi) then setups a 'routing' table of the existing channels (me thinks); next step was defining the pcm slave which consists of two pcm slaves a and b (both cards), with 2 channels each; then it binds each slave's channels to one of 'routing' table.

So basically, if I got it right, it defines 4 virtual channels and binds 2 to each card.

This was a great progress, thanks a lot big_smile

Now to find out how to but mixing working with this setup and then the capture of sound through the on-board card. Any clues?

Thanks!

Offline

Board footer

Powered by FluxBB