Datamation content and product recommendations are
editorially independent. We may make money when you click on links
to our partners.
Learn More
Last week we learned a bit about the chaotic jumble that is audio on Linux, and about the new PulseAudio sound server that just may create bit of order, and perhaps some more user-friendliness. Several Linux distributions default to using PulseAudio, such as Fedora, Ubuntu Hardy Heron, and Mandriva. Many others now
include it in their software repositories, or you can follow this
guide for installing the latest versionfrom source code.
Application support for PulseAudio is not quite complete. Notable problem applications are Skype, Flash Player, and Real Player. I shall refrain from my usual sarcastic commentary on the inability of the vendors of closed, proprietary applications to keep pace with FOSS development, because a person should exhibit a bit of class now and then, however insincere. Visit The Perfect Setup for instructions on getting these to work.
I had originally intended to make this as general a guide as possible, but I ran into a number of problems on both Kubuntu Gutsy and Hardy and got all wrapped up in debugging them, so today is going to be Fix *buntu Day. This may be useful to users on other other distributions as well because it covers permission problems, ALSA problems, and init problems, so everyone is welcome to tag along.
PulseAudio has a collection of good user-space utilities:
- Device Chooser
- Volume Control
- Volume Meter
- Manager
- Preferences
If your distribution has not messed with the package names, installing pulseaudio gets you the core sound server, and pavucontrol, pavumeter, paman, padevchooser, and paprefs are the user-space applications. Your distribution may also install Avahi/Zeroconf because PulseAudio uses it to auto-detect other audio servers on your network, and it should also install libasound2-plugins for ALSA compatibility.
After installation, run a simple command-line test:
$ pulseaudio --version
W: main.c: WARNING: called SUID root, but not in group 'pulse-rt'.
pulseaudio 0.9.6
pulse-rt stands for “pulse real-time”, and you need to be a member of the pulse-rt group to get rid of this warning. The easy and safe way is to edit the /etc/group file directly:
pulse-rt:x:125:carla
Anytime you change your group memberships you have to log out and then log back in to activate the changes, so do that next. After logging back in, check your group membership:
$ groups
carla adm dialout floppy audio dip video plugdev fuse lpadmin admin pulse-rt
It isn’t strictly necessary to do this, but enabling realtime priority means better audio quality.
We still need ALSA compatibility, so add these lines to /etc/asound.conf:
pcm.pulse {type pulse}
ctl.pulse {type pulse}
Now find yourself a nice WAV file to play and give it a whirl:
$ aplay -D pulse music/1st-set.wav
*** PULSEAUDIO: Unable to connect: Connection refused
aplay: main:545: audio open error: Connection refused
Oops. A quick ps ax|grep pulse reveals that the PulseAudio daemon isn’t even running. Another symptom of this is when you open the graphical Pulse Audio Manager, you see something like Figure 1 with a “connection refused” message. So what to do?
PulseAudio can run as an ordinary system-wide daemon if you wish. To enable this, edit /etc/default/pulseaudio like this:
PULSEAUDIO_SYSTEM_START=1
DISALLOW_MODULE_LOADING=0
That should be the opposite of the default. Then any user that needs access to the Pulse server needs to be added to the pulse-access group, including root. Then start it in the usual way:
$ sudo /etc/init.d/pulseaudio start
* Starting PulseAudio Daemon [ OK ]
Now when you open the PulseAudio Manager it looks like Figure 2, and aplay will play your file.
But on a multi-user system this is not the best way to run PulseAudio, according to the developers. It is better to run it per-user for these reasons: it creates a potential security hazard because it runs SUID, users can mess with other users’ sound, and settings are system-wide instead of individualized. If you’re on a single-user system then it doesn’t matter.
If you want it to run per-user, then each user needs individual configuration and startup files. PulseAudio is already well-integrated into Gnome, and Gnome supports per-session startup, so the hard work is already done. If you’re running a distribution that does not default to PulseAudio, create a symlink from Pulse’s compatibility script to the ESD binary to load PulseAudio instead:
# ln -sf /usr/local/bin/esdcompat /usr/bin/esd
Verify your filepaths first, of course.
What do users of other desktop environments do? We’ll get into detail on that next week. Meanwhile, KDE users can do this: stop it by running sudo /etc/init.d/pulseaudio stop, then reverse the changes to /etc/default/pulseaudio so that it does not start at boot. Then start it manually like this:
$ pulseaudio --high-priority --log-target=syslog
Check out the various userland tools, which you should find in your multimedia menu, and next week we’ll learn how to configure per-user startup, learn about sinks and sources, and play networked sounds.
Resources
Carla Schroder is the author of the Linux Cookbook and the newly-released Linux Networking Cookbook, and is a regular contributor to LinuxPlanet.
This article was first published on LinuxPlanet.com.
-
Ethics and Artificial Intelligence: Driving Greater Equality
FEATURE | By James Maguire,
December 16, 2020
-
AI vs. Machine Learning vs. Deep Learning
FEATURE | By Cynthia Harvey,
December 11, 2020
-
Huawei’s AI Update: Things Are Moving Faster Than We Think
FEATURE | By Rob Enderle,
December 04, 2020
-
Keeping Machine Learning Algorithms Honest in the ‘Ethics-First’ Era
ARTIFICIAL INTELLIGENCE | By Guest Author,
November 18, 2020
-
Key Trends in Chatbots and RPA
FEATURE | By Guest Author,
November 10, 2020
-
Top 10 AIOps Companies
FEATURE | By Samuel Greengard,
November 05, 2020
-
What is Text Analysis?
ARTIFICIAL INTELLIGENCE | By Guest Author,
November 02, 2020
-
How Intel’s Work With Autonomous Cars Could Redefine General Purpose AI
ARTIFICIAL INTELLIGENCE | By Rob Enderle,
October 29, 2020
-
Dell Technologies World: Weaving Together Human And Machine Interaction For AI And Robotics
ARTIFICIAL INTELLIGENCE | By Rob Enderle,
October 23, 2020
-
The Super Moderator, or How IBM Project Debater Could Save Social Media
FEATURE | By Rob Enderle,
October 16, 2020
-
Top 10 Chatbot Platforms
FEATURE | By Cynthia Harvey,
October 07, 2020
-
Finding a Career Path in AI
ARTIFICIAL INTELLIGENCE | By Guest Author,
October 05, 2020
-
CIOs Discuss the Promise of AI and Data Science
FEATURE | By Guest Author,
September 25, 2020
-
Microsoft Is Building An AI Product That Could Predict The Future
FEATURE | By Rob Enderle,
September 25, 2020
-
Top 10 Machine Learning Companies 2021
FEATURE | By Cynthia Harvey,
September 22, 2020
-
NVIDIA and ARM: Massively Changing The AI Landscape
ARTIFICIAL INTELLIGENCE | By Rob Enderle,
September 18, 2020
-
Continuous Intelligence: Expert Discussion [Video and Podcast]
ARTIFICIAL INTELLIGENCE | By James Maguire,
September 14, 2020
-
Artificial Intelligence: Governance and Ethics [Video]
ARTIFICIAL INTELLIGENCE | By James Maguire,
September 13, 2020
-
IBM Watson At The US Open: Showcasing The Power Of A Mature Enterprise-Class AI
FEATURE | By Rob Enderle,
September 11, 2020
-
Artificial Intelligence: Perception vs. Reality
FEATURE | By James Maguire,
September 09, 2020
SEE ALL
ARTICLES