Difference between revisions of "PulseAudio"

From ArchWiki
Jump to: navigation, search
(13 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
[[fr:PulseAudio]]
 
[[fr:PulseAudio]]
  
'''PulseAudio''' is a general purpose sound server. For a list of features, see [[Wikipedia:PulseAudio#Features]].
+
{{Article summary start}}
 
+
{{Article summary text|'''PulseAudio''' is a general purpose sound server. For a list of features, see [[Wikipedia:PulseAudio#Features]].}}
{{Tip|If you want to play sound from multiple applications, [[ALSA]] already provides a basic software mixer named "dmix" which is enabled by default.}}
+
{{Article summary heading|Related Articles}}
 +
{{Article summary wiki|PulseAudio_Examples}}
 +
{{Article summary end}}
  
 
==Installation==
 
==Installation==
You can [[pacman|install]] PulseAudio with package {{Pkg|pulseaudio}}, available from the [[official repositories]].
+
*Required PKG:  {{Pkg|pulseaudio}}
 
+
*Optional GUIs: {{Pkg|paprefs}} and {{Pkg|pavucontrol}}
Optionally you can install some GTK front-ends for PulseAudio (packages {{Pkg|paprefs}} {{Pkg|pavucontrol}}).
+
*Optional volume control via mapped keyboard keys: {{AUR|pulseaudio_ctl}}
 +
*Optional console mixer:  {{AUR|pamixer-git}}
  
 
==Running==
 
==Running==
If the D-Bus system daemon is not already running, start it:
+
{{Note|Pulseaudio requires dbus to function.  This is very likely already added in the daemons array, if not consider adding it.}}
 +
{{Note|Most X11 environments start pulseaudio automatically with the X11 session.}}
  
# rc.d start dbus
+
In the unlikely event that pulseaudio isn't automatically called upon entering X, it can can be started with:
 
+
PulseAudio can be started with:
+
 
  $ pulseaudio --start
 
  $ pulseaudio --start
 
Or if you use X11:
 
$ start-pulseaudio-x11
 
 
If you use KDE 4:
 
$ start-pulseaudio-x11; start-pulseaudio-kde
 
  
 
PulseAudio can be stopped with:
 
PulseAudio can be stopped with:
 
  $ pulseaudio --kill
 
  $ pulseaudio --kill
 
Note that in the case of most X11 environments, PulseAudio will be automatically started together with the X11 session. See the section on Desktop Environments for details.
 
  
 
==Backend Configuration==
 
==Backend Configuration==
 
===ALSA===
 
===ALSA===
For the applications that do not support PulseAudio and support ALSA it is '''recommended''' to install the PulseAudio plugin for ALSA. The simplest way of doing this is installing the {{Pkg|pulseaudio-alsa}} package.
+
*Recommended PKG: {{Pkg|pulseaudio-alsa}}
 +
*Optional PKGs: {{Pkg|lib32-libpulse}} and {{Pkg|lib32-alsa-plugins}}
  
This package also contains the necessary {{ic|/etc/asound.conf}} for configuring ALSA to use PulseAudio.
+
{{Note|Optional PKGs are needed only if running x86_64 and wanting to have sound for 32 bit programs (like Wine).}}
  
If you are on Arch x86_64 and want to have sound for 32 bit programs (like Wine), make sure to install {{Pkg|lib32-libpulse}} and {{Pkg|lib32-alsa-plugins}} as well.
+
For the applications that do not support PulseAudio and support ALSA it is '''recommended''' to install the PulseAudio plugin for ALSA.  This package also contains the necessary {{ic|/etc/asound.conf}} for configuring ALSA to use PulseAudio.
  
To prevent applications from using ALSA's OSS emulation and bypassing Pulseaudio (thereby preventing other applications from playing sound), make sure the module {{ic|snd_pcm_oss}} is not in the {{ic|MODULES}} array in {{ic|/etc/[[rc.conf]]}}. If it's currently loaded you can disable it by executing:
+
To prevent applications from using ALSA's OSS emulation and bypassing Pulseaudio (thereby preventing other applications from playing sound), make sure the module {{ic|snd_pcm_oss}} is not in the {{ic|MODULES}} array in {{ic|/etc/[[rc.conf]]}}. If it's currently loaded, disable it by executing:
 
  # rmmod snd_pcm_oss
 
  # rmmod snd_pcm_oss
  
Line 46: Line 41:
  
 
====osspd====
 
====osspd====
This is the simplest method.
+
Recommended PKG:  {{Pkg|ossp}}
  
Install '''ossp''' and start oospd with:
+
Start oospd with:
 
  rc.d start osspd
 
  rc.d start osspd
  
Line 54: Line 49:
  
 
====padsp wrapper====
 
====padsp wrapper====
If you have a program that uses OSS you can make it work with PulseAudio by starting it with padsp:
+
Programs using OSS can work with PulseAudio by starting it with padsp:
 +
 
 
  $ padsp OSSprogram
 
  $ padsp OSSprogram
 
A few examples:
 
A few examples:
Line 60: Line 56:
 
  $ padsp sox foo.wav -t ossdsp /dev/dsp
 
  $ padsp sox foo.wav -t ossdsp /dev/dsp
  
If you prefer you can rename the program OSSprogram-bin and replace it with a script like this:   
+
One can also rename the program OSSprogram-bin and replace it with a script like this:   
 
{{hc|/usr/bin/OSSProgram|<nowiki>
 
{{hc|/usr/bin/OSSProgram|<nowiki>
 
#!/bin/sh
 
#!/bin/sh
Line 84: Line 80:
 
Edit the libao configuration file:
 
Edit the libao configuration file:
 
{{hc|/etc/libao.conf|2=default_driver=pulse}}
 
{{hc|/etc/libao.conf|2=default_driver=pulse}}
 
===PortAudio===
 
{{Out of date}}
 
 
The current binary of PortAudio in the community repository does not support PulseAudio and non-mmap audio devices. This can be remedied by building PortAudio from ABS and applying [https://bitbucket.org/byronclark/archlinux/src/43996780d71d/modified/portaudio/portaudio-19-alsa_pulse.patch a patch] to the sources.
 
There is an [http://aur.archlinux.org/packages.php?ID=51583 AUR]{{Linkrot|2012|01|31}} package for portaudio with pulse support.
 
  
 
===ESD===
 
===ESD===
Line 96: Line 86:
 
==Desktop Environments==
 
==Desktop Environments==
 
===General X11===
 
===General X11===
Start Pulseaudio after the X session using:
+
{{Note|As mentioned previously, PulseAudio is very likely launched automatically via either {{ic|/etc/X11/xinit/xinitrc.d/pulseaudio}} or the files in {{ic|/etc/xdg/autostart/}} if users have some DE installed.}}
$ start-pulseaudio-x11
+
  
This will start PulseAudio and load the X11 plugins.
+
Check to see of PulseAudio is running:
  
Note that PulseAudio may already launch automatically. This is handled by either {{ic|/etc/X11/xinit/xinitrc.d/pulseaudio}} or the files in {{ic|/etc/xdg/autostart/}}.
+
$ ps aux | grep pulse
 +
facade  1794  0.0  0.0 360464  6532 ?        S<l  15:33  0:00 /usr/bin/pulseaudio --start
 +
facade  1827  0.0  0.0  68888  2608 ?        S    15:33  0:00 /usr/lib/pulse/gconf-helper
  
====X11 bell====
+
If Pulseaudio isn't running and users are using X, the following will start PulseAudio with the needed the X11 plugins:
To make PulseAudio play a sample when an X11 bell event happens (e.g. to make your terminal go 'Ping!' instead of 'Beep!'), add the following to
+
  $ start-pulseaudio-x11
{{ic|/etc/pulse/default.pa}}:
+
  # Prevent pulseaudio --start from failing when following commands fail (eg. when X is not active)
+
.nofail
+
load-sample-lazy x11-bell /usr/share/sounds/freedesktop/stereo/dialog-error.oga
+
load-module module-x11-bell sample=x11-bell
+
.fail
+
 
+
You can also use another sample. {{ic|dialog-error.oga}} is provided by ''sound-theme-freedesktop''.
+
  
 
===GNOME===
 
===GNOME===
Line 118: Line 101:
  
 
===KDE 3===
 
===KDE 3===
PulseAudio is ''not'' a drop-in replacement for aRts. If you use KDE 3, it is not currently possible to use PulseAudio. However note, recent versions of puleaudio may have eliminated the prohibition:
+
PulseAudio is ''not'' a drop-in replacement for aRts. Users of KDE 3 cannot use PulseAudio. However note, recent versions of puleaudio may have eliminated the prohibition:
  
 
See: http://www.pulseaudio.org/wiki/PerfectSetup KDE 3 uses the artsd sound server by default. However, artsd itself can be configured to use an Esound backend. Edit kcmartsrc (either in /etc/kde or /usr/share/config for global configuration or .kde/share/config to configure only one user) like this:
 
See: http://www.pulseaudio.org/wiki/PerfectSetup KDE 3 uses the artsd sound server by default. However, artsd itself can be configured to use an Esound backend. Edit kcmartsrc (either in /etc/kde or /usr/share/config for global configuration or .kde/share/config to configure only one user) like this:
Line 128: Line 111:
  
 
===KDE 4 and Qt4===
 
===KDE 4 and Qt4===
If you've installed PulseAudio, it will be used by KDE4/Qt4 applications. For more information see the [http://www.pulseaudio.org/wiki/KDE KDE pages in the PulseAudio wiki].
+
PulseAudio, it will be used by KDE4/Qt4 applications. For more information see the [http://www.pulseaudio.org/wiki/KDE KDE pages in the PulseAudio wiki].
  
 
Additionally, a minimal KDE alternative to pavucontrol, the  {{AUR|kdeplasma-addons-applets-veromix}} is available in the AUR.
 
Additionally, a minimal KDE alternative to pavucontrol, the  {{AUR|kdeplasma-addons-applets-veromix}} is available in the AUR.
  
 
===XFCE4===
 
===XFCE4===
Applications running under XFCE4 can take advantage of Pulseaudio. To manage Pulseaudio settings you can use pavucontrol.
+
Applications running under XFCE4 can take advantage of Pulseaudio. To manage Pulseaudio settings can use {{Pkg|pavucontrol}}.
  
 
==Applications==
 
==Applications==
 
===Audacious===
 
===Audacious===
[[Audacious]] natively supports PulseAudio. In order to use it, in Audacious you should set Audacious Preferences -> Audio -> Current output plugin to 'PulseAudio Output Plugin'.
+
[[Audacious]] natively supports PulseAudio. In order to use it, set Audacious Preferences -> Audio -> Current output plugin to 'PulseAudio Output Plugin'.
  
 
===Flashplugin (x86_64 only)===
 
===Flashplugin (x86_64 only)===
If you are using [[Browser Plugins#Adobe Flash Player|Adobe Flash Player]] browser plugin from the [[Multilib_Project|multilib repository]] you need to install {{Pkg|lib32-alsa-plugins}} and {{Pkg|lib32-libcanberra-pulse}}, otherwise you will not be able to use other audio applications while using flashplugin.
+
Users of [[Browser Plugins#Adobe Flash Player|Adobe Flash Player]] browser plugin from the [[Multilib_Project|multilib repository]] need to install {{Pkg|lib32-alsa-plugins}} and {{Pkg|lib32-libcanberra-pulse}}.
  
 
===Java/OpenJDK 6===
 
===Java/OpenJDK 6===
Line 146: Line 129:
  
 
===Music Player Daemon (MPD)===
 
===Music Player Daemon (MPD)===
You will need to [http://mpd.wikia.com/wiki/PulseAudio configure] [[MPD]] to use PulseAudio.
+
[http://mpd.wikia.com/wiki/PulseAudio configure] [[MPD]] to use PulseAudio.
 
+
On a headless box, run PulseAudio as the ''mpd'' user.
+
On a desktop, running mpd as yourself and not using the ''mpd'' user is preferred.
+
  
 
===MPlayer===
 
===MPlayer===
Line 156: Line 136:
  
 
===Skype (x86_64 only)===
 
===Skype (x86_64 only)===
Install lib32-libpulse from [[Multilib_Project|multilib repository]], otherwise you will get the Error "Problem with Audio Playback" when trying to initiate a call.
+
Install {{Pkg|lib32-libpulse}}, otherwise the following error will occur when trying to initiate a call: "Problem with Audio Playback".
 
+
===VLC media player===
+
[[VLC]] supports PulseAudio through native plugin. In order to use it, in VLC you should open '''Tools -> Preferences''' (or Ctrl-P) and on '''Audio''' tab change '''Output Type''' to '''Pulseaudio audio output'''.
+
 
+
Also consider increasing '''Caching''' to 1000-1500 ms.: (This could solve some freezings/lags) change '''Show options''' to '''All''' and go to '''Input / Codecs -> Access Modules -> File'''
+
 
+
===volume control===
+
Adapt the variable 'device' to your sink-device listed in {{bc|pactl list}} and you can change the volume using this script.
+
{{bc|<nowiki>
+
#!/bin/bash
+
device="alsa_output.pci-0000_00_14.2.analog-stereo"
+
case "$1" in
+
"up")    # increase volume by 1000
+
pacmd dump | awk --non-decimal-data '$1~/set-sink-volume/{if ($2~/'${device}'/) {if ($3+1000 > 65535) {system ("pactl "$1" '${device}' "65535)} else {system ("pactl "$1" '${device}' "$3+1000)}}}'
+
;;
+
"down")  # decrease volume by 1000
+
pacmd dump | awk --non-decimal-data '$1~/set-sink-volume/{if ($2~/'${device}'/) {if ($3-1000 < 0) {system ("pactl "$1" '${device}' "0)} else {system ("pactl "$1" '${device}' "$3-1000)}}}'
+
;;
+
"mute")  # toggle mute
+
pacmd dump|awk --non-decimal-data '$1~/set-sink-mute/{if ($2~/'${device}'/) {system ("pactl "$1" '${device}' "($3=="yes"?"no":"yes"))}}'
+
;;
+
esac
+
</nowiki>}}
+
 
+
*There is also a amixer like commandline mixer avaible {{AUR|pamixer-git}}.
+
*For  those wanting to map keyboard keys (such as volume up, volume down, mute, etc.), {{AUR|pulseaudio_ctl}} allows for this behavior.
+
 
+
==Alternative configurations==
+
===Surround sound systems===
+
Many people have a surround card, but have speakers for just two channels, so PulseAudio cannot really default to a surround setup. To enable all the channels, edit {{ic|/etc/pulse/daemon.conf}}: uncomment the default-sample-channels line (i.e. remove the semicolon  from the beginning of the line) and set the value to '''6''' if you have a ''5.1'' setup, or '''8''' if you have ''7.1'' setup etc.
+
# Default
+
default-sample-channels=2
+
# For 5.1
+
default-sample-channels=6
+
# For 7.1
+
default-sample-channels=8
+
 
+
After doing the edit, you will need to restart Pulseaudio.
+
 
+
====Splitting front/rear====
+
You may want connect speakers to front analog output and headphones to rear output. It would be usefull to split front/rear to separate sinks. Add to default.pa:
+
 
+
  load-module module-remap-sink sink_name=speakers remix=no master=alsa_output.pci-0000_05_00.0.analog-surround-40 channels=2 master_channel_map=front-left,front-right channel_map=front-left,front-right
+
  load-module module-remap-sink sink_name=headphones remix=no master=alsa_output.pci-0000_05_00.0.analog-surround-40 channels=2 master_channel_map=rear-left,rear-right  channel_map=front-left,front-right
+
 
+
(replace alsa_output.pci-0000_05_00.0.analog-surround-40 to your sound card name that you got from 'pacmd list-sinks')
+
 
+
After that you can switch player between speakers and headphones.
+
 
+
====LFE remixing====
+
By default Pulseaudio remixes the number of channels to the default-sample-channels, however it dose not do this for the LFE channel. To enable LFE remixing uncomment the line:
+
 
+
; enable-lfe-remixing = no
+
 
+
and replace no with yes:
+
 
+
enable-lfe-remixing = yes
+
 
+
then restart Pulseaudio.
+
 
+
===Advanced ALSA Configuration===
+
In order for ALSA to use PulseAudio it needs a special {{ic|/etc/asound.conf}} (system wide settings) (recommended) or {{ic|~/.asoundrc}} (settings on a per user basis):
+
{{hc|/etc/asound.conf|<nowiki>
+
pcm.pulse {
+
    type pulse
+
}
+
ctl.pulse {
+
    type pulse
+
}
+
pcm.!default {
+
    type pulse
+
}
+
ctl.!default {
+
    type pulse
+
}
+
</nowiki>}}
+
 
+
If you omit the last two groups, Pulseaudio will not be used by default. You will then need to change the ALSA device to "pulse" in the applications that you use to make it work.
+
 
+
{{Note|You can also simply install the package 'pulseaudio-alsa'}}
+
 
+
====ALSA Monitor source====
+
To be able to record from a monitor source (a.k.a. "What-U-Hear", "Stereo Mix"), use {{ic|pactl list}} to find out the name of the source in Pulseaudio (e.g. {{ic|alsa_output.pci-0000_00_1b.0.analog-stereo.monitor}}). Then add lines like the following to {{ic|/etc/asound.conf}} or {{ic|~/.asoundrc}}:
+
pcm.pulse_monitor {
+
  type pulse
+
  device alsa_output.pci-0000_00_1b.0.analog-stereo.monitor
+
}
+
+
ctl.pulse_monitor {
+
  type pulse
+
  device alsa_output.pci-0000_00_1b.0.analog-stereo.monitor
+
}
+
 
+
Now you can select {{ic|pulse_monitor}} as a recording source.
+
 
+
Alternatively, you can use pavucontrol to do this : make sure you've set up the display to "All input Devices", then select "Monitor of [your soundcard]" as the recording source.
+
 
+
===HDMI output configuration===
+
As outlined in ftp://download.nvidia.com/XFree86/gpu-hdmi-audio-document/gpu-hdmi-audio.html#_issues_in_pulseaudio unless your hdmi port is the first
+
output you will not be able to have any audio when using certain graphics cards with hdmi audio support. This is because of a bug in pulseaudio where it will only select the first HDMI output on a device. A work around posted further down is to first find which hdmi output is working by using the aplay utility from alsa you will need to install the {{Pkg|alsa-utils}} package.
+
 
+
The original title for this section indicated the problem is specific to nVidia cards. As seen in [https://bbs.archlinux.org/viewtopic.php?id=133222 this forum thread] other cards are affected as well. The rest of the section will use an nVidia card as a case-study but the solution should carry over for people using other affected cards.
+
 
+
====Finding HDMI output====
+
Then find the working output by listing the available cards
+
# aplay -l
+
 
+
sample output:
+
  **** List of PLAYBACK Hardware Devices ****
+
  card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]
+
    Subdevices: 1/1
+
    Subdevice #0: subdevice #0
+
  card 0: NVidia [HDA NVidia], device 3: ALC1200 Digital [ALC1200 Digital]
+
    Subdevices: 1/1
+
    Subdevice #0: subdevice #0
+
  card 1: NVidia_1 [HDA NVidia], device 3: HDMI 0 [HDMI 0]
+
    Subdevices: 1/1
+
    Subdevice #0: subdevice #0
+
  card 1: NVidia_1 [HDA NVidia], device 7: HDMI 0 [HDMI 0]
+
    Subdevices: 0/1
+
    Subdevice #0: subdevice #0
+
  card 1: NVidia_1 [HDA NVidia], device 8: HDMI 0 [HDMI 0]
+
    Subdevices: 1/1
+
    Subdevice #0: subdevice #0
+
  card 1: NVidia_1 [HDA NVidia], device 9: HDMI 0 [HDMI 0]
+
    Subdevices: 1/1
+
    Subdevice #0: subdevice #0
+
 
+
====Testing for the correct card====
+
Now that you have a list of the detected cards you need to test for which one is outputing to the tv/monitor
+
# aplay -D plughw:1,3 /usr/share/sounds/alsa/Front_Right.wav
+
 
+
where 1 is the card and 3 is the device substitute in the values listed from the previous section. If there is no audio then try substituting a different device (on my card I had to use card 1 device 7)
+
 
+
====Manually configuring pulseaudio to detect the Nvidia HDMI====
+
Now that you know which HDMI device is working you can force pulseaudio to use it
+
 
+
Edit /etc/pulse/default.pa
+
add the follwing line to the file
+
# load-module module-alsa-sink device=hw:1,7
+
 
+
where the 1 is the card and the 7 is the deivce that you found to work in the previous section
+
 
+
restart pulse audio
+
# killall pulseaudio
+
 
+
open the sound settings manager, make sure that under the hardware tab the graphics cards HDMI audio is set to "Digital Stereo (HDMI) Output" ( My graphics card audio is called "GF100 High Definition Audio Controller"
+
 
+
Then open the output tab there should now be two HDMI outputs for the graphics card test which one works by selecting one of them and then using a program to play audio i.e use vlc to play a movie if it doesn't work the select the other.
+
 
+
===PulseAudio over network===
+
One of PulseAudio's magnificent features is the possibility to stream audio from clients over TCP to the server running the PulseAudio daemon, allowing sound to be streamed through your LAN.
+
 
+
To accomplish this, one needs to enable module-native-protocol-tcp, and copy the pulse-cookie to the clients.
+
 
+
====TCP support (networked sound)====
+
To enable the TCP module, add this to (or uncomment, if already there) {{ic|/etc/pulse/default.pa}}:
+
load-module module-native-protocol-tcp
+
 
+
Note: If you are having trouble connecting, use (on server)
+
pacmd>> list-modules
+
(you can even load modules from here!)
+
 
+
====TCP support with anonymous clients====
+
 
+
If you do not want to copy the pulse-cookies from clients, you can allow anonymous clients, by giving these parameters to module-native-protocol-tcp (again in {{ic|/etc/pulse/default.pa}}):
+
 
+
  load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;192.168.0.0/24 auth-anonymous=1
+
 
+
Remember to change your LAN ip prefix should it be different from 192.168.0.0.
+
 
+
====Zeroconf (Avahi) publishing====
+
For the remote Pulseaudio server to appear in the PulseAudio Device Chooser ({{ic|padevchooser}}) you need to load the appropriate zeroconf modules as well as to enable Avahi. On both machines add {{ic|avahi-daemon}} to the DAEMONS in rc.conf.
+
On the server, add {{ic|load-module module-zeroconf-publish}} to /etc/pulse/default.pa, on the client, add {{ic|load-module module-zeroconf-discover}} to /etc/pulse/default.pa. You can then redirect any stream or complete audio output to the remote pulseaudio server by selecting the appropriate sink.
+
 
+
====Switching the PulseAudio server used by local X clients====
+
To switch between servers on the client from within X, the {{ic|pax11publish}} command can be used.  For example, to switch from the default server to the server at hostname foo:
+
$ pax11publish -e -S foo
+
 
+
Or to switch back to the default:
+
$ pax11publish -e -r
+
 
+
Note that for the switch to become apparent, the programs using Pulse must be restarted.
+
 
+
====When everything else seems to fail====
+
The following is a quickfix and NOT a permanent solution
+
 
+
On the Server:
+
  $ paprefs
+
Go to Network Access -> Enable access to local sound devices (Also check both 'Allow discover' and 'Don't require authentication').
+
 
+
On the Client:
+
  $ export PULSE_SERVER=server.ip && mplayer test.mp3
+
 
+
===PulseAudio through JACK the new new way===
+
This configuration only works with jackdbus (JACK2 compiled with D-Bus support).
+
load-module module-jackdbus-detect
+
As described on the [http://trac.jackaudio.org/wiki/JackDbusPackaging Jack-DBUS Packaging] page:
+
 
+
''Server auto-launching is implemented as D-Bus call that auto-activates JACK D-Bus service, in case it is not already started, and starts the JACK server. Correct interaction with PulseAudio is done using a D-Bus based audio card "acquire/release" mechanism. When JACK server starts, it asks this D-Bus service to acquire the audio card and PulseAudio will unconditionally release it. When JACK server stops, it releases the audio card that can be grabbed again by PulseAudio.''
+
 
+
{{ic|module-jackdbus-detect.so}} dynamically loads and unloads module-jack-sink and module-jack-source when jackdbus is started and stopped.
+
 
+
If PulseAudio sound does not work, check with {{ic|pavucontrol}} to see if the relevant programs appear in the playback tab.  If not, add the following to {{ic|~/.asound.conf}} or {{ic|/etc/asound.conf}} to redirect ALSA to PulseAudio:
+
 
+
pcm.pulse {
+
    type pulse
+
}
+
+
ctl.pulse {
+
    type pulse
+
}
+
+
pcm.!default {
+
    type pulse
+
}
+
ctl.!default {
+
    type pulse
+
}
+
 
+
If it still doesn't work, check with {{ic|pavucontrol}} in the playback tab and make sure the relevant programs are outputting to PulseAudio JACK Sink instead of your audio card (which JACK has control of, so it won't work).
+
 
+
===PulseAudio through JACK the new way===
+
The basic idea is that killing PulseAudio is bad idea, it may crash any apps using PulseAudio, and disrupt any audio playing
+
 
+
the flow of how this setup works:
+
+
# PulseAudio releases the sound card
+
# JACK grabs sound card and starts up
+
# script redirects PulseAudio to JACK
+
# manually send PulseAudio apps to JACK output (pavucontrol may come in helpful for this)
+
# use JACK programs etc
+
# via script, stop redirecting PulseAudio to JACK
+
# stop JACK and release soundcard
+
# PulseAudio grabs sound card and reroutes audio to it directly
+
 
+
with QJackCTL setup these scripts:
+
 
+
{{ic|pulse-jack-pre-start.sh}} set it up as the execute script on startup script
+
#!/bin/bash
+
pacmd suspend true
+
 
+
{{ic|pulse-jack-post-start.sh}} set this one up as execute script after startup
+
#!/bin/bash
+
pactl load-module module-jack-sink channels=2
+
pactl load-module module-jack-source channels=2
+
pacmd set-default-sink jack_out
+
pacmd set-default-source jack_in
+
 
+
{{ic|pulse-jack-pre-stop.sh}} "execute script on shutdown"
+
#!/bin/bash
+
SINKID=$(pactl list | grep -B 1 "Name: module-jack-sink" | grep Module | sed 's/[^0-9]//g')
+
SOURCEID=$(pactl list | grep -B 1 "Name: module-jack-source" | grep Module | sed 's/[^0-9]//g')
+
pactl unload-module $SINKID
+
pactl unload-module $SOURCEID
+
sleep 5
+
 
+
{{ic|pulse-jack-post-stop.sh}} "execute script after shutdown"
+
#!/bin/bash
+
pacmd suspend false
+
 
+
===Pulseaudio through JACK the old way===
+
The JACK-Audio-Connection-Kit is popular for audio work, and is widely supported by Linux audio applications. It fills a similar niche as Pulseaudio, but with more of an emphasis on professional audio work. In particular, audio applications such as Ardour and Audacity (recently) work well with Jack.
+
 
+
Pulseaudio provides module-jack-source and module-jack-sink which allow Pulseaudio to be run as a sound server above the JACK daemon. This allows the usage of per-volume adjustments and the like for the apps which need it, play-back apps for movies and audio, while allowing low-latency and inter-app connectivity for sound-processing apps which connect to JACK. However, this will prevent Pulseaudio from directly writing to the sound card buffers, which will increase overall CPU usage.
+
 
+
To just try PA on top of jack you can have PA load the necessary modules on start:
+
pulseaudio -L module-jack-sink -L module-jack-source
+
 
+
To use pulseaudio with JACK, JACK must be started up before Pulseaudio, using whichever method you prefer. Pulseaudio then needs to be started loading the 2 relevant modules. Edit {{ic|/etc/pulse/default.pa}}, and change the following region:
+
### Load audio drivers statically (it is probably better to not load
+
### these drivers manually, but instead use module-hal-detect --
+
### see below -- for doing this automatically)
+
#load-module module-alsa-sink
+
#load-module module-alsa-source device=hw:1,0
+
#load-module module-oss device="/dev/dsp" sink_name=output source_name=input
+
#load-module module-oss-mmap device="/dev/dsp" sink_name=output source_name=input
+
#load-module module-null-sink
+
#load-module module-pipe-sink
+
+
### Automatically load driver modules depending on the hardware available
+
.ifexists module-udev-detect.so
+
load-module module-udev-detect
+
.else
+
### Alternatively use the static hardware detection module (for systems that
+
### lack udev support)
+
load-module module-detect
+
.endif
+
 
+
to the following:
+
### Load audio drivers statically (it is probably better to not load
+
### these drivers manually, but instead use module-hal-detect --
+
### see below -- for doing this automatically)
+
#load-module module-alsa-sink
+
#load-module module-alsa-source device=hw:1,0
+
#load-module module-oss device="/dev/dsp" sink_name=output source_name=input
+
#load-module module-oss-mmap device="/dev/dsp" sink_name=output source_name=input
+
#load-module module-null-sink
+
#load-module module-pipe-sink
+
load-module module-jack-source
+
load-module module-jack-sink
+
+
### Automatically load driver modules depending on the hardware available
+
#.ifexists module-udev-detect.so
+
#load-module module-udev-detect
+
#.else
+
### Alternatively use the static hardware detection module (for systems that
+
### lack udev support)
+
#load-module module-detect
+
#.endif
+
 
+
Basically, this prevents module-udev-detect from loading. module-udev-detect will always try to grab your sound-card (JACK has already done that, so this will cause an error). Also, the jack source and sink must be explicitly loaded.
+
 
+
====QjackCtl with Startup/Shutdown Scripts====
+
Using the settings listed above you can use QjackCtl to execute a script upon startup and shutdown to load/unload PulseAudio. Part of the reason you may wish to do this is that the above changes disable PulseAudio's automatic hardware detection modules. This particular setup is for using PulseAudio in an exclusive fashion with JACK, though the scripts could be modified to unload and load an alternate non-JACK setup, but killing and starting PulseAudio while programs might be using it would become problematic.
+
 
+
The following example could be used and modified as necessary as a startup script that daemonizes PulseAudio and loads the ''padevchooser'' program (optional, needs to be built from AUR) called {{ic|jack_startup}}:
+
#!/bin/bash
+
#Load PulseAudio and PulseAudio Device Chooser
+
+
pulseaudio -D
+
padevchooser&
+
 
+
as well as a shutdown script to kill PulseAudio and the Pulse Audio Device Chooser, as another example called {{ic|jack_shutdown}} also in the home directory:
+
#!/bin/bash
+
#Kill PulseAudio and PulseAudio Device Chooser
+
+
pulseaudio --kill
+
killall padevchooser
+
 
+
Both scripts need to be made executable:
+
chmod +x jack_startup jack_shutdown
+
 
+
then with QjackCtl loaded, click on the ''Setup'' button and then the ''Options'' tab and tick both "Execute Script after Startup:" And "Execute Script on Shutdown:" and put either use the ... button or type the path to the scripts (assuming the scripts are in the home directory) {{ic|~/jack_startup}} and {{ic|~/jack_shutdown}} making sure to save the changes you have made.
+
 
+
===Pulseaudio through OSS===
+
Add the following to {{ic|/etc/pulse/default.pa}}:
+
  load-module module-oss
+
 
+
Then start Pulseaudio as usual. You should have sinks and sources for your OSS devices.
+
 
+
===Pulseaudio from within a chroot (ex. 32-bit chroot in 64-bit install)===
+
Since a chroot sets up an alternative root for the running/jailing of applications, pulseaudio must be installed within the chroot itself ({{ic|pacman -S pulseaudio}} within the chroot environment).
+
 
+
Pulseaudio, if not set up to connect to any specific server (this can be done in {{ic|/etc/pulse/client.conf}}, through the PULSE_SERVER environment variable, or through publishing to the local X11 properties using module-x11-publish), will attempt to connect to the local pulse server, failing which it will spawn a new pulse server. Each pulse server has a unique ID based on the machine-id value in {{ic|/var/lib/dbus}}. To allow for chrooted apps to access the pulse server, the following directories must be mounted within the chroot:-
+
/var/run
+
/var/lib/dbus
+
/tmp
+
~/.pulse
+
 
+
{{ic|/dev/shm}} should also be mounted for efficiency and good performance. Note that mounting /home would normally also allow sharing of the {{ic|~/.pulse}} folder.
+
 
+
For specific direction on accomplishing the appropriate mounts, please refer to the wiki on installing a bundled 32-bit system, especially the [http://wiki.archlinux.org/index.php?title=Arch64_Install_bundled_32bit_system#Additional_mount_option_to_allow_32-bit_apps_to_access_the_64-bit_Pulseaudio_server additional section] specific to Pulseaudio.
+
 
+
===Simultaneous Digital and Analog Output===
+
As an example situation: you want to listen to music at your desktop, using the regular 3.5mm analog outputs into your desktop PC speakers. You also want to feed the same music to your hi-fi system in another room via your sound card's digital output. You would think this would be a simple matter, but for many sound chipsets, it requires some editing to get it set up since the default Pulseaudio profiles allow you to use either analog or digital, but not both simultaneously.
+
 
+
The solution is as follows (with thanks for some useful pointers from: http://superuser.com/questions/267442/how-to-get-simultaneous-sound-from-pulseadio-on-two-outputs-analog-and-digital). Amarok is used in this example.
+
 
+
* Install "pavucontrol" (pacman -S pavucontrol). You ''won't'' be needing the other useful pulse configuration utility "paprefs" for this task.
+
* In a terminal, launch "pacmd" - a command line utility for loading pulse modules
+
* Enter the following commands in pacmd in this order (where your numbers for "hw:0,0" are determined by entering "aplay -l" in terminal. One number is the hardware ID for the analog device, the other for the digital):
+
  load-module module-alsa-sink device="hw:0,0" sink_name=analog_output
+
  load-module module-alsa-sink device="hw:0,1" sink_name=digital_output
+
  load-module module-combine sink_name=analog_digital slaves=digital_output,analog_output
+
 
+
* Open "pavucontrol" from a terminal
+
* Under pavucontrol's "Playback Tab", for the running app Amarok, select "Simultaneous output to Internal Audio, Internal Audio" (you will need to have Amarok playing something to test this)
+
* Under the "Configuration Tab" Select "Digital Stereo Duplex (IEC958)" for "Internal Audio" (your exact names may vary here, according to how ALSA has named your hardware). You should now be able to hear Amarok playing on both your analog and digital outputs!
+
 
+
The above solution only holds to long as you have pacmd running, and is specific for the running app (in the above example, Amarok).
+
 
+
To set the the sinks up every reboot and for all audio apps, add the above load-module commands to your '''/etc/pulse/default.pa''' file. You may need to add them at the start of the file, just above line "### Automatically restore the volume of streams and devices", or it may not work as expected.
+
 
+
Finally, use the Gnome 3 sound preferences to set your system's default "Output" to "Simultaneous output to Internal Audio, Internal Audio".
+
 
+
===System-wide Equalizer===
+
Pulseaudio can be configured to sound much better through the use of a system-wide equalizer. There are a few tools to do this. Extra information on the cons of each [http://ubuntuforums.org/showthread.php?t=1378087 here] . Individual apps can be excluded via {{Ic|pavucontrol}} .
+
 
+
====pulseaudio-equalizer====
+
A simple, user-friendly gtk tool which you can grab from the AUR [https://aur.archlinux.org/packages.php?ID=48316 here].
+
 
+
{{Note| If you remove pulseaudio-equalizer, you should comment out the respective generated section in {{Ic| $HOME/.pulse/default.pa}} or you may have strange issues.}}
+
{{Note|If you have trouble with the volume resetting to the maximum level or making harsh noise upon switching sound sources, do [https://wiki.archlinux.org/index.php/Pulseaudio#Volume_gets_louder_every_time_a_new_application_is_started this] and then find the "Equalized audio configuration" section in {{Ic| $HOME/.pulse/default.pa}} and comment out only the "set-sink-volume" line there.}}
+
 
+
====qpaeq====
+
A simple qt tool that comes with pulseaudio and includes support for more bands than pulseaudio-equalizer (just resize the window horizontally), but presently lacks easily accessible presets and may need to be set as the default manually. Located at {{Ic|/usr/bin/qpaeq}} and requires {{Ic|python2-pyqt}} to run.
+
 
+
{{Note| If qpaeq crashes at startup, be sure you have {{Ic|load-module module-equalizer-sink}} in {{Ic|/etc/pulse/default.pa}} or {{Ic|$HOME/.pulse/default.pa}} }}
+
 
+
{{Note| If the equalizer has no effect (e.g., setting the ''qpaeq'' preamp bar to zero doesn't mute all sound), you may need to link your applications' audio sinks to the equalizer. Do this by adding the line {{Ic|set-default-sink equalized}} to {{Ic|/etc/pulse/default.pa}} or {{Ic|$HOME/.pulse/default.pa}}.}}
+
  
 
==Troubleshooting==
 
==Troubleshooting==
Line 555: Line 144:
  
 
====Flash Content====
 
====Flash Content====
If after installing pulseaudio you get no sound from flash content, you can try installing {{AUR|libflashsupport-pulse}} from the AUR. You can also try lib32-libpulse if on a 64-bit Arch and using [multilib]'s flashplugin:
+
No sound from flash content may be fixed by installing {{AUR|libflashsupport-pulse}} from the AUR. {{Pkg|lib32-libpulse}} is another PKG users can consider if on a 64-bit Arch and using [multilib]'s flashplugin:
  
 
  # pacman -S lib32-libcanberra-pulse lib32-alsa-plugins
 
  # pacman -S lib32-libcanberra-pulse lib32-alsa-plugins

Revision as of 21:23, 9 February 2012

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.


Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어


External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

Template:Article summary start

Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary end

Installation

Running

Note: Pulseaudio requires dbus to function. This is very likely already added in the daemons array, if not consider adding it.
Note: Most X11 environments start pulseaudio automatically with the X11 session.

In the unlikely event that pulseaudio isn't automatically called upon entering X, it can can be started with:

$ pulseaudio --start

PulseAudio can be stopped with:

$ pulseaudio --kill

Backend Configuration

ALSA

Note: Optional PKGs are needed only if running x86_64 and wanting to have sound for 32 bit programs (like Wine).

For the applications that do not support PulseAudio and support ALSA it is recommended to install the PulseAudio plugin for ALSA. This package also contains the necessary /etc/asound.conf for configuring ALSA to use PulseAudio.

To prevent applications from using ALSA's OSS emulation and bypassing Pulseaudio (thereby preventing other applications from playing sound), make sure the module snd_pcm_oss is not in the MODULES array in /etc/rc.conf. If it's currently loaded, disable it by executing:

# rmmod snd_pcm_oss

OSS

There are multiple ways of making OSS-only programs play to PulseAudio:

osspd

Recommended PKG: ossp

Start oospd with:

rc.d start osspd

Afterwards, add it to DAEMONS in rc.conf.

padsp wrapper

Programs using OSS can work with PulseAudio by starting it with padsp:

$ padsp OSSprogram

A few examples:

$ padsp aumix
$ padsp sox foo.wav -t ossdsp /dev/dsp

One can also rename the program OSSprogram-bin and replace it with a script like this:

/usr/bin/OSSProgram
#!/bin/sh
if test -x /usr/bin/padsp; then
    exec /usr/bin/padsp /usr/bin/OSSprogram-bin "$@"
else
    exec /usr/bin/OSSprogram "$@"
fi

GStreamer

To make GStreamer use PulseAudio, execute gstreamer-properties (part of gnome-media package) and select PulseAudio Sound Server in both Audio Input and Output. Alternatively, this can be done by setting the gconf variables /system/gstreamer/0.10/default/audiosink to pulsesink and /system/gstreamer/0.10/default/audiosrc to pulsesrc:

 $ gconftool-2 -t string --set /system/gstreamer/0.10/default/audiosink pulsesink
 $ gconftool-2 -t string --set /system/gstreamer/0.10/default/audiosrc pulsesrc

Some applications (like Rhythmbox) ignore the audiosink property, but rely instead on musicaudiosink, which can't be configured using gstreamer-properties but needs to be manually set using gconf-editor or the gconftool-2:

 $ gconftool-2 -t string --set /system/gstreamer/0.10/default/musicaudiosink pulsesink

OpenAL

OpenAL Soft should use PulseAudio by default, but can be explicitly configured to do so:
/etc/openal/alsoft.conf
drivers=pulse,alsa

libao

Edit the libao configuration file:

/etc/libao.conf
default_driver=pulse

ESD

PulseAudio is a drop-in replacement for the enlightened sound daemon (ESD). While PulseAudio is running, ESD clients should be able to output to it without configuration.

Desktop Environments

General X11

Note: As mentioned previously, PulseAudio is very likely launched automatically via either /etc/X11/xinit/xinitrc.d/pulseaudio or the files in /etc/xdg/autostart/ if users have some DE installed.

Check to see of PulseAudio is running:

$ ps aux | grep pulse
facade   1794  0.0  0.0 360464  6532 ?        S<l  15:33   0:00 /usr/bin/pulseaudio --start
facade   1827  0.0  0.0  68888  2608 ?        S    15:33   0:00 /usr/lib/pulse/gconf-helper

If Pulseaudio isn't running and users are using X, the following will start PulseAudio with the needed the X11 plugins:

$ start-pulseaudio-x11

GNOME

As of GNOME 3, GNOME fully integrates with PulseAudio and no extra configuration is needed.

KDE 3

PulseAudio is not a drop-in replacement for aRts. Users of KDE 3 cannot use PulseAudio. However note, recent versions of puleaudio may have eliminated the prohibition:

See: http://www.pulseaudio.org/wiki/PerfectSetup KDE 3 uses the artsd sound server by default. However, artsd itself can be configured to use an Esound backend. Edit kcmartsrc (either in /etc/kde or /usr/share/config for global configuration or .kde/share/config to configure only one user) like this:

[Arts]
Arguments=\s-F 10 -S 4096 -a esd -n -s 1 -m artsmessage -c drkonqi -l 3 -f
NetworkTransparent=true
SuspendTime=1

KDE 4 and Qt4

PulseAudio, it will be used by KDE4/Qt4 applications. For more information see the KDE pages in the PulseAudio wiki.

Additionally, a minimal KDE alternative to pavucontrol, the kdeplasma-addons-applets-veromixAUR is available in the AUR.

XFCE4

Applications running under XFCE4 can take advantage of Pulseaudio. To manage Pulseaudio settings can use pavucontrol.

Applications

Audacious

Audacious natively supports PulseAudio. In order to use it, set Audacious Preferences -> Audio -> Current output plugin to 'PulseAudio Output Plugin'.

Flashplugin (x86_64 only)

Users of Adobe Flash Player browser plugin from the multilib repository need to install lib32-alsa-plugins and lib32-libcanberra-pulse.

Java/OpenJDK 6

Create a wrapper for the java executable using padsp as seen on the Java sound with Pulseaudio page.

Music Player Daemon (MPD)

configure MPD to use PulseAudio.

MPlayer

MPlayer natively supports PulseAudio output with the "-ao pulse" option. It can also be configured to default to PulseAudio output, in ~/.mplayer/config for per-user, or /etc/mplayer/mplayer.conf for system-wide:

/etc/mplayer/mplayer.conf
ao=pulse

Skype (x86_64 only)

Install lib32-libpulse, otherwise the following error will occur when trying to initiate a call: "Problem with Audio Playback".

Troubleshooting

No sound after install

Bad configuration files

If after starting pulseaudio your system outputs no sound, it may be necessary to delete the contents of ~/.pulse. Pulseaudio will automatically create new configuration files on its next start.

Flash Content

No sound from flash content may be fixed by installing libflashsupport-pulseAUR from the AUR. lib32-libpulse is another PKG users can consider if on a 64-bit Arch and using [multilib]'s flashplugin:

# pacman -S lib32-libcanberra-pulse lib32-alsa-plugins

No cards

If PulseAudio starts, run pacmd list. If no cards are reported, make sure that your ALSA devices are not in use:

$ fuser -v /dev/snd/*
$ fuser -v /dev/dsp

Make sure any applications using the pcm or dsp files are shut down before restarting PulseAudio.

The only device shown is "dummy output"

This may be caused by different reasons, one of them being the .asoundrc file in your home taking precedence over the systemwide /etc/asound.conf.

The user file is modified also by the tool asoundconf or by its graphical variant asoundconf-gtk (the latter is named "Default sound card" in the menu) as soon as you run it. You can prevent the effects of .asoundrc altogether by commenting the last line like this:

#</home/<yourusername>/.asoundrc.asoundconf>

KDE4

It may be that you have another output device set as preferred in phonon. Make sure that every setting has your preferred output device at the top, and check the playback streams tab in kmix to make sure that applications are using the device for output.

Muted audio device

If you experience no audio output via any means while using ALSA as your default device, you may have to unmute your sound card. To do this, you will want to launch alsamixer and make sure each column has a green 00 under it (this can be toggled by pressing 'm')

$ alsamixer -c 0

Bluetooth headset replay problems

Some user report huge delays or even no sound when the bluetooth connection does not send any data. This is due to an idle-suspend-module that puts the related sinks/sources automatically into suspend. As this can cause problems with headset, the responsible module can be deactivated.

1. cp /etc/pulse/default.pa ~/.pulse/default.pa
2. comment out the "load-module module-suspend-on-idle" line in ~/.pulse/default.pa
3. pulseaudio -k && pulseaudio --start

More information

Pulse overwrites ALSA settings

Pulseaudio usually overwrites the ALSA settings- for example set with alsamixer- at start up, even when the alsa daemon is loaded. Since there seems to be no other way to restrict this behaviour, a workaround is to restore the alsa settings again after pulseaudio had started. Add the following command to .xinitrc .bash_login or any other autostart file and adjust the sleep, depending how long pulse needs to start on your system.

(sleep 30 && alsactl -f /var/lib/alsa/asound.state restore) &

Daemon startup failed

Try resetting PulseAudio. To do that:

$ pulseaudio --kill
$ killall pulseaudio
$ killall -9 pulseaudio
$ rm -rf ~/.pulse*
$ rm -rf /tmp/pulse*

Afterwards, start PulseAudio again.

padevchooser

If you cannot launch the PulseAudio Device Chooser, first (re)start the Avahi daemon as follows:

$ rc.d restart avahi-daemon

Glitches, skips or crackling

The PulseAudio sound server uses a timer-based audio scheduling instead of the traditional interrupt-driven approach. Timer-based scheduling may expose issues in some ALSA drivers. To turn timer-based scheduling off, replace the line:

load-module module-udev-detect 

in /etc/pulse/default.pa by:

load-module module-udev-detect tsched=0

Then restart the PulseAudio server.

Choppy sound

Choppy sound in pulsaudio can result from wrong settings for the sample rate in /etc/pulse/daemon.conf. Try changing the line

; default-sample-rate = 44100

to

default-sample-rate = 48000

and restart the PulseAudio server.

If you experience choppy sound in applications using openAL, you should also change the sample rate in /etc/openal/alsoft.conf:

frequency = 48000

Volume adjustment doesn't work properly

You might want to check

/usr/share/pulseaudio/alsa-mixer/paths/analog-output.conf.common

If the volume does not appear to increment/decrement properly using alsamixer or amixer, it may be due to pulseaudio having a larger number of increments (65537 to be exact). Try using larger values when changing volume (e.g. amixer set Master 655+).

Volume gets louder every time a new application is started

Per default, it seems as if changing the volume in an application sets the global system volume to that level instead of only affecting the respective application. Applications setting their volume on startup will therefore cause the system volume to "jump". If you encounter this issue, you can fix it by uncommenting

flat-volumes = no

in

/etc/pulse/daemon.conf

and then restarting PulseAudio by executing

pulseaudio -k

When Pulse comes back after a few seconds, applications will not alter the global system volume anymore but have their own volume level again.

Note: If you've previously installed and removed pulseaudio-equalizer, remnants of it in $HOME/.pulse/default.pa can also cause maximized volume trouble. Comment that out as needed.

No mic on ThinkPad T400/T500

Run

alsamixer -c 0

and maximize the volume of/unmute the "Internal Mic". Please improve this documentation if you know the cause of this issue.

No mic input on Acer Aspire One

Install pavucontrol, unlink the microphone channels and turn down the left one to 0. You should now be able to use your microphone. Reference: http://getsatisfaction.com/jolicloud/topics/deaf_internal_mic_on_acer_aspire_one#reply_2108048

Sound output is only mono on M-Audio Audiophile 2496 sound card

Add the following to /etc/pulseaudio/default.pa:

load-module module-alsa-sink sink_name=delta_out device=hw:M2496 format=s24le channels=10 channel_map=left,right,aux0,aux1,aux2,aux3,aux4,aux5,aux6,aux7
load-module module-alsa-source source_name=delta_in device=hw:M2496 format=s24le channels=12 channel_map=left,right,aux0,aux1,aux2,aux3,aux4,aux5,aux6,aux7,aux8,aux9
set-default-sink delta_out
set-default-source delta_in

Static Noise in Microphone Recording

If we are getting static noise in skype, gnome-sound-recorder, arecord, etc.'s recordings then the sound card samplerate is incorrect. That's why there is static noise in linux microphone recordings. To fix this We need to set sample-rate in /etc/pulse/daemon.conf for the sound hardware.

1. Determine soundcards in the system

This requires alsa-utils and related packages to be installed:

$  arecord --list-devices

output:

   **** List of CAPTURE Hardware Devices ****
   card 0: Intel [HDA Intel], device 0: ALC888 Analog [ALC888 Analog]
     Subdevices: 1/1
     Subdevice #0: subdevice #0
   card 0: Intel [HDA Intel], device 2: ALC888 Analog [ALC888 Analog]
     Subdevices: 1/1
     Subdevice #0: subdevice #0

soundcard is hw:0,0

2. Determine sampling-rate of the sound card

arecord -f dat -r 60000 -D hw:0,0 -d 5 test.wav

output:

  "Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 60000 Hz, Stereo
  Warning: rate is not accurate (requested = 60000Hz, got = 96000Hz)
  please, try the plug plugin

observe, the got = 96000Hz, this is the max sample-rate of our card.

3. Setting the soundcard's sampling rate into pulse audio configuration

the default sample-rate in pulseaudio is

grep "sample-rate" /etc/pulse/daemon.conf

output:

   ; default-sample-rate = 44100

It is 44100 and is disabled. Let us set our sound card's settings into pulseaudio configuation file

su -c "sed 's/; default-sample-rate = 44100/default-sample-rate = 96000/g' -i /etc/pulse/daemon.conf"

Let's verify the changes to deamon.conf

grep "sample-rate" /etc/pulse/daemon.conf 

output:

  default-sample-rate = 96000

and it's done.

4. Restart pulseaudio to apply the new settings

pulseaudio --kill
pulseaudio --start

5. Finally check by recording and playing it back

Let's record some voice using mic for say 10 seconds. Make sure the mic is not muted and all

arecord -f cd -d 10 test-mic.wav

After 10 seconds, let's play the recording...

aplay test-mic.wav

Now hopefully, there's no static noise in microphone recording anymore.

My Bluetooth device is paired but doesn't play any sound

See the article in Bluetooth section

External links