Moode Audio Player for Raspberry Pi

Further to this if the moOde developers added MQTT support (they just need the library and a form for the MQTT broker), every time moOde performed an action like Vol up/down, next track, track name, stop, end PL, etc it could send the message to the broker and from there the sky is the limit.

Lookup singer.
Do some thing funky with an LED strip.
Lower the lights.
Start the the roomba.
Open the blinds.

Try turning on the Metadata file and LCD update engine in System config. The metadata file is updated with UI and playback state information and the LCD update engine automatically executes a user written Python script when the metadata file changes.

Your Python script doesn't have to update an LCD, it can do whatever you want it to do based on information in the metadata file.

-Tim

It doesn't even have to be a Python script. Here's a brute-force-and-ignorance demonstration using the shell.

I installed MQTT broker and client packages (mosquitto and mosquitto-clients) in a moOde Player. (The mosquitto package installs and configures the mosquitto broker to run as a service) [1]

I wrote a shell script /home/pi/pub.sh
Code:
#!/bin/sh
/usr/bin/mosquitto_pub -t moode -f /var/local/www/currentsong.txt
chown'ed it root.root and chmod'ed it +x

In moOde, I turned on the Metadata file setting, pointed the LCD update engine to my shell script, and enabled the update engine.

Now, if I subscribe to the topic "moode" on the broker I get the currentsong data each time it updates. Note that the connection stays open; in the following I've shown just the first update.

Code:
kreed@T520 ~ $ mosquitto_sub -h moode -t moode
file=NAS/OMV-HC1/DBPowerAmp/Berlin Philharmonic Orchestra/Beethoven; Symphonie No. 9/01 Singverein der Gesellschaft der Musikfreunde - Symphony No. 9 in D minor ('Choral'), Op. 125; Allegro ma non troppo.flac
artist=Agnes Baltsa
album=Beethoven: Symphonie No. 9
title=Symphony No. 9 in D minor ("Choral"), Op. 125: Allegro ma non troppo
coverurl=/coverart.php/NAS%2FOMV-HC1%2FDBPowerAmp%2FBerlin%20Philharmonic%20Orchestra%2FBeethoven%3B%20Symphonie%20No.%209%2F01%20Singverein%20der%20Gesellschaft%20der%20Musikfreunde%20-%20Symphony%20No.%209%20in%20D%20minor%20%28%27Choral%27%29%2C%20Op.%20125%3B%20Allegro%20ma%20non%20troppo.flac
track=1
date=1984
composer=Ludwig van Beethoven
encoded=16/44.1k FLAC
bitrate=123 kbps
volume=40
mute=0
state=play

While this demonstration just echoes the info on the current song provided by mpd, one could do more, like use the mpd call-back mechanism to get changes in mpd status. Ah, but there's the rub. Who wants what information? What should the topics be? What should the messages be? How should they be encoded? The pub-sub software pattern is totally generic. It's up to the user to decide the topics and the semantics and syntax of the messages. Then the clients have to be written to work with these decisions. [2]

I'm having a hard time imagining a configuration form in moOde which would cover everyone's use case. But now that you see how easy it is to get started, have a go at a personalized implementation. It's fun. Let us know if you get the Roomba to dance to the tunes:)

Regards,
Kent

[1] be careful with info you find on the Web; much of it is out of date. Now that mosquitto and debian stretch have been reconciled, a simple apt-get install will do.
[2] in case you can't tell, I still bear the scars of some ambitious pub-sub projects which proved the old adage "too many cooks spoil the pot".
 
Jes Relaxin'
 

Attachments

  • moode-r41-jesrelaxin.png
    moode-r41-jesrelaxin.png
    500.7 KB · Views: 337
Hi Tim etc.

Can I add my voice to Mr190E (post 13674).

I used the automated build on 7th Feb for a Pi3 which built fine and still runs well (Stetch Lite downloaded 6th Feb, Pi3 using BT to speaker).

I tried to build a Pi Zero W image with automated builder on 8th of Feb to replace my test Pi3. This ran well before switching radio stations caused it to crash irreversibly. Imaged from back up and similar problem after 4-5hrs running.

