2

How can I create custom PCM device with dmix-slave and use it in audacious without touching global PCM? Is it even possible? I tried miscellaneous configurations but no luck. ALSA asound.conf syntax is really weird. Here's the aplay -L output:

null
    Discard all samples (playback) or generate zero samples (capture)
default:CARD=SB
    HDA ATI SB, ALC662 rev1 Analog
    Default Audio Device
sysdefault:CARD=SB
    HDA ATI SB, ALC662 rev1 Analog
    Default Audio Device
front:CARD=SB,DEV=0
    HDA ATI SB, ALC662 rev1 Analog
    Front speakers
surround21:CARD=SB,DEV=0
    HDA ATI SB, ALC662 rev1 Analog
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=SB,DEV=0
    HDA ATI SB, ALC662 rev1 Analog
    4.0 Surround output to Front and Rear speakers
surround41:CARD=SB,DEV=0
    HDA ATI SB, ALC662 rev1 Analog
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=SB,DEV=0
    HDA ATI SB, ALC662 rev1 Analog
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=SB,DEV=0
    HDA ATI SB, ALC662 rev1 Analog
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=SB,DEV=0
    HDA ATI SB, ALC662 rev1 Analog
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=SB,DEV=0
    HDA ATI SB, ALC662 rev1 Digital
    IEC958 (S/PDIF) Digital Audio Output

And aplay -l:

**** List of PLAYBACK Hardware Devices ****
card 0: SB [HDA ATI SB], device 0: ALC662 rev1 Analog [ALC662 rev1 Analog]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 0: SB [HDA ATI SB], device 1: ALC662 rev1 Digital [ALC662 rev1 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

The roots of the problem: due to bug in audacious/alsa during music playback audacious consumes way too much CPU time. I found some kind of solution here https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=613203. I created ~/.asoundrc containing the following lines:

  pcm.!default {
  type plug
  slave.pcm {
    type dmix
    ipc_key 1024
    slave {
       pcm "hw:0,0"
       rate 44100
    }
  }
}

It really works and audacious consumes only small amount of CPU time. However, this creates problems with sound playback in Firefox. Sound in youtube videos stutters.

  • The device name can be changed in ~/.config/audacious/config. But why don't you update Audacious? – CL. Apr 11 '15 at 20:21
  • Thanks. I'll give it a shot. The very last Audacious version is not yet available in my distro. Besides, TBH, I'm not quite sure whether this will help. This weird bug persists across many versions, AFAIR. Not only Audacious to blame, but ALSA too. It may be also hardware specific. I don't know. – rfx Apr 11 '15 at 20:38
0

Regarding the main problem: I've overridden pcm.default like this:

pcm.dmixed {
    type asym

    playback.pcm {
        # See plugin:dmix at http://www.alsa-project.org/alsa-doc/alsa-lib/pcm_plugins.html
        type dmix
        ipc_key 5678293
        ipc_perm 0660
        ipc_gid audio

        slave {
            channels 6

            pcm {
                format S16_LE
                rate 44100
                type hw
                card 0
                device 0
                subdevice 0
            }

            # Play with this value, if you get errors "unable to set buffer size" or "underrun occured"
            # 4320 is effective minimum with hda-intel, but flash in firefox needs at least 5000.
            buffer_size 5000
            period_time 0
            #period_size 512
            #periods 2
        }
    }

    capture.pcm {
        type null
    }
}

pcm.!default {
    type plug
    slave.pcm "dmixed"
}

Take a look at this line:

# 4320 is effective minimum with hda-intel, but flash in firefox needs at least 5000.
buffer_size 5000

This seems to do the trick. So finally I got around it without creating additional PCM devices.

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.