Sound on LTSP Terminals
Getting sound working on an LTSP Terminal can be a bit of a challenge. The problem is that normally applications run on the LTSP Server, and when they want to send audio, they write to
/dev/dsp (OSS). The typical result is that the sounds come out of the speakers attached to the server (if the server has a soundcard and speakers).
To send audio to the terminal speakers, we need to use a sound server, and LTSP supports two sound servers directly: NASD and ESD. Any application that supports one of those two sound servers should be functional out of the box. Additionally, both NASD and ESD have a library that redirects OSS audio to the sound server. This lets OSS applications use audio as well.
Terms
- sound server: is a daemon that plays audio sent to it through its open network port.
- ALSA: (Advanced Linux Sound Architecture) a modern audio interface with greater hardware support that succeeds OSS, together with a high level audio functions such as software mixing.
- aRts: aRts is often used by default with KDE. However, KDE will be switching away from aRts for KDE 4. aRts is not currently directly supported by LTSP.
- ESD: (Enlightened Sound Daemon, EsounD) is a sound server supported by LTSP.
- GStreamer: A common media interface in Gnome.
- Jack: A low latency audio interface designed for professional audio requirements.
- NASD: (Network Audio System Daemon) is a sound server supported by LTSP.
- NMM: (Network Integrated Multimedia Middleware) is a network friendly multimedia system with integration support to Phonon.
- OSS: (Open Sound System) is a portable sound interface, but it is not a sound server. Nevertheless redirection to EsounD for application based on /dev/oss can be transparent (see OSS redirection).
- Phonon: A common media interface for KDE 4 replacing aRts.
- PulseAudio?: is a sound server not supported by LTSP, but PulseAudio? allows volume control and is a drop-in replacement for ESD. Set for integration with Gnome version 2.18. Previously known as Polypaudio.
Which sound server should I choose?
TODO What is the difference? Do they all work equally well? What about compatibility?
| Sink | Active support | OSS source | ALSA source | Software mixing | Network transparent | Applications |
| ALSA | Yes | aoss | - | Yes | No | Flash 9, Skype 1.3 |
| aRts | No | artsdsp | No | Yes | Yes | KDE v2-3 applications |
| ESD | No | esddsp | No | Yes | Yes | Gnome system sounds, GStreamer default sink |
| GStreamer | Yes | No | No | Yes | No | Gnome media applications |
| Jack | Yes | No | No | Yes | No | Various |
| NASD | Yes | audiooss | AIX only | Yes | Yes | Various |
| NMM | Yes | No | No | Yes | Yes | Phonon network sink |
| OSS | No | - | libsalsa | No | No | Flash 7, Skype 1.2, RealPlayer 10 |
| Phonon | Yes | No | No | Yes | Yes | KDE v4 applications |
| PulseAudio? | Yes | padsp | Yes | Yes | Yes | Limited |
Generally NASD is the oldest as used in Unix terminal server environments, being replaced by ESD and aRts with Gnome and KDE respectively. However both ESD and aRts are no longer supported and quite buggy and application developers are moving to using ALSA as it supports software mixing without needing a separate daemon.
PulseAudio? looks the best choice but distribution wide support is currently minimal but will become greater with Gnome 2.18. KDE can be supported through Phonon ontop of GStreamer, however a Phonon plugin might appear for
PulseAudio? to remove the Gnome dependency, it is unknown whether Gnome support for Phonon or NMM will be planned.
See the section here called "Adjusting terminal's volume."
Configuration
lts.conf
There are only a handful of sound options in
lts.conf to deal with, and most cards will auto-configure.
-
SOUND=Y - enable sound on this client
- SMODULE_01= (module) tells which driver to use (if it's not auto-detected)
-
SOUND_DAEMON=esd The sound server to use. nasd is also a supported option.
Last you want to set hardware volumes on the terminal. This value ranges from 0
to 100. I set it to 75 by default, this avoids most distortion from bad sound
cards and reduces the possibility of the microphone causing a feedback loop.
the options are
VOLUME=75, =MIC_VOLUME=75, and
CD_VOLUME=75. It should be noted
that unless the cdrom has hardware controls to play the CD, it is pointless to
set a volume for the cdrom as you will have no way to play CDs currently. Below
is a sample audio configuration.
what are the default sound settings for lts.conf?
NASD, ESD and ALSA
The NASD and ESD daemons are included in the ltsp_core package, but you will need to install a package on the server, to redirect the audio stream to the terminal. This package contains a shell script whose sole purpose is to configure the environment so that applications know where to find the NASD or ESD server.
This package is available in an RPM and a TGZ format:
The two links point into empty space ATM... --
TheRoach - 13 Nov 2006
Are there the good ones? I sure hope so...
http://ltsp.mirrors.tds.net/pub/ltsp/ltsp-4.1-extras/ --
TheRoach - 20 Nov 2006
Install one of the above packages, and set the following in
lts.conf:
[ws001]
SOUND = Y
SOUND_DAEMON = nasd #or esd
Make sure that you actually test the shell script in /etc/ltsp-sound.sh by running it from a terminal,
after logging on to the thin client (a terminal started from your desktop, that is, like xterm). After
running the script, the variable
ESPEAKER should be set. If the script doesn't work, try the following:
- check whether the command that is used to set the DOMAIN variable (one of the first lines) actually returns the domain part of your workstation's domain (often: ltsp).
- check whether the 'nc' command used for determining whether port 16001 on your workstation is actually open for connections is really where the script thinks it is (/usr/bin/nc).
--
DucoDokter - 15 Jan 2007
The ltsp-sound script was failing to set anything on a FC6 machine. I think the message that nc returns changed. So in ltsp-sound, I changed the end of line 69/70 from
NC=`/usr/bin/nc -v -w 1 -z $REMOTESOUNDIP $REMOTESOUNDPORT 2>&1 \
| grep -v open$`
to
NC=`/usr/bin/nc -v -w 1 -z $REMOTESOUNDIP $REMOTESOUNDPORT 2>&1 \
| egrep -v '(succeeded!|open)$'`
--
KenTanzer - 21 Feb 2007
ALSA
As an alternative to the above, you can use ALSA to serve sound to the workstation, and on some server/workstation combinations, it is the only way to get sound working. Getting ALSA to work was easy with the below script. All you have to do is unpack it into any directory and run the shell script. I used the command:
tar -xvf
and then ran it, as root, using the following command:
./install.sh
Please note the period at the beginning of the above command is not a typo.
I am using K12LTSP-6 which is a LTSP 4.2 distribution.
http://wiki.ltsp.org/twiki/bin/view/Ltsp/WorkInProgress#esd_ALSA_sound_on_LTSP_4_2
The link was taken from the "Sound Card" section of this TWiki.
--
AaronFeldman - 17 Mar 2007
aRts
If you are using KDE, your options include using NASD or ESD or using OSS via redirection.
aRts may need to be rebuilt to support NASD or ESD. Mandriva and perhaps other distros have
support for NAD by default.
In any case, you need to go into the KDE Control Center and check some settings under
"Sound & Multimedia->Sound System"
- Enable the sound system
- Enable networked sound
- Run with the highest priority
- Sound buffer=20ms (you want this as low as possible, but may need to raise it
until it's not choppy)
On the sound I/O tab, unchecked "Enable full duplex operation". On the aRTs tab, uncheck "Enable network transparency" and "Exchange security and reference info over X11 server". (Newer versions of KDE don't have an "aRts" tab.)
OSS transparent redirection to EsounD
My users do not need high quality sound, but when your PBX is handled by Linux, and that voicemail arrive as sound attachement by mail, you MUST have a working sound on any terminal use to read mail.
Most Linux application can use /dev/oss, KDE, RealPlayer, Skype, ... support it. Also if sound redirection by OSS might not be the best quality, in order to listen voicemails and/or online training it is more than enough.
The other nice thing with OSS redirection, is that from a system admin point of view it is a piece of cake !!! After you've started esound server from lts.conf as explained before, make it avaliable automatically from X11 startup. In order to do so add in /etc/X11/xdm/Xsession somewhere before it launches your window manager.
REMOTE_X11=${DISPLAY%:*}
if test "$REMOTE_X11" == ""
then
export REMOTEX_11=false
else
export ESPEAKER=$REMOTE_X11:16001
export ESDDSP_MIXER=1
export LD_PRELOAD="/usr/lib/libesddsp.so.0 /usr/lib/libesd.so.0 $LD_PRELOAD"
export REMOTE_X11=true
fi
In order to check, connect from your LSTP client and check
$ESPEAKER. It's value should look like
ltsp-client-name:16001. Next step is to try it:
- esdplay /usr/share/sounds/alsa/test.wav ;# use ESPEAKER not oss redirect
- realplayer ;# use oss redirect
- skype
...
OSS redirection to ESD in KDE
The way KDE starts usually renders previous method unfeasible because
/etc/X11/xdm/Xsession not necessarily works. To handle that, the script must be executable and be placed at
$HOME/.kde/env folder (called, for example,
startsound.sh). That folder uses not to exist in normal KDE installations, but there is no problem creating it, and KDE will honour it. KDE executes all scripts of that folder when launching.
This way, you must setup your KDE to use OSS as its sound system. You do not need to turn on "Networked Sound". It's supossed that setting it as ESD must work too, but there are no reports about that working and there are about it don't doing. Configure all applications (only those not using KDE sound) to use OSS as well.
--
EjerciciosResueltos - 20 Dec 2006
Applications
Amarok
After getting sound working through the client, it's still possible Amarok will
play sound through the server. This is because Amarok supports multiple "engines"
and may be bypassing the sound server to talk directly to the output device.
The settings you need to change in Amarok are under:
"Settings -> Configure Amarok... -> Engines"
If you are using aRts to handle the sound output and "XINE" for your sound output,
then set "Output Plugin" to be "arts". That should cause sound from Amarok to be passed
on to aRts and on to the client. If you want to select "esd" and the option is missing here,
you may need to install an additional package on the server with a name like
xine-esd
Gaim
Gaim has its own sound settings which may need to adjusted to make sound come out of the
client rather than the server. Look under:
"Preferences -> Sounds -> Sound Method"
Then you can choose the sound server to match the one you have configured
through the process above.
GNOME
These instructions assume you are using ESD.
Using the GUI:
- Desktop->Preferences->More Preferences->Multimedia Systems Selector
- Set Sink Output to ESD
Using the CLI:
gconftool-2 --type string --set /system/gstreamer/0.8/default/audiosink "esdsink"
Alternatively:
I do this by installing gconf-editor (if not already installed) and then running it as root:
sudo gconf-editor
Then, I browse to system > gstreamer > 0.10 > default and change the audiosink to: esdsink
Then, I right click on the entry and choose "Set as Mandatory". This will change all users' settings on the server and take effect upon next login.
--
GideonRomm - 17 Nov 2006
Macromedia Flash 7
Installing the current
ltsp-sound-1.0 sound package is not enough to get sound going for Flash. The hack below worked for my install of LTSP. It was taken for the most part from the
K12LTSP wiki site with some minor editing on my part.
(Hope this will get a better setup procedure and eventual assimilation into LTSP from the gurus at LTSP)
Symptoms
When viewing a web site with Macromedia Flash that has sound, the browser won't play the sound and may freeze.
Problem
The Flash player plugin looks for two files in particular that, when absent, will cause problems. These files are
-
/tmp/.esd/socket
-
/usr/lib/libesd.so.1
Verify ESD works with other applications, rc.sound may require modification.
http://wiki.ltsp.org/twiki/bin/view/Ltsp/Sound#ESD_can_t_play_sound
Creating the .esd directory
If your server has no sound card, and you disabled ESD on the server to avoid getting error messages, then you may not even have a /tmp/.esd directory! Your system does not need it if you aren't playing sound off the server. However, the flash plugin still checks to see if it exists. So, if you don't have this directory, do the following commands in a terminal window
Change to root with the appropriate password
#su -
Create the
.esd directory under
/tmp
#mkdir /tmp/.esd
Create an empty file called socket under
.esd (this is enough to make the flash-plugin happy)
#touch /tmp/.esd/socket
Creating the libesd.so.1 file
Next, flash-plugin will look for the library file
/usr/lib/libesd.so.1. If you do not have this file, do the following;
su to root with appropriate password
#su -
Create a symbolic link from the library file that the flash-plugin will look for to the compatible one that DOES exist on your server.
#ln -s /usr/lib/libesd.so.0 /usr/lib/libesd.so.1
That's it! Close all web browsers and reopen them. Now, you should have sound!
Periodically, /tmp may be cleared by system processes or system administration, so if sound fails, check the existence of
/tmp/.esd/socket.
You may set up an hourly cron job to test for this and re-create it if necessary. If I do get to this, I will try to post that script here too.
--
FaruqueAhmed - 05 Mar 2005
Creating the check script file
Having to come back to reference this page a couple of times already, it really is important to have a cron check on this on a regular basis to save you the headache of creating the directory and file every once in a while.
So, you can create a file called check-for-tmp-esd-socket.sh and put something like the following script inside;
#!/bin/bash
if [ ! -e /tmp/.esd/socket ]; then
/bin/mkdir /tmp/.esd
/bin/touch /tmp/.esd/socket
fi
Put the file somewhere on the system, such as under
/usr/local/scripts, and put the following entry into root's crontab
0 * * * * /usr/local/scripts/check-for-tmp-esd-socket.sh 1> /dev/null 2> /dev/null
which will check for the socket file and .esd directory every hour on the hour. Some people like to check every 5 minutes, so the corresponding entry in cron would be
*/5 * * * * /usr/local/scripts/check-for-tmp-esd-socket.sh 1> /dev/null 2> /dev/null
The above is very rudimentary, but basic enough to start with. One should add some finese to the script and crontab entry if possible.
--
FaruqueAhmed - 21 May 2005
Adobe Flash 9
Adobe Flash 9 (as is) requires ALSA, so
it does not directly support sound in LTSP. However, there are two workarounds:
Rdesktop
--------- Forwarded message ----------
From: Gideon Romm <ltsp@symbio-technologies.com>
To: "Support list for opensource software in schools." <k12osn@redhat.com>
Date: Fri, 23 Sep 2005 09:58:16 -0400
Subject: Re: [K12OSN] rDesktop sound issues
Burt, if you want sound through rdesktop, you will need to sacrifice
sound through Linux. It is one or the other. Here's why:
As you surmised, rdesktop thru esd does not work well. rdesktop needs
to write directly to /dev/dsp in order for sound to work properly. The
only way to do this, is to run rdesktop off the thin client AND not have
a sound daemon of any kind running of the thin client at the same time.
This is because any sound daemon (such as esd/nasd) will take control
of /dev/dsp and not allow rdesktop to write to it.
So, If you want sound from Windows on the thin client, you should do
something like this:
SCREEN_02 = "rdesktop -r sound:local 192.168.0.253"
SOUND = Y
SOUND_DAEMON = "rdp"
and on the WTS, uncheck "Disallow Audio mapping"
Now, you will have Windows sound on screen 2, but no linux sound.
Side note: SOUND_DAEMON = "rdp" will produce a warning when booting the
thin client that "rdp" is not a recognized daemon. This trick is used
to have the thin client load the sound modules, but not a daemon. If
SOUND_DAEMON is omitted, esd will run by default.
Cheers,
-Gadi
Here's another option! I know that to play quake under linux with mp3's going in the background I had to run artsdsp -m or similar (it's esddsp --mmap) , there are "memory map" options for these sound servers. Now, that option might not work over the network, however I don't see why it wouldn't
RealPlayer
RealPlayer 10 does not include support for ESD, but apparently RealPlayer 8 does. In either case, MPlayer and
mplayerplug-in do play RealAudio (and many other formats).
Currently Realplayer 8 can be found on the
Real Legacy Software Archive. After installation select - View | Preferences and choose "ESound Support" on the Performance tab.
XMMS
If you are using ESD, then follow these steps:
- Open XMMS
- Preferences (CTRL+P)
- Set the Output Plugin to EsounD plugin
For a way to configure XMMS for all users, see
ManagingUserConfiguration.
XMMS + Crossfade-Plugin
If you also like to use the crossfade plugin, you have do the following steps:
- Open XMMS
- Preferences (CTRL+P)
- Set the Output Plugin to Crossfade Plugin
- Press Configure
- Set Output Method to Output Plugin
- Select Esound Plugin
- Press Configure
- Uncheck Remote Host (if checked)
--
MarkusGoerres - 14 Nov 2006
Adjusting terminal's volume
What doesn't work:
How is it possible (and easy) to adjust the terminal's volume?
Workarounds:
- Adjust volume on speakers
- Adjust volume in application
Distribution specific tips
See our page on
Sound on Mandriva using KDE and NAS
LTSP Sound on Gentoo
See
this entry on the Gentoo wiki
PulseAudio? on Ubuntu
Read the article
HOWTO: PulseAudio?
Debian (using KDE and nasd)
It took me long time to get Sound running under Debian ("Etch"). Below the hints which made me
accomplish this:
- First, one
needs to understand which packages are required. It turned out the alsaplayer-nas package
was the one package I'd missed all the time, after installation Sound worked.
- I had been using the LTSP kernel ltsp 2.6.16.1-ltsp-2 package, however I needed to compile my own nas-daemon ("nasd")
for the thin-client. Somehow the supplied "nasd", didn't work. For all commandline options I tried, I always got the
message "Cannot establish any listening sockets". So download the source, compile and replace the
/opt/ltsp-4.2/i386/usr/X11R6/bin/nasd with the new one.
-
To add to this Sound page are screen-shots from the KDE->Configuration->Sound and Multimedia->Soundsystem. As I
struggled to find the right one: to select the right sound-server, don't use "AutoDetect", but "NetworkAudioSystem".
Some details: KDE uses Arts for sound-processing, Arts is instructed to pass sound to "nasd", the "nasd" on the server sents the sound to the client, which therefore also runs "nasd".
After using the KDE->Configuration->Sound and Multimedia->Soundsystem panel, the following process
shows up in the process list ("ps -edf")
/usr/bin/artsd -F 6 -S 256 -a nas -r 15000 -N -m artsmessage -c drkonqi -l 3 -f
-
One last thing to solve is the fact that with above settings I cannot log into the server
directly, without getting lots of errors from the KDE Sound System.
--
LucCastermans - 4 Jul 2006
A few coments to this artsd commandline above (I am using Sarge):
- -F 6 -S 256 means 6 fragments at 256 byte. It is the first slider on the first soundsettings tab.
- -a nas means "use network sound as Hardware" on the second (hardware) tab.
- -r 15000 means the sampling rate,
- -N means "use larger network buffers". On sarge you have to put this option into the "additional settings" field on the hardware tab (don't know if this is the right name, because I use a German system).
- You don't have have to activate network sound on the first tab.
-
If you want to hear sound with this settings, go to the "system messages" controlfield and change in the "rendition settings" (German "Wiedergabe-Einstellungen") to "external player" artsplay.
This is a short explanation for the meaning of the settings in KDE 3.3.2 (Debian Sarge). For me ther are a different settings then the settings above working:
artsd -F 5 -S 2048 -a nas -r 44000 -N -m artsmessage -c drkonqi -l 3 -f
Just experiment a little bit.
--
HubertKrause - 19 Sep 2006
Debian OSS redirection to ESD
The above script must be modified to work in Debian. The line
export LD_PRELOAD="/usr/lib/libesddsp.so.0 /usr/lib/libesd.so.0 $LD_PRELOAD"
must be changed to
export LD_PRELOAD="/usr/lib/esound/libesddsp.so.0 /usr/lib/libesd.so.0 $LD_PRELOAD"
--
EjerciciosResueltos - 20 Dec 2006
General tips on the terminal
To troubleshoot the terminal you must make sure that the sound card is configured, and that the backend is running.
Put
SCREEN_02 = shell into your lts.conf for the terminal in question, then start the terminal. Once the terminal is started, do not login, simply hit
to switch to the shell running on virtual terminal two.
- Run
ls /dev/dsp, if a file is found, then the terminal has the proper drivers loaded. If the command gives you an error, then you must determine which driver it should use and configure the card manually.
- After verifying that the card has been detected and drivers are loaded, check to make sure the volume levels have been set. Run
aumix-minimal -q to verify the volume levels of PCM, and master specifically.
- Next, verify that the backend daemon is running, Use
ps aux | grep esd To see if esd is running, or ps aux | grep nasd to see if nasd is running. If you do not find the backend you configured, verify your configuration in lts.conf. For esd, make sure the command line option -public is set -- DucoDokter - 15 Jan 2007
- Finally you can test if it really sounds using
cat /proc/kcore > /dev/dsp . If you hear some static and noise, your sound works. If you do not hear nothing, check wires and connections twice. Do not use /dev/random as sound generator for this test 'cos it does not work.
ESD: can't play sound
If you use ESD, sometimes after setting up everything correctly, you still unable to play any sound file. XMMS, for example, will complain "Couldn't open audio"
In my case, I found that this is basically because access to ESD over the network is blocked.
If you open the following file:
/opt/ltsp/i386/etc/rc.sound
(Backup this file first: you don't want to lose it.)
On line 67, you can see this:
export ESD_SPAWN_OPTIONS="-public"=
However, somehow it's not recognized when ESD was executed (when the workstation booted up), so ESD will only accept access from localhost (which won't work for LTSP)
The quickest fix is to edit that file, goto line 68. You'll see this:
/bin/esd -nobeeps -tcp -port 16001 &
Change it to:
/bin/esd -nobeeps -tcp -port 16001 -public &
Now restart the workstation. You should be able to play sound files now.
(Yes, there's no authorization involved when accessing an ESD server: potential fun for the LTSP sysadmin
)
-- HarrySufehmi - 12 Sep 2005
I also had to add "-public" in order to get sound working again after upgrading LTSP 4.2 to update 4 (Fedora Core 5).
See http://www.mail-archive.com/ltsp-discuss@lists.sourceforge.net/msg28490.html
-- RasmusOryNielsen - 09 Sep 2006
GNOME: "No volume control elements and/or devices found"
When GNOME starts, it may say "No volume control elements and/or devices found." This message comes from the mixer applet (but will also be displayed by gnome-volume-control). It seems like the error delays GNOME startup by several seconds.
I don't know a solution that makes volume control or mixing work over ESD or NASD, but you can disable the mixer by default with this command (thanks to Eric Harrison:
chmod a-wrx /etc/gconf/gconf.xml.defaults/apps/panel/applets/mixer
Further assistance needed!
If all these tips still don't solve this problem, please visit the IRC channel
#ltsp in irc.freenode.net for help.
Hardware and drivers
For audio hardware and audio drivers, see SoundCards.
Video players
See VideoPlayers.