How can I make Chromium use a different ALSA device?

I need one instance of Chromium on Linux to target a different sound card than the default, including Flash. Is there anyway to do this easily?


Solution 1:

First, use aplay -l to get the identifier of the alternative sound card you want to use. In the following example, it's AUDIO.

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: CONEXANT Analog [CONEXANT Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: AUDIO [USB  AUDIO], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Next, create an alternative ALSA configuration file (I used .asoundrc.usb) and fill it with the following content (based on a solution for a similar problem). Don't forget to replace AUDIO with the identifier you obtained in the previous step.

pcm.usb { type hw; card AUDIO; }
ctl.usb { type hw; card AUDIO; }

pcm.!default pcm.usb
ctl.!default ctl.usb

The only thing left is to modify the startup (desktop or menu shortcut, script, alias, etc.) of your browser to set the ALSA_CONFIG_PATH environment variable (documented on the ALSA project page) to the file you created.