Thank you for your donation!


Instruction Guide 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi
(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
Hello Adrian,
Probably I have found how to replicate the ALSA problem.
If all the following parameter are in the related setting, I have the problem.

1. Audio Config    -->    I2S Audio Device  -->   Named device      set to    None
2. Audio Config    -->    ALSA Options       -->   ALSA loopback     set to    ON
3. MPD Config      -->    Audio output       -->   Output device       set to    Pi Headphone jack
4. An input stream at the rate of 44.1 kHz.

The last condition can be emulated with the SoX "ON" at any "bit deepth"and at 44.1 kHz or using Jazz24.0rg station.

I am not sure that this is the only condition, but I am sure that it is one condition that give always the following error:
MPD error - Failed to open "ALSA Default" (alsa); Error opening ALSA device "_audioout"; snd_pcm_hw_params_set_buffer_time_near() failed: Invalid argument.

This is not an issue related to mpd_oled but, as you remember, it has been an error raised during the mpd_oled tests.

Best regards and thanks,
Francesco
P.S.: do you think that I have to write this on the 7.2 thread?
Reply
Hi Francesco

Moode 7.2.1 is going to change the playback device to use plughw rather than hw, which might help with the issue you are seeing. If you want to try it now, edit '/etc/alsa/conf.d/_deviceout.conf' and set the slave.pcm line to use plughw rather than hw.

Adrian.
Reply
Upgrade to Moode 7.1

I had an issue with the upgrade.

'/etc/modules' is reset, so if you are using an I2C OLED then edit '/etc/modules/' and add 'i2c-dev' to the file again.

The spectrum was not working for me. I am not sure of the exact steps to fix this but, possibly, stop mpd_oled


Code:
sudo systemctl stop mpd_oled

In Configure / Audio / ALSA options turn the loopback to OFF and click on SET, then turn it to ON and click on SET. Then start mpd_oled again


Code:
sudo systemctl start mpd_oled


Adrian.
Reply
(Yesterday, 06:37 AM)adrii Wrote: Upgrade to Moode 7.1

I had an issue with the upgrade.

'/etc/modules' is reset, so if you are using an I2C OLED then edit '/etc/modules/' and add 'i2c-dev' to the file again.

The spectrum was not working for me. I am not sure of the exact steps to fix this but, possibly, stop mpd_oled


Code:
sudo systemctl stop mpd_oled

In Configure / Audio / ALSA options turn the loopback to OFF and click on SET, then turn it to ON and click on SET. Then start mpd_oled again


Code:
sudo systemctl start mpd_oled


Adrian.

Hello Adrian,
after update 7.2.0 to 7.2.1 and following the instructions from you, the oled works again ...
Great work from you ...
Reply


Forum Jump: