Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Multiple sound cards with ALSA : HOWTO
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Root Moose
Tux's lil' helper
Tux's lil' helper


Joined: 29 Jan 2004
Posts: 112

PostPosted: Tue May 17, 2005 8:46 pm    Post subject: Reply with quote

I have since gotten this working. The trick was to configure each card individually and then merge the configs together.

cat /etc/modules.autoload.d/kernel-2.6
Code:
#snd-usb-audio
#snd_emu10k1
#snd_via82xx


Yes, nothing gets loaded at this point!

cat /etc/modules.d/alsa
Code:
# ALSA portion
alias char-major-116 snd
alias snd-card-0 snd-usb-audio
alias snd-card-1 snd-via82xx

options snd-usb-audio index=0 id="audigy"
options snd-via82xx index=1 dxs_support=3 id="via"

# OSS/Free portion
alias char-major-14 soundcore

alias sound-slot-0 snd-card-0

# OSS/Free portion - card #1
alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss
alias sound-service-0-12 snd-pcm-oss

# OSS/Free portion - card #2
alias sound-service-1-0 snd-mixer-oss
alias sound-service-1-1 snd-seq-oss
alias sound-service-1-3 snd-pcm-oss
alias sound-service-1-8 snd-seq-oss
alias sound-service-1-12 snd-pcm-oss

alias /dev/sound/mixer snd-mixer-oss
alias /dev/sound/dsp snd-pcm-oss
alias /dev/sound/midi snd-seq-oss

# Set this to the correct number of cards.
options snd cards_limit=2


You will end up with the following devices created after modules-update and/or a reboot:

ls -l /dev/snd /dev/sound
Code:
/dev/snd:
total 0
crw-------  1 recon audio 116,  0 May 17 16:20 controlC0
crw-------  1 recon audio 116, 32 May 17 16:20 controlC1
crw-------  1 recon audio 116, 24 May 17 16:20 pcmC0D0c
crw-------  1 recon audio 116, 16 May 17 16:20 pcmC0D0p
crw-------  1 recon audio 116, 56 May 17 16:20 pcmC1D0c
crw-------  1 recon audio 116, 48 May 17 16:20 pcmC1D0p
crw-------  1 recon audio 116, 57 May 17 16:20 pcmC1D1c
crw-------  1 recon audio 116, 49 May 17 16:20 pcmC1D1p
crw-------  1 recon audio 116,  1 May 17 16:20 seq
crw-------  1 recon audio 116, 33 May 17 16:20 timer

/dev/sound:
total 0
crw-------  1 recon audio 14, 28 May 17 16:20 adsp1
crw-------  1 recon audio 14,  4 May 17 16:20 audio
crw-------  1 recon audio 14, 20 May 17 16:20 audio1
crw-------  1 recon audio 14,  3 May 17 16:20 dsp
crw-------  1 recon audio 14, 19 May 17 16:20 dsp1
crw-------  1 recon audio 14,  0 May 17 16:20 mixer
crw-------  1 recon audio 14, 16 May 17 16:20 mixer1
crw-------  1 recon audio 14,  1 May 17 16:20 sequencer
crw-------  1 recon audio 14,  8 May 17 16:20 sequencer2


The modules loaded looks like this.

lsmod
Code:
Module                  Size  Used by
snd_pcm_oss            54304  0
snd_mixer_oss          20512  1 snd_pcm_oss
snd_seq_oss            36064  0
snd_seq_midi_event      7904  1 snd_seq_oss
snd_seq                55760  4 snd_seq_oss,snd_seq_midi_event
snd_via82xx            27936  0
snd_ac97_codec         78840  1 snd_via82xx
snd_mpu401_uart         8192  1 snd_via82xx
snd_usb_audio          67904  0
snd_pcm                96872  4 snd_pcm_oss,snd_via82xx,snd_ac97_codec,snd_usb_audio
snd_timer              26596  2 snd_seq,snd_pcm
snd_page_alloc         10020  2 snd_via82xx,snd_pcm
snd_usb_lib            13440  1 snd_usb_audio
snd_rawmidi            25536  2 snd_mpu401_uart,snd_usb_lib
snd_seq_device          8652  3 snd_seq_oss,snd_seq,snd_rawmidi
snd                    56068  12 snd_pcm_oss,snd_mixer_oss,snd_seq_oss,snd_seq,snd_via82xx,snd_ac97_codec,\
snd_mpu401_uart,snd_usb_audio,snd_pcm,snd_timer,snd_rawmidi,snd_seq_device
soundcore              10528  1 snd


This thread has details on getting the Audigy 2 NX working:

https://forums.gentoo.org/viewtopic-t-301053-highlight-audigy+usb.html

HTH someone.

r@m


Last edited by Root Moose on Mon Nov 21, 2005 6:58 pm; edited 1 time in total
Back to top
View user's profile Send private message
koroumel
Guru
Guru


Joined: 17 Jun 2004
Posts: 339
Location: Athens, Greece

PostPosted: Tue May 17, 2005 10:33 pm    Post subject: Reply with quote

Thanx for the answer, I set the default card in all applications to be the ZS one, so it does not matter (yet). Again, thanx!
_________________
"Yep linux is an alternative. Windows on the other hand isn't even an option"
Registered Linux User No #242616
Back to top
View user's profile Send private message
codergeek42
Bodhisattva
Bodhisattva


Joined: 05 Apr 2004
Posts: 5142
Location: Anaheim, CA (USA)

PostPosted: Wed May 18, 2005 4:57 am    Post subject: Reply with quote

Beautiful. I've got a Plantronics DSP500 USB headset set as the default and an onboard VIA 82xx driver that I use for the gameport. Thanks for the guide.

Now to find out how to get it to do dmix and full-duplex ^_^
_________________
~~ Peter: Programmer, Mathematician, STEM & Free Software Advocate, Enlightened Agent, Transhumanist, Fedora contributor
Who am I? :: EFF & FSF
Back to top
View user's profile Send private message
saluk
n00b
n00b


Joined: 25 Aug 2004
Posts: 34

PostPosted: Sat May 21, 2005 5:59 pm    Post subject: Reply with quote

Very nice tutorial, while I had sound sort of working and other times I have had no problems with two sound cards, now I understand the configuration file a LOT better and everything is working perfectly :)
Back to top
View user's profile Send private message
frogg
n00b
n00b


Joined: 05 Dec 2004
Posts: 20

PostPosted: Thu Oct 06, 2005 4:30 am    Post subject: Reply with quote

TheCoop wrote:
is there some way of duplicating the output to both sound cards, ie whatever is sent to the first one is also sent to the second one (I dont care about syncing it or anything like that)


I am also trying to do this. Anybody know?
Back to top
View user's profile Send private message
nickd
Tux's lil' helper
Tux's lil' helper


Joined: 29 Dec 2003
Posts: 81
Location: London, UK

PostPosted: Fri Oct 07, 2005 12:27 pm    Post subject: Still can't get on-board sound to trump USB headset Reply with quote

Hello,

I've followed this, and many other threads and really thought that I'd got it, but I still get my sound defaulting to the USB headset (Plantronics DSP400) rather than the on-board card (intel8x0 on a Thinkpad T40p).

I think that this is because the headset is detected during the usb initialisation - so nothing that I do in modules.autoload will help as this is read later in the boot.

It appears that my index= entry in modules.d/alsa has no effect.

Can ayone suggest steps to fix this?

TIA

--
Nick

[/code]Some conf files:

/etc/modules.autoload.d/kernel-2.6
Code:
# on-board sound
snd_intel8x0
# USM headphone
snd_usb_audio
# Graphics stuff


cat /etc/modules.d/alsa
Code:
options snd-intel8x0 index=0 id="onboard"
options snd-usb-audio index=1 id="headset"
# This will let non-root users use sound
options snd device_mode=0666
# Set this to the correct number of cards.
options snd major=116 cards_limit=2

##
##  ALSA portion
alias char-major-116 snd
alias snd-card-0 snd-intel8x0
alias snd-card-1 snd-usb-audio

