|
|
Contents |
This document details the installation of PulseAudio as a replacement of EsoundD for improved audio quality and support of the Skype VoIP client. PulseAudio used to be called Polypaudio and was a Ubuntu package for Breezy however it was removed due to stalled development, today it is seeing new development though and is heading for integration into Gnome 2.18 (~March 2007) and then should appear in Feisty Fawn (Ubuntu 7.04) at least for LTSP (Edubuntu).
A typical scenario would look like this:
We also configure ALSA to use a PulseAudio plugin to redirect over the network as the GStreamer PulseAudio plugin package is not built yet.
Check upstream with Debian packages and the Ubuntu Desktop team for further updates.
Some extra libraries are required for PulseAudio, as we are manually installing the others via dpkg we need to manually install these too.
$ sudo apt-get install \
libltdl3 liboil0.3 libsamplerate0 libsndfile1 libjack0.100.0-0 libflac7 \
libavahi-client3 libavahi-common-data libavahi-common3 libdbus-1-3 libhal1
$ sudo chroot /opt/ltsp/i386/ apt-get install
libltdl3 liboil0.3 libsamplerate0 libsndfile1 libjack0.100.0-0 libflac7 \
libavahi-client3 libavahi-common-data libavahi-common3 libdbus-1-3 libhal1
Debian unstable has started creating packages for PulseAudio and these can be used as part of the setup, download the following packages via Debian Package Search.
libpulse-browse0_0.9.5-2_i386.deb libasound2_1.0.13-1_i386.deb libasound2-plugins_1.0.13-2_i386.deb libasyncns0_0.1-1_i386.deb libpulse0_0.9.5-2_i386.deb pulseaudio_0.9.5-2_i386.deb pulseaudio-esound-compat_0.9.5-2_i386.deb pulseaudio-module-hal_0.9.5-2_i386.deb pulseaudio-utils_0.9.5-2_i386.deb
Save to /opt/ltsp/i386/tmp and you can conveniently install to both server and client as follows.
$ sudo dpkg -i tmp/* $ sudo chroot /opt/ltsp/i386/ dpkg -i tmp/*
As an alternative I have rebuilt each of these packages on Ubuntu Edgy Eft and you can download here:
libasound2_1.0.13-2miru1_i386.deb libasound2-plugins_1.0.13-2miru1_i386.deb libasyncns0_0.1-2miru1_i386.deb libpulse0_0.9.5-3miru1_i386.deb libpulse-browse0_0.9.5-3miru1_i386.deb pulseaudio_0.9.5-3miru1_i386.deb pulseaudio-esound-compat_0.9.5-3miru1_i386.deb pulseaudio-module-hal_0.9.5-3miru1_i386.deb pulseaudio-utils_0.9.5-3miru1_i386.deb
Re-configure Gnome to use ALSA for audio.
Configure ALSA to forward audio to PulseAudio by creating a file /etc/asound.conf or ~/.asoundrc with the following.
pcm.!default {
type pulse
}
ctl.!default {
type pulse
}
Configure the PulseAudio daemon, create /opt/ltsp/i386/etc/pulse/daemon.conf as follows:
daemonize = 1 high-priority = 1 log-target = stderr resample-method = trivial no-cpu-limit = 1 system-instance = 1 disable-shm = 1
There are no native local audio players and so those features are disabled, thin clients are generally low powered so the configuration has been tuned for the lowest quality and highest priority. The CPU limiter kills the daemon so not useful for conferencing.
PulseAudio modules are configured in /opt/ltsp/i386/etc/pulse/default.pa, we setup to communicate with local audio via ALSA and listen for EsoundD and native PulseAudio connections over the network from the LTSP server.
### Load audio drivers automatically on access # mobo sound on hw:0 (default) add-autoload-sink default_output module-alsa-sink device=hw:0 sink_name=default_output add-autoload-source default_input module-alsa-source device=hw:0 source_name=default_input # USB phone on hw:1 add-autoload-sink phone_output module-alsa-sink device=hw:1 rate=8000 channels=1 sink_name=phone_output add-autoload-source phone_input module-alsa-source device=hw:1 rate=8000 channels=1 source_name=phone_input ### Network access load-module module-esound-protocol-tcp auth-anonymous=1 load-module module-native-protocol-tcp auth-anonymous=1 ### Automatically restore the volume of playback streams load-module module-volume-restore ### Automatically move streams to the default sink if the sink they are ### connected to dies, similar for sources load-module module-rescue-streams ### Make some devices default set-default-sink default_output set-default-source default_input .nofail
Its probably recommended to implement IP ACL's on the TCP connections in a production environment.
For systems with more than one sound card or for devices not well detected you might have to manually specify the configuration. In future releases you might be able to leave PulseAudio to automagically configure itself, however the version used here has a fault with static hardware detection. There is no DBUS on a thin client so we cannot use PulseAudio's default detection mechanism. First take the above config files and make some changes, to daemon.conf disable the daemon:
; daemonize = 1 high-priority = 1 log-target = stderr resample-method = trivial no-cpu-limit = 1 system-instance = 1 disable-shm = 1
To default.pa enable static hardware detection, disable the autoload lines, default devices and enable the CLI interface:
### Alternatively use the static hardware detection module (for systems that ### lack HAL support load-module module-detect ### Load audio drivers automatically on access # mobo sound on hw:0 (default) #add-autoload-sink default_output module-alsa-sink device=hw:0 sink_name=default_output #add-autoload-source default_input module-alsa-source device=hw:0 source_name=default_input # USB phone on hw:1 #add-autoload-sink phone_output module-alsa-sink device=hw:1 rate=8000 channels=1 sink_name=phone_output #add-autoload-source phone_input module-alsa-source device=hw:1 rate=8000 channels=1 source_name=phone_input ### Network access load-module module-esound-protocol-tcp auth-anonymous=1 load-module module-native-protocol-tcp auth-anonymous=1 ### Automatically restore the volume of playback streams load-module module-volume-restore ### Automatically move streams to the default sink if the sink they are ### connected to dies, similar for sources load-module module-rescue-streams ### Make some devices default #set-default-sink default_output #set-default-source default_input .nofail load-module module-cli
Ensure you can login locally to a LTSP client, e.g. set an empty root password in /opt/ltsp/i386/etc/passwd, and Ctrl+Alt+F1. Restart PulseAudio and list the interfaces it can find with the info command.
# pkill pulseaudio
# pulseaudio
Welcome to PulseAudio! Use "help" for usage information.
>>> info
…
2 sink(s) available.
* index: 0
name: <alsa_output.hw_0>
driver: <modules/module-alsa-sink.c>
volume: <0: 80% 1: 80%>
latency: <0 usec>
monitor_source: <0>
sample spec: <s16le 2ch 44100Hz>
channel map: <front-left,front-right>
owner module: <0>
description: <ALSA PCM on hw:0 (VIA 82C686A/B rev50)>
index: 1
name: <alsa_output.hw_1>
driver: <modules/module-alsa-sink.c>
volume: <0: 100%>
latency: <0 usec>
monitor_source: <2>
sample spec: <s16le 1ch 8000Hz>
channel map: <mono>
owner module: <2>
description: <ALSA PCM on hw:1 (USB Audio)>
4 source(s) available.
index: 0
name: <alsa_output.hw_0.monitor>
driver: <modules/module-alsa-sink.c>
latency: <0 usec>
sample spec: <s16le 2ch 44100Hz>
channel map: <front-left,front-right>
monitor_of: <0>
owner module: <0>
description: <Monitor Source of ALSA PCM on hw:0 (VIA 82C686A/B rev50)>
* index: 1
name: <alsa_input.hw_0>
driver: <modules/module-alsa-source.c>
latency: <0 usec>
sample spec: <s16le 2ch 44100Hz>
channel map: <front-left,front-right>
owner module: <1>
description: <ALSA PCM on hw:0 (VIA 82C686A/B rev50)>
index: 2
name: <alsa_output.hw_1.monitor>
driver: <modules/module-alsa-sink.c>
latency: <0 usec>
sample spec: <s16le 1ch 8000Hz>
channel map: <mono>
monitor_of: <1>
owner module: <2>
description: <Monitor Source of ALSA PCM on hw:1 (USB Audio)>
index: 3
name: <alsa_input.hw_1>
driver: <modules/module-alsa-source.c>
latency: <78000 usec>
sample spec: <s16le 1ch 8000Hz>
channel map: <mono>
owner module: <3>
description: <ALSA PCM on hw:1 (USB Audio)>
…
The name and sample spec details can then be used in the manual configuration.
Apply the following patch to /opt/ltsp/i386/etc/init.d/ltsp-client to allow configuration for PulseAudio:
--- ltsp-client.original 2006-10-09 18:57:28.000000000 +0800
+++ ltsp-client 2006-10-09 02:22:52.000000000 +0800
@@ -39,6 +39,9 @@
warn "Sound requested but /dev/dsp is missing. Continuing."
fi
case "$SOUND_DAEMON" in
+ pulse)
+ /usr/bin/pulseaudio
+ ;;
esd|) # The default when no value is set
/usr/bin/esd -nobeeps -public -tcp &
;;
Then update /opt/ltsp/i386/usr/sbin/ldm to implement the pulse setting:
--- ldm.original 2006-10-09 18:59:35.000000000 +0800
+++ ldm 2006-10-09 19:00:27.000000000 +0800
@@ -117,12 +117,12 @@
ssh_auth = ['%s@%s' % (username,self.server)]
if self.use_sound:
+ espeakerport = 16001
if self.sound_daemon == 'esd':
print "info: Enabling esd sound support."
# Could start using esddsp, but it is not enabled
# because it gave problems when using firefox.
# esddsp', '-m','--server=%s:16001' % (self.ip)
- espeakerport = 16001
sound_cmd = ['ESPEAKER=%s:%d' % (self.ip, espeakerport)]
# Make sure esd is ready to accept new
@@ -132,6 +132,11 @@
# better. [pere 2006-02-24]
os.system("killall esd")
os.system("/usr/bin/esd -nobeeps -public -tcp &")
+ elif self.sound_daemon == 'pulse':
+ print "info: Enabling PulseAudio sound support."
+ pulseport = 4713
+ sound_cmd = ['ESPEAKER=%s:%d' % (self.ip, espeakerport),
+ 'PULSE_SERVER=tcp:%s:%d' % (self.ip, pulseport)]
elif self.sound_daemon == 'nasd':
print "info: Enabling nasd sound support."
# Could use the audiooss package to set LD_PRELOAD.
Then update your lts.conf for PulseAudio:
## Sound configuration SOUND = True SOUND_DAEMON = pulse
Now reboot the client and sound should work through PulseAudio.
Skype 1.3 for Linux implements ALSA support but apparently not sufficiently to configure an ALSA plugin, therefore the PulseAudio system for OSS needs to be used. To run Skype with PulseAudio/OSS type the following:
$ padsp skype
Then Skype should detect an OSS audio device which is PulseAudio routed to the client. If you wish to specify a different PulseAudio set of devices, typically a USB phone use the PULSE_SINK and PULSE_SOURCE environment variables:
$ PULSE_SINK=phone_output PULSE_SOURCE=phone_input padsp skype
Firefox uses OSS audio by default and can be configured to use a wrapper that redirects audio to ALSA (aoss), NASD (audiooss), ESD (esddsp), aRts (artsdsp), or PulseAudio (padsp). Simply edit /etc/firefox/firefoxrc or ~/.mozilla/firefox/rc and set the following variable.
FIREFOX_DSP="padsp"
The latest beta from Adobe allows an customization of the audio sink and the Revolution Linux team have made a Pulse/ESD/ALSA/OSS compatible library available:
© 2008 Novell, Inc. All Rights Reserved.