About:
This tutorial is meant for Ubuntu 9.10 Karmic Koala, but it might work in earlier or later versions as well. I wrote this tutorial mostly because it took me a full day of work using lots of help from people on #mpd and #pulseaudio from the FreeNode IRC server.
Goal:
The goal is to get the MPD daemon working using PulseAudio, but without it being dependent on the X server or a session. To do that we must configure PulseAudio to run in system-wide daemon mode (which is not recommended by the developers, but in this case we do not have a choice). This means it will be using the /etc/pulse/system.pa config file instead of the usual /etc/pulse/default.pa. We must also make sure the appropriate user/group permissions are set, or PulseAudio will be rejecting the connections.
The result will be an interrupt-less music environment, not dependent on the X server. Meaning we can for example log out and log in without the music having to stop for even a second. Switching TTYs (Ctrl+Alt+Fx) will also keep the music playing (not possible by default). All that and PulseAudio will still be able to detect and configure all your devices automatically.
Instructions:
Make sure you add your username to the following system groups: pulse, pulse-access and audio.
Do that by going to System --> Administration --> Users and Groups.
Click the unlock button (the one with a picture of some keys), then click Manage Groups. In the list of groups that pops up, for each of the previously mentioned groups click "Properties" and select all the users that you want to have this functionality.
Press Alt+F2 and type:
Change PULSEAUDIO_SYSTEM_START from 0 to 1 and DISALLOW_MODULE_LOADING from 1 to 0.gksudo gedit /etc/default/pulseaudio
Save the file and close the editor.
(Since Ubuntu 10.04 Lucid Lynx, this step is no longer required. Instead download the attached system.pa file and place it in your /etc/pulse folder.)
Press Alt+F2 and type:
Find this section:gksudo gedit /etc/pulse/system.pa
Change it to:Code:### Automatically load driver modules depending on the hardware available .ifexists module-hal-detect.so load-module module-hal-detect .else ### Alternatively use the static hardware detection module (for systems that ### lack HAL support) load-module module-detect .endif
Save the file and close the editor.Code:### Automatically load driver modules depending on the hardware available .ifexists module-udev-detect.so load-module module-udev-detect .else ### Alternatively use the static hardware detection module (for systems that ### lack HAL support) load-module module-detect .endif
Install the MPD daemon and a MPD client of your choice.
Open Synaptic Package Manager (System --> Administration --> Synaptic Package Manager) and find the mpd package and the client of your choice (my recommendation is the GMPC client). Mark the packages for installation and click Apply.
Press Alt+F2 and type:
gksudo gpasswd -a mpd pulse-access
Press Alt+F2 and type:
Find the following section:gksudo gedit /etc/mpd.conf
Make sure it is all commented out, by putting a # symbol in front of each line, so that it looks like this:Code:audio_output { type "alsa" name "My ALSA Device" device "hw:0,0" # optional format "44100:16:2" # optional mixer_device "default" # optional mixer_control "PCM" # optional mixer_index "0" # optional }
Then in the same file, add the following:Code:#audio_output { # type "alsa" # name "My ALSA Device" # device "hw:0,0" # optional # format "44100:16:2" # optional # mixer_device "default" # optional # mixer_control "PCM" # optional # mixer_index "0" # optional #}
Save the file and close the editor.Code:audio_output { type "pulse" name "MPD PulseAudio Stream" }- Make sure MPD gets started after PulseAudio on boot time! Do this by properly renaming the S30mpd (it could have a different number) file in /etc/rc2.d, /etc/rc3.d, /etc/rc4.d and /etc/rc5.d to one with a number higher than that of S50pulseaudio. I suggest S60mpd.
- Reboot your computer and you should be able to use MPD via PulseAudio without any interferences when switching TTYs or when killing the whole X server.
Additional Information:
Bookmarks