Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Bluetooth - MPD Error - failed to open ALSA Bluetooth
#1
I have recently installed a fresh copy of moode (v 8.2.2 64 bit) on a new raspberry pi 4b v1.2 4gb. I would like to use this to stream audio to a bluetooth speaker but I cannot get bluetooth to work. The pi is on my local wifi network and I can access the moode web ui as expected. In settings I have turned on the bluetooth controller under renderers, set the pairing agent to yes and set speaker sharing to yes. Under the bluetooth controller options I have "mpd audio >bluetooth" selected. I can connect over bluetooth which I have determined from the "list" in the moode bluetooth controller page and the smartphone end.reports a successful connection too.

When I attempt playback of any of the included radio streams I get an error message in the moode web ui and no audio from the bluetooth speaker. The error says:

"MPD error
Failed to open "ALSA Bluetooth" (alsa); Failed to open ALSA device "_audioout": Invalid argument"

What have I  done wrong and how can I resolve this error? I am using the bluetooth onboard the raspberry pi, no other accessories are attached to the pi. The intended use case is to have moode audio sit as a web server on the local WLAN to be controlled over wifi via its web ui, from a smartphone, with moode playing audio out to a separate speaker connected by bluetooth.
Reply
#2
First, turn off the Speaker sharing option. It can result in no audio for outbound connections. It's an old option and obsolete at this point. It will not be part of upcoming 8.2.3. Reboot after making this change and then retry sending audio to the speaker.

After rebooting if the problem is still present then post the startup log to start troubleshooting "MPD error: Failed to open "ALSA Bluetooth" (alsa); Failed to open ALSA device "_audioout": Invalid argument".

Code:
moodeutl -l
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#3
Thanks for the quick response Tim. I tried a fresh install of the new 8.2.3 version and made the following changes after flashing the boot media:
(1) configure wifi (REDACTED) below is my WLAN SSID
(2) change the hostname to moode40 in the system menu
(3) under the renderers menu, turn on the bluetooth pairing agent and turn on the bluetooth controller
(4) in the bluetooth control menu, change the audio output to "bluetooth speaker"

Wondering if my speaker itself was part of the problem, I decide to pair a set of bluetooth headphones I know work. The pairing went as expected,  the device was listed in the moode bluetooth interface and the flashing led on the headphones indicated a successful pairing event. I then returned to the library and selected a radio station and pressed play. I get the same error as previously:


"MPD error

Failed to open "ALSA Bluetooth" (alsa); Failed to open ALSA device "_audioout": Invalid argument"

The code block below shows the output of moodutl -l. Does that suggest anything to you that I can investigate?

Should the line "20221219 200915 worker: MPD output 2 ALSA Bluetooth (Off)" say Bluetooth (On) at the end instead?

Code:
pi@moode40:~ $ moodeutl -l
20221219 200904 worker: --
20221219 200904 worker: -- Start moOde 8 series
20221219 200904 worker: --
20221219 200904 worker: Successfully daemonized
20221219 200907 worker: File check (OK)
20221219 200907 worker: Session vacuumed
20221219 200907 worker: Session loaded
20221219 200907 worker: Debug logging (OFF)
20221219 200907 worker: --
20221219 200907 worker: -- Audio debug
20221219 200907 worker: --
20221219 200907 worker: ALSA cards: (0:b1 | 1:Headphones | 2:empty | 3:empty
20221219 200907 worker: MPD config: (0:Pi HDMI 1 | mixer:(HDMI) | card:0)
20221219 200907 worker: ALSA mixer actual (HDMI)
20221219 200908 worker: ALSA HDMI volume set to (0%)
20221219 200908 worker: --
20221219 200908 worker: -- System
20221219 200908 worker: --
20221219 200909 worker: Host      (moode40)
20221219 200909 worker: moOde     (8.2.3 2022-12-18)
20221219 200909 worker: RaspiOS   (11.6)
20221219 200909 worker: Kernel    (5.15.76-v8+ #1597)
20221219 200909 worker: Platform  (Pi-4B 1.2 4GB)
20221219 200909 worker: ARM arch  (aarch64, 64-bit)
20221219 200909 worker: MPD ver   (0.23.11)
20221219 200909 worker: CPU gov   (ondemand)
20221219 200909 worker: USB boot  (enabled)
20221219 200909 worker: File sys  (expanded)
20221219 200909 worker: HDMI port (On)
20221219 200909 worker: Sys LED0  (On)
20221219 200909 worker: Sys LED1  (On)
20221219 200909 worker: --
20221219 200909 worker: -- Network
20221219 200909 worker: --
20221219 200909 worker: eth0 adapter exists
20221219 200909 worker: eth0 check for address (Off)
20221219 200909 worker: eth0 address not assigned
20221219 200909 worker: wlan0 adapter exists
20221219 200909 worker: wlan0 country (GB)
20221219 200909 worker: wlan0 trying configured SSID (REDACTED)
20221219 200909 worker: wlan0 check 0 for IP address
20221219 200911 worker: wlan0 check 1 for IP address
20221219 200913 worker: wlan0 connected SSID is (REDACTED)
20221219 200913 worker: IP addr (192.168.1.40)
20221219 200913 worker: Netmask (255.255.255.0)
20221219 200913 worker: Gateway (192.168.1.254)
20221219 200914 worker: Pri DNS (1.1.1.1)
20221219 200914 worker: Domain  ()
20221219 200914 worker: wlan0 power save disabled
20221219 200914 worker: apd0 router mode (Off)
20221219 200914 worker: --
20221219 200914 worker: -- Software update
20221219 200914 worker: --
20221219 200914 worker: Automatic check (Off)
20221219 200914 worker: --
20221219 200914 worker: -- Audio config
20221219 200914 worker: --
20221219 200914 worker: MPD conf updated
20221219 200914 worker: ALSA card number (0)
20221219 200914 worker: MPD audio output (Pi HDMI 1)
20221219 200914 worker: Audio formats (U8, S16_LE)
20221219 200914 worker: ALSA mixer name (HDMI)
20221219 200914 worker: MPD mixer type (hardware)
20221219 200914 worker: Hdwr volume controller exists
20221219 200914 worker: Max ALSA volume (100%)
20221219 200914 worker: ALSA output mode (Default: plughw)
20221219 200914 worker: ALSA loopback (Off)
20221219 200914 worker: Reset renderer active flags
20221219 200914 worker: CamillaDSP (off)
20221219 200914 worker: --
20221219 200914 worker: -- File sharing
20221219 200914 worker: --
20221219 200914 worker: SMB file sharing (Off)
20221219 200914 worker: NFS file sharing (Off)
20221219 200914 worker: --
20221219 200914 worker: -- MPD startup
20221219 200914 worker: --
20221219 200915 worker: MPD started
20221219 200915 worker: MPD accepting connections
20221219 200915 worker: MPD output 1 ALSA Default (On)
20221219 200915 worker: MPD output 2 ALSA Bluetooth (Off)
20221219 200915 worker: MPD output 3 HTTP Server (Off)
20221219 200915 worker: MPD crossfade (off)
20221219 200915 worker: MPD ignore CUE files (yes)
20221219 200915 worker: Default playlist loaded for first boot
20221219 200915 worker: --
20221219 200915 worker: -- Music sources
20221219 200915 worker: --
20221219 200915 worker: USB sources
20221219 200915 worker: No drives found
20221219 200915 worker: NAS sources
20221219 200915 worker: None configured
20221219 200915 worker: --
20221219 200915 worker: -- Feature availability
20221219 200915 worker: --
20221219 200915 worker: Input select (available)
20221219 200915 worker: Input (MPD)
20221219 200915 worker: Output (Pi HDMI 1)
20221219 200915 worker: Bluetooth (available)
20221219 200915 worker: AirPlay renderer (available)
20221219 200915 worker: Spotify renderer (available)
20221219 200915 worker: Squeezelite (available)
20221219 200915 worker: RoonBridge renderer (not installed)
20221219 200915 worker: Multiroom sender (available)
20221219 200915 worker: Multiroom receiver (available)
20221219 200915 worker: UPnP renderer (available)
20221219 200915 worker: DLNA server (available)
20221219 200915 worker: GPIO button handler (available)
20221219 200915 worker: Stream recorder (n/a)
20221219 200915 worker: HTTPS-Only mode (n/a)
20221219 200915 worker: --
20221219 200915 worker: -- Other
20221219 200915 worker: --
20221219 200915 worker: USB volume knob (Off)
20221219 200915 worker: USB auto-mounter (udisks-glue)
20221219 200915 worker: Saved MPD vol level (0)
20221219 200915 worker: Preamp volume level (0)
20221219 200915 worker: MPD volume level (0) restored
20221219 200915 worker: ALSA HDMI volume (0%)
20221219 200915 worker: Auto-play (Off)
20221219 200915 worker: LocalUI (Off)
20221219 200915 worker: CoverView toggle (Off)
20221219 200915 worker: On-screen keyboard (Off)
20221219 200915 worker: Library scope (all)
20221219 200915 worker: View reset to playback
20221219 200915 worker: Maintenance interval (360 minutes)
20221219 200915 worker: Screen saver activation (Never)
20221219 200915 worker: Session permissions (OK)
20221219 200915 worker: Mount monitor (Off)
20221219 200915 worker: Watchdog started
20221219 200915 worker: Ready
20221219 201335 worker: Job btsvc
20221219 201350 worker: Job btsvc
20221219 201435 worker: Job pairing_agent
20221219 201502 worker: Job pairing_agent
20221219 201509 worker: Job btsvc
Reply
#4
@trackman92

Fresh install of 8.2.3 working here...listening to a SomaFM channel via BT to a JBL Flip2 speaker as I type.

Note that "Bluetooth pairing agent" applies to incoming BT, like from a smartphone, not outgoing BT, like to a wireless speaker.

You mention pairing but say nothing about connecting. Both steps are necessary for pushing MPD output to a BT device.

Regards,
Kent
Reply
#5
(12-19-2022, 10:02 PM)TheOldPresbyope Wrote: @trackman92

Fresh install of 8.2.3 working here...listening to a SomaFM channel via BT to a JBL Flip2 speaker as I type.

Note that "Bluetooth pairing agent" applies to incoming BT, like from a smartphone, not outgoing BT, like to a wireless speaker.

You mention pairing but say nothing about connecting. Both steps are necessary for pushing MPD output to a BT device.

Regards,
Kent

Hi Kent,

For avoidance of doubt, I was not trying to imply anything was wrong with v8.2.3, rather that I decided to start over in case I had botched up the setup the first time round.

You are right, I failed to say I had connected the bluetooth device, I should have mentioned that. I did get a "bluetooth connected" message from the headphones after pressing the connect button in the moode interface.

I have managed to get the streaming working now. It seems the problem was not with bluetooth at all. I just tried a different audio source and that ones works. I am not sure why but the first few radio stations in the default list yield the alsa error message I mentioned in my last post. That error message doesn't make any sense to me and it seems unrelated, maybe the problem is a network issue on my end. Regardless, streaming some of the web radio links from moode to the headphones does work so the problem cannot be bluetooth otherwise none of them would work. Sorry for the confusion. Thank you for your help and thank you to Tim too.
Reply
#6
(12-19-2022, 10:29 PM)trackman92 Wrote:
(12-19-2022, 10:02 PM)TheOldPresbyope Wrote: @trackman92

Fresh install of 8.2.3 working here...listening to a SomaFM channel via BT to a JBL Flip2 speaker as I type.

Note that "Bluetooth pairing agent" applies to incoming BT, like from a smartphone, not outgoing BT, like to a wireless speaker.

You mention pairing but say nothing about connecting. Both steps are necessary for pushing MPD output to a BT device.

Regards,
Kent

Hi Kent,

For avoidance of doubt, I was not trying to imply anything was wrong with v8.2.3, rather that I decided to start over in case I had botched up the setup the first time round.

You are right, I failed to say I had connected the bluetooth device, I should have mentioned that. I did get a "bluetooth connected" message from the headphones after pressing the connect button in the moode interface.

I have managed to get the streaming working now. It seems the problem was not with bluetooth at all. I just tried a different audio source and that ones works. I am not sure why but the first few radio stations in the default list yield the alsa error message I mentioned in my last post. That error message doesn't make any sense to me and it seems unrelated, maybe the problem is a network issue on my end. Regardless, streaming  some of the web radio links from moode to the headphones does work so the problem cannot be bluetooth otherwise none of them would work. Sorry for the confusion. Thank you for your help and thank you to Tim too.

Interesting. Which radio stations caused the ALSA error. Maybe its a Bluetooth case that needs to be tested and debugged :-0

Also, the startup log (moodeutl -l) prints the value of the settings at reboot. When a setting is changed after startup it won't be reflected in that log and so you will see "MPD output 2 ALSA Bluetooth (Off)" instead of On.

To check the current state of settings you can query various SQL tables or the PHP session file.

Code:
# SQL
moodeutl -q "select * from cfg_system"

# Session
sudo moodeutl -d
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#7
I have now tried all 52 stations in the default list and the only one I can consistently reproduce an error message with is BBC Radio 1, a little ironic given I am in the UK. Unless someone else can reproduce the error it might just be an issue on my network. When I select the BBC station, and only for that one (others give audio as expected with no error message), I am now getting a slightly different error message which reads

"Failed to open "ALSA Bluetooth" (alsa); Error opening ALSA device "_audioout"; snd_pcm_hw_params() failed: Invalid argument"

I have bluetooth working for playing the other stations. And also for playing local attached media which is my intended use case which is now all working just fine.
Reply
#8
Is it the 320K station or the standard one?
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#9
@trackman92

I live in the USA and I just fired up BBC 1 on a moOde 8.2.3 player pushing Bluetooth output to a JBL Flip speaker. 

The playable URL displayed in the Audio information window is

http://a.files.bbci.co.uk/media/live/man...o_one.m3u8

and I'm listening to...um...interesting programming Tongue

I was about to say I have no idea why this might be happening for you but after several infrequent and random dropouts, oops, playback just went silent and this message popped up

Code:
Failed to open "ALSA Bluetooth" (alsa); Failed to open ALSA device "_audioout": No such device

At this point, the Bluetooth control page shows no  connection. The JBL speaker still shows up in the list of paired devices but I can't reestablish connection until after I reboot the player, after which playback to the JBL was restored "automagically".

The above URL ultimately leads to a series of transport streams. I cranked up the MPD error reporting and tried again. Pretty arcane output but some features such as this snippet suggest something wrong with the stream (at least so far as ffmpeg is concerned)

Code:
D: bluealsa-pcm.c:316: /org/bluealsa/hci0/dev_00_1D_DF_AA_27_37/a2dpsrc/sink: Starting
D: bluealsa-pcm.c:196: /org/bluealsa/hci0/dev_00_1D_DF_AA_27_37/a2dpsrc/sink: Waiting for first period of frames
D: bluealsa-pcm.c:200: /org/bluealsa/hci0/dev_00_1D_DF_AA_27_37/a2dpsrc/sink: IO thread resumed: 3
D: bluealsa-pcm.c:189: /org/bluealsa/hci0/dev_00_1D_DF_AA_27_37/a2dpsrc/sink: IO thread paused: 3
Dec 20 17:09 : ffmpeg/hls: skipping 1 segments ahead, expired from playlists
D: bluealsa-pcm.c:477: /org/bluealsa/hci0/dev_00_1D_DF_AA_27_37/a2dpsrc/sink: Prepared
D: bluealsa-pcm.c:316: /org/bluealsa/hci0/dev_00_1D_DF_AA_27_37/a2dpsrc/sink: Starting
D: bluealsa-pcm.c:196: /org/bluealsa/hci0/dev_00_1D_DF_AA_27_37/a2dpsrc/sink: Waiting for first period of frames
D: bluealsa-pcm.c:200: /org/bluealsa/hci0/dev_00_1D_DF_AA_27_37/a2dpsrc/sink: IO thread resumed: 3
D: bluealsa-pcm.c:189: /org/bluealsa/hci0/dev_00_1D_DF_AA_27_37/a2dpsrc/sink: IO thread paused: 3
Dec 20 17:20 : ffmpeg/hls: keepalive request failed for 'http://as-hls-ww-live.akamaized.net/pool_904/live/ww/bbc_radio_one/bbc_radio_one.isml/bbc_radio_one-audio%3d96000.norewind.m3u8' with error: 'Connection reset by peer' when parsing playlist
Dec 20 17:20 : ffmpeg/hls: skipping 18 segments ahead, expired from playlists
D: bluealsa-pcm.c:477: /org/bluealsa/hci0/dev_00_1D_DF_AA_27_37/a2dpsrc/sink: Prepared
D: bluealsa-pcm.c:316: /org/bluealsa/hci0/dev_00_1D_DF_AA_27_37/a2dpsrc/sink: Starting
D: bluealsa-pcm.c:196: /org/bluealsa/hci0/dev_00_1D_DF_AA_27_37/a2dpsrc/sink: Waiting for first period of frames
D: bluealsa-pcm.c:200: /org/bluealsa/hci0/dev_00_1D_DF_AA_27_37/a2dpsrc/sink: IO thread resumed: 3
D: bluealsa-pcm.c:189: /org/bluealsa/hci0/dev_00_1D_DF_AA_27_37/a2dpsrc/sink: IO thread paused: 3
D: bluealsa-pcm.c:477: /org/bluealsa/hci0/dev_00_1D_DF_AA_27_37/a2dpsrc/sink: Prepared
D: bluealsa-pcm.c:316: /org/bluealsa/hci0/dev_00_1D_DF_AA_27_37/a2dpsrc/sink: Starting
D: bluealsa-pcm.c:196: /org/bluealsa/hci0/dev_00_1D_DF_AA_27_37/a2dpsrc/sink: Waiting for first period of frames
D: bluealsa-pcm.c:200: /org/bluealsa/hci0/dev_00_1D_DF_AA_27_37/a2dpsrc/sink: IO thread resumed: 3
Dec 20 17:23 : ffmpeg/hls: skipping 5 segments ahead, expired from playlists
Dec 20 17:23 : ffmpeg/hls: skipping 1 segments ahead, expired from playlists
D: bluealsa-pcm.c:129: /org/bluealsa/hci0/dev_00_1D_DF_AA_27_37/a2dpsrc/sink: IO thread cleanup
Dec 20 17:32 : output: Failed to play on "ALSA Bluetooth" (alsa): snd_pcm_poll_descriptors_revents() failed: No such device
D: bluealsa-pcm.c:349: /org/bluealsa/hci0/dev_00_1D_DF_AA_27_37/a2dpsrc/sink: Stopping
D: bluealsa-pcm.c:432: /org/bluealsa/hci0/dev_00_1D_DF_AA_27_37/a2dpsrc/sink: Freeing HW
D: bluealsa-pcm.c:385: /org/bluealsa/hci0/dev_00_1D_DF_AA_27_37/a2dpsrc/sink: Closing
Dec 20 17:32 : exception: Failed to open audio output
 
I have no idea how this stream issue kills the Bluez-alsa code.

Kent
Reply
#10
(12-20-2022, 10:56 PM)TheOldPresbyope Wrote: I have no idea how this stream issue kills the Bluez-alsa code.

Hi Kent,

could it be BT goes to sleep (timed powersave...) because there's no audio incoming from the stream (due to those errors, I mean)? Just wandering wild here, but...
Reply


Forum Jump: