INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Unable to Select Bluetooth Speaker on Raspberry PI  (Read 4038 times)

Sammy

  • Regular Member
  • Recent member
  • *
  • Posts: 16
  • nothing more to say...
Unable to Select Bluetooth Speaker on Raspberry PI
« on: November 11, 2018, 02:48:53 pm »

Running MC24 on Raspbian Stretch.  Can pair the bluetooth speaker and it plays fine through the browser but there seems to be no way to select it in the audio options.  The only options seem to be ALSA.  So far I can only play via the audio output port which is not great.  It works fine with a USB audio DAC.
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72438
  • Where did I put my teeth?
Re: Unable to Select Bluetooth Speaker on Raspberry PI
« Reply #1 on: November 11, 2018, 04:45:05 pm »

As a work around, you could try using Panel in a browser.  The wiki has a topic.

You would use this link:

http://localhost:52199

Media Network needs to be turned on in MC's settings.
Logged

Sammy

  • Regular Member
  • Recent member
  • *
  • Posts: 16
  • nothing more to say...
Re: Unable to Select Bluetooth Speaker on Raspberry PI
« Reply #2 on: November 12, 2018, 05:35:52 am »

Thanks for the suggestion.  Unfortunately I am running a JRemote setup trying to use the Pi as a headless server.  This works great at home where I have USB DAC but when I take it places where only a bluetooth speaker is available my setup doesn't work.  I would have expected playing through the default device would play to whatever device was selected by right clicking the speaker icon (which is the bluetooth speaker) but sound continues to come out of the headphone jack.  I thought about trying to set up a virtual device with blue-alsa but since I think MC is just looking at listed devices and virtual devices are not listed I doubt that would work.

I would expect MC to have an option to route sound to the default device just like Chrome does.
Logged

mwillems

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5234
  • "Linux Merit Badge" Recipient
Re: Unable to Select Bluetooth Speaker on Raspberry PI
« Reply #3 on: November 12, 2018, 07:37:18 am »

Can you provide more detail about what the available audio output devices you see in MC (you just say "ALSA devices")?  I see several default ALSA options in MC here on my pi. but it would help to know what options you're seeing.  If you see any pulse related alsa entries, those are very likely to be the correct one (although I'm not certain that pi's run pulseaudio by default).
Logged

Sammy

  • Regular Member
  • Recent member
  • *
  • Posts: 16
  • nothing more to say...
Re: Unable to Select Bluetooth Speaker on Raspberry PI
« Reply #4 on: November 12, 2018, 09:53:43 am »

In the attached image you can see that the Nyne Bass bluetooth speaker is select as the sound device.  It is paired, connected and if I play a YouTube video from Chrome, sounds is routed to the Nyne Bass speaker.  In MC it is not clear though how I select it the Nyne Bass speaker.  When I select sysdefault CARD=ALSA, plughw or hw sound comes out of the headphone jack.  When I select default or dmix no sound is emitted.  In no case does the sound come out of the Nyne Bass.

This is debian stretch so it is my understanding that pulse is no longer used and in place there is bluez-alsa.
Logged

bob

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 13870
Re: Unable to Select Bluetooth Speaker on Raspberry PI
« Reply #5 on: November 12, 2018, 10:07:41 am »

It's going to have to show up as either an ALSA device or Pulse.
If bluez isn't using pulse any more you still need to see an alsa device.

There is a little utility in MC's app directory that enumerates ALSA devices and their capabilities. You can run it by doing:

/usr/lib/jriver/Media\ Center\ 24/alsacap

from a terminal as the user running MC.
Logged

Sammy

  • Regular Member
  • Recent member
  • *
  • Posts: 16
  • nothing more to say...
Re: Unable to Select Bluetooth Speaker on Raspberry PI
« Reply #6 on: November 12, 2018, 10:22:46 am »

I am not sure how to get it to show up as an ALSA device

pi@raspberrypi:~ $ /usr/lib/jriver/Media\ Center\ 24/alsacap
*** Scanning for playback devices ***
Card 0, ID `ALSA', name `bcm2835 ALSA'
  Device 0, ID `bcm2835 ALSA', name `bcm2835 ALSA', 8 subdevices (7 available)
    1..2 channels, sampling rates 8000, 11025, 16000, 22050, 32000, 44100, 48000 Hz
    Sample formats: U8, S16_LE
      Subdevice 0, name `subdevice #0'
      Subdevice 1, name `subdevice #1'
      Subdevice 2, name `subdevice #2'
      Subdevice 3, name `subdevice #3'
      Subdevice 4, name `subdevice #4'
      Subdevice 5, name `subdevice #5'
      Subdevice 6, name `subdevice #6'
      Subdevice 7, name `subdevice #7'
  Device 1, ID `bcm2835 ALSA', name `bcm2835 IEC958/HDMI', 1 subdevices (1 available)
