I have a system with two sound devices and am using sound via HDMI out. This is Card 1, Device 7, Subdevice 0, so I set in my /usr/share/alsa.conf:

defaults.ctl.card 1
defaults.pcm.card 1
defaults.pcm.device 7
defaults.pcm.subdevice 0

This gives me sound in ALSA applications. Now I want to run an old program that needs OSS, so I installed alsa-oss and did sudo modprobe snd-pcm-oss snd-mixer-oss. When I run the old program, I get sound, but only from the analog line out, not from HDMI, so the OSS emulation uses the first card.

How can I tell the OSS emulation to use the second card instead?


The documentation says:

ALSA supports the following OSS device files:


Unlike the real OSS, ALSA cannot use the device files more than the assigned ones. For example, the first card cannot use /dev/dsp1 or /dev/dsp2, but only /dev/dsp0 and /dev/adsp0. [...]
As seen above, PCM and MIDI may have two devices. Usually, the first PCM device (hw:0,0 in ALSA) is mapped to /dev/dsp and the secondary device (hw:0,1) to /dev/adsp (if available).

You can change this device mapping via the module options of snd-pcm-oss and snd-rawmidi. In the case of PCM, the following options are available for snd-pcm-oss:

  dsp_map     PCM device number assigned to /dev/dspX
      (default = 0)
  adsp_map    PCM device number assigned to /dev/adspX
      (default = 1)

For example, to map the third PCM device (hw:0,2) to /dev/adsp0, define like this:

options snd-pcm-oss adsp_map=2

The options take arrays. For configuring the second card, specify two entries separated by comma. For example, to map the third PCM device on the second card to /dev/adsp1, define like below:

options snd-pcm-oss adsp_map=0,2
| improve this answer | |
  • The problem is, to my understanding, my HDMI is not hw:0,1 but hw:1,7. How would I set /dev/dsp to be hw:1,7 then? – rabejens Nov 22 '15 at 8:55
  • You have to tell the old program to use /dev/(a)dsp1. – CL. Nov 22 '15 at 9:05
  • I never get /dev/(a)dsp1, I only get /dev/dsp. My sound hardware is funny in that way, it seems to use the snd_hda_intel and NVidia's proprietary graphics driver somehow installs a second device, but when I blacklist snd_hda_intel, HDMI sound is also gone – rabejens Nov 22 '15 at 9:33
  • Both use the snd-hda-intel driver. You get adsp for device 1 by default. Aren't you using the adsp_map option? – CL. Nov 22 '15 at 9:36
  • If I do sudo modprobe snd_pcm_oss adsp_map=0 I do get /dev/adsp, but sound still comes from the analog audio. When using dsp_map=1 or anything other than 0, I not even get /dev/dsp. I think I will be running the video signal through DVI via two adapters to strip the audio, and use onboard analog sound instead. It's only a monitor with built-in speakers anyway. – rabejens Nov 22 '15 at 10:05

I got this working on my system.


Let me know if you got it to work. Very interested.

| improve this answer | |
  • 1
    Welcome to Super User! Please quote the essential parts of the answer from the reference link(s), as the answer can become invalid if the linked page(s) change. – DavidPostill Apr 10 at 20:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.