Friday 23 May 2014

Sony Bluetooth Speaker SRS-BTM8 With Ubuntu Studio

Just bought a sony bluetooth speaker, and thought I'd share the hoops I had to jump through to get it going.

In short, I've managed to set it up with Ubuntu, such that if I turn on the speaker and press the play button, the currently playing sound is automatically transferred to the speaker, and when I turn the speaker off, the sound is transferred back to the PC sound card.

The only thing left to sort out is to get the play/pause to actually pause/play if you press it a second time - to-date, all the button does is enables and starts the connection.

1. Install the bluetooth adaptor

2. Ensure bluetooth and the bluetooth/pulse-audio packages are installed
sudo apt-get remove gnome-bluetooth
sudo apt-get install blueman pulseaudio-module-bluetooth
 3a. Edit the audio.conf configuration files in /etc/bluetooth
[General]
Disable=Headset
AutoConnect=true

[Headset]
MaxConnected=0

[A2DP]
SBCSources=1
The Disable=Headset, and MaxConnected=0 prevent the speaker from connecting as a headset.

3b. Edit daemon.conf in /etc/pulse

Ensure the following lines are commented out
; default-samplechannels=2
; default-channel-map = front ...
And the following lines are uncommented
load-default-script-file = yes
default-script-file = /etc/pulse/default.pa
3c. Edit default.pa in /etc/pulse

Ensure the following four lines are uncommented:
set-default-sink output
set-default-source input
3d. Edit system.pa in /etc/pulse

Add the following two lines at the top of the file: 
load-module module-bluetooth-discover
load-module module-switch-on-connect
4. Change the permissions of pactl

The pulse-audio module-bluetooth-discover should be loaded on start-up, but to enable command-line control of the sound system, the control program should be accessible by members of the 'audio' group - this step is not strictly necessary.
sudo chgrp audio /usr/bin/pactl
sudo chmod g+s /usr/bin/pactl
5. Turn on, and browse / find the bluetooth speaker using the bluetooth icon on the taskbar
  • Hold the pairing button on the speaker until it beeps, then select "Setup New Device" from the bluetooth icon on the taskbar.
  • When prompted for the passkey, enter "0000", then a short press on the speaker pairing button to do the other end.
  • Select the Audio Sink / A2DP service, not the Input/Headset one. 
6. Authorise the speaker

Go into the Settings / Bluetooth Manager, and mark the speaker as trusted

7. Set the Default (non-bluetooth output device)

Right click on the speaker (Volume Control) in the taskbar, and select  Configuration, and disable any profile you don't want to use (in my case, disabling HDMI)

8. Check it all works

Reboot the machine, and login.  The software should automatically load and configure, that's it, all you need to do is turn on the bluetooth speaker, and press the play button to connect.

9. Other Useful Bits

pactl list short

This should show module-bluetooth-discover, amongst other things

Settings / Bluetooth Manager

Here you can manage the bluetooth connections, including disconnecting and forgetting bluetooth devices.

Debugging

sudo apt-get install bluez-hcidump
hcidump -h

10. Update Required

This blog page needs an update. If the speakers are to be used on a system where JackD is running, furthere modifications are required, because there are some driver / interface name assumptions made with adobe-flash plugins which are not compatible.

https://bbs.archlinux.org/viewtopic.php?id=171729