Ganging audio cards

index page

This is one of a series of pages detailing attempts to play Ambisonic sound on cheap everyday equipment. This is not the ideal way to do it, but it does allow for experimentation. The faltering steps reported here are offered as one person's experience not as suggestions of how anything should be done!!

1. The Problem

The minimal practical speaker configuration for playing ambisonic files with height (that is fully three dimensional) would seem to be eight speakers. Sound cards with more than six tracks are either rare or expensive. So can one use two cards simultaneously?

That said, a few weeks ago (August 2007) I saw in a shop window the shop's basic PC for about 300 to 400 Euro, which had a 7.1 sound card built in and four 'stereo' sound jack sockets on the backs. So perhaps all this will soon be history.

The general advice seems to be that attempts to do multiple channel recording by ganging sound cards are a disaster. I did though notice that Richard Furse's Ambisonic Player (www.muse.demon.co.uk) offers (on Windows) to gang cards for you, so I thought I'd give it a try!

2. The System

The following all supposes a basic Linux distribution with jackd installed. (The latter came with my distribution but was not installed by default.)

3. Finding the cards

On booting, my system assigns a card number to each card. This is effectively random. There are (at least) three solutions to this:
  1. If like me you are using a USB card, then do not plug it in until the system is up and running. The 'on board' card will then be 0 (counting begins with 0, not 1) and the USB card will be 1.
  2. Find out what the card numbers are. In a terminal type:
    cat /proc/asound/cards
    and all the cards and their numbers should be displayed.
  3. It would be relatively trivial to write a script that does the previous and then uses the result to tweak everything else automatically.

Some texts seemed to imply one can refer to cards by name rather than number, but I have had no luck.

4. Writing an .asoundrc file

The following is purely based on trial and error and may be heavily flawed. But it does work for me:

pcm.card0 {
	type hw
	card 0
}
ctl.card0 {
	type hw
	card 0
}

pcm.card1 {
	type hw
	card 1
}
ctl.card1 {
	type hw
	card 1
}



pcm.eight {
	type multi;
	
	slaves.b.pcm  "hw:0,0";
	slaves.b.channels 2;
	slaves.a.pcm  "hw:1,0";
	slaves.a.channels 6;
	
	bindings.0.slave a;
	bindings.0.channel 0;
	bindings.1.slave a;
	bindings.1.channel 1;
	bindings.2.slave a;
	bindings.2.channel 2;
	bindings.3.slave a;
	bindings.3.channel 3;
	bindings.4.slave a;
	bindings.4.channel 4,
	bindings.5.slave a;
	bindings.5.channel 5;
	bindings.6.slave b;
	bindings.6.channel 0;
	bindings.7.slave b;
	bindings.7.channel 1;	
}

ctl.eight {
	type hw;
	card 0;
}

There is a copy of the file on line. To use it it just needs placing in the home directory (and its name changing to .asoundrc (that is adding a leading fullstop)). (The file structure was inspired by a Web posting of 20020808 of Patrick Shirkey —the errors are though mine (e.g. "card 0" should presumably not occur in two control statements, but I gave up trying to learn the syntax / editing once it worked …).)

5. Using it

To use the device created in the file:
jackd -d alsa -P eight

To have a look at it, then:
jack-patch-bay

For further discussion on usage see the principal pages. This page is just an offshoot about the specific issue of using multiple sound cards.

6. After thoughts

Pluses

Minuses


September 2007.

Copyright © 2007 Michael Chapman.
No rights claimed for .asoundrc code.