This is an old revision of the document!


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 of sound muted I offer the following:
pavucontrol panel offers at least 3 ways of muting sound.

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 if needed, choose paprefs as “ondemand” See (new) 88888888888888

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.

googe 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.

Tweak so PA is always on

If this is what you desire, edit file and hash out the module that is shutting it 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

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 as 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

Modules info

Print/export
QR Code
QR Code wiki:pulseaudio (generated for current page)