Differences between revisions 36 and 37
Revision 36 as of 2016-07-08 01:47:33
Size: 8442
Editor: BenWong
Comment: Previous instructions had multiple problems: unnecessary killall -9 as root, unnecessary copying of client.conf, unnecessary use of sudo to do the copy, incorrect usage of chmod, etc...
Revision 37 as of 2016-07-08 01:52:16
Size: 8469
Editor: BenWong
Comment: I'm guessing the person who wrote the section on "wheezing" was not a native English speaker. Fixed to "stuttering".
Deletions are marked like this. Additions are marked like this.
Line 100: Line 100:
== Wheezing and audio interruptions ==

If a low-power machine having wheezing, in {{{/etc/pulse/daemon.conf}}} list the following:
== Stuttering and audio interruptions ==

If a low-power machine stutters (audio breaks up), you can try adding the following to {{{/etc/pulse/daemon.conf}}}:

Translation(s): English - Русский


Hardware - Sound

PulseAudio

PulseAudio is a sound server that replaces the ESoundDaemon.

Here are some features of PulseAudio:

  • High quality software mixing of multiple audio streams with support for more than one entrance (source) and exit (sink).
  • Can be used to combine multiple sound cards into one (with frequency rate).
  • Large set of supported client libraries. Applications that use ESD, ALSA, oss, libao and GStreamer, are supported without the need for any changes. Modules for PulseAudio are available for xmms and mplayer.

  • Low latency and accurately measured delay time for recording and playback. Ability to fully synchronize multiple playback streams.
  • Network transparency: the application can play or record audio on a computer other than the one on which they run.
  • Extensible architecture with modules for jackd, multicast-rtp, lirc and avahi, among others.

Installing PulseAudio

# aptitude install pulseaudio

Since at least squeeze, installing pulseaudio through apt in this way should result in a pulseaudio system that "just works". Pulseaudio becomes the default when the package is installed. Everything (including flash) will use it.

This can be checked by with pavucontrol (in the pavucontrol package). If the sound is registering in the vu vumetre of that program, then it is being routed through the pulse system.

Surround sound system

Many people have a multi-channel sound cards, but use the speakers for the two channels. PulseAudio has no default settings for surround sound support. To enable all channels, edit the file /etc/pulse/daemon.conf: uncomment default-sample-channels (ie remove the semicolon at the beginning of the line) and set it to 6 if you System 5.1 or 8, if your system is 7.1.

# Default
default-sample-channels = 2
# To 5.1
default-sample-channels = 6
# To 7.1
default-sample-channels = 8

After making the changes, restart Pulseaudio.

Solving Problems

Restarting the Pulseaudio Daemon

To reread the config files ~/.config/pulse/daemon.conf and /etc/pulse/daemon.conf, do this:

$ pulseaudio --kill
$ pulseaudio --start

Missing playback devices or audio capture

If Pulseaudio does not correctly detect your input / output devices ("sources" and "sinks" in Pulseaudio parlance), you can try deleting the configuration files. This is probably unnecessary overkill, but might help some people.

$ pulseaudio --kill
$ rm -r ~/.config/pulse /tmp/pulse-*
$ pulseaudio --start

Disabling daemon autospawn

From version 6.0 of pulseaudio, the daemon autospawns each time its killed. In order to have the previous way of running the following is required to be changed :-

[$] cat /etc/pulse/client.conf | grep autospawn                                                                                   
; autospawn = yes

Copy the configuration files to ~/.config/pulse

[/etc/pulse] 
└─[$] sudo cp client.conf /home/shirish/.config/pulse/ 

Change the file permissions so you can edit the file :-

[~/.config/pulse]
└─[$] sudo chmod 446 client.conf    

Make the change using your favorite editor so that it says :-

[~/.config/pulse] 
└─[$] cat client.conf | grep autospawn                                                                                               
  autospawn = no

Make sure that the indentation in the file is at it is and carry on with above.

Front Panel Jacks not working

As of wheezy, for some reason, pulseaudio does not see the toggle feature of some cards (i.e. CMI8788 [Oxygen HD Audio]) exposed by ALSA and playing with the pulseaudio interface (pavucontrol) won't bring happiness. The trick, (for now?), is to bring up the alsamixer ( or alsamixergui) and the audio output can be switched from the read of the card to the front-panel as well as the mic input.

Stuttering and audio interruptions

If a low-power machine stutters (audio breaks up), you can try adding the following to /etc/pulse/daemon.conf:

high-priority = no
nice-level = -1
realtime-scheduling = yes
realtime-priority = 5
flat-volumes = no
resample-method = speex-float-1
default-sample-rate = 48000

Interrupting play in Amarok when running Skype

Comment out or remove the line in the / etc / pulse / default.pa

load-module module-cork-music-on-phone

Excessive CPU usage and distortion

Add a line to / etc / pulse / default.pa

load-module module-udev-detect tsched = 0

Sound level is low or suddenly becomes too loud

Add a line to / etc / pulse / daemon.conf:

flat-volumes = no

Various problems with Skype and Wine

Add or uncomment the line in / etc / pulse / daemon.conf

default-fragments = 25
default-fragment-size-msec = 25

Advanced

Dynamically enable/disable

As mentioned above, all sound will automatically be routed thorugh pulseaudio when the pulseaudio package is installed. These instructions describe how to disable it with the pulseaudio package still installed. Individual users can then reenable it themselves as needed.

The "just works" magic is achieved through configuration files placed in /usr/share/alsa/alsa.conf.d/. Without these files in place, the regular alsa defaults will be used. Therefore, to achieve the default alsa behavior with the pulseaudio package installed, divert these files

mkdir /usr/share/alsa/alsa.conf.pulse/

dpkg-divert --divert /usr/share/alsa/alsa.conf.pulse/pulse.conf --rename  /usr/share/alsa/alsa.conf.d/pulse.conf

dpkg-divert --divert /usr/share/alsa/alsa.conf.pulse/99-pulseaudio-default.conf.example  --rename  /usr/share/alsa/alsa.conf.d/99-pulseaudio-default.conf.example

dpkg-divert --divert /usr/share/alsa/alsa.conf.pulse/50-pulseaudio.conf --rename  /usr/share/alsa/alsa.conf.d/50-pulseaudio.conf

Now if a user wishes to use pulseaudio, they can create an ~/.asoundrc file that looks something like

 @hooks [
         {
                 func load
                 files [
                         {
                                 @func concat
                                 strings [
                                         { @func datadir }
                                         "/alsa.conf.pulse/"
                                 ]
                         }
                 ]
                 errors false
         } 
 ]

If a user wishes to switch between pulse and non-pulse on a quasi-regular basis, put the above into the ~/.asoundrc.pulse instead and symlink it to ~/.asoundrc when pulse is desired

ln -s ~/.asoundrc.pulse ~/.asoundrc

and remove it when not

rm ~/.asoundrc

be sure also when disabling pulse to kill the server so that other things can directly access the soundcard again

killall pulseaudio

Temporarily suspend and run an application without PulseAudio

You can use the pasuspender utility, if you only need to disable PulseAudio temporarily, to run an application and have it access your audio devices directly.

  • Run: pasuspender -- yourapplication [yourapplicationoptions]

  • Configure your application to access your audio devices directly (e.g. select your soundcard ALSA address in an audio player)

While you run pasuspender, other applications won't be able to use PulseAudio. When you quit the application, the default behaviour of PulseAudio will be restored automatically.

See man pasuspender for more information.

Install from source

Seems as though there ought to be some general instructions for building things from source in Debian, but I couldn't find them when editing this.

Download

from here:

http://www.freedesktop.org/wiki/Software/PulseAudio/Download/

Configure

???

Build

make

Install

Put it somewhere. Make some links so programs can find it.

  • Reference:

http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/PerfectSetup/


CategoryHardware CategorySound