Bluetooth Speakers and Squeezeslave

The setup serving audio in our kitchen was pretty conviluded and had a few too many cables jammed into a cupboard: A thin-client with powered speakers, attached to a wireless access point set to client mode. I picked up a newer set of powered speakers that came with a 30 pin iPod/iPad dock – so I looked online and found an attachment for the iPod dock that converts it to a Bluetooth audio receiver (similar to this), so you can connect with any Bluetooth enabled music device (phone, laptop, etc.). I have a laptop (Media Director for LinuxMCE) hooked up to a TV in a close room that’s on most of the time anyway, so I paired the Bluetooth receiver to a laptop and setup squeezeslave to pass audio to the speakers.

In summary: Before – Thin-client, wireless access point and speakers. Now – Speakers with a Bluetooth adapter. I pulled 2 power packs, 4-5 cables and 2 devices from the cupboard. Not only am I saving power (+ money), it’s a cleaner looking setup.

To setup the Bluetooth audio in LinuxMCE (12.04) I did the following:

  • Check to make sure a Bluetooth dongle in laptop is detected correctly:

# hcitool dev
Devices:
hci0    xx:xx:xx:xx:xx:xx <– Built in device wouldn’t connect successfully. I’m also pretty sure it was integrated into the wireless chipset.
hci1    xx:xx:xx:xx:xx:xx  <– USB bluetooth dongle which worked fine.

  • Scan for Bluetooth devices (it must be in discoverable mode):

hcitool scan

  • Connect to speakers: bt-device –adapter=hci1 -c xx:xx:xx:xx:xx:xx

“hci1” is the USB dongle, “xx:xx:xx:xx:xx:xx” is the MAC address from the above scan.

  • Check to make sure it joined correctly:

# bt-device -l
Added devices:
H168C (xx:xx:xx:xx:xx:xx)

  • Connect the Bluetooth audio service

bt-audio –adapter=hci1 -c xx:xx:xx:xx:xx:xx

  • Added device to the trusted list:

bt-device –set H168C Trusted 1

“H168C” is the name of the audio device.

  • Edit /etc/bluetooth/audio.conf

Master=false

# If we want to disable support for specific services
# Defaults to supporting all implemented services
#Disable=Control,Source

# SCO routing. Either PCM or HCI (in which case audio is routed to/from ALSA)
# Defaults to HCI
#SCORouting=PCM

# Automatically connect both A2DP and HFP/HSP profiles for incoming
# connections. Some headsets that support both profiles will only connect the
# other one automatically so the default setting of true is usually a good
# idea.
AutoConnect=true

Enable=Source,Sink,Media,Socket

  • Restart Bluetooth servive:

service bluetooth restart

  • Install squeezeslave:

apt-get install squeezeslave

  • List available audio devices squeezeslave detects:

squeezeslave -L
Output devices:
0: (ALSA) HDA Intel: CONEXANT Analog (hw:0,0) (11/46)
1: (ALSA) sysdefault (42/46)
2: (ALSA) front (11/46)
3: (ALSA) surround40 (11/46)
4: (ALSA) surround51 (11/46)
5: (ALSA) surround71 (11/46)
  6: (ALSA) rawbluetooth (139/139)
7: (ALSA) analog_playback (42/46)
8: (ALSA) asym_analog (42/46)
9: (ALSA) dmix (42/42)
*10: (ALSA) default (42/46)

  • Test run of audio device:

squeezeslave –retry -o6 <IPAddress of Server>

  • Edit /etc/rc.local

bt-audio –adapter=hci1 -c xx:xx:xx:xx:xx:xx
squeezeslave –retry -o6 <IPAddress of Server> -M -Y /var/log/squeeze.log

  • On DCERouter change the Media Director’s sound settings to manual.
  • Always reboot to make sure the settings are all working

So far it looks pretty good, although it’s having issues starting at boot time, but it shouldn’t be too hard.

Cheers.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*