This is an old revision of the document!
Table of Contents
under construction old one too bad to revive.
Pulseaudio (PA)
OSS versus ALSA
Warning: These reasons are written for newbies, its an Unofficial recommendation.
- If you need skype –> ALSA (and suggest no Pulseaudio)
- If you need to change sound devices on-the-fly gui –> Pulseaudio (front end to ALSA)
- If you need to change sound devices no gui –> ALSA
- If you need easier surround sound –> Pulseaudio
- If you like command mode surround sound –> Try OSS
- If you have an ISA sound device –> Try OSS then ALSA
- If you need a sound modem (dial-up) plus normal sound out –> Likely to be ALSA
- If you need to use a webcam builtin mic –> Try OSS then ALSA
- If you need to play high quality sound files –> ALSA
- If you have a Intel device, that needs a tweak –> ALSA
OSS is easier to setup, but fewer people use it so you may not get the support you are looking for. ALSA is better suited to those with “better” sound devices or multiple sound devices or sound devices that need tweaked settings. As I have an intel device, that needs a tweak, multichannel sliders do no appear in my ossxmix image as OSS appears to not know how to handle my sound device. But ALSA had the same issue but was easier to resolve with some research.
good luck and click here for OSS wiki, click here for ALSA wiki
Positive aspects of PA
Our downstream maintainer, Juanito offers the following:
- PulseAudio is a sound system for POSIX OSes, meaning that it is a proxy for sound applications.
- It allows you to do advanced operations on your sound data as it passes between your application and your hardware.
- Things like transferring the audio to a different machine,
- changing the sample format or channel count and
- mixing several sounds into one are easily achieved using a sound server
Extra:
- On-the-fly switching of sound devices using a graphical panel
- Module in PA to allow equalizer mixing
- May allow auto muting (corking) of playing sound file if your VOIP phone rings
Negative aspects of PA
Unofficial opinion of aus9
As its a front end, users need to get the backend (ALSA) correct first.
It increases the ways things can go wrong and as an example, sound can be muted by pavucontrol in at least 3 ways.
The other major issue is for some users, not all, PA puts higher demands on system resources.
- CPU may run hotter and cause shutdown if extreme temperatures reached
- More electricity consumed
- Sound latency or lags may become noticeable
Last, not all configs can be done thru pavucontrol, some text files may need tweaking
What audio group is TC?
http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/PerfectSetup TC is group 3 and so the following applies: (in a code box for display purposes only)
If your distribution belongs to group 2 or 3, you should make sure that no one is in the "audio" group. (If you plan running pulseaudio in the system-wide mode, then the special user "pulse" should still be in the "audio" group in order to have access to the sound card.) And reason for conclusion: real code ls -l /dev/snd total 0 drwxr-xr-x 2 root root 60 Oct 19 02:50 by-path/ crw-rw---- 1 root staff 116, 6 Oct 19 02:50 controlC0 crw-rw---- 1 root staff 116, 5 Oct 19 02:50 hwC0D0 crw-rw---- 1 root staff 116, 4 Oct 19 02:55 pcmC0D0c crw-rw---- 1 root staff 116, 3 Oct 19 02:55 pcmC0D0p crw-rw---- 1 root staff 116, 2 Oct 19 02:55 pcmC0D1p crw-rw---- 1 root staff 116, 33 Oct 19 02:50 timer #### note your controls may differ in number but not the owner/group
For newbies, this means I want to ensure you do not use system wide configs and a section below achieves this.
What packages to have onboot
Extra to whatever you use for your media player, codecs etc
Add
- pulseaudio
- pavucontrol
Optional, choose paprefs as “ondemand” paprefs If you need a streamer sound server, to share with others it can be onboot. Obviously if you need paprefs on a regular basis, please change to onboot
I will tell you when to reboot. (On reboot, home/tc will have a new folder called .pulse)
And of course, you need to setup ALSA first as PA is a front end to ALSA
And you also need to ensure all apps have been updated thru the APPS panel please.
Create dbus config
Copy and paste these commands to create a dbus config for local user.
mkdir .X.d echo 'dbus-launch --sh-syntax --exit-with-session' > .X.d/dbus
Please note the dot before and after the capital x please
Now do a full reboot please. Upon reboot test if dbus is running with
/usr/local/etc/init.d/dbus status # and your response should be dbus is running.
If you have the following response, dbus is not running, we have an error. A typo exists in the folder name for X.d or in the file for dbus. If you see a response command not found, then somehow, dbus has dropped out of your onboot list.
dbus errors must be resolved before we can start PA.
Make PA use local configs
Therefore, before trying out PA or running a mixer, lets “force” PA to detect and use local user configs. Open a terminal and copy and paste these 2 commands. Newbie tip, use lxterminal which has a pulldown function for copy or paste. Or click here for mouse wiki
tc@box:~$ cp /usr/local/etc/pulse/daemon.conf .pulse tc@box:~$ cp /usr/local/etc/pulse/default.pa .pulse
TIP If you make change in the future, just delete your .pulse files and start again.
Start testing for errors
Hopefully, we have sufficient dependencies already installed for you to have no errors for missing packages.
Its possible, you installed a very small codec tcz selection and you won't immediately notice the error for this test but may notice it when you attempt to run your media player. Do not run any sound media player however, as trouble-shooting requires the elimination of conflict or interference…..as a rule.
So we start terminal, as a local user and run command
pulseaudio -v
We look for any error lines, and they will always be in red text font.
Trivial errors
If you close down the terminal and forgot to stop PA by holding down the control key (Ctrl) and then pressing the c key,
next time you repeat the command you will get errors like this
E: [pulseaudio] pid.c: Daemon already running. E: [pulseaudio] main.c: pa_pid_file_create() failed.
The above errors mean PA is running already. So to get back to reading any errors or information PA can display we stop PA and restart it with commands
killall pulseaudio pulseaudio -v
Interference errors
You may have some interference errors where you have accidently left open some sound capable software. I exclude ethernet modem/routers and wireless connection devices as they don't actually play sounds. Not sure about dial up modems.
Please close down your web browser if it has the capacity to play sounds like firefox or chromium. And obviously do not have any media player software running like vlc etc.
Missing software errors
These errors are likely to be fatal, meaning PA will display the first missing software error in red text and then abort the running PA process. So, we need to search APPS panel for the missing software. Try search in case the package provides the missing executable or library (lib) file and if nothing found then try pulldown the search arrow and select “provides”
—good luck
After installing each missing package, reboot and redo the pulseaudio command above until you have no missing errors please.
I will repeat, for me, I had no missing errors although a short while ago I did and one stage need to install GConf.tcz but a repeat test seems to have cleared that error.
google non-missing errors
After resolving missing packages for the onboot list, you might still have some that appear to be configuration type errors.
eg
Error=E: [pulseaudio] module-equalizer-sink.c: resume state exists but is wrong size!
google shows eg http://www.freedesktop.org/wiki/Software/PulseAudio/Notes/1.0
Of interest to me, is mention that…..module-equalizer-sink:added temporary debugging output to track filter output removed dead code only a small amount of crackling remains.
But we notice that the error is for a “removable” module, so lets show how to fix it by not enabling this particular module. I use terminal file manager mc, but newbies might like to use a gui text editor like leafpad?
Open /home/tc/.pulse/default.pa and prefix the lines with a # symbol so lines read (in a code box for display purposes)
### Load Equaliser #.ifexists module-equalizer-sink.so #load-module module-equalizer-sink #.endif
Stop PA by using the control + c keys
restart PA and check if red error message has disappeared.
Now if you truly need a software equalizer, my method won't work will look at qpaeq later
No errors
After doing whatever you needed to do like adding packages, disabling modules etc and you have no more red text errors, then we can move onto the next step.
Create autostart PA config file
echo 'start-pulseaudio-x11' > .X.d/pulseaudio
reboot to test pulseaudio -v command. If all good, start pavucontrol thru your menu please.
Temporary tweak ONLY so PA is always on
While you are tweaking your config files, edit default.pa and hash out the module that is shutting PA down so lines become
### Automatically suspend sinks/sources that become idle for too long |
---|
#load-module module-suspend-on-idle |
The effect of this tweak is, (a) you never need to run the pulseaudio command to “refresh” the service or daemon and (b) running a command like pacmd won't return an abort message like this
pacmd No PulseAudio daemon running, or not running as session daemon.
Note that having a service always on may impact on people with low spec machines so this is not a recommendation. If this becomes your preferred tweak then I suggest you kill pulseaudio, make changes to any config files and then restart PA with command
killall pulseaudio (make changes to any config) pulseaudio --start
Instead of the start command re-click the pavucontrol icon/menu item.
Once you have tweaked, re-enable the shutdown config option please. If you do do reverse this tweak, you may have issues with some sound applications wanting to use sound device but PA might not “release” it to them.
This is another negative aspect of PA but you only need to close down paprefs, pavucontrol and stop using PA commands like pacmd and the autostop function will work.
Tweak sample rate
From Arch wiki Determine_sampling-rate_of_the_sound_card
My example
arecord -f dat -r 60000 -D hw:0,0 -d 5 test.wav Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 60000 Hz, Stereo Warning: rate is not accurate (requested = 60000Hz, got = 48000Hz) please, try the plug plugin
Please watch out for hw:0,0 as that may not be your preferred output card index, device number. So change it if needed please
YMMV
But unlike Arch, we tweak .pulse/daemon.conf for your maximum sample rate. I suggest you add a hash symbol to make a backup of default sample rate so file reads as
# default-sample-rate = 44100 |
---|
then add extra line to read as
default-sample-rate = (your-number) |
---|
For me (your-number) becomes 48000. Note I could have used the alternative rate. As the Arch wiki shows that user with a decent sample rate, we can safely assume mine is a little ordinary in stellar performance terms! It might be better to copy and paste your-number so you reduce typos?
Tweak your actual media player
I prefer vlc, so click on tools → preferences → audio (left pane) → output module pulldown and choose pulseaudio. Arch also have a list such as https://wiki.archlinux.org/index.php/PulseAudio#Desktop_Environments
Persistence?
No special backups needed for PA we have used home file configs. If you elect to use system wide configs then you need to add
etc/pulse |
---|
to your filetool.lst
But .pulse will fill quickly and impact on creating and restoring mydata as per see the backup utility section
So if its an issue try this
Add the .pulse folder to negative backup config file so the entire folder is not saved edit /opt/.xfiletool.lst
.pulse |
---|
But then we lose any changes we made to our config files, so they are added to /opt/.filetool.lst
.pulse/daemon.conf |
---|
.pulse/default.conf |
If your home is persistent, then you could either use your file manager to delete the bloat, or create a cron job to automate that task
Modules info
http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/
What modules are available to be loaded?
/usr/local/lib/pulse-2.1/modules/module-zeroconf-publish.so /usr/local/lib/pulse-2.1/modules/module-zeroconf-discover.so /usr/local/lib/pulse-2.1/modules/module-x11-xsmp.so /usr/local/lib/pulse-2.1/modules/module-x11-publish.so /usr/local/lib/pulse-2.1/modules/module-x11-cork-request.so /usr/local/lib/pulse-2.1/modules/module-x11-bell.so /usr/local/lib/pulse-2.1/modules/module-volume-restore.so /usr/local/lib/pulse-2.1/modules/module-virtual-surround-sink.so /usr/local/lib/pulse-2.1/modules/module-virtual-source.so /usr/local/lib/pulse-2.1/modules/module-virtual-sink.so /usr/local/lib/pulse-2.1/modules/module-udev-detect.so /usr/local/lib/pulse-2.1/modules/module-tunnel-source.so /usr/local/lib/pulse-2.1/modules/module-tunnel-sink.so /usr/local/lib/pulse-2.1/modules/module-switch-on-port-available.so /usr/local/lib/pulse-2.1/modules/module-switch-on-connect.so /usr/local/lib/pulse-2.1/modules/module-suspend-on-idle.so /usr/local/lib/pulse-2.1/modules/module-stream-restore.so /usr/local/lib/pulse-2.1/modules/module-sine.so /usr/local/lib/pulse-2.1/modules/module-sine-source.so /usr/local/lib/pulse-2.1/modules/module-simple-protocol-unix.so /usr/local/lib/pulse-2.1/modules/module-simple-protocol-tcp.so /usr/local/lib/pulse-2.1/modules/module-rygel-media-server.so /usr/local/lib/pulse-2.1/modules/module-rtp-send.so /usr/local/lib/pulse-2.1/modules/module-rtp-recv.so /usr/local/lib/pulse-2.1/modules/module-role-cork.so /usr/local/lib/pulse-2.1/modules/module-rescue-streams.so /usr/local/lib/pulse-2.1/modules/module-remap-sink.so /usr/local/lib/pulse-2.1/modules/module-raop-sink.so /usr/local/lib/pulse-2.1/modules/module-raop-discover.so /usr/local/lib/pulse-2.1/modules/module-position-event-sounds.so /usr/local/lib/pulse-2.1/modules/module-pipe-source.so /usr/local/lib/pulse-2.1/modules/module-pipe-sink.so /usr/local/lib/pulse-2.1/modules/module-oss.so /usr/local/lib/pulse-2.1/modules/module-null-source.so /usr/local/lib/pulse-2.1/modules/module-null-sink.so /usr/local/lib/pulse-2.1/modules/module-native-protocol-unix.so /usr/local/lib/pulse-2.1/modules/module-native-protocol-tcp.so /usr/local/lib/pulse-2.1/modules/module-native-protocol-fd.so /usr/local/lib/pulse-2.1/modules/module-mmkbd-evdev.so /usr/local/lib/pulse-2.1/modules/module-match.so /usr/local/lib/pulse-2.1/modules/module-loopback.so /usr/local/lib/pulse-2.1/modules/module-ladspa-sink.so /usr/local/lib/pulse-2.1/modules/module-jackdbus-detect.so /usr/local/lib/pulse-2.1/modules/module-jack-source.so /usr/local/lib/pulse-2.1/modules/module-jack-sink.so /usr/local/lib/pulse-2.1/modules/module-intended-roles.so /usr/local/lib/pulse-2.1/modules/module-http-protocol-unix.so /usr/local/lib/pulse-2.1/modules/module-http-protocol-tcp.so /usr/local/lib/pulse-2.1/modules/module-hal-detect.so /usr/local/lib/pulse-2.1/modules/module-gconf.so /usr/local/lib/pulse-2.1/modules/module-filter-heuristics.so /usr/local/lib/pulse-2.1/modules/module-filter-apply.so /usr/local/lib/pulse-2.1/modules/module-esound-sink.so /usr/local/lib/pulse-2.1/modules/module-esound-protocol-unix.so /usr/local/lib/pulse-2.1/modules/module-esound-protocol-tcp.so /usr/local/lib/pulse-2.1/modules/module-esound-compat-spawnpid.so /usr/local/lib/pulse-2.1/modules/module-esound-compat-spawnfd.so /usr/local/lib/pulse-2.1/modules/module-equalizer-sink.so /usr/local/lib/pulse-2.1/modules/module-echo-cancel.so /usr/local/lib/pulse-2.1/modules/module-device-restore.so /usr/local/lib/pulse-2.1/modules/module-device-manager.so /usr/local/lib/pulse-2.1/modules/module-detect.so /usr/local/lib/pulse-2.1/modules/module-default-device-restore.so /usr/local/lib/pulse-2.1/modules/module-dbus-protocol.so /usr/local/lib/pulse-2.1/modules/module-console-kit.so /usr/local/lib/pulse-2.1/modules/module-combine.so /usr/local/lib/pulse-2.1/modules/module-combine-sink.so /usr/local/lib/pulse-2.1/modules/module-cli.so /usr/local/lib/pulse-2.1/modules/module-cli-protocol-unix.so /usr/local/lib/pulse-2.1/modules/module-cli-protocol-tcp.so /usr/local/lib/pulse-2.1/modules/module-card-restore.so /usr/local/lib/pulse-2.1/modules/module-bluetooth-proximity.so /usr/local/lib/pulse-2.1/modules/module-bluetooth-discover.so /usr/local/lib/pulse-2.1/modules/module-bluetooth-device.so /usr/local/lib/pulse-2.1/modules/module-augment-properties.so /usr/local/lib/pulse-2.1/modules/module-always-sink.so /usr/local/lib/pulse-2.1/modules/module-alsa-source.so /usr/local/lib/pulse-2.1/modules/module-alsa-sink.so /usr/local/lib/pulse-2.1/modules/module-alsa-card.so
How to load?
Way 1 kill pulseaudio, modify default.pa to name new module, restart PA
Way 2 (more suitable for command line users)
- Open terminal
- pacmd (name of command to type press enter)
- help (pacmd has a help page but for us try
- load-module module-name eg
pacmd load-module module-switch-on-port-available
If module succeeds you get no feedback, but if it fails you see Module load failed.
paprefs
I suggest you load this as ondemand to see if you wish to use or abuse it. If you need to stream music to others, this is what you might be looking for. Lets look at setting up playing 2 or more sounds thru the one set of speaker. Open paprefs, click tab for simultaneous output and tick the box.
Then in pavucontrol, playback tab, click the button between your media player and the mute speaker icon and choose simultaneous OR
click output devices tab, and it will default to simultaneous
Now pavucontrol bottom panel is the actual hardware controls
But both sets of sliders will still impact on your volume out, ditto the mute speaker icons. Confused yet?
Network and sharing
PA controls sound device issues
If you have pavucontrol open, then PA controls your device and won't release. This impacts on microphone testing of arecord as per alsa wiki.
Solution close down all pavucontrol and paprefs and wait about 10 seconds and try again.
You know PA has control when you see an error like this
arecord -d 20 -f dat /tmp/test.wav ALSA lib pcm_dsnoop.c:612:(snd_pcm_dsnoop_open) unable to open slave arecord: main:660: audio open error: Device or resource busy
PA and mic issues
If you want to record using a normal mic, without using any suspender command, PA will be active and not give control to “arecord” which is a non-PA sound app unless you close down pavucontrol and paprefs and exit any pulseaudio command. Then you wait for the suspend module to work.
But before closing down pavucontrol, you may want predict if you sound mic is working without recording. Strange I know but easier to show image.
Now I have deliberately shown a naughty image. I have raised volumes higher than my hardware can do. This proves PA is a post-processor and is a warning do not have volumes set this high….you will have distortion.
Now I reset the volume for me around 80%
Now if your voice on playback has sufficient volume then one issue is resolved. But you can have machine hum. This may be easy to resolve by having your mic input as far away as possible from any fan noise. (B) If you can, consider reducing any fan speeds on your pc.