6

I have gone through the whole gamut of trials with setting up playing audio through bluetooth and have not been able to make it work reliably (i.e., got it to work one time, and has not worked after rebooting).

I can see the bluetooth interface (hciconfig) and can see the speaker (D100 creative) in a hcinconfig scan, but run into problems with bluez. The documentation is terrible and has not changed much since this guy wrote about it. I really do not want to talk about or debug this issue further. I am beaten and worn out on this issue.

However, I seem to have better luck connecting to the D100 using the default Ubuntu GUI. I can get the sound to work through the bluetooth speakers and I get sound when I click on the "test sound" button. How can I do this same thing using command line? Where can I find out what the bluetooth/sound app uses in the backend to make this work and play an mp3/wav file?

3
  • See if my answer to the following questions meets your needs: askubuntu.com/questions/48001/…
    – Takkat
    May 15, 2013 at 19:08
  • @Takkat Thanks for that link and will try it out today. Once I succeed in connecting, how can you play an mp3/wav file (updated the question). I have tried aplay, mplayer unsuccessfully - what do you do?
    – Trewq
    May 15, 2013 at 19:51
  • aplay can only play raw file, no mp3. For mp3 playback with mplayer you need to have the mp3 codes installed. See askubuntu.com/questions/44443/command-line-audio-players for a list of CLI players.
    – Takkat
    May 15, 2013 at 20:19

1 Answer 1

0

I use this to connect (or disconnect) to my bluetooth radio.

To find the MAC address of your bluetooth device, you could do this, which should show MAC addresses and names of devices you have paired with your system:

find /var/lib/bluetooth -name names | xargs cat

Then edit the mac=... line in this script and try it.

#!/bin/bash

mac="90:03:B7:17:00:08"  # replace with correct MAC address of your bluetooth speaker

if [ "$1" = "off" ]; then
    bt-audio -d "$mac"
    exit $?
fi

bt-audio -c "$mac"

sink=$(pactl list short sinks | grep bluez | awk '{print $2}')

if [ -n "$sink" ]; then
    pacmd set-default-sink "$sink" && echo OK
else
    echo could not find sink
fi

Depending on your music player, you may need to stop and restart it's playback to make it pick up the new output.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .