Difference between revisions of "PulseAudio"
m |
m (→pipewire-pulse - No PulseAudio daemon on new distributions) |
||
Line 117: | Line 117: | ||
You can '''Remove Pipewire and switch back to PulseAudio''' | You can '''Remove Pipewire and switch back to PulseAudio''' | ||
− | * warning: this will probably break bluetooth audio | + | * warning: this will probably break bluetooth audio (possible fix below) |
sudo apt remove --purge pipewire pipewire-audio-client-libraries pipewire-pulse | sudo apt remove --purge pipewire pipewire-audio-client-libraries pipewire-pulse | ||
sudo apt autoremove --purge pipewire* | sudo apt autoremove --purge pipewire* | ||
Line 130: | Line 130: | ||
sudo apt update | sudo apt update | ||
sudo apt install pulseaudio pavucontrol paprefs | sudo apt install pulseaudio pavucontrol paprefs | ||
+ | |||
+ | Switching to PulseAudio breaks Bluetooth | ||
+ | sudo apt install libspa-0.2-bluetooth | ||
+ | sudo apt install pulseaudio pulseaudio-module-bluetooth | ||
+ | sudo vi /etc/pulse/default.pa | ||
+ | Then add the following lines in the bluetooth section (ref: [https://superuser.com/questions/1686238/cant-connect-to-bluetooth-in-linux Can't connect to Bluetooth in linux]) | ||
+ | load-module module-bluetooth-policy | ||
+ | load-module module-bluez5-device | ||
+ | load-module module-bluez5-discover | ||
+ | |||
+ | ''Final thoughts: Mint devs are switching from PulseAudio to PipeWire and have left a fake PulseAudio behind for compatibility, but they have not considered tools like paprefs (PulseAudio Preferences) for bridging output sinks as well as other impacted tools, software, and games. If PipeWire is better the change is warranted but only after tools are developed and included that fulfill all of these ancillary needs. You might want to think twice before going back to PulseAudio on a new distribution as it can get pretty involved depending on what you need.'' | ||
===Test Sound Utility: Stereo Separation Test=== | ===Test Sound Utility: Stereo Separation Test=== |
Revision as of 19:25, 6 December 2024
PulseAudio, previously known as Polypaudio, is a sound server for POSIX and WIN32 systems. It is a drop in replacement for the ESD sound server with much better latency, mixing/re-sampling quality and overall architecture. PulseAudio / Pulse Audio is a sound manager for ALSA on Linux, ALSA being the Advanced Linux Sound Architecture.
PulseAudio Volume Control (pavucontrol) is a simple GTK+ based volume control tool (mixer) for the PulseAudio sound server. In contrast to classic mixer tools this one allows you to control both the volume of hardware devices and of each playback stream separately. It also allows you to redirect a playback stream to another output device without interrupting playback.
2024 Update: Ubuntu / Mint is moving from PulseAudio server to PipeWire. Comments below. Compatibility problems introduced by this move include virtual audio sink aka bridge and bluetooth audio. Thanks for the problems devs!
pavucontrol
The volume control "configure" on Ubuntu and Mint is NOT the same as PulseAudio pavucontrol. You will NOT see a Configuration tab on the standard volume control mixer. Install pavucontrol for the real deal.
sudo apt install pavucontrol
Contents
- 1 Processes Related to PulseAudio
- 2 Distribution Specific
- 3 Tips and Tricks
- 4 Troubleshoot
- 4.1 pipewire-pulse - No PulseAudio daemon on new distributions
- 4.2 Test Sound Utility: Stereo Separation Test
- 4.3 Testing audio input / microphone input from CLI
- 4.4 PulseAudio does not get along well with KDE
- 4.5 Microphone detected but can't change volume in Mint Linux
- 4.6 Controlling Pulse Audio from CLI
- 4.7 Google Chrome Keeps Adjusting Microphone Input Level
Processes Related to PulseAudio
- PulseAudio Process name: pavucontrol , Binary path: /usr/bin/pavucontrol , Package Name: Pavucontrol
- PulseAudio Preferences Process name: paprefs, Binary Path: /usr/bin/paprefs , Package Name: Paprefs
- PulseAudio Equalizer Process name: qpaeq , Binary path: /usr/bin/qpaeq , Package Name: PulseAudio-equalizer
Distribution Specific
Fedora
PulseAudio became the standard audio system in Fedora 8, but at the time it is buggy and crashed from time to time for no apparent reason. Or, sometimes it works great without any problems. Maybe it's not so bad.
Debian
Want to install PulseAudio mixer on Debian?
apt-get install pavucontrol
Ubuntu
A sound server is basically a proxy for your 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.
Pulseaudio is already installed by default on most Ubuntu flavors, including Ubuntu, Kubuntu, and Xubuntu.
For Ubuntu environments that use pulseaudio, Ubuntu has its own custom sound indicator that will allow you to select the preferred device and control the volume of each application. If you would prefer to try pulseaudio's generic control GUI, install the pavucontrol package and launch it with terminal command:
pavucontrol
source: ubuntu wiki: PulseAudio
Tips and Tricks
Bridge HDMI and analog audio output
Updated: The easiest way to accomplish this on modern Ubuntu/Mint (at least 18.3 and up) is to use a utility called paprefs aka PulseAudio Preferences.
You won't find the ability to enable simultaneous output in the default Pulseaudio sound controls for any desktop environment.
Install PulseAudio Preferences
sudo apt install paprefs
Run the software paprefs aka PulseAudio Preferences
paprefs
There will only be one item there, Add virtual output device and you need to Check the box. Now refresh Pulseaudio
Illustration shows the paprefs interface, launched from console by typing: "paprefs" and the correct selection.
The check box is selected for: Add virtual output devices for simultaneous output on all local sound cards
Illustration shows the Pulse Audio Volume Control Output Devices Tab with "Set as fallback" checked for "Simultaneous output to..." checked so programs send sound on all bridged devices.
older information:
How to stop and start the Pulse Audio Service
With systemd PulseAudio is controlled by systemctl and if you kill PulseAudio it will be restarted automatically by systemctl. To suspend the service, stopping PulseAudio do:
systemctl --user stop pulseaudio.socket systemctl --user stop pulseaudio.service
To start it again, you can use:
systemctl --user start pulseaudio.socket systemctl --user start pulseaudio.service
Is PulseAudio running?
ps ax|grep -i pulse
If yes
40871 ? S<sl 0:01 /usr/bin/pulseaudio --daemonize=no --log-target=journal 40874 ? Sl 0:00 /usr/libexec/pulse/gsettings-helper
Temporarily suspend PulseAudio
pasuspender is a tool that can be used to tell a local PulseAudio sound server to temporarily suspend access to the audio devices, to allow other applications access them directly. pasuspender will suspend access to the audio devices, fork a child process, and when the child process terminates, resume access again.
Example environment without PulseAudio without stopping the service
pasuspender bash
Here is an example where a game is launched with PulseAudio suspended
pasuspender ./PULSAR_LostColony.x86_64
pulseaudio-equalizer
Note: May be broken or not compatible in newer distributions.
Your distribution may or may not have pulseaudio-equalizer as part of the main repository.
sudo apt install pulseaudio-equalizer
Launch the mixer with
qpaeq
For qpaeq to work you have to have the modules module-equalizer-sink and module-dbus-protocol set to load in the /etc/pulse/default.pa file
sudo vi /etc/pulse/default.pa
add
load-module module-equalizer-sink load-module module-dbus-protocol
For more information on pulseaudio-equalizer visit How to Install PulseAudio-Equalizer in Ubuntu and Linux Mint
Troubleshoot
pipewire-pulse - No PulseAudio daemon on new distributions
Linux Mint 22 comes with other audio systems pre-installed, such as ALSA (Advanced Linux Sound Architecture) or PipeWire. To see what yours is running
ps aux | grep -E 'pulse|pipewire'
You might see
/usr/bin/pipewire /usr/bin/pipewire -c filter-chain.conf /usr/bin/pipewire-pulse
if you have something other than the pulseaudio server.
Another way to check
pactl info
In the output look for: Server Name: PulseAudio (on PipeWire 1.0.5)
If you're on pipewire then the paprefs simultaneous output feature (audio bridge) will not work.
pipewire-pulse replaces PulseAudio and provides a compatibility layer, making applications think they're interacting with PulseAudio. It translates PulseAudio API calls to PipeWire actions.
If you try to go back to PulseAudio via apt from the repository you will find it redirect PulseAudio installations to PipeWire because Mint 22 has adopted PipeWire as the default audio server with PulseAudio compatibility through pipewire-pulse.
You can Remove Pipewire and switch back to PulseAudio
- warning: this will probably break bluetooth audio (possible fix below)
sudo apt remove --purge pipewire pipewire-audio-client-libraries pipewire-pulse sudo apt autoremove --purge pipewire* sudo apt remove pulseaudio pavucontrol paprefs
Block PipeWire from being reinstalled automatically: Use a package pinning configuration to ensure PulseAudio is installed instead of PipeWire.
sudo vi /etc/apt/preferences.d/no-pipewire
add the following text and save
Package: pipewire* Pin: release * Pin-Priority: -1
Then
sudo apt update sudo apt install pulseaudio pavucontrol paprefs
Switching to PulseAudio breaks Bluetooth
sudo apt install libspa-0.2-bluetooth sudo apt install pulseaudio pulseaudio-module-bluetooth sudo vi /etc/pulse/default.pa
Then add the following lines in the bluetooth section (ref: Can't connect to Bluetooth in linux)
load-module module-bluetooth-policy load-module module-bluez5-device load-module module-bluez5-discover
Final thoughts: Mint devs are switching from PulseAudio to PipeWire and have left a fake PulseAudio behind for compatibility, but they have not considered tools like paprefs (PulseAudio Preferences) for bridging output sinks as well as other impacted tools, software, and games. If PipeWire is better the change is warranted but only after tools are developed and included that fulfill all of these ancillary needs. You might want to think twice before going back to PulseAudio on a new distribution as it can get pretty involved depending on what you need.
Test Sound Utility: Stereo Separation Test
Excerpt from Troubleshooting Linux Sound by Steve Litt troubleshooting guide"
Steve says, "The speaker-test program provides a nice, easy way to provide input for your sound system. When used with no arguments, it simply supplies white noise to both speakers."
Testing an M-Audio external USB sound board it was unclear as to whether or not stereo separation was functional or if the audio was monaural (mono) since the balance slider on audio players seemed to have zero impact. Elimination of audio application software is advised to find if ALSA and your wiring are correct. Use this command:
speaker-test -c2 -t wav
As Steve advised in his article the command will alternate between left and right speaker audio dialog in a loop allowing you to listen and determine if the sound is coming from the speakers, the correct speakers and that you have functional stereo separation. You may find it useful to ensure you do not have intended left speaker audio coming out of your right speaker. If you have more than 2 channels, put the number of channels in the -c argument.
Be advised the article is very informative and we hope it remains online as well as The Steve Litt Diagnostic Tools he provides there. Thanks Steve!
Testing audio input / microphone input from CLI
We can test the default audio input device, or the only audio input device on a simplistic configuration
arecord -vvv -f dat /dev/null
Watch while the audio input levels are displayed as a percentage.
We can specify an audio input device
arecord -vvv --device="hw:1,0" -f dat /dev/null
You can display a list of CAPTURE Hardware Devices. To figure out what audio input device is at hw: card,device use the following command
arecord -l
The output look for "Card X" and on the same line "device X" to know the card,device combination to specify.
PulseAudio does not get along well with KDE
pulseaudio-core-libs-0.9.8-5.fc8 pulseaudio-module-gconf-0.9.8-5.fc8 pulseaudio-utils-0.9.8-5.fc8 pulseaudio-0.9.8-5.fc8 pulseaudio-module-x11-0.9.8-5.fc8 pulseaudio-esound-compat-0.9.8-5.fc8 alsa-plugins-pulseaudio-1.0.15-3.fc8.1 pulseaudio-libs-0.9.8-5.fc8 akode-pulseaudio-2.0.2-4.fc8 kde-settings-pulseaudio-3.5-38.fc8 pulseaudio-libs-glib2-0.9.8-5.fc8
esdcompat: esdcompat is a compatibility script that takes the same arguments as the ESD sound daemon esd(1), but uses them to start a the PulseAudio sound server with the appropriate parameters
PULSEAUDIO: Unable to connect: Connection refused
Playing WAVE '/usr/share/system-config-soundcard/sound-sample.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo *** PULSEAUDIO: Unable to connect: Connection refused
aplay -L amixer cat /proc/asound/version cat /etc/asound.conf lspci -v |grep -iC 10 audio lsmod |grep snd
Try this: (THIS WORKED) A viable work around to get rid of pulseaudio.,
rename pulse-default.conf in /etc/alsa to somethin else. (This file makes pulseaudio the default device for sound for alsa) run /sbin/alsactl restore
cd /etc/alsa mv pulse-default.conf pulse-default.SUCKS /sbin/alsactl restore mplayer /usr/share/sounds/what_the_hell.mp3
Audio playback successful!
Some people say remove the rpm
alsa-plugins-pulseaudio
and another Fedora 8 person has urged me to install
kde-settings-pulse
$ xmms *
- PULSEAUDIO: Unable to connect: Connection refused
- WARNING **: alsa_setup(): Failed to open pcm device (default):
Connection refused
$ mplayer * ....
- PULSEAUDIO: Unable to connect: Connection refused
[AO_ALSA] Playback open error: Connection refused Could not open/initialize audio device -> no sound. Audio: no sound Video: no video ....
The solution isn't as simple as starting pulseaudio, though:
$ pulseaudio W: alsa-util.c: Cannot find mixer control "Master". E: module-alsa-source.c: Error opening PCM device hw:0: No such file or directory E: module.c: Failed to load module "module-alsa-source" (argument: "device=hw:0 source_name=alsa_input.pci_1002_4383_alsa_capture_0"): initialization failed.
Microphone detected but can't change volume in Mint Linux
You open pulseaudio in Linux Mint and the Microphone audio device under "Input" is displayed, however, the slider is grayed out. Can apply to Linux Mint 18.x - 20.x
Try to clear the settings in the ~/.config/pulse directory. Delete all of the directory contents (rm * but not rm -r *). Once all the files in that folder are gone execute the following command at the cli:
pulseaudio -k
Now reboot and see if you have control over the microphone slider.
- credit: This tip provided by user trytip over at linuxmint.com
Controlling Pulse Audio from CLI
restart the Pulse Audio with:
pulseaudio -k
You can check if the pulse audio is running by:
pulseaudio --check
if all is ok no output will be shown. you can start it and check for problems on start by:
- the pulseaudio --check reports nothing even when the service is stopped. this does not seem to do a damn thing.
the following will start pulse audio, however, you should use systemctl instead if you are ubuntu/mint. See above on starting and stopping pulseaudio with systemctl.
pulseaudio --start
Google Chrome Keeps Adjusting Microphone Input Level
Google Chrome uses WebRTC and their implementation of Automatic Gain Control is broken. The problem is further aggravated due to Google not allowing people to override the Automatic Gain Control. WebRTC Automatic Gain Control is broken and prevents some users from being able to use their microphone with Google Voice and other web site applications in Google Chrome and Chromium.
Note: This page is notably untidy. Information is unkept or not arranged neatly and in order. Organization is needed to clean up this page including the removal of options and revision of information presentation. You can help. Please contribute by registering your email address and adding your knowledge to this page. The D.U.C.K. wiki was created to be a free informative place that allows an open exchange of accurate information. Learn more... |