The Complete Magazine on Open Source

Bluetooth Speakers and Beginners’ Blues

, / 203 0

Bluetooth speakers may not connect natively when used with Linux distributions. Solutions to the problem come from the author’s own experiments with Bluetooth speakers and various genres of Linux.

Beginners often face problems which cannot be replicated, i.e., it is almost impossible to recreate the exact scenario that caused the problem, in the first place. Something similar happened to me when I used a Bluetooth speaker with Linux for the first time. I was using the KDE environment. The speaker indicated that it was paired and connected but no sound would emerge. Using the search, I went around in circles trying out solutions which were often for older versions.
Once the speakers worked and I tried to recreate the situation that caused the issues, originally, it was obvious that I had been ignoring what was staring at me. The problem was different, depending on whether I used KDE 5 or GNOME3. In both cases, the issue really was that what I had expected was not what happened.

KDE comes with Bluedevil graphical tools for managing Bluetooth devices and it is integrated with the KDE desktop environment.
It recognised the Bluetooth speaker. It paired with it and connected the device as would be expected. The audio volume applet showed the device as a Bluetooth headset. However, no amount of tinkering made the sound come out from the Bluetooth speaker!
In retrospect, Pulseaudio was using the hardware device it was supposed to use. I needed to tell it to use the Bluetooth speaker instead. This is where how KDE functioned was not obvious to me. Pulseaudio’s pavucontrol also did not allow me to switch the output device.
I needed to go to the Multimedia option in System Settings and then the ‘Audio and Video’ options. Here, the Bluetooth speaker’s priority had to be higher than that of the built-in speakers. As soon as that was done, the sound switched to the Bluetooth speaker. If the Bluetooth speaker was disconnected, the sound was routed back to the built-in speaker.
This setting was needed only once. After that, anytime the Bluetooth speaker was connected, the audio switched to that device.

The Bluetooth applet in GNOME finds the device but does not know how to configure it (I had removed the device after the KDE experiments to prevent any confusion). The current version of GNOME 3 does not have a configuration tool for managing Bluetooth devices. The simplest option is to install the Blueman package.
Now, use the ‘Bluetooth Manager’ (command ‘blueman-manager’) to configure the Bluetooth device. The Bluetooth speaker can now be selected using the Bluetooth settings and the preferred output device selected from its sound settings option. This is a one-time activity.
After that, GNOME applications will route the audio through the Bluetooth speaker as soon as it is connected. As expected, the audio will fall back to built-in speakers if the Bluetooth speaker is disconnected.

The command line
Instead of Blueman, it is possible to use the bluetoothctl tool to configure the device. A typical session might look like what follows:

[anil@localhost ~]$ sudo bluetoothctl 
[NEW] Controller 24:FD:52:03:98:69 localhost.localdomain [default] 
[bluetooth]# scan on
Discovery started 
[CHG] Controller 24:FD:52:03:98:69 Discovering: yes 
[NEW] Device 0C:A6:94:FA:32:B9 JBL GO 
[bluetooth]# pair 0C:A6:94:FA:32:B9 
Attempting to pair with 0C:A6:94:FA:32:B9 
[CHG] Device 0C:A6:94:FA:32:B9 Connected: yes 
[CHG] Device 0C:A6:94:FA:32:B9 UUIDs: 00001200-0000-1000-8000-00805f9b34fb 
[CHG] Device 0C:A6:94:FA:32:B9 Paired: yes 
Pairing successful 
[CHG] Device 0C:A6:94:FA:32:B9 Connected: no 
[bluetooth]# trust 0C:A6:94:FA:32:B9 
[CHG] Device 0C:A6:94:FA:32:B9 Trusted: yes 
Changing 0C:A6:94:FA:32:B9 trust succeeded 
[bluetooth]# connect 0C:A6:94:FA:32:B9 
Attempting to connect to 0C:A6:94:FA:32:B9 
[CHG] Device 0C:A6:94:FA:32:B9 Connected: yes 
Connection successful 
[CHG] Device 00:19:91:59:CF:BB RSSI: -55 
[JBL GO]# quit 
[DEL] Controller 24:FD:52:03:98:69 localhost.localdomain [default] 
[anil@localhost ~]$

The only limitation of the Bluetooth speaker on Linux is that it cannot be used to pause music playing on the laptop as on an Android device.

Moral of the story
If the usage seems unreasonably complex in Linux, chances are that you are indeed on the wrong path.