PulseAudio: Difference between revisions

imported>Artturin
No edit summary
imported>Flexagoon
No edit summary
Line 15: Line 15:
</syntaxHighlight>
</syntaxHighlight>


==Troubleshooting PulseAudio==
==Explicit PulseAudio support in applications==
Normally, the system-wide ALSA configuration (<tt>/etc/asound.conf</tt>) redirects the audio of applications which use the ALSA API through PulseAudio. For this reason, most applications do not need to be PulseAudio-aware. Some NixOS packages can be built with explicit PulseAudio support which is disabled by default. This support can be enabled in all applicable packages by setting:
 
<syntaxHighlight lang="nix">
nixpkgs.config.pulseaudio = true;
</syntaxHighlight>
 
== Using Pulseaudio Equalizer ==
Currently (2017-11-29 {{issue|8384}}) the <code>qpaeq</code> command does not work out of the box, use the following commands to get it running:
 
<syntaxHighlight lang=console>
$ pactl load-module module-equalizer-sink
$ pactl load-module module-dbus-protocol
$ nix-shell -p python27Full python27Packages.pyqt4 python27Packages.dbus-python --command qpaeq
</syntaxHighlight>
 
== Troubleshooting ==
=== General troubleshooting ===
Before troubleshooting PulseAudio, determine that the kernel-level sound APIs (ALSA) are functional; see [[ALSA]].
Before troubleshooting PulseAudio, determine that the kernel-level sound APIs (ALSA) are functional; see [[ALSA]].


Line 47: Line 64:
(The problem is that also also tries to connect to the card that is already used by pulseaudio, so we need a module pulseaudio-alsa on pulseaudio to redirect also calls to pulseaudio)
(The problem is that also also tries to connect to the card that is already used by pulseaudio, so we need a module pulseaudio-alsa on pulseaudio to redirect also calls to pulseaudio)


==Explicit PulseAudio support in applications==
=== Clicking and Garbled Audio ===
Normally, the system-wide ALSA configuration (<tt>/etc/asound.conf</tt>) redirects the audio of applications which use the ALSA API through PulseAudio. For this reason, most applications do not need to be PulseAudio-aware. Some NixOS packages can be built with explicit PulseAudio support which is disabled by default. This support can be enabled in all applicable packages by setting:
The newer implementation of the PulseAudio sound server uses timer-based audio scheduling instead of the traditional, interrupt-driven approach.
 
<syntaxHighlight lang="nix">
nixpkgs.config.pulseaudio = true;
</syntaxHighlight>


== Using Pulseaudio Equalizer ==
Timer-based scheduling may expose issues in some ALSA drivers. On the other hand, other drivers might be glitchy without it on, so check to see what works on your system.
Currently (2017-11-29 {{issue|8384}}) the <code>qpaeq</code> command does not work out of the box, use the following commands to get it running:
 
<syntaxHighlight lang=console>
$ pactl load-module module-equalizer-sink
$ pactl load-module module-dbus-protocol
$ nix-shell -p python27Full python27Packages.pyqt4 python27Packages.dbus-python --command qpaeq
</syntaxHighlight>


== Clicking and Garbled Audio for Creative Sound Cards ==
To turn timer-based scheduling off add this to your configuration:
If you own a sound card from Creative like X-Fi and you notice random clicks during audio playback, then add following to your configuration [https://github.com/NixOS/nixpkgs/issues/788#issuecomment-21707426]:
<syntaxHighlight lang="nix">
<syntaxHighlight lang="nix">
  hardware.pulseaudio.configFile = pkgs.runCommand "default.pa" {} ''
hardware.pulseaudio.configFile = pkgs.runCommand "default.pa" {} ''
    sed 's/module-udev-detect$/module-udev-detect tsched=0/' \
  sed 's/module-udev-detect$/module-udev-detect tsched=0/' \
      ${pkgs.pulseaudio}/etc/pulse/default.pa > $out
    ${pkgs.pulseaudio}/etc/pulse/default.pa > $out
  '';
'';
</syntaxHighlight>
</syntaxHighlight>
Then perform <code># nixos-rebuild switch</code>, followed by <code>$ pulseaudio -k</code>.
Then perform <code># nixos-rebuild switch</code>, followed by <code>$ pulseaudio -k</code>.


The difference should be directly noticeable. This is a known issue related to quality of Creative driver [https://guh.me/solving-creative-sound-blaster-x-fi-titanium-crackling-slash-distortion-on-linux].
The difference should be directly noticeable. This is a known issue related to quality of Creative driver [https://guh.me/solving-creative-sound-blaster-x-fi-titanium-crackling-slash-distortion-on-linux], but it can also happen with other sound cards.


==See also==
==See also==