Thank you for your donation!


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


Instruction Guide 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi
Hi officialsm

There was an issue that mpd_oled would not start when using the Moode ALSA loopback if MPD had not started.

Check if you have a recent copy of mpd_oled that includes the launch test script

Code:
pi@moode:~ $ which mpd_oled_launch_test 
/usr/bin/mpd_oled_launch_test

If not, install the latest mpd_oled and see if this fixes the issue.

However, if you do have this script then please post the contents of the mpd_oled service file

Code:
cat /etc/systemd/system/mpd_oled.service

Adrian.
Reply
(05-02-2021, 08:20 AM)adrii Wrote: Hi officialsm

There was an issue that mpd_oled would not start when using the Moode ALSA loopback if MPD had not started.

Check if you have a recent copy of mpd_oled that includes the launch test script

Code:
pi@moode:~ $ which mpd_oled_launch_test 
/usr/bin/mpd_oled_launch_test

If not, install the latest mpd_oled and see if this fixes the issue.

However, if you do have this script then please post the contents of the mpd_oled service file

Code:
cat /etc/systemd/system/mpd_oled.service

Adrian.

Yes i have launch test script:

pi@Simoode-audio:~ $ which mpd_oled_launch_test

/usr/bin/mpd_oled_launch_test


Here mped_oled.service output:

pi@Simoode-audio:~ $ cat /etc/systemd/system/mpd_oled.service
[Unit]
Description=MPD OLED Display

[Service]
ExecStartPre=/usr/bin/mpd_oled_launch_test
ExecStart=/usr/bin/mpd_oled  -o 6 -b 10 -g 1 -f 20 -c alsa,hw:Loopback,1

[Install]
WantedBy=multi-user.target
Reply
Hi officialsm

That all seems fine. Next time mpd_oled fails to start at boot please run the following command (before running any extra commands to start mpd_oled) and post the output

Code:
systemctl status mpd_oled

Adrian.
Reply
Hi Francesco

I have pushed a prospective fix to a separate branch for you to try (if you are using an mpd_oled package then uninstall it first with 'sudo apt remove mpd-oled'). It simply delays starting cava until the first time that music is playing.

To avoid confusion with any existing mpd_oled directories, I recommend that you clone the branch into a fresh directory with a different name (e.g. mpd_oled_test)

Code:
git clone -b start_cava_when_play https://github.com/antiprism/mpd_oled.git mpd_oled_test
cd mpd_oled_test

The only other instructions change is that the cava input is now plughw:Loopback,1 (rather than hw:Loopback,1).

If this doesn't fix the issue for you then please open an mpd_oled issue and I will investigate further.

Adrian.
Reply
(05-02-2021, 03:17 PM)adrii Wrote: Hi officialsm

That all seems fine. Next time mpd_oled fails to start at boot please run the following command (before running any extra commands to start mpd_oled) and post the output

Code:
systemctl status mpd_oled

Adrian.
Not oled is not started. Here command output

