2 soundcards

Preface

Having 2 soundcards I wanted to use them for feeding music from mserv into 2 amplifiers. I'm using

  • the (optical9 digital out of a Terratec Aureon Fun (C-Media Electronics Inc CM8738) and
  • the line out of a Soundblaster Live (Creative Labs SB Live! EMU10k1)

I wanted to define some sort of virtual sound card that feeds both soundcards with the same input at the same time.

Making them run

For Debian Linux (Sarge):

  • add definitions to /etc/modprobe.d/sound
 # Terratec Aureon Fun (C-Media Electronics Inc CM8738)
 alias snd-card-0 snd-cmipci
 options snd-cmipci index=0
 # Soundblaster Live (Creative Labs SB Live! EMU10k1)
 alias snd-card-1 snd-emu10k1
 options snd-emu10k1 index=1
  • run update-modules.modutils (updates /etc/modules.conf)
  • add modules to /etc/modules (modules loaded at startup through /etc/init.d/module-init-tools):
 # ALSA sound cards (see /etc/modprobe.d/sound)
 snd-cmipci
 snd-emu10k1
  • create /etc/asound.conf containing
# Terratec AureonFun
pcm.AureonFun {
  type hw
  card 0
  device 2
}
ctl.AureonFun {
  type hw
  card 0
}
# SoundblasterLive
pcm.SoundblasterLive {
  type hw
  card 1
  device 0
}
ctl.SoundblasterLive {
  type hw
  card 1
}
# virtual device using both soundcards simultaniously
# - first create 4 virtual channels (2 pairs)
# - use pairs for both soundcards
pcm.both {
  type route
  slave.pcm route
  slave.channels 4
  ttable.0.0 1
  ttable.1.1 1
  ttable.0.2 1
  ttable.1.3 1
}
pcm.route {
  type multi
  slaves.a.pcm AureonFun
  slaves.a.channels 2
  slaves.b.pcm SoundblasterLive
  slaves.b.channels 2
  bindings.0.slave b
  bindings.0.channel 0
  bindings.1.slave b
  bindings.1.channel 1
  bindings.2.slave a
  bindings.2.channel 0
  bindings.3.slave a
  bindings.3.channel 1
}

Play MP3 Audio

First sound card using IEC958 on Terratec Aureon Fun:

 mpg321 --stdout SomeFile.mp3 | aplay -D hw:0,2,0 -c 2 -t raw -r 44100 -f S16_LE

Second sound card using Line Out on Soundblaster Live:

 mpg123 --stdout SomeFile.mp3 | aplay -D hw:1,0,0 -c 2 -t raw -r 44100 -f S16_LE

Both soundcards:

 mpg321 -o alsa09 -a both SomeFile.mp3

Hints

I found the output of aplay -L and aplay -l quite usefull.

Links