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

Unfortunately the right hand side of the lines is missing, and so I can't see all the information, but I think I can see enough. The launch test has completed earlier in the startup than it should. This is because mpd appears to be running
before it is started as a service

Code:
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]:   764 ?        DL     0:00 mpd -


[This line is longer than printed. If you view the log with 'journalctl -u mpd_oled.service -b | less' you will be able to see the end of this line.]

Something is running mpd by name, i.e. without a path. In my log mpd is run like this

Code:
May 04 17:22:36 moode mpd_oled_launch_test[282]:   673 ?        Rs     0:00 /usr/local/bin/mpd --no-daemon /etc/mpd.conf

Reviewing the Moode code I found

Code:
//
workerLog('worker: -- System');
//

// Store platform data
playerSession('write', 'hdwrrev', getHdwrRev());
$mpdver = explode(" ", strtok(shell_exec('mpd -V | grep "Music Player Daemon"'),"\n"));

And you can see from your logs that this is where mpd_oled was run

Code:
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 think it is likely that this is the issue. Sometimes the script test will run at the same time as this command, which will cause it to succeed early, and mpd_oled will fail to start. I'll look into a fix for the launch test script, but for now you could probably load the ALSA loopback module at boot by adding 'snd-aloop' to '/etc/modules'.

Adrian.
Reply
Hi officialsm

The module name should use a hyphen

Code:
sudo modprobe snd-aloop

EDIT: I see the suggestion is to use snd_aloop, and this also completes for me without error. Check if the module is loaded with 'lsmod | grep snd_aloop'

Adrian.
Reply
(05-03-2021, 10:18 AM)adrii Wrote: 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.

Adrian,
I have some difficulties to install it from scratch: would you please be so kind to help me?
Best regards and thanks,
Francesco
Reply
Hi Francesco

I am not sure if you have a custom setup, but the general steps are as follows.

If you are using the binary package then uninstall it: https://github.com/antiprism/mpd_oled/bl...#uninstall

Review '/etc/asound.conf' and remove any changes made for mpd_oled if they are no longer needed

Follow the instructions for installing from source: https://github.com/antiprism/mpd_oled/bl..._source.md

Where it says to run
Code:
git clone https://github.com/antiprism/mpd_oled
cd mpd_oled

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

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

Unfortunately the right hand side of the lines is missing, and so I can't see all the information, but I think I can see enough. The launch test has completed earlier in the startup than it should. This is because mpd appears to be running
before it is started as a service

Code:
May 04 14:25:31 Simoode-audio mpd_oled_launch_test[373]:   764 ?        DL     0:00 mpd -


[This line is longer than printed. If you view the log with 'journalctl -u mpd_oled.service -b | less' you will be able to see the end of this line.]

Something is running mpd by name, i.e. without a path. In my log mpd is run like this

Code:
May 04 17:22:36 moode mpd_oled_launch_test[282]:   673 ?        Rs     0:00 /usr/local/bin/mpd --no-daemon /etc/mpd.conf

Reviewing the Moode code I found

Code:
//
workerLog('worker: -- System');
//

// Store platform data
playerSession('write', 'hdwrrev', getHdwrRev());
$mpdver = explode(" ", strtok(shell_exec('mpd -V | grep "Music Player Daemon"'),"\n"));

And you can see from your logs that this is where mpd_oled was run

Code:
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 think it is likely that this is the issue. Sometimes the script test will run at the same time as this command, which will cause it to succeed early, and mpd_oled will fail to start. I'll look into a fix for the launch test script, but for now you could probably load the ALSA loopback module at boot by adding 'snd-aloop' to '/etc/modules'.

Adrian.

Ok added to /etc/modules. Please when new installation script will be ready notify me in order to make new installation.
Thank you so much helping me.
Reply
Hi officialsm

I have made a new launch test for mpd_oled on Moode. If you would like to test it then remove 'snd-aloop' from '/etc/modules', and 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"
   # wait for worker to start to ensure start flag is set to 0
   until ps -C worker.php > /dev/null; do
      sleep 2
   done
   sleep 1     # extra time allow to set flag
   until test $(moodeutl -q "select value from cfg_system where param='wrkready'") = "1"; do
      sleep 4
   done

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

If this is working for you I will update the mpd_oled repository with the change.

Thank you for reporting the issue, and all your help to track down the cause!

Adrian.
Reply
Hi Adrian,
there is a problem related to pluhw: as you remember some time ago I had the problem "MPD error - Failed to open "ALSA Default" (alsa); Error opening ALSA device "_audioout"; snd_pcm_hw_params_set_buffer_time_near() failed: Invalid argument"; the same problem raises after changing "_sndaloop.conf" with some input codec (Jazz24.com -problem / WQXR - no problem).
About the other problem it seems solved with the "wait for play" you have implemented.
Tomorrow I will continue with the tests.
Best regards and thanks,
Francesco
Reply
(05-04-2021, 07:14 PM)adrii Wrote: Hi officialsm

I have made a new launch test for mpd_oled on Moode. If you would like to test it then remove 'snd-aloop' from '/etc/modules', and 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"
   # wait for worker to start to ensure start flag is set to 0
   until ps -C worker.php > /dev/null; do
      sleep 2
   done
   sleep 1     # extra time allow to set flag
   until test $(moodeutl -q "select value from cfg_system where param='wrkready'") = "1"; do
      sleep 4
   done

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

If this is working for you I will update the mpd_oled repository with the change.

Thank you for reporting the issue, and all your help to track down the cause!

Adrian.

Thank you I will use it for a week so i will let you know
Reply
Hi Francesco

Thanks for the feedback on the fix. I'll check it on Volumio, and then I'll update the repository.

Regarding your ALSA problem, I have the default _sndaloop.conf with 'type route' and 'hw:Loopback'
Code:
pcm.!_audioout {
    type route
    slave.pcm {
        type multi
        slaves {
            a { channels 2 pcm "_deviceout" }       # Original output
            b { channels 2 pcm "hw:Loopback,0" }    # Loopback output

And I am running mpd_oled with the start-cava-on-play fix and plughw:Loopback


Code:
/usr/local/bin/mpd_oled -o 6 -b 21 -g 1 -f 20 -c alsa,plughw:Loopback,1

And the Jazz24 radio station is working fine for me.

Adrian.
Reply
(05-05-2021, 05:47 AM)adrii Wrote: Hi Francesco

Thanks for the feedback on the fix. I'll check it on Volumio, and then I'll update the repository.

Regarding your ALSA problem, I have the default _sndaloop.conf with 'type route' and 'hw:Loopback'
Code:
pcm.!_audioout {
    type route
    slave.pcm {
        type multi
        slaves {
            a { channels 2 pcm "_deviceout" }       # Original output
            b { channels 2 pcm "hw:Loopback,0" }    # Loopback output

And I am running mpd_oled with the start-cava-on-play fix and plughw:Loopback


Code:
/usr/local/bin/mpd_oled -o 6 -b 21 -g 1 -f 20 -c alsa,plughw:Loopback,1

And the Jazz24 radio station is working fine for me.

Adrian.

Hi Adrian,
For the Alsa: I took that if the mpd_oled has lounched with plughw, the file that create the output had to be chance to plughw too. Clearly it is not.
I will continue the tests with the sndaloop unmodified.
Thanks and regards,
Francesco
Reply


Forum Jump: