Why can't I play audio from two or more sources?

5,769

Solution 1

Try the solution posted here. Add these lines to /etc/asound.conf:

pcm.pulse {
    type pulse
}
ctl.pulse {
    type pulse
}
pcm.!default {
    type pulse
}
ctl.!default {
    type pulse
}

Solution 2

The actual problem you're having is that -- probably -- mpd is configured to use ALSA by default. Did you know that mpd has a PulseAudio backend? Look at /etc/mpd.conf.

Anyway, mpd and mpc is a silly way to play music if you're just doing it locally. mpd is really designed for network streaming, like to run a streaming radio station. There are many other programs that will use PulseAudio natively, such as Rhythmbox, which requires zero configuration.

@terdon's answer should help if you have programs that are using the Safe ALSA Subset and respect libasound2 plug-layer configuration. But if any one program tries to open hw:0 or a similar direct-to-hardware ALSA device, it will prevent PulseAudio from working properly, and will block out all other access to the sound device.

I also don't know why you are trying to use jackd, since that is normally only for high-end audio work such as in Digital Audio Workstations (DAWs). Installing it probably didn't activate it (fortunately) or you'd have an even bigger mess.

A few things about your post make me think that you are making this entirely too difficult:

  • You "installed" PulseAudio. Why wasn't it installed by default?
  • You "installed" jackd. What made you think that doing that would be a good idea? Do you need to run a program that only runs on JACK, such as Ardour2?
  • You seem to need to play with configuration files such as /etc/asound.conf. This really should not be necessary.

It sounds like you are trying to run an extremely, extremely old version of Debian. Honestly, any distribution that is not from at least 2011 (and Debian Squeeze doesn't count) is not going to have a good out-of-the-box audio experience. My recommendation is to go with the latest stable release of Ubuntu, Linux Mint, OpenSUSE, or Fedora.

Old versions of Debian (and other distros, too) have a very poor out of the box audio experience, where things don't "just work" and have to be manually configured. So the fact that you had to install PulseAudio, when it has been shipped and enabled by default on distros since 2008, tells me you are running an ancient OS. It's free; you should upgrade rather than trying to manually re-do what distributions have done flawlessly through a lot of research and development over the past 5 years.

Share:
5,769

Related videos on Youtube

Павел Иванов
Author by

Павел Иванов

Updated on September 18, 2022

Comments

  • Павел Иванов
    Павел Иванов over 1 year

    When I installed on my desktop mpd and mpc, I found that I can't hear other sources (like Amarok, Flash player etc.) at the time when mpc or other client is playing music. If I try to start an audio stream with two Flash players in two tabs, I have the same problem.

    How to solve it?
    I have installed PulseAudio with default system settings and Jackd. How do I configure it for multiple sound sources?

    gigam@bird:~$ aplay -l
    List of PLAYBACK Hardware Devices
    card 0: Intel [HDA Intel], device 0: ALC888 Analog [ALC888 Analog]
    Subdevices: 1/1
    Subdevice #0: subdevice #0 card 0: Intel [HDA Intel], device 1: ALC888 Digital [ALC888 Digital]
    Subdevices: 1/1
    Subdevice #0: subdevice #0
    card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
    Subdevices: 1/1
    Subdevice #0: subdevice #0
    card 1: NVidia [HDA NVidia], device 7: HDMI 0 [HDMI 0]
    Subdevices: 1/1
    Subdevice #0: subdevice #0
    card 1: NVidia [HDA NVidia], device 8: HDMI 0 [HDMI 0]
    Subdevices: 1/1
    Subdevice #0: subdevice #0
    card 1: NVidia [HDA NVidia], device 9: HDMI 0 [HDMI 0]
    Subdevices: 1/1
    Subdevice #0: subdevice #0

    I'm using ALSA and PulseAudio as it was installed automatically.

    P.S. Hmmm... I have one additional error from PulseAudio: pacmd:

    >> load-module module-alsa-sink
    Module load failed.

    But in directory "/usr/lib/pulse-2.0/modules" I have it: module-alsa-sink.so

    • Admin
      Admin almost 12 years
      I mean music and Skype alerts, for example, at one time. It's impossible in my system now. And it's not an answer :)