Brian Sorahan

Bluetooth Audio on Arch Linux

07 Feb 2016 – Austin, TX

Background

My wife and I got an iLive IKB333s under-cabinet bluetooth radio for Christmas this year and she said she wanted to be able to stream audio from our Arch Linux laptop in the living room to it.
I decided to blog about what it was like to get this working because it’s my first time using bluetooth on Linux, and because it was successful.

TL;DR

The way I got this working was using pulseaudio-bluetooth
(since we want to stream audio from Spotify, which uses pulse), and set the default sink to the bluetooth sink.

Setting up bluetooth

I had to steal the USB dongle that I bought for my raspberry pi to get bluetooth on my laptop (Toshiba Satellite L645).
After this I installed all the packages recommended here and here.
I added myself to the lp group since the bluetooth daemon will only give out bnep0 devices to users who are in this group.

After powering up the radio I set the source to Bluetooth, and hit the Pair button.
A blue light on the device starts blinking until you pair with it from another device.

Next I followed the cli instructions to connect to the radio.

[brian@arch bluez-tools]$ hcitool scan
Scanning ...
	 00:15:00:00:03:D9	IKB333
[brian@arch bluez-tools]$ bluetoothctl
[NEW] Controller 00:1A:7D:DA:71:13 arch [default]
Drive
[NEW] Device DB:94:B9:E3:29:6B IKB333
[bluetooth]# scan on
Discovery started
[CHG] Controller 00:1A:7D:DA:71:13 Discovering: yes
[NEW] Device 00:15:00:00:03:D9 IKB333
[bluetooth]# scan off
[CHG] Device 00:15:00:00:03:D9 RSSI is nil
[CHG] Controller 00:1A:7D:DA:71:13 Discovering: no
Discovery stopped
[bluetooth]# pair 00:15:00:00:03:D9
Attempting to pair with 00:15:00:00:03:D9
[CHG] Device 00:15:00:00:03:D9 Connected: yes
[CHG] Device 00:15:00:00:03:D9 UUIDs: 0000110b-0000-1000-8000-00805f9b34fb
[CHG] Device 00:15:00:00:03:D9 UUIDs: 0000110c-0000-1000-8000-00805f9b34fb
[CHG] Device 00:15:00:00:03:D9 UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
[CHG] Device 00:15:00:00:03:D9 Paired: yes
Pairing successful
[CHG] Device 00:15:00:00:03:D9 Connected: no
[bluetooth]# connect 00:15:00:00:03:D9
Attempting to connect to 00:15:00:00:03:D9
[CHG] Device 00:15:00:00:03:D9 Connected: yes
Connection successful
[IKB333]#

Next I set the default pulseaudio sink to the bluetooth device

[brian@arch ~]$ pacmd list-sinks
2 sink(s) available.
* index: 0
       name: <alsa_output.pci-0000_00_1b.0.analog-stereo>
       ...
index: 1
       name: <bluez_sink.00_15_00_00_03_D9>
       ...
[brian@arch ~]$ pacmd set-default-sink 1
[brian@arch ~]$ pacmd list-sinks
2 sink(s) available.
index: 0
       name: <alsa_output.pci-0000_00_1b.0.analog-stereo>
       ...
* index: 1
       name: <bluez_sink.00_15_00_00_03_D9>
       ...

Next all I had to do was start spotify, and voila! I was streaming great-sounding audio to the radio from my Arch laptop.

Conclusion

As always, the arch wiki was extremely helpful. Because arch maintainers create such good documentation, it was really painless to stream audio from my laptop to the bluetooth radio.
I have experienced loss of quality occasionally. Bringing the laptop closer to the radio fixes it, but I’d like to figure out what I can do to avoid this.