##  OSS/Free portion
alias char-major-14 soundcore
alias sound-slot-0 snd-card-0
alias sound-slot-1 snd-card-1

# OSS/Free portion - card #1
alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss
alias sound-service-0-12 snd-pcm-oss

##  OSS/Free portion - card #2
alias sound-service-1-0 snd-mixer-oss
alias sound-service-1-3 snd-pcm-oss
alias sound-service-1-12 snd-pcm-oss

alias /dev/mixer snd-mixer-oss
alias /dev/dsp snd-pcm-oss
alias /dev/midi snd-seq-oss
Back to top
View user's profile Send private message
Gentree
Watchman
Watchman


Joined: 01 Jul 2003
Posts: 5350
Location: France, Old Europe

PostPosted: Mon Oct 10, 2005 9:35 am    Post subject: Reply with quote

DaNIsH wrote:

Works really well if you have TV-out going and want to watch a movie on the TV and computer at the same time (Read: Girlfriend gets me to download horribly boring soap operas) :)


Stop spending so much time on the computer and she might watch less soaps !! :lol:


Seriously, this thread is great help. Alsa is powerful but so poorly documented most of that power is lost. I must have spent weeks over the time I've been using Linux battling to get things to work right.

Thanks for a great confribution. It actually sorted out a problem I had since removing my second sound card (I gave up with things coming out wrong, maybe now I can fix it to work right.)


Nice work. 8)

Almost forgot , I add a line for the joystick config as well , I only found this worked in kernel-2.6 not in /etc/modules.d/alsa. Dont know why.

Code:
joydev
analog
gameport
snd-ens1371 joystick_port=1


May be worth a note in your guide. 8)
_________________
Linux, because I'd rather own a free OS than steal one that's not worth paying for.
Gentoo because I'm a masochist
AthlonXP-M on A7N8X. Portage ~x86
Back to top
View user's profile Send private message
weeroona
n00b
n00b


Joined: 21 Oct 2004
Posts: 13
Location: Pittsburgh

PostPosted: Wed Feb 22, 2006 5:28 pm    Post subject: problems with many sound cards..... Reply with quote

I have 12 usb sound cards that I am using for a museum exhibit (outputs to many different speakers at the same time). I have been testing two of the devices while developing the software and just received the other 10 (all are the same model of sound card). When I plugged them all in, only 8 show up under /proc/asound/cards but all 12 are listed by lsusb:
Code:

localhost portage # lsusb
Bus 002 Device 040: ID 0d8c:000c C-Media Electronics, Inc. Audio Adapter
Bus 002 Device 039: ID 0d8c:000c C-Media Electronics, Inc. Audio Adapter
Bus 002 Device 038: ID 0d8c:000c C-Media Electronics, Inc. Audio Adapter
Bus 002 Device 037: ID 0d8c:000c C-Media Electronics, Inc. Audio Adapter
Bus 002 Device 036: ID 050d:0234 Belkin Components F5U234 USB 2.0 4-Port Hub
Bus 002 Device 035: ID 0d8c:000c C-Media Electronics, Inc. Audio Adapter
Bus 002 Device 034: ID 0d8c:000c C-Media Electronics, Inc. Audio Adapter
Bus 002 Device 033: ID 0d8c:000c C-Media Electronics, Inc. Audio Adapter
Bus 002 Device 032: ID 0d8c:000c C-Media Electronics, Inc. Audio Adapter
Bus 002 Device 031: ID 0d8c:000c C-Media Electronics, Inc. Audio Adapter
Bus 002 Device 026: ID 050d:0234 Belkin Components F5U234 USB 2.0 4-Port Hub
Bus 002 Device 022: ID 0d8c:000c C-Media Electronics, Inc. Audio Adapter
Bus 002 Device 021: ID 0403:6001 Future Technology Devices International, Ltd 8-bit FIFO
Bus 002 Device 018: ID 0d8c:000c C-Media Electronics, Inc. Audio Adapter
Bus 002 Device 014: ID 0403:6001 Future Technology Devices International, Ltd 8-bit FIFO
Bus 002 Device 013: ID 0403:6001 Future Technology Devices International, Ltd 8-bit FIFO
Bus 002 Device 012: ID 0403:6001 Future Technology Devices International, Ltd 8-bit FIFO
Bus 002 Device 011: ID 0403:6001 Future Technology Devices International, Ltd 8-bit FIFO
Bus 002 Device 008: ID 0d8c:000c C-Media Electronics, Inc. Audio Adapter
Bus 002 Device 007: ID 05e3:0604 Genesys Logic, Inc. USB 1.1 Hub
Bus 002 Device 005: ID 07cc:0501 Carry Computer Eng., Co., Ltd
Bus 002 Device 004: ID 050d:0234 Belkin Components F5U234 USB 2.0 4-Port Hub
Bus 002 Device 003: ID 050d:0234 Belkin Components F5U234 USB 2.0 4-Port Hub
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 002: ID 046d:c016 Logitech, Inc. M-UV69a Optical Wheel Mouse
Bus 001 Device 001: ID 0000:0000
localhost portage # cat /proc/asound/cards
0 [default        ]: USB-Audio - C-Media USB Headphone Set
                     C-Media USB Headphone Set   at usb-0000:00:0b.1-3.3, full speed
1 [default_1      ]: USB-Audio - C-Media USB Headphone Set
                     C-Media USB Headphone Set   at usb-0000:00:0b.1-3.4, full speed
2 [default_2      ]: USB-Audio - C-Media USB Headphone Set
                     C-Media USB Headphone Set   at usb-0000:00:0b.1-4.1, full speed
3 [default_3      ]: USB-Audio - C-Media USB Headphone Set
                     C-Media USB Headphone Set   at usb-0000:00:0b.1-1.1, full speed
4 [default_4      ]: USB-Audio - C-Media USB Headphone Set
                     C-Media USB Headphone Set   at usb-0000:00:0b.1-1.2, full speed
5 [default_5      ]: USB-Audio - C-Media USB Headphone Set
                     C-Media USB Headphone Set   at usb-0000:00:0b.1-1.3, full speed
6 [default_6      ]: USB-Audio - C-Media USB Headphone Set
                     C-Media USB Headphone Set   at usb-0000:00:0b.1-1.4, full speed
7 [default_7      ]: USB-Audio - C-Media USB Headphone Set
                     C-Media USB Headphone Set   at usb-0000:00:0b.1-4.4.4, full speed


I have 'options snd cards_limit=12' in my /etc/modules.d/alsa.
Any thoughts?
I will supply any more info if needed.
thanks!
Back to top
View user's profile Send private message
Root Moose
Tux's lil' helper
Tux's lil' helper


Joined: 29 Jan 2004
Posts: 112

PostPosted: Wed Feb 22, 2006 6:36 pm    Post subject: Re: problems with many sound cards..... Reply with quote

Do the 8 that appear seem to work?

If they do my thought is that there might be something hard coded and/or not-coded in ALSA itself. Devices 0-7 looks very obvious.

I'd be inclined to post to alsa-users and see what the developers say.
Back to top
View user's profile Send private message
Dominique_71
Veteran
Veteran


Joined: 17 Aug 2005
Posts: 1695
Location: Switzerland (Romandie)

PostPosted: Wed Feb 22, 2006 9:00 pm    Post subject: Reply with quote

This thread is very good to do a basic configuration, but a musician will need to get more of the sound card(s).

They will use jack as the sound server. For the live and audigy sound cards, it is 3 files in /usr/src/linux/Documentation/sound/alsa that they must read.
It is possible to archieve a very low latency with jack and a 8 channel mixing capability with those sound cards.

Another issue is the kernel. The best kernel for serious audio work is a realtime kernel with Ingo Molnar patch. You can look at that thread: realtime-preempt

Another good thread with music apps is pro audio production applications portage overlay
Back to top
View user's profile Send private message
weeroona
n00b
n00b


Joined: 21 Oct 2004
Posts: 13
Location: Pittsburgh

