Are you experiencing this strange behaviour when you have your precious Bluetooth headphones connected, but after a few minutes of no audio playing and you start a video or audio, it seems that there is no sound coming out your headphones although they are still paired?
Using pavucontrol may help keeping the line up, but it is not the ideal solution, shall I say.
Then what else can solve this mysterious annoyance?
Indeed, if your headphones are connected, the modules are successfully loaded. Sometimes, the issue is that Pulseaudio gets started before Bluetooth. Other times, the Bluetooth audio module just does not stay active, which launching pavucontrol usually keeps it alive.
Let’s start by entering
sudo nano /etc/pulse/default.pa into a terminal. Pretty straight forward at this point, isn’t it?
Now the fun begins. You may find the section starting with:
### Automatically load driver modules for Bluetooth hardware
Got it? Fantastic!
Now shall you comment the corresponding lines as shown bellow. Commenting a line usually means adding a specific character before a phrase, so that the software will not read it or interprete it. In that case, the comment symbol we use is the pound #.
### Automatically load driver modules for Bluetooth hardware #.ifexists module-bluetooth-policy.so load-module module-bluetooth-policy #.endif #.ifexists module-bluetooth-discover.so load-module module-bluetooth-discover #.endif
After that, search for
load-module module-suspend-on-idle and comment it so it looks like the following:
### Automatically suspend sinks/sources that become idle for too long #load-module module-suspend-on-idle
Great! Now the for the last step, you may go completely to the bottom, and add the script below!
# automatically switch to newly-connected devices load-module module-switch-on-connect # or switch also to newly-connected virtual devices load-module module-switch-on-connect ignore_virtual=no
To save your changes, hit the ctrl and s keys on your keyboard simultaneously, followed by ctrl and x to leave the editor.
To make sure the changes are fully applied, we will restart the pulse audio process by executing
pulseaudio --k in the terminal, followed by
pulseaudio --start.You may also reboot if you want to be certain that the changes are applied.
Next, we will prevent Pulseaudio from automatically starting a server if there are none running, as many Desktop Managers will start their own PulseAudio instance.
Let’s proceed by entering
sudo nano /var/lib/gdm/.config/pulse/client.conf into the terminal.
You may now add the following lines:
autospawn = no daemon-binary = /bin/true
Once again, to save your changes, hit the ctrl and s keys on your keyboard simultaneously, followed by ctrl and x to leave the editor.
We will also make sure that Systemd does not decide to start PulseAudio randomly by executing
sudo -ugdm mkdir -p /var/lib/gdm/.config/systemd/user in a terminal, followed by
sudo -ugdm ln -s /dev/null /var/lib/gdm/.config/systemd/user/pulseaudio.socket .
pgrep -u gdm pulseaudio in the terminal!
Voilà! This clumsy behaviour with Bluetooth headphones should now be eliminated, not interrupting your majestic jam playback anymore!
I hope this helped, and as always, have a wonderful day!
-The Quantum Alpha