Have now rebuilt with automated build 3 times on Pi zero W and although it starts up it fails when trying to confirm almost any change in the settings. I.e. the first time I try to make a setting change.

I have had it crash to unresponsive trying to confirm WiFi access, trying to request a search for BT devices and just trying to switch BT on. A reboot does not clear the problem. If anything it is worse after reboot as often won't load Web interface.

Was anything changed in the automated download between 7th and 8th Feb?

If we can fix this I will deffjnarely donate as I can see 3-4 of these on Pi zeros with BT or hats around the home.

Tried to post on this before but have narrowed the problem a little now.

Frank
 
Hi Tim etc.

Can I add my voice to Mr190E (post 13674).

I used the automated build on 7th Feb for a Pi3 which built fine and still runs well (Stetch Lite downloaded 6th Feb, Pi3 using BT to speaker).

I tried to build a Pi Zero W image with automated builder on 8th of Feb to replace my test Pi3. This ran well before switching radio stations caused it to crash irreversibly. Imaged from back up and similar problem after 4-5hrs running.

Have now rebuilt with automated build 3 times on Pi zero W and although it starts up it fails when trying to confirm almost any change in the settings. I.e. the first time I try to make a setting change.

I have had it crash to unresponsive trying to confirm WiFi access, trying to request a search for BT devices and just trying to switch BT on. A reboot does not clear the problem. If anything it is worse after reboot as often won't load Web interface.

Was anything changed in the automated download between 7th and 8th Feb?

If we can fix this I will deffjnarely donate as I can see 3-4 of these on Pi zeros with BT or hats around the home.

Tried to post on this before but have narrowed the problem a little now.

Frank

I see you have been experimenting with Bluetooth...I had a Bluetooth related lockup and solved it here....
Moode Audio Player for Raspberry Pi

Ymmv
 
I have upgraded to 4.0. Everything is working fine.
I had some trouble after changing theme on my Android 6.0 device where the old theme was still visible in Chrome, despite clearing cache and cookies for the specific site. It seems to have solved that on its own.

At times, the playback seems to be pausing briefly - as if it cannot handle the bandwidth. Now I changed my router to see if that helps.


When I do a "Check for software update", I find a link to Download image builder. What is the purpose of that? Should I download the image builder now or later?
 
Drone

Thanks for the comment. I don't think it is BT related issue. I don't even get that far on the later bud attempts.

New install connected via ethernetvusb on Pi0w -> settings -> network -> add ssid and password --> Apply settings > system locks/interface hangs

Can reboot from ssh but settings are not saved and then trying to use any of the settings menu causes a hang.

Frank
 
Hello Tim
I think i got a bug on the new squeezelite option. While picoreplayer display the album cover, moode does not seem to do so. I was so happy to be able to connect my rpi / kali / mamboberry to my tv to display what was playing ... but i only got a squeelite logo.
Is it something already reported ?

Best regarrds and many thanks for the good work

Alain
 
When i use Moode as AP, moode.log show waiting for wlan0 ip , then failed to start hostapd.
After fiddling around, i add nohook wpasupplicant to /etc/dhcpcd.conf , i can start using hostapd

Hi,

This param is used just for just for AP mode, correct?

nohook wpa_supplicant # don't call the wpa_supplicant hook

There must have been some change in dhcpcd from 9.1 to 9.3 Raspbian. I'll investigate.

-Tim
 
Hello Tim
I think i got a bug on the new squeezelite option. While picoreplayer display the album cover, moode does not seem to do so. I was so happy to be able to connect my rpi / kali / mamboberry to my tv to display what was playing ... but i only got a squeelite logo.
Is it something already reported ?

Best regarrds and many thanks for the good work

Alain

Hi Alain,

The only renderers that show album art in moOde are Airplay and UPnP. Neither Bluetooth nor Squeezelite provide an album art API.

-Tim
 
First, thanks Tim for all the effort you put into Moode!

I have been using Moode 3.7 for several months without issues. I use a Marantz NA11S1 usb dac. When Moode 3.8 was released, I tried that version as well, but the Marantz dac was clicking a lot, so I went back to 3.7.
After I saw Moode 4.0 was released I gave it another try. Installing/building was successful but the Pi freezes random and I notice a click sometimes.

Tried already:
- new power supply (original PS)
- new SD card (brand)
- even a new RPI3
- used several kernels 4.9.x and 4.14.x
- underclocked RPI3 to 1000Mhz

This was all without success.
At one moment I saw an "Oops" message on the connected HDMI screen, but there is nothing in the log files because I need to power off/on the Pi after a freeze.

I really like to run 4.0 because I think it sounds better then 3.7.

Any idea's.
 
Hi Tim,


Here is the output. Looks ok to me.


pi@raspberrypi4:~ $ mosbrief
// STEP 2 - Direct build so no need to expand Root partition
// STEP 3A - Install core packages
// STEP 3B - Install core packages
// STEP 4 - Install enhanced networking
** Compile bluez-alsa
// STEP 5 - Install Rotary encoder driver
** Compile WiringPi
** Compile rotary encoder driver
// STEP 6 - Compile and install MPD
// STEP 7 - Create moOde runtime environment
// STEP 8 - Install moOde sources and configs
// STEP 9 - Alsaequal
** STEP 10 - Squashfs option not selected
** STEP 11 - Latest kernel option not selected
// STEP 12 - Launch and configure moOde!
// STEP 13 - Final prep for image
// COMPONENT 1 - MiniDLNA
// COMPONENT 2 - Auto-shuffle
// COMPONENT 3 - MPD Audio Scrobbler
// COMPONENT 4 - Shairport-sync
// COMPONENT 5 - Squeezelite
// COMPONENT 6 - Upmpdcli
** Compile Libupnp jfd5
** Compile Libupnpp
** Compile Upmpdcli
** Compile Upexplorer
// COMPONENT 7 - Optionally install gmusicapi
// COMPONENT 8 - Local UI display
// COMPONENT 9 - Allo Piano 2.1 Firmware
// END
pi@raspberrypi4:~ $ cat /var/log/moode.log
20180213 134755 worker: - Start
20180213 134756 worker: Successfully daemonized
20180213 134756 worker: - Init
20180213 134756 worker: Session loaded
20180213 134756 worker: Debug logging (off)
20180213 134757 worker: Host (raspberrypi4)
20180213 134757 worker: Hdwr (Pi-3B 1GB v1.2)
20180213 134757 worker: Arch (armv7l)
20180213 134757 worker: Kver (4.14.18-v7+)
20180213 134757 worker: Ktyp (Standard)
20180213 134757 worker: Gov (performance)
20180213 134757 worker: Rel (Moode 4.0 2018-01-26)
20180213 134757 worker: Upd (None)
20180213 134757 worker: MPD (0.20.17)
20180213 134757 worker: USB boot enabled
20180213 134758 worker: File system expanded
20180213 134758 worker: HDMI port on
20180213 134758 worker: File check ok
20180213 134758 worker: - Network
20180213 134758 worker: eth0 exists
20180213 134758 worker: eth0 (192.168.2.41)
20180213 134758 worker: wlan0 exists
20180213 134758 worker: wlan0 SSID is blank
20180213 134758 worker: eth0 addr exists, AP mode not started
20180213 134758 worker: wlan0 address not assigned
20180213 134758 worker: - Audio
20180213 134758 worker: ALSA outputs unmuted
20180213 134758 worker: Audio output (USB audio device)
20180213 134758 worker: ALSA mixer name (PCM)
20180213 134758 worker: MPD volume control (disabled)
20180213 134758 worker: Hdwr volume controller exists
20180213 134758 worker: - Services
20180213 134801 worker: MPD started
20180213 134801 worker: MPD scheduler policy (time-share)
20180213 134801 worker: MPD output 1 ALSA default (on)
20180213 134801 worker: MPD output 2 ALSA crossfeed (off)
20180213 134801 worker: MPD output 3 ALSA parametric eq (off)
20180213 134801 worker: MPD output 4 ALSA graphic eq (off)
20180213 134801 worker: MPD crossfade (off)
20180213 134801 worker: UPnP renderer started
20180213 134801 worker: - Last
20180213 134801 worker: USB sources (none attached)
20180213 134801 worker: NAS sources (mountall initiated)
20180213 134801 worker: Volume level (0) restored
20180213 134801 worker: Maintenance interval (21600)
20180213 134801 worker: Watchdog started
20180213 134801 worker: Ready
pi@raspberrypi4:~ $
 
