Howto connect musicbox to Bluetooth?

After installing a bluetooth-dongle for bluetooth transmitting to my speakers it works with installing and testing of this lines;
~# sudo apt-get install cmus
~# dsp.alsa.device bluetooth
~# output plugin alsa
~# sudo apt-get install mpg321
~# mpg321 -a bluetooth -g 95 http://icecast.omroep.nl/radio2-bb-mp3

Installing the last command line into => rc.local … starts my bluetooth speakers with the stream radio2 ( mpg321 -a bluetooth -g 95 http://icecast.omroep.nl/radio2-bb-mp3 & ).
But where and how can I’ll bring or change the lines//command such ( ~# dsp.alsa.device bluetooth
and ~# output plugin alsa ), so that the MusicBox-audio output starts with or into Bluetooth transmit ?

If you have the bluetooth device configured to show up as a alsa device try using https://docs.mopidy.com/en/latest/config/#confval-audio/output and setting alsasink device=bluetooth

Thanks for the hint, it works really superb !!! :heart_eyes:

Hi @Dvsat can you give some more insight on how you got bluetooth streaming to work?

specifically when I run your second command:

dsp.alsa.device bluetooth

it says command not found

Any help would be appreciated,
-Lunz

@Lunz, maybe it will help the site of Mr. Correderajorge
http://www.correderajorge.es/bluetooth-on-raspberry-audio-streaming/

In the meantime, the bluetooth experiment will be finished 100%.
So, we can handle Musixbox normally and complete with all futures and the output will be transmit (stereo) with a good quality to the (my) bluetooth sounbar.

In the weekend I’ll publish a howto in this topic.

1 Like

Hi @Dvsat, any updates to report?

You have right, I’ll promised a howto; :wink:

  • Flash MusicBox normaly to your RaspberryPi !

$ sudo apt-get install bluetooth bluez bluez-utils bluez-alsa
$ hcitool scan ## switch you bluetooth to scan ##
$ bluetooth-agent --adapter hci0 0000 48:5A:B6:A8:1C:A2 ## <–device you find with the scan and will connect ##
$ bluez-test-device trusted 48:5A:B6:A8:1C:A2 yes
$ bluez-test-device trusted 48:5A:B6:A8:1C:A2 ## If Okay, this will confirmed with a 1 ##
$ sudo /etc/init.d/bluetooth restart

  • Change output = alsasink into output = alsasink device=bluetooth (settings.ini)
  • Put the lines (only) into the file asound.conf (/etc);

pcm.bluetooth {
type bluetooth
device 48:5A:B6:A8:1C:A2 ##your device##
profile “auto”
}

  • Remove the file setsound.sh (/opt/musicbox)
  • Put some lines into the file audio.conf (/etc/bluetooth);

[General]
Enable=Source,Sink,Socket

Disable=Media

$ Reboot and … GoodLuck !

1 Like

I know it’s not totally relevant, but does anyone know if it’d be possible to stick in a bluetooth dongle that mopidy could use to accept audio from other devices like phones which it would then route through mopidy as if it’s a proper music source?

Thoughts:

  1. Thank you for the clear instructions! I was able to get it working!!!

  2. Is it possible to add any logic to detect if the trused BT device(s) are not detected to route audio to headphone port or HDMI?

  3. When I airplay into the device, audio is sent to headphone port (not through BT)

Let me know what you think and if we can enhance this a bit more :smile:

Thanks,
Lunz

As you request by line 2, Yes this will be possible, but you must rewrite/program the setsound.sh (/opt/musicbox) instead of removing. It will be also the solution for your request of line 3.

But for your info, I don’t have the skils like a programmer, Sorry !!!

Maybe you could better buy the option DAC (for a better audio output then the headphone-jack) and bring this signal into the seperated bluetooth transmitter of newest Marmitek BoomBoom (with USB)

@fusen I can’t think of a way to do this involving Bluetooth but I also don’t see what the the benefits would be of doing so. To let you skip/pause/play through the same interface?

I think dlna/upnp might be a better way to go with that. Have you looked at using that?

We launch shairport with arguments to use the default device. You’d need to either change your asound device definition and make bluetooth the default, or change the line in /etc/init.d/shairport-sync to explicitly use your bluetooth device. The former, along with some extra logic in setsound.sh, would be better in my opinion as then you can do something sensible in the case of your trusted BT device being unavailable.

  1. Thanks for perfect working instruction!

  2. It is also possible to use Bluetooth and Analog speakers at the same time?
    Or how can I switch between Bluetooth and Anlaog?

Thanks a lot!

Is it posible to leave the bt dongle on when the bt speaker is turned of?
When I now turn my speaker off, after a while the dongle is off and when I want to reconnect I must reboot the Raspberry.

I have mopidy running on a Raspberry Pi3 with built-in bluetooth. I have the BT working with my BT speakers. How to I get mopidy to use the BT as output? I tried using the instructions given by Dvsat. But I’m not running Musicbox 0.6.

Thanks in advance.

@fusen Hi! I was playing a bit to set up Bluetooth as a source to mopidy. My main purpose was to have the audio and also see whats playing (artist/title/lenght) and control the playback (play/pause, etc) like the car players usually do (I found it’s called AVRCP in the bluetooth world).

I came up making this extension: https://github.com/ismailof/mopidy-btsource

Now, the code is just a proof of concept and it’s not suitable for everyone. Some things do work and others don’t. The connection to the Bluetooth source has to be done previously and the mananging of the audio is all done via pulseaudio (not mopidy or gstreamer). What you get is only to see the Artist/Title and control play/pause from mopidy itself.

I’m adding it just to answer your comment because I could find very little information about it when I started to look for it. It seems a very unpopular use case in the internet world, but my feeling is that is very common outside there.

Hey @ismailof: Good job with the Bluetooth tool. I’d like to suggest to focus on the auto connecting feature for use with a Bluetooth remote (which many of us already have) like the remote included with the Amazon Firestick: or Wiimote because it looks like you already support remote playback control.

I know that these remotes usually ‘time out’ to save battery life and then autoconnect once they find the source – that’s why the autoconnect feature would immediately make your tool useful for everyday use.

I’m really looking forward for better Mopidy Bluetooth support… Mopidy would be complete then I think.

someone tried to connect music box with a car ? I would like to connect to my renault rlink2 system not only for listen music but also to control like I do with the phone (just play/pause and next/prev), not only for the better audio quality but also for the library control. Is it possible?
thanks

Folks, has anybody managed to install Bluetooth on a Pi W zero with the MusicBox image? I get
E: Unable to locate package bluetooth
E: Unable to locate package bluez
E: Unable to locate package bluez-utils
E: Package ‘bluez-alsa’ has no installation candidate
Any ideas…
Thank you