Error opening sound device for card 0, device 1: Device or resource busy.  Skipping.
pi@raspberrypi:~ $ bluetoothctl
[NEW] Controller B8:27:EB:3A:CA:B2 raspberrypi [default]
[NEW] Device 40:EF:4C:FB:C2:DD Nyne Bass
Logged

Sammy

  • Regular Member
  • Recent member
  • *
  • Posts: 16
  • nothing more to say...
Re: Unable to Select Bluetooth Speaker on Raspberry PI
« Reply #7 on: November 12, 2018, 11:01:56 am »

Have made some progress in getting the speaker to show up.

I added this to /usr/share/alsa/alsa.conf.d/20-bluealsa.conf

pcm.Nyne {
type plug
slave.pcm {
type bluealsa
device "40:EF:4C:FB:C2:DD"
profile "a2dp"
}
hint {
show on
description "JUSTOP BTR006"
}
}

I then tried to connect the device with

[NEW] Controller B8:27:EB:3A:CA:B2 raspberrypi [default]
[NEW] Device 40:EF:4C:FB:C2:DD Nyne Bass
[Nyne Bass]# connect 40:EF:4C:FB:C2:DD
Attempting to connect to 40:EF:4C:FB:C2:DD
Connection successful

Now it shows as the first audio device in MC.  Unfortunately when you try and play something it flashes for a second and then stops.  Is there a log file somewhere that might give a hint as to the error?

Logged

bob

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 13870
Re: Unable to Select Bluetooth Speaker on Raspberry PI
« Reply #8 on: November 12, 2018, 11:08:23 am »

Have made some progress in getting the speaker to show up.

I added this to /usr/share/alsa/alsa.conf.d/20-bluealsa.conf

pcm.Nyne {
type plug
slave.pcm {
type bluealsa
device "40:EF:4C:FB:C2:DD"
profile "a2dp"
}
hint {
show on
description "JUSTOP BTR006"
}
}

I then tried to connect the device with

[NEW] Controller B8:27:EB:3A:CA:B2 raspberrypi [default]
[NEW] Device 40:EF:4C:FB:C2:DD Nyne Bass
[Nyne Bass]# connect 40:EF:4C:FB:C2:DD
Attempting to connect to 40:EF:4C:FB:C2:DD
Connection successful

Now it shows as the first audio device in MC.  Unfortunately when you try and play something it flashes for a second and then stops.  Is there a log file somewhere that might give a hint as to the error?
Yes, turn on logging and look in
~/.jriver/Media\ Center\ 24/Log.txt

I suspect a sample rate issue.
You probably need to set DSP studio to convert everything to 48k.
Logged

Sammy

  • Regular Member
  • Recent member
  • *
  • Posts: 16
  • nothing more to say...
Re: Unable to Select Bluetooth Speaker on Raspberry PI
« Reply #9 on: November 12, 2018, 02:05:34 pm »

Indeed it was a sample rate issue.  With the sample rate converted to 48khz it seems to work fine.  Ignore everything in this thread.  It works perfectly with the default ALSA output setting under Debian stretch.  You just add your bluetooth device using the bluetooth icon, right click on the speaker icon and select it (which connects to it),  then in tools -> options -> DSP & Output format and set the sample rate output for your given input rate to 48K.  In my case I had CD's ripped so I needed to change the 44.1K to 48K.  The confusing things was just that MC for Windows pops up an error about the sample rate issue whereas the *nix version doesn't seem to.  No big deal.

Thank You Thank You Thank You bob!
Logged

Sammy

  • Regular Member
  • Recent member
  • *
  • Posts: 16
  • nothing more to say...
Re: Unable to Select Bluetooth Speaker on Raspberry PI
« Reply #10 on: December 15, 2018, 05:04:37 am »

I spoke too fast in terms of JRiver Media Center outputting to the default ALSA device and having it output to whatever is selected as the default output under the speaker.  JRiver goes deeper and so you must actually add the configuration section to /usr/share/alsa/alsa.conf.d/20-bluealsa.conf.  I am guessing this has something to do with avoiding any mixing that might be done. 
Logged

bob

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 13870
Re: Unable to Select Bluetooth Speaker on Raspberry PI
« Reply #11 on: December 17, 2018, 11:10:12 am »

I spoke too fast in terms of JRiver Media Center outputting to the default ALSA device and having it output to whatever is selected as the default output under the speaker.  JRiver goes deeper and so you must actually add the configuration section to /usr/share/alsa/alsa.conf.d/20-bluealsa.conf.  I am guessing this has something to do with avoiding any mixing that might be done.
Interesting, thanks for the update.
Logged
Pages: [1]   Go Up