Multiple Soundcards Under Linux?
Magnus Huckvale asks:
"We'd like to kit our new flat out with a MP3/Linux stereo system, with a set of stereo speakers in each room. Does anyone have any experience with fitting more than one soundcard to a Linux box? Is it possible to synchronise MP3 players outputting to different cards? What other capabilities can we build in given the hardware? What (cheap) soundcard would do? PCI or ISA?" While this is an interesting question, I think it would be easier to wire both sets of speakers to one soundcard rather than fiddling with two (and the headache involved in getting both to work properly). What do you all think?
(I am the original poster, I haven't got round to an account yet)
The reason we want more than one card is so we have the option of playing different music in each room, from a central server...
(Thanks to everyone for their thoughts!)
Um, me thinks /dev entries are just not there --- A friend of mine did this with his gus, playing two mp3's at the same time, on the different devices - /dev/dsp0 (/dev/dsp) and /dev/dsp1. (this was under 2.0.3x) Just run MAKEDEV audio in /dev (I think it's audio, check the script) and it'll make your dev entries.
(I would figure out what the script command line is, but....well, I'm stuck behind a badly braindammaged windowing system, e.g. Microsoft Windows.)
da w00t. mtfnpy?
I think there is a world market for maybe five personal web logs.
Again, there's no point. Write a set of shell scripts for different room control if you must, but otherwise just tee the output to multiple audio devices.
/dev/audio0 > /dev/audio2
whore# mpg123 -s crack.mp3 | tee
I think there is a world market for maybe five personal web logs.
This shouldn't be too hard, so long as you can set the cards to use different IRQs and I/O ports. It might be easier to have each sound card using a different chipset (and hence different drivers) but, otherwise, it shouldn't be much different from having multiple network interface cards.
The main reason I see to have multiple sound cards (with each sound card driving speakers in a different room) is to be able to play different MP3s in different rooms. This use, however, doesn't require the sound output streams to be synchronized in any way. If you just want to have multiple speakers playing the same stuff, a single sound card with a splitter/amplifier and multiple speakers should do the trick.
It's quite possible to set up linux with multiple sound cards. They manifest themselves as additional /dev/[mixer,audio,dsp] devices.
/dev/mixer when setting up the line/mic levels, if not /dev/audio, too.
:) You fire up one version of the player, and once it's happy, you change the device (via symlinks) that /dev/[mixer,audio,dsp] point to.
/dev/dsp0 /dev/dsp /dev/audio0 /dev/audio /dev/mixer0 /dev/mixer
/dev/dsp1 /dev/dsp /dev/audio1 /dev/audio /dev/mixer1 /dev/mixer
/proc/interrupts /proc/ioports
/dev/sndstat
The application I set up was using multiple Real encoders taking input from two soundcards and outputting it to 6 Real streams (2 sources @ 3 bandwidths each)
Some software is hardcoded to use
The solution? A sickening hack...but it worked
For example:
ln -s
ln -s
ln -s
mp3play mp3file_for_soundcard1.mp3
ln -s
ln -s
ln -s
mp3play mp3file_for_soundcard2.mp3
Yeah, yeah..I know it's horrible, but if you haven't got the source for the application, and it doesn't allow you to specify different devices on the command line, this should work.
And as ppl have correctly pointed out, make sure you don't have any resource conflicts:
cat
cat
Check that all soundcards have been detected using:
cat
You should see entries for each of the soundcards.
Hope this helps.
Coma
I've got a Soundblaster AWE 64 and a Gravis Ultrasound MAX in my linux box. /dev/sndstat tells me I have three digital audio dsp's (I'd guess that's 1 on the SB, 1 using Classic GUS playback and 1 using the GUSMAX Codec). Problem is, it seems that Linux 2.x does not support more than two dsp's (/dev/dsp0 and /dev/dsp1).
Do I have to switch to Commercial OSS or ALSA or something else?
-- close but no sig
If you really want to use multiple soundcards you could get the mp3 player to simultaneously send output to two audio devices, say, audio0 and audio2. The source is out there.
However, I recommend using an external audio switch (if you want more than one to be on simultaneously, I'd recommend an active one). If you build it yourself (easy) you can use, say, a parallel port to switch which ones will be on or off.
If you want to try either of these, I can help you. Email me and I'll elaborate.
You really have a couple solutions. First, you can modify your mp3 player to output its stream to multiple devices, and if that doesn't work, you could really write a simple wrapple program that would take the audio output from your mp3 player, and simultaneously write to several devices (I like that idea, because then you could do some fun stuff with it, like turn on and off a room's speakers, have two different things playing with two mp3 players, etc).
Just make sure your irq's and io ports are not conflicting with each other (dma also), or anything else in the system for that matter.
It's pretty flexible.