I've got a Ubuntu 16.04 box on an Intel NUC for HTPC purposes (running Kodi). Most of the time it's outputting audio to the TV via HDMI (one day will be via a receiver) however occasionally I'd like to output audio to my Bluetooth headphones to avoid bothering others. The box does not have a GUI installed on it and I'd like to keep it that way.
I don't want to install Pulseaudio if at all possible - ALSA is much simpler and seems to be better suited to Kodi.
What I want to achieve:
- The HTPC should automatically connect to the Bluetooth headphones when I turn them on (having manually paired them once). I don't mind if there's a script running in the background periodically trying to do that.
- The Bluetooth headphones should be available as a separate ALSA output device in Kodi
- I don't mind manually switching the output device in Kodi from HDMI to the headphones
What I've tried so far:
- I'm able to "see" my Bluetooth headphones using hcitool scan
- I'm able to see them using bluetoothctl and pair with them, however "connecting" fails (I believe due to missing Pulseaudio)
- I've tried defining an ALSA audio device for them (approximately following the guide here: Bluetooth/Alsa - Debian Wiki) however when I try and "aplay" to that device it complains about a missing .so module (libasound_module_pcm_bluetooth.so)
Hopefully someone has done this before (on a recent version of Ubuntu)
Update I've found the reason it's looking for "libasound_module_pcm_bluetooth.so" is based on the "type" in the asound.conf declaration. So I guess I need to use one of the modules that is present on my machine (under /usr/lib/x86_64-linux-gnu/alsa-lib/).