I was able to retrieve this also (running kernel 4.14.18 during one of my tests):


Feb 12 00:51:41 raspberrypi4 kernel: [84728.185551] Unable to handle kernel NULL pointer dereference at virtual address 000000c0
Feb 12 00:51:41 raspberrypi4 kernel: [84728.188159] pgd = b6bcc000
Feb 12 00:51:41 raspberrypi4 kernel: [84728.189448] [000000c0] *pgd=36be5835, *pte=00000000, *ppte=00000000
Feb 12 00:51:41 raspberrypi4 kernel: [84728.190894] Internal error: Oops: 17 [#1] SMP ARM
Feb 12 00:51:41 raspberrypi4 kernel: [84728.192238] Modules linked in: snd_usb_audio snd_hwdep snd_usbmidi_lib snd_rawmidi snd_seq_device brcmfmac brcmutil cfg80211 rfkill snd_soc_bcm2835_i2s snd_bcm2835(C) snd_soc_cor
e i2c_bcm2835 snd_compress snd_pcm_dmaengine snd_pcm snd_timer snd uio_pdrv_genirq uio fixed ip_tables x_tables ipv6
Feb 12 00:51:41 raspberrypi4 kernel: [84728.198161] CPU: 0 PID: 754 Comm: io Tainted: G C 4.14.18-v7+ #1093
Feb 12 00:51:41 raspberrypi4 kernel: [84728.201242] Hardware name: BCM2835
Feb 12 00:51:41 raspberrypi4 kernel: [84728.202778] task: b9100000 task.stack: ae00a000
Feb 12 00:51:41 raspberrypi4 kernel: [84728.204316] PC is at skb_release_head_state+0x48/0x140
Feb 12 00:51:41 raspberrypi4 kernel: [84728.205870] LR is at skb_release_all+0x1c/0x34
Feb 12 00:51:41 raspberrypi4 kernel: [84728.207408] pc : [<80655c58>] lr : [<80655d6c>] psr: 20000013
Feb 12 00:51:41 raspberrypi4 kernel: [84728.208985] sp : ae00be60 ip : ae00be78 fp : ae00be74
Feb 12 00:51:41 raspberrypi4 kernel: [84728.210555] r10: 00000008 r9 : af87a8e0 r8 : 00000000
Feb 12 00:51:41 raspberrypi4 kernel: [84728.212127] r7 : 0010fe18 r6 : b93e86dc r5 : 00000000 r4 : b6bfdf00
Feb 12 00:51:41 raspberrypi4 kernel: [84728.213712] r3 : 000005b4 r2 : 01793316 r1 : bab53f94 r0 : 000000c0
Feb 12 00:51:41 raspberrypi4 kernel: [84728.215307] Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
Feb 12 00:51:41 raspberrypi4 kernel: [84728.216896] Control: 10c5383d Table: 36bcc06a DAC: 00000055
Feb 12 00:51:41 raspberrypi4 kernel: [84728.218450] Process io (pid: 754, stack limit = 0xae00a210)
Feb 12 00:51:41 raspberrypi4 kernel: [84728.220029] Stack: (0xae00be60 to 0xae00c000)
Feb 12 00:51:41 raspberrypi4 kernel: [84728.221584] be60: 000005b4 b6bfdf00 ae00be8c ae00be78 80655d6c 80655c1c 000005b4 b6bfdf00
Feb 12 00:51:41 raspberrypi4 kernel: [84728.224693] be80: ae00bea4 ae00be90 80655da0 80655d5c 000005b4 b93e8640 ae00bed4 ae00bea8
Feb 12 00:51:41 raspberrypi4 kernel: [84728.227809] bea0: 806c5d80 80655d90 00000008 806f0cc8 806f0c9c b93e8640 af87a8c0 b9df6110
Feb 12 00:51:41 raspberrypi4 kernel: [84728.230936] bec0: afbbd660 00000000 ae00beec ae00bed8 806f0cf0 806c5a60 af87a8c0 00000000
Feb 12 00:51:41 raspberrypi4 kernel: [84728.234162] bee0: ae00bf04 ae00bef0 806499bc 806f0ca8 b9253000 af87a8e0 ae00bf14 ae00bf08
Feb 12 00:51:41 raspberrypi4 kernel: [84728.237572] bf00: 80649a64 80649998 ae00bf54 ae00bf18 8028b210 80649a54 00000000 00000000
Feb 12 00:51:41 raspberrypi4 kernel: [84728.241177] bf20: 8028b3b4 b9253008 b9100528 00000000 b9100528 b9100000 b9100544 80c91dc4
Feb 12 00:51:41 raspberrypi4 kernel: [84728.244924] bf40: b9253000 00000000 ae00bf64 ae00bf58 8028b3cc 8028b180 ae00bf8c ae00bf68
Feb 12 00:51:41 raspberrypi4 kernel: [84728.248878] bf60: 8013b840 8028b3c0 ae00a000 ae00a010 80108224 ae00bfb0 80108224 ae00a000
Feb 12 00:51:41 raspberrypi4 kernel: [84728.252906] bf80: ae00bfac ae00bf90 8010b830 8013b790 6eb08d58 0000000a 76f3198c 00000006
Feb 12 00:51:41 raspberrypi4 kernel: [84728.257055] bfa0: 00000000 ae00bfb0 801080b4 8010b770 00000000 7146a264 00000002 00000000
Feb 12 00:51:41 raspberrypi4 kernel: [84728.261271] bfc0: 6eb08d58 0000000a 76f3198c 00000006 6eb00478 00000001 76f32048 00000000
Feb 12 00:51:41 raspberrypi4 kernel: [84728.265483] bfe0: 00000000 71469aa0 00000000 735b2474 80000010 0000000a 3abfa861 3abfac61
Feb 12 00:51:41 raspberrypi4 kernel: [84728.269703] [<80655c58>] (skb_release_head_state) from [<80655d6c>] (skb_release_all+0x1c/0x34)
Feb 12 00:51:41 raspberrypi4 kernel: [84728.273937] [<80655d6c>] (skb_release_all) from [<80655da0>] (__kfree_skb+0x1c/0x28)
Feb 12 00:51:41 raspberrypi4 kernel: [84728.278165] [<80655da0>] (__kfree_skb) from [<806c5d80>] (tcp_close+0x32c/0x4e0)
Feb 12 00:51:41 raspberrypi4 kernel: [84728.282389] [<806c5d80>] (tcp_close) from [<806f0cf0>] (inet_release+0x54/0x80)
Feb 12 00:51:41 raspberrypi4 kernel: [84728.284571] [<806f0cf0>] (inet_release) from [<806499bc>] (sock_release+0x30/0xbc)
Feb 12 00:51:41 raspberrypi4 kernel: [84728.288768] [<806499bc>] (sock_release) from [<80649a64>] (sock_close+0x1c/0x24)
Feb 12 00:51:41 raspberrypi4 kernel: [84728.292970] [<80649a64>] (sock_close) from [<8028b210>] (__fput+0x9c/0x1e8)
Feb 12 00:51:41 raspberrypi4 kernel: [84728.295121] [<8028b210>] (__fput) from [<8028b3cc>] (____fput+0x18/0x1c)
Feb 12 00:51:41 raspberrypi4 kernel: [84728.297251] [<8028b3cc>] (____fput) from [<8013b840>] (task_work_run+0xbc/0xe0)
Feb 12 00:51:41 raspberrypi4 kernel: [84728.299366] [<8013b840>] (task_work_run) from [<8010b830>] (do_work_pending+0xcc/0xd0)
Feb 12 00:51:41 raspberrypi4 kernel: [84728.303440] [<8010b830>] (do_work_pending) from [<801080b4>] (slow_work_pending+0xc/0x20)
Feb 12 00:51:41 raspberrypi4 kernel: [84728.307521] Code: e3500000 0a000009 f57ff05b f590f000 (e1902f9f)
Feb 12 00:51:41 raspberrypi4 kernel: [84728.309668] ---[ end trace 6c3b04a14607fb09 ]---
Feb 12 00:52:11 raspberrypi4 upmpdcli[764]: :2:src/mpdcli.cxx:147::mpd_run_stop(M_CONN) failed: Timeout
Feb 12 00:52:11 raspberrypi4 upmpdcli[764]: :2:libupnpp/device/device.cxx:355::UpnpDevice: Action failed: Stop code -911
Feb 12 00:52:41 raspberrypi4 upmpdcli[764]: :2:src/mpdcli.cxx:147::MPDCli::eek:penconn failed: Timeout
Feb 12 00:52:41 raspberrypi4 upmpdcli[764]: :2:src/mpdcli.cxx:191::MPDCli::updStatus: can't get status
Feb 12 00:52:41 raspberrypi4 upmpdcli[764]: :2:src/mpdcli.cxx:147::MPDCli::updStatus failed: Timeout
 
Hi @streamerguy,

moOde logs look ok but the kernel Oops which I believe is a page fault condition suggests a kernel bug or maybe bad OC/UC settings in config.txt.

I definitely wouldn't bump to the 4.14.y kernel branch. It caused a lot of odd problems when I tested it out. It usually takes months for the bugs to be shaken out of a new branch.

Two things to try would be:

1. Revert to kernel 4.9.80
sudo PRUNE_MODULES=1 rpi-update 5c80565c5c0c7f820258c792a98b56f22db2dd03
sudo rm -rf /lib/modules.bak
sudo rm -rf /boot.bak
sudo apt-get clean

2. Remove all OC/UC or other hand entered settings from /boot/config.txt and revert it to default. Same for cmdline.txt

/boot/config.txt

disable_splash=1
hdmi_drive=2
dtparam=i2c_arm=on
dtparam=i2s=on
dtparam=audio=on
#dtoverlay=pi3-disable-wifi
#dtoverlay=pi3-disable-bt

/boot/cmdlint.txt (all on a single line)
NOTE the PARTUUID may differ in your file

net.ifnames=0 dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=37665771-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait


-Tim
 
Last edited:
Hi Tim etc.

Can I add my voice to Mr190E (post 13674).

I used the automated build on 7th Feb for a Pi3 which built fine and still runs well (Stetch Lite downloaded 6th Feb, Pi3 using BT to speaker).

I tried to build a Pi Zero W image with automated builder on 8th of Feb to replace my test Pi3. This ran well before switching radio stations caused it to crash irreversibly. Imaged from back up and similar problem after 4-5hrs running.

Have now rebuilt with automated build 3 times on Pi zero W and although it starts up it fails when trying to confirm almost any change in the settings. I.e. the first time I try to make a setting change.

I have had it crash to unresponsive trying to confirm WiFi access, trying to request a search for BT devices and just trying to switch BT on. A reboot does not clear the problem. If anything it is worse after reboot as often won't load Web interface.

Was anything changed in the automated download between 7th and 8th Feb?

If we can fix this I will deffjnarely donate as I can see 3-4 of these on Pi zeros with BT or hats around the home.

Tried to post on this before but have narrowed the problem a little now.

Frank

I do not know if it will solve your problem but I found Moode uses a lot more memory in Pi Zero W than Pi 3 B. I had similar problems before, then I use htop to monitor processes in Pi Zero W then I found it ate all memory and trying to swapping memory from SD! It is not crashed but hangs there due to trashing. I then turned off almost every services: AirPlay, DLNA, ... and it became more stable. YMMV.
 
I do not know if it will solve your problem but I found Moode uses a lot more memory in Pi Zero W than Pi 3 B. I had similar problems before, then I use htop to monitor processes in Pi Zero W then I found it ate all memory and trying to swapping memory from SD! It is not crashed but hangs there due to trashing. I then turned off almost every services: AirPlay, DLNA, ... and it became more stable. YMMV.

Hi,

The article "Linux Ate My RAM" has good info on how to interpret memory utilization.
Help! Linux ate my RAM!

Here is snapshot of Pi-0W memory usage with Bluetooth, Airplay, UPnP and DLNA server on, and MPD database rescan is running to create file caching.

Code:
pi@rp2:~ $ free -mh
              total        used        free      shared  buff/cache   available
Mem:           434M         58M         28M         38M        347M        288M
Swap:            0B          0B          0B

If you can provide a scenario that creates an out of memory condition I'll try and repro it.

-Tim