humpty promotes - Linux - Lubuntu

Lubuntu linux Tips
 
Setting Up Bluetooth Audio with Alsa
Installing Bluetooth Headphones or Speakers


Bluetooth probably already came installed on your Ubuntu-like distro, but just incase
it didn't,
you uninstalled by mistake,
you can't get pulse-audio working,

then here is a way to get your headset or speakers working with Alsa alone.

1. Install
blueman
bluez-asla

That's right (!), that's all you need !

2. Edit Config file
The alsa config file is searched for in many places;
/etc/alsa.conf
/usr/share/alsa/alsa.conf
/etc/bluetooth/audio.conf
/usr/share/alsa/alsa.conf.d/70-btspeakers.conf
I recommend creating and editing the last one. It begins with a priority number (70) it can be any number and the system reads the files in order of this number. That's not interesting, what is interesting is the content;

/usr/share/alsa/alsa.conf.d/70-btspeakers.conf

pcm.btspeakers {
   type plug
   slave {
       pcm {
           type bluetooth
           device FC:58:FA:C3:03:96
           profile "auto"
       }
   }
   hint {
       show on
       description "BT Speakers"
   }
}
ctl.btspeakers {
  type bluetooth
}

The HEX values specify the device ID. You get this by issueing the command;
hcitool scan
Scanning ...
    FC:58:FA:C3:03:96    DOSS hurricane3

Make up your own name e.g btspeakers, btheadset..,, etc  and give it a description e.g "BT Speakers"


3. Restart Bluetooth

sudo service bluetooth restart

4. Pair and Connect

Preferences > Bluetooth Manager

Adapter > Search

Search and pair the headphones or speakers...
Connect and pair to "Audio Sink"

5. Play

Audacious : File > Preferences > Audio > Output Settings >
ALSA-Preferences > PCM device: btspeakers


Mplayer : -ao alsa:device=btspeakers

(for SMplayer, paste alsa:device=btspeakers into the "output driver>user defined" box


That's it!


Extras
How to set the default ALSA pcm device.

If you want Alsa to select your device by default then create another config file or append this code after ;
/usr/share/alsa/alsa.conf.d/90-default-select.conf

pcm.!default {
    type plug
    slave.pcm "btspeakers"
}

Alternatively (and preferred) you can create a ".asoundrc"  file in your home directory like this;

~/.asoundrc
pcm.btspeakers_softvol
{
   type softvol
   slave.pcm "btspeakers"
   control.name "Bluetooth"
   control.card 0
}

#pcm.!default front:Intel # main
#pcm.!default btspeakers # bluetooth speakers
pcm.!default btspeakers_softvol # bluetooth speakers with software volume control


The first part enables the device to be controlled with compatible software (e.g smplayer). It is not
needed, but it's nice to have.

The bottom part is the important part. Un-comment the line that you want as the default device.
There is no need to 'bluetooth restart', just close and re-open your software.

To get a list of device names type : > aplay -L

The main card is something like;
front:CARD=Intel,DEV=0
which is used as pcm.!default front:Intel

The bluetooth device is something like;
btspeakers_softvol
is used as pcm.!default btspeakers_softvol



The main (base) volume can be set by using the command line tool: alsamixer.
There will be a column which you can tab to called Bluetooth.



/End.


Advertisement

More Lubuntu Tips


Leading Cloud Surveillance service

Leading Enterprise Cloud IT Service Since 2003

Powered by FirstCloudIT.com, a division of DriveHQ, the leading Cloud IT and Cloud Surveillance Service provider since 2003.