PostPosted: Fri Mar 10, 2006 6:40 pm    Post subject: ALSA: Multiple sound cards - more than 8 Reply with quote

After getting referred to the alsa-users mailing list, I posted there and got a quick response. The stable 'alsa-driver' 1.0.10 does not allow more than 8 cards, but 1.0.11-rc3 does.

so, add 'media-sound/alsa-driver' to your /etc/portage/packages.keywords plus any other dependencies that need to be upgraded to testing version.

alsa-driver must be compiled seperately from the kernel with the '--enable-dynamic-minors' flag. so add that to the 1.0.11rc3 ebuild:
Code:

src_compile() {
   # Should fix bug #46901
   is-flag "-malign-double" && filter-flags "-fomit-frame-pointer"
   append-flags "-I${KV_DIR}/arch/$(tc-arch-kernel)/include"

   econf $(use_with oss) \
      $(use_with debug debug full) \
      --with-kernel="${KV_DIR}" \
      --with-build="${KV_OUT_DIR}" \
      --with-isapnp=yes \
      --with-sequencer=yes \
      --with-cards="${ALSA_CARDS}" \
      --enable-dynamic-minors || die "econf failed"  # <--------added flag

emerge --digest alsa-driver

for my /etc/modules.d/alsa:
Code:

alias /dev/mixer snd-mixer-oss
alias /dev/dsp snd-pcm-oss
alias /dev/midi snd-seq-oss

alias char-major-116 snd
alias char-major-14 soundcore

alias snd-card-0 snd-usb-audio
alias sound-slot-0 snd-card-0
alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss
alias sound-service-0-12 snd-pcm-oss

alias snd-card-1 snd-usb-audio
alias sound-slot-1 snd-card-1
alias sound-service-1-0 snd-mixer-oss
alias sound-service-1-1 snd-seq-oss
alias sound-service-1-3 snd-pcm-oss
alias sound-service-1-8 snd-seq-oss
alias sound-service-1-12 snd-pcm-oss

alias snd-card-N snd-usb-audio   # (continue for each additional card with N getting incremented)
alias sound-slot-N snd-card-N
alias sound-service-N-0 snd-mixer-oss
alias sound-service-N-1 snd-seq-oss
alias sound-service-N-3 snd-pcm-oss
alias sound-service-N-8 snd-seq-oss
alias sound-service-N-12 snd-pcm-oss

options snd_cards_limit=11   # set to your total number of cards

run 'modules-update'
then probably reload the modules. I ran '/etc/init.d/alsasound restart' but this didn't work. Only 4 cards showed up. I was frustrated and restarted. Upon the fresh boot, all the cards were found and working. I'm pretty sure I just didn't reload enough modules after recompiling 'alsa-driver'.
Code:

 0 [default        ]: USB-Audio - C-Media USB Headphone Set
                      C-Media USB Headphone Set   at usb-0000:00:0b.1-4.2.1, full speed
 1 [default_1      ]: USB-Audio - C-Media USB Headphone Set
                      C-Media USB Headphone Set   at usb-0000:00:0b.1-4.2.2, full speed
 2 [default_2      ]: USB-Audio - C-Media USB Headphone Set
                      C-Media USB Headphone Set   at usb-0000:00:0b.1-4.2.3, full speed
 3 [default_3      ]: USB-Audio - C-Media USB Headphone Set
                      C-Media USB Headphone Set   at usb-0000:00:0b.1-4.2.4, full speed
 4 [default_4      ]: USB-Audio - C-Media USB Headphone Set
                      C-Media USB Headphone Set   at usb-0000:00:0b.1-4.3.1, full speed
 5 [default_5      ]: USB-Audio - C-Media USB Headphone Set
                      C-Media USB Headphone Set   at usb-0000:00:0b.1-4.3.2, full speed
 6 [default_6      ]: USB-Audio - C-Media USB Headphone Set
                      C-Media USB Headphone Set   at usb-0000:00:0b.1-4.3.3, full speed
 7 [default_7      ]: USB-Audio - C-Media USB Headphone Set
                      C-Media USB Headphone Set   at usb-0000:00:0b.1-4.3.4, full speed
 8 [default_8      ]: USB-Audio - C-Media USB Headphone Set
                      C-Media USB Headphone Set   at usb-0000:00:0b.1-4.4.1, full speed
 9 [default_9      ]: USB-Audio - C-Media USB Headphone Set
                      C-Media USB Headphone Set   at usb-0000:00:0b.1-4.4.2, full speed
10 [default_A      ]: USB-Audio - C-Media USB Headphone Set
                      C-Media USB Headphone Set   at usb-0000:00:0b.1-4.4.3, full speed
11 [default_B      ]: USB-Audio - C-Media USB Headphone Set
                      C-Media USB Headphone Set   at usb-0000:00:0b.1-4.4.4, full speed

I know this is a rediculous number of cards to be using. I had to use alsa rather than jack because the pymedia library, I don't believe, have support for Jack. actually I won't even be using the alsa support, I'll be using OSS emulation. I haven't tested that out yet but am hopeful it will work since it seems to be attached to the alsa configuration.

more info on the snd-usb-audio driver from alsa-project.org.
I also found this helpful.

Thanks for folks help in leading me down the right path!
Back to top
View user's profile Send private message
nivw
Apprentice
Apprentice


Joined: 09 Nov 2005
Posts: 261

PostPosted: Wed Mar 29, 2006 11:58 pm    Post subject: Reply with quote

Quote:
If someone else knows a better way to set up the module loading order, ping the thread and I will add it. This seemed like the most simple way to me.


I do http://gentoo-wiki.com/UDEV_Overview

using udev I can staticly set the devices each sound card gets.
Back to top
View user's profile Send private message
Dominique_71
Veteran
Veteran


Joined: 17 Aug 2005
Posts: 1695
Location: Switzerland (Romandie)

PostPosted: Thu Mar 30, 2006 10:16 pm    Post subject: Reply with quote

For a realtime kernel configuration, a good article is Low-latency Kernel Building How-to
To install the source, a good way is the pro audio production applications portage overlay. Don't forget to install sys-process/rtirq (description: Change the realtime scheduling policy and priority of relevant system driver IRQ handlers) with a such kernel.
Back to top
View user's profile Send private message
HackingM2
Apprentice
Apprentice


Joined: 26 Jul 2004
Posts: 245
Location: Cambridge, England

PostPosted: Sun Apr 02, 2006 1:45 pm    Post subject: Reply with quote

Hi all.

Sorry to post such a shameless plug for my own how-to thread but it does contain some information you may find useful, including details of how to use the microphone from one card (in the example USB) and the line-out on another as the defaults.

Check it out at [HOWTO] ALSA - Application specific volume controls
Back to top
View user's profile Send private message
lukaz
Tux's lil' helper
Tux's lil' helper


Joined: 20 Jun 2004
Posts: 103
Location: europe.old.ch

PostPosted: Thu Jun 01, 2006 8:38 am    Post subject: keep usb devices brave in order Reply with quote

hi there,

I got a ozone keyboard with a integrated audio-interface and a yahama usb-midi port. both use the same (usb-audio) driver. to keep the order of those devices, the indexoption does obviously not help. the usb-devices will be orderd in the order you connect them.

to get rid of this behaviour, I set the "pid" (idProduct) & the "vid" (idVendor) of the devices in "/etc/modules.d/alsa" like this.
Code:
alias snd-card-0 snd-intel8x0
options snd-intel8x0 index=0 id="Onboard"
alias snd-card-1 snd-usb-audio
options snd-usb-audio index=1 nrpacks=1 vid=0x0763 pid=0x2008 id="Ozone"
alias snd-card-2 snd-usb-audio
options snd-usb-audio index=2 vid=0x0499 pid=0x1009 id="usb-midi"
# Set this to the correct number of cards.
options snd cards_limit=3

to get the vid and pid of your devices use "lsusb -v"!

put it in your "/etc/modules.d/alsa", module-update, reboot...

lukaz
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum