User:Fenris02/pulseaudio-fixes-and-workarounds

From FedoraProject

Jump to: navigation, search
PulseAudio fixes and workarounds

by fenris02 — last modified Nov 26, 2010 10:04 PM — filed under: Multimedia Solutions

A collection of fixes and work-arounds for PulseAudio: This page has hints for if you are having some sound, but it is choppy, skips - or is too quiet. Applicable to Fedora Versions

   Fedora 9-14+
   This guide is based around the default set of tools, so if you do not have Gnome - the commands may be slightly different.  (Particularly related to sound properties and volume controls.)

Doing the work 0: Volume adjustment Explanation of requirements.

- Run "cat /proc/asound/cards" and verify that your audio hardware shows up.  If it does not, that issue needs to be resolved first.
- Another command to verify that your sound drivers are loaded is "/sbin/lsmod | grep -c snd".  This command should print a number greater than 6.   If either of these commands does not have proper output, then your sound driver is not loading.
- If you have an Intel-HDA card, see the note at the bottom.  ("lspci" or "lsusb" will tell you what specific audio card you have.)
- You have already run "gnome-sound-properties" and select your default output devices.  As this is no longer found in Fedora 11, use "yum install gst-mixer" and run it instead.  If you have Fedora 12, use "gnome-volume-control".
- For multimedia, look in "gstreamer-properties".  Set the output devices to PulseAudio.
- Frequently - the PCM device is muted.  Unmute it with these commands.  Adjust the volume upwards to somewhere between 80-100%.  Be sure  you unmute PulseAudio, and Hardware levels for Master, PCM and Speakers.   Certain cards default the Speaker volume to 0.
- [GUI] GNOME users: You have already run "gnome-volume-control" and un-mute all devices.
- [TUI] Install alsa-utils ("yum install alsa-utils") if you have not done so already, and then you can adjust your sound controls with "alsamixer -c 0" as well.  Another command to try is "alsamixer -D hw:0".  A third option here is to run "alsaunmute".
- [GUI] Install and run pavucontrol ("yum install pavucontrol") and adjust your volume levels.
- [GUI] XFCE users: You have already installed ("yum install xfce4-mixer") and run "xfce4-mixer" and un-mute all of your devices.
- You have run "yum update" and applied all the system-updates before continuing.  If you updated your kernel, you will need to reboot before moving onward.
-  You have reviewed the document in "yum install kernel-doc ; more /usr/share/doc/kernel-doc-*/Documentation/sound/alsa/ALSA-Configuration.txt" and made any adjustments need.  (Example here is for laptops that have sound output on both speaker and headphones) See also: http://www.kernel.org/doc/Documentation/sound/alsa/HD-Audio-Models.txt

Doing the Work 1: Changing audio priority

Install the base PulseAudio tools from a Terminal window.

   Install the Jack Audio Connection Kit:
   su -c "yum install alsa-plugins-pulseaudio pulseaudio pulseaudio-module-jack alsa-plugins-jack jack-audio-connection-kit tuned"
   Add your user-id to the proper audio groups:
   # Releases prior to F12:
    su -c "usermod -aG pulse-rt,jackuser,audio username"
   # F12-F13 users:
    su -c "usermod -aG pulse,pulse-access,jackuser,audio username"
   Apply the changes:
   From the System menu bar, Select logout.  Log back in to apply the changes above.

Doing the Work 2 (only if #1 above did not resolve the issue)

You have tried the first part, and it did not help enough - this section covers additional cases. Most people will probabily not need this section, but it has helped a number of individuals.

   Change the scheduler default (Caution, this step can cause high-CPU usage on some systems.  You can undo this step if it causes you problems. This disables time-scheduling.)
   su -c "nano -w /etc/pulse/default.pa"
   If you have F10 or F11, Skip down to about line 48, where it reads:
   load-module module-hal-detect
   Change this to:
   load-module module-hal-detect tsched=0


   If you have F12, on about line 53, where it reads:
   load-module module-udev-detect
   Change this to:
   load-module module-udev-detect tsched=0


   Save and exit nano.
   Modify the use of the real-time scheduler
   su -c "nano -w /etc/pulse/daemon.conf"
   Skip down to about line 34 where it reads:
   ; realtime-scheduling = no
   Change this to:
   realtime-scheduling = yes
   Skip down to about line 76 where it reads
   ; default-fragments = 4
   ; default-fragment-size-msec = 25
   Change this to:
   default-fragments = 8
   default-fragment-size-msec = 5
   Save and exit nano.
   Edit "~/.asoundrc" and add the following lines if they do not exist:
   pcm.pulse { type pulse }
   ctl.pulse { type pulse }
   Install additional audio tools:
   su -c "yum install pavucontrol pavumeter paman padevchooser paprefs alsa-plugins-pulseaudio gstreamer-plugins-pulse pulseaudio pulseaudio-core-libs pulseaudio-esound-compat pulseaudio-libs pulseaudio-libs-glib2 pulseaudio-libs-zeroconf pulseaudio-module-gconf pulseaudio-module-x11 pulseaudio-module-zeroconf pulseaudio-utils xine-lib-pulseaudio xmms-pulse"


   Ensure that you're using PulseAudio as your default audio:
   System > Preferences > Hardware > Sound for "Sound Playback" 
   set to PulseAudio Sound Server.
   (F12 users)  Sound and Video > Pulseaudio Device Chooser


   Apply the changes:
   From the System menu bar, Select logout.  Reboot to apply the changes above.


Troubleshooting How to test Explanation troubleshooting basics and expectations.

   Verify that your user-id is a member of "pulse-rt" (F10-11) and "jackuser" (F10-12):  (Your output may look different)
   $ id user1
   uid=500(user1) gid=500(user1) groups=500(user1),10(wheel),100(users),497(pulse-rt),490(jackuser)
   Restart PulseAudio (as your own ID, not root):
   pulseaudio -k
   Test without using flash, mp3 or anything special:
   If you are unsure how to test audio, run "cat /dev/urandom > /dev/dsp" and press Ctrl-C to stop.  You should hear noise/static if it is working.
   You can also use something like "aplay /usr/share/sounds/ekiga/ring.wav" and it should play a ringtone.

Common problems and fixes If the above does not work there are several things you can try

   To temporarily disable PulseAudio for a given application, in this example wine, in a terminal (as your user) run:
   pasuspender wine
   padsp wine mygame.exe


If you receive a "permission denied" message when audio was working before try

   To re-add your user permissions to sound devices run:
   su -c "setfacl -m u:${USER}:rw /dev/snd/*"


If you have an Intel HDA card, try

   If you hear a clicking noise, see this link: https://fedoraproject.org/wiki/Common_F12_bugs#hda-clicks
   Disable power management for audio by running this as one long line, and then reload the module, or reboot.  This may reduce the amount of popping noises.  (This will ask for root's password.)
   su -c 'echo "options snd_hda_intel power_save=0" > /etc/modprobe.d/snd_hda_intel.conf';
   su -c 'echo 0 > /sys/module/snd_hda_intel/parameters/power_save';
   Reboot to Test and verify if the problem is resolved.
   If you still have problems with sound, read http://www.mjmwired.net/kernel/Documentation/sound/alsa/HD-Audio-Models.txt and find your specific module option.  You might be able to find the correct section by running "cat /proc/asound/cards" and looking for matching headers on mjmwired's site  (Ex: STAC92xx).  Replace the '<MODEL>' item below with the model found in the link:
   su -c 'echo "options snd_hda_intel model=<MODEL>" >> /etc/modprobe.d/snd_hda_intel.conf'
   Example output for an HP laptop that previously had problems:
   # cat /etc/modprobe.d/snd_hda_intel.conf
   options snd-hda-intel model=hp
   options snd_hda_intel power_save=0
   options snd-hda-intel enable_msi=1
   options snd-hda-intel single_cmd=1
   Reboot to Test and verify if the problem is resolved.
   If problem persists, Install reporting tool:
   su -c 'yum install alsa-utils; alsa-info'
   'File a bug report under "Fedora" and "Alsa-lib" to explain the problems you were having and attach the output of alsa-info: https://fedoraproject.org/wiki/How_to_debug_PulseAudio_problems   and   https://bugzilla.redhat.com/


To remove PulseAudio from being used by default:

   Remove the plugin that calls PulseAudio:
   su -c "yum remove alsa-plugins-pulseaudio"
   Apply the changes:
   From the System menu bar, Select logout.  Log back in to apply the changes above.
   'File a bug report under "Fedora" and "PulseAudio" to explain the problems you were having and attach the output of alsa-info: https://fedoraproject.org/wiki/How_to_debug_PulseAudio_problems and https://bugzilla.redhat.com/



If you are running Fedora under VMWare, and it reports unable to open /dev/dsp (starts with sound disconnected):

   Install pulseaudio-utils and run vmware under padsp to provide backward compatability:
   su -c "yum install pulseaudio-utils" ;
   padsp vmware


If you are experiencing problems with Firefox + Adobe Flash:

   If you are not using the Fedora provided version of Firefox, see: https://fedoraproject.org/wiki/Common_F12_bugs#Non-Fedora_Mozilla.2FFirefox_binaries_may_crash
   If step 1 does not solve it, try:
   LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so firefox


To really remove PulseAudio for some reason:

   See https://fedoraproject.org/wiki/How_to_debug_PulseAudio_problems
   Remove PulseAudio and all of it's dependencies:
   su -c "yum remove alsa-plugins-pulseaudio pulseaudio padevchooser pavumeter paprefs pavucontrol"
   Create a file ~/.asoundrc with these contents:
   # For details, see http://www.alsa-project.org/main/index.php/Asoundrc
   pcm.!default {
           type plug
           slave.pcm "dmixer"
   }
   # cat /proc/asound/cards to see which hardware device
   pcm.dmixer  {
           type dmix
           ipc_key 1024
           slave {
                   pcm "hw:0,0"
                   period_time 0
                   period_size 1024
                   buffer_size 4096
                   rate 44100
           }
           bindings {
                   0 0
                   1 1
           }
   }
   ctl.dmixer {
           type hw
           card 0
   }
   Logout or reboot.
   File a bug report under "Fedora 12" and "PulseAudio" to explain the problems you were having and how this helped: https://bugzilla.redhat.com/ 


The volume goes down to 0 while playing different applications:

   Disable volume adjustment
   echo "flat-volumes = no" >> /etc/pulse/daemon.conf


There are known conflicts with kernel-2.6.27.9-159.fc10 and Intel Audio cards.

   To see if this includes you run the following:
   uname -r ;
   lspci |grep Audio ;
   lsmod |grep snd_hda_intel
   If it does match, update and reboot your system:
   su -c "yum update" ;
   shutdown -r now
   (At this time, kernel-2.6.27.12-170.2.5.fc10 is current, and has this problem resolved.)

More Information Any additional information or notes.

   If you are unsure how to test audio, run "cat /dev/urandom > /dev/dsp" and press Ctrl-C to stop.  You should hear noise/static if it is working.
   If the problem you are having is with Flash, See http://fedorasolved.org/browser-solutions/flash
   If you are attempting to play audio from MP3 or other sources, first add rpmfusion ( http://fedorasolved.org/post-install-solutions/yum-config ), then try "yum install audacious-plugins* gstreamer-plugins* gstreamer-ffmpeg xine* mplayer* vlc* --exclude=*-devel".  KDE users may also need "yum install phonon-backend*". Logout/Login may be required.  You can instead use "yum install @sound-and-video" if you want the complete set.
   If you are still having problems, consult this page to see if there is a work-around for your card:  http://pulseaudio.org/wiki/BrokenSoundDrivers
   Possible work-around for choppy audio while using Adobe Flash: http://k001.livejournal.com/791690.html  (Ref: https://bugzilla.redhat.com/show_bug.cgi?id=638477 and https://bugs.adobe.com/jira/browse/FP-5739 )


Disclaimer

We test this stuff on our own machines, really we do. But you may run into problems, if you do, come to #fedora on irc.freenode.net Added Reading

   http://www.pulseaudio.org/wiki/PerfectSetup
   http://forums.fedoraforum.org/showthread.php?t=206868
   http://www.harald-hoyer.de/linux/pulseaudio-and-jackd
   http://www.fedorafaq.org/#sound-pops
   http://pulseaudio.org/wiki/BrokenSoundDrivers
   http://www.mjmwired.net/kernel/Documentation/sound/alsa/HD-Audio-Models.txt
   http://fedoraproject.org/wiki/Test_Day:2008-10-09
   http://www.alsa-project.org/main/index.php/Asoundrc
   http://www.pulseaudio.org/wiki/SystemWideInstance
   https://fedoraproject.org/wiki/How_to_debug_PulseAudio_problems