pi@Simoode-audio:~ $ systemctl status mpd_oled
● mpd_oled.service - MPD OLED Display
   Loaded: loaded (/etc/systemd/system/mpd_oled.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2021-05-03 11:21:14 CEST; 24h ago
  Process: 364 ExecStartPre=/usr/bin/mpd_oled_launch_test (code=exited, status=0/SUCCESS)
 Main PID: 798 (mpd_oled)
    Tasks: 2 (limit: 4915)
   CGroup: /system.slice/mpd_oled.service
           └─798 /usr/bin/mpd_oled -o 6 -b 10 -g 1 -f 20 -c alsa,hw:Loopback,1

May 03 11:20:53 Simoode-audio systemd[1]: Starting MPD OLED Display...
May 03 11:21:14 Simoode-audio systemd[1]: Started MPD OLED Display.
May 03 11:21:14 Simoode-audio mpd_oled[798]: Linux kernel module "snd_aloop" does not seem to  be loaded.
May 03 11:21:14 Simoode-audio mpd_oled[798]: Maybe run "sudo modprobe snd_aloop".
Reply
Hi officialsm

Thanks for the extra details. The error is clear, but unexpected. Are you using the Moode UI option to enable the audio copy (https://github.com/antiprism/mpd_oled/bl...-and-later)?

The launch test script checks that mpd is running before mpd_oled is started. When using the Moode configured audio copy Moode loads the ALSA loopback device before mpd is started, and so the loopback device should be available when mpd_oled starts. Here is my startup log


Code:
pi@moode:~ $ moodeutl -l
...

20210503 125650 worker: ALSA loopback (On)
20210503 125650 worker: Reset renderer active flags
20210503 125650 worker: CamillaDSP (off)
20210503 125650 worker: -- MPD startup
20210503 125651 worker: MPD started
20210503 125652 worker: MPD accepting connections
...

If you look at your startup log you should be able to see if the ALSA loopback device was loaded before mpd was started, and could also review it for any errors relating to this.

Adrian.
Reply
(05-04-2021, 10:44 AM)adrii Wrote: Hi officialsm

Thanks for the extra details. The error is clear, but unexpected. Are you using the Moode UI option to enable the audio copy (https://github.com/antiprism/mpd_oled/bl...-and-later)?

The launch test script checks that mpd is running before mpd_oled is started. When using the Moode configured audio copy Moode loads the ALSA loopback device before mpd is started, and so the loopback device should be available when mpd_oled starts. Here is my startup log


Code:
pi@moode:~ $ moodeutl -l
...

20210503 125650 worker: ALSA loopback (On)
20210503 125650 worker: Reset renderer active flags
20210503 125650 worker: CamillaDSP (off)
20210503 125650 worker: -- MPD startup
20210503 125651 worker: MPD started
20210503 125652 worker: MPD accepting connections
...

If you look at your startup log you should be able to see if the ALSA loopback device was loaded before mpd was started, and could also review it for any errors relating to this.

Adrian.

Here my moodeutl -l 

pi@Simoode-audio:~ $ moodeutl -l
20210503 112112 worker: -- Start
20210503 112112 worker: Successfully daemonized
20210503 112112 worker: Integrity check (passed)
20210503 112113 worker: File check (OK)
20210503 112113 worker: Session vacuumed
20210503 112113 worker: Session loaded
20210503 112113 worker: Debug logging (OFF)
20210503 112113 worker: -- Audio debug
20210503 112113 worker: ALSA cards: (0:b1 | 1:Headphones | 2:C20 | 3:empty
20210503 112113 worker: MPD config: (2:CA CXA81 2.0 | mixerSadPCM) | card:2)
20210503 112113 worker: ALSA mixer actual (PCM)
20210503 112113 worker: ALSA PCM volume set to (amixer: Unable to find simple control 'PCM',0)
20210503 112113 worker: -- System
20210503 112115 worker: Host     (Simoode-audio)
20210503 112115 worker: moOde    (7.2.0 2021-04-24)
20210503 112115 worker: RaspiOS  (10.6)
20210503 112115 worker: Kernel   (5.4.77-v7l+ #1371)
20210503 112115 worker: Platform (Pi-4B 1.1 4GB)
20210503 112115 worker: ARM arch (armv7l, 32-bit kernel)
20210503 112115 worker: MPD ver  (0.22.6_p0x3)
20210503 112115 worker: CPU gov  (ondemand)
20210503 112115 worker: USB boot not available
20210503 112115 worker: File system expanded
20210503 112115 worker: HDMI port on
20210503 112115 worker: -- Network
20210503 112115 worker: eth0 exists
20210503 112115 worker: eth0 wait 0 for IP address
20210503 112118 worker: eth0 wait 1 for IP address
20210503 112121 worker: eth0 wait 2 for IP address
20210503 112124 worker: eth0 wait 3 for IP address
20210504 120814 worker: eth0 wait 4 for IP address
20210504 120817 worker: eth0 address not assigned
20210504 120817 worker: wlan0 exists
20210504 120817 worker: wifi country (IT)
20210504 120817 worker: wlan0 trying SSID (Vodafonefederica)
20210504 120817 worker: IP addr (192.168.1.14)
20210504 120817 worker: Netmask (255.255.255.0)
20210504 120817 worker: Gateway (192.168.1.1)
20210504 120817 worker: Pri DNS (192.168.1.1)
20210504 120817 worker: Domain  (station)
20210504 120817 worker: Pi integrated wlan0 power save disabled
20210504 120817 worker: -- Audio config
20210504 120817 worker: ALSA card number (2)
20210504 120818 worker: MPD audio output (CA CXA81 2.0)
20210504 120818 worker: Audio formats (S16_LE, S32_LE, SPECIAL)
20210504 120818 worker: ALSA mixer name (PCM)
20210504 120818 worker: MPD volume control (none)
20210504 120818 worker: Hdwr volume controller not detected
20210504 120818 worker: ALSA loopback (On)
20210504 120818 worker: Reset renderer active flags
20210504 120818 worker: CamillaDSP (off)
20210504 120818 worker: -- MPD startup
20210504 120818 worker: MPD started
20210504 120819 worker: MPD accepting connections
20210504 120819 worker: MPD output 1 ALSA Default (on)
20210504 120819 worker: MPD output 2 ALSA Bluetooth (off)
20210504 120819 worker: MPD output 3 HTTP Server (off)
20210504 120819 worker: MPD crossfade (off)
20210504 120819 worker: MPD ignore CUE files (yes)
20210504 120819 worker: -- Feature availability
20210504 120819 worker: Source select (available)
20210504 120819 worker: Source select (source: MPD)
20210504 120819 worker: Source select (output: CA CXA81 2.0)
20210504 120819 worker: Bluetooth (available)
20210504 120819 worker: Airplay renderer (available)
20210504 120819 worker: Spotify renderer (available)
20210504 120819 worker: Squeezelite (available)
20210504 120819 worker: RoonBridge renderer (not installed)
20210504 120819 worker: UPnP renderer (available: started)
20210504 120819 worker: DLNA server (available)
20210504 120819 worker: UPnP browser (available)
20210504 120819 worker: GPIO button handler (available)
20210504 120819 worker: Stream recorder (n/a)
20210504 120819 worker: -- Music sources
20210504 120819 worker: USB sources (none attached)
20210504 120819 worker: NAS and UPnP sources (none configured)
20210504 120819 worker: -- Other
20210504 120819 worker: USB volume knob (Off)
20210504 120819 worker: Shellinabox SSH started
20210504 120819 worker: USB auto-mounter (udisks-glue)
20210504 120819 worker: LED0 (On)
20210504 120819 worker: LED1 (On)
20210504 120819 worker: Saved MPD vol level (0)
20210504 120819 worker: Preamp volume level (0)
20210504 120819 worker: MPD volume level (0) restored
20210504 120819 worker: ALSA volume level (None)
20210504 120819 worker: Auto-play (Off)
20210504 120819 worker: Maintenance interval (3 hours)
20210504 120819 worker: Screen saver activation (Never)
20210504 120819 worker: Session permissions (OK)
20210504 120819 worker: Watchdog started
20210504 120819 worker: Ready
Reply
Hi officialsm

Again, that all seems fine. In which case, I can think of two possibilities to test: 1. the launch test script is failing to wait until mpd has started, 2. mpd has started without the loopback device being loaded.

Could you replace the contents of '/usr/bin/mpd_oled_launch_test' with

Code:
#!/bin/bash

sysname="unknown"

moodeutl_path="/usr/local/bin/moodeutl"
volumio_path="/volumio"
raudio_path="/srv/http/command/rune_shutdown"

if test -f "$moodeutl_path" ; then
   sysname="moode"
   until ps -C mpd > /dev/null; do
      sleep 10
   done
   lsmod | grep snd
   ps ax | grep mpd
   moodeutl -l

elif test -f "$volumio_path" ; then
     sysname="volumio"
     until ps -C mpd > /dev/null; do
        sleep 10
     done
elif test -f "$raudio_path" ; then
     sysname="raudio"
     until ps -C mpd > /dev/null; do
        sleep 10
     done
fi

This will log whether mpd is running, and whether the loopback module is loaded, and whether the Moode log says the loopback device is loaded, all immediately before mpd_oled is started.

After updating the script, next time mpd_oled fails to start, please post the output of the following commands


Code:
systemctl status mpd_oled
journalctl -u mpd_oled.service -b

Adrian.
Reply
(05-04-2021, 12:04 PM)adrii Wrote: Hi officialsm

Again, that all seems fine. In which case, I can think of two possibilities to test: 1. the launch test script is failing to wait until mpd has started, 2. mpd has started without the loopback device being loaded.

Could you replace the contents of '/usr/bin/mpd_oled_launch_test' with

Code:
#!/bin/bash

sysname="unknown"

moodeutl_path="/usr/local/bin/moodeutl"
volumio_path="/volumio"
raudio_path="/srv/http/command/rune_shutdown"

if test -f "$moodeutl_path" ; then
   sysname="moode"
   until ps -C mpd > /dev/null; do
      sleep 10
   done
   lsmod | grep snd
   ps ax | grep mpd
   moodeutl -l

elif test -f "$volumio_path" ; then
     sysname="volumio"
     until ps -C mpd > /dev/null; do
        sleep 10
     done
elif test -f "$raudio_path" ; then
     sysname="raudio"
     until ps -C mpd > /dev/null; do
        sleep 10
     done
fi

This will log whether mpd is running, and whether the loopback module is loaded, and whether the Moode log says the loopback device is loaded, all immediately before mpd_oled is started.

After updating the script, next time mpd_oled fails to start, please post the output of the following commands


Code:
systemctl status mpd_oled
journalctl -u mpd_oled.service -b

Adrian.

Here output

pi@Simoode-audio:~ $ systemctl status mpd_oled

● mpd_oled.service - MPD OLED Display
   Loaded: loaded (/etc/systemd/system/mpd_oled.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2021-05-04 14:25:31 CEST; 2h 43min ago
  Process: 373 ExecStartPre=/usr/bin/mpd_oled_launch_test (code=exited, status=0/SUCCESS)
 Main PID: 784 (mpd_oled)
    Tasks: 2 (limit: 4915)
   CGroup: /system.slice/mpd_oled.service
           └─784 /usr/bin/mpd_oled -o 6 -b 10 -g 1 -f 20 -c alsa,hw:Loopback,1

May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: 20210504 142530 worker: Debug lo
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: 20210504 142530 worker: -- Audio
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: 20210504 142530 worker: ALSA car
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: 20210504 142530 worker: MPD conf
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: 20210504 142530 worker: ALSA mix
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: 20210504 142530 worker: ALSA PCM
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: 20210504 142530 worker: -- Syste
May 04 14:25:31 Simoode-audio systemd[1]: Started MPD OLED Display.
May 04 14:25:31 Simoode-audio mpd_oled[784]: Linux kernel module "snd_aloop" does not see
May 04 14:25:31 Simoode-audio mpd_oled[784]: Maybe run "sudo modprobe snd_aloop".

pi@Simoode-audio:~ $ journalctl -u mpd_oled.service -b

-- Logs begin at Tue 2021-05-04 14:25:07 CEST, end at Tue 2021-05-04 17:09:10 CEST. --
May 04 14:25:10 Simoode-audio systemd[1]: Starting MPD OLED Display...
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: snd_usb_audio         217088  1
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: snd_hwdep              16384  1
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: snd_usbmidi_lib        32768  1
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: snd_rawmidi            32768  1
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: snd_seq_device         16384  1
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: snd_soc_bcm2835_i2s    16384  0
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: snd_soc_core          200704  1
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: snd_compress           20480  1
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: snd_bcm2835            28672  2
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: snd_pcm_dmaengine      16384  1
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: snd_pcm                94208  5
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: snd_timer              32768  1
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: snd                    73728  16
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: mc                     40960  7
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]:   373 ?        Ss     0:00 /bin/
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]:   763 ?        S      0:00 sh -c
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]:   764 ?        DL     0:00 mpd -
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]:   771 ?        S      0:00 grep
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: 20210504 142528 worker: -- Start
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: 20210504 142528 worker: Successf
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: 20210504 142529 worker: Integrit
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: 20210504 142529 worker: File che
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: 20210504 142530 worker: Session
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: 20210504 142530 worker: Session
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: 20210504 142530 worker: Debug lo
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: 20210504 142530 worker: -- Audio
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: 20210504 142530 worker: ALSA car
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: 20210504 142530 worker: MPD conf
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: 20210504 142530 worker: ALSA mix
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: 20210504 142530 worker: ALSA PCM
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]: 20210504 142530 worker: -- Syste
May 04 14:25:31 Simoode-audio systemd[1]: Started MPD OLED Display.
May 04 14:25:31 Simoode-audio mpd_oled[784]: Linux kernel module "snd_aloop" does not see
May 04 14:25:31 Simoode-audio mpd_oled[784]: Maybe run "sudo modprobe snd_aloop".

i ran  "sudo modprobe snd_aloop"
Reply
after running "sudo modprobe snd_aloop" still not working
Reply


Forum Jump: