Moode Forum
[How to do instruction] 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi - Printable Version

+- Moode Forum (https://moodeaudio.org/forum)
+-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3)
+--- Forum: FAQ and Guides (https://moodeaudio.org/forum/forumdisplay.php?fid=9)
+--- Thread: [How to do instruction] 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi (/showthread.php?tid=155)



RE: 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi - Tim Curtis - 09-29-2022

(09-29-2022, 09:00 AM)DRONE7 Wrote: Aha.....I had forgotten that the  headphone output could be disabled....the things one lets slide lol.

I will try with  dtparam  audio=off  and see if that fixes it :-)

looks like that has done the trick...will try again tomorrow when i have the system running again.

Code:
aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM]
 Subdevices: 6/8
 Subdevice #0: subdevice #0
 Subdevice #1: subdevice #1
 Subdevice #2: subdevice #2
 Subdevice #3: subdevice #3
 Subdevice #4: subdevice #4
 Subdevice #5: subdevice #5
 Subdevice #6: subdevice #6
 Subdevice #7: subdevice #7
card 0: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM]
 Subdevices: 8/8
 Subdevice #0: subdevice #0
 Subdevice #1: subdevice #1
 Subdevice #2: subdevice #2
 Subdevice #3: subdevice #3
 Subdevice #4: subdevice #4
 Subdevice #5: subdevice #5
 Subdevice #6: subdevice #6
 Subdevice #7: subdevice #7
Quick trial without any HDMI connected and all seems to be fine!!  Got the spectrum analyser  and the title scrolling working.

That output shows only the Loopback device. There is no HDMI or Headphone audio device prolly because of audio=off.

What I've observed with Headphone or HDMI audio  + Loopback is that 44.1K rate will cause MPD playback error while other rates play fine. I've only been able to get 44.1K to work by setting SoX to Depth=Any, Rate=Something other than 44.1K


RE: 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi - DRONE7 - 09-29-2022

(09-29-2022, 10:25 AM)Tim Curtis Wrote:
(09-29-2022, 09:00 AM)DRONE7 Wrote: Aha.....I had forgotten that the  headphone output could be disabled....the things one lets slide lol.

I will try with  dtparam  audio=off  and see if that fixes it :-)

looks like that has done the trick...will try again tomorrow when i have the system running again.

Code:
aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM]
 Subdevices: 6/8
 Subdevice #0: subdevice #0
 Subdevice #1: subdevice #1
 Subdevice #2: subdevice #2
 Subdevice #3: subdevice #3
 Subdevice #4: subdevice #4
 Subdevice #5: subdevice #5
 Subdevice #6: subdevice #6
 Subdevice #7: subdevice #7
card 0: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM]
 Subdevices: 8/8
 Subdevice #0: subdevice #0
 Subdevice #1: subdevice #1
 Subdevice #2: subdevice #2
 Subdevice #3: subdevice #3
 Subdevice #4: subdevice #4
 Subdevice #5: subdevice #5
 Subdevice #6: subdevice #6
 Subdevice #7: subdevice #7
Quick trial without any HDMI connected and all seems to be fine!!  Got the spectrum analyser  and the title scrolling working.

That output shows only the Loopback device. There is no HDMI or Headphone audio device prolly because of audio=off.

What I've observed with Headphone or HDMI audio  + Loopback is that 44.1K rate will cause MPD playback error while other rates play fine. I've only been able to get 44.1K to work by setting SoX to Depth=Any, Rate=Something other than 44.1K
Just connected system to test and you are correct....back to the problem behaviour with no audio when loopback set and the error..
Code:
MPD error
Failed to open "ALSA Default" (alsa); Error opening ALSA device "_audioout"; snd_pcm_hw_params_set_buffer_time_near() failed: Invalid argument

Unfortunately the sox  workaround doesn't work for my AVR and I've abandoned HDMI and refitted a HiFiBerry Digi+-pro (after repairing it yet again !)   The oled is now working fine...
Code:
ExecStart=/usr/bin/mpd_oled  -o 6 -b 16 -g 1 -f 20 -s 20.0,2.0,10.0,5.0 -C 3 -c alsa,plughw:Loopback,1



RE: 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi - pioneersky - 11-13-2022

Want to start off with saying thank you so much for this work. This software is part of the reason I am sticking with Moode over Plexamp (just not there yet) that being said I like the playlists/radio stations Plexamp comes up with and often use it and send the airplay stream to my Moode Audio powered amp. Do you know is there any way to get metadata from airplay to display on this?


RE: 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi - TheOldPresbyope - 11-13-2022

Have a look at the shairport-sync GitHub repo. The basic plumbing exists for getting metadata from the Airplay stream. I've played a bit with it as I'm sure others have. OTOH I don't know of anyone successfully introducing the metadata into Tim's code.

Regards,
Kent


RE: 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi - adrii - 11-13-2022

Hi pioneersky

mpd_oled displays the song details reported by Moode, and so for mpd_oled to display Airplay metadata Moode would need to collect and report it.

Adrian.


RE: 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi - pioneersky - 11-15-2022

(11-13-2022, 09:51 PM)TheOldPresbyope Wrote: Have a look at the shairport-sync GitHub repo. The basic plumbing exists for getting metadata from the Airplay stream. I've played a bit with it as I'm sure others have. OTOH I don't know of anyone successfully introducing the metadata into Tim's code.

Regards,
Kent

Hmm will take a look thanks for the idea!


RE: 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi - fdealexa - 05-02-2023

Hi Adrian, hi all,
I encountered a difficulty with the new version of Moode (8.3.2).
I partially solved it by modifying the second test in the "mpd_oled_launch_test" script: I practically inserted "sleep 10" instead of the test on the "wrkready".
The symptom was practically a near "freeze" of the system.
Greetings and thanks in advance,
Francesco


RE: 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi - adrii - 05-03-2023

Hi Francesco

Thanks for the report. I'll take a look.

Adrian.


RE: 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi - adrii - 05-03-2023

Hi Francesco

I am able to reproduce the issue. For some reason Moode does not set the wrkready parameter to 1 (which indicates that Moode startup has completed) and so mpd_oled never starts. I wonder if there is some kind of deadlock, where Moode is now waiting for the mpd_oled service to start before signalling that the Moode startup is complete? I'll try to track down the source of the issue.

Adrian.


RE: 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi - Tim Curtis - 05-03-2023

(05-03-2023, 09:44 AM)adrii Wrote: Hi Francesco

I am able to reproduce the issue. For some reason Moode does not set the wrkready parameter to 1 (which indicates that Moode startup has completed) and so mpd_oled never starts. I wonder if there is some kind of deadlock, where Moode is now waiting for the mpd_oled service to start before signalling that the Moode startup is complete? I'll try to track down the source of the issue.

Adrian.

I just did a quick test and the 'wrlready' param is definitely set to 1 at the end of worker.php startup. You can verify this by running the command below.

Code:
moodeutl -q "select value from cfg_system where param='wrkready'"

The beginning of the startup sequence in worker.php has been changed though to wait for Linux startup to complete first before continuing with moOde startup. This "wait" is done to allow the the Pi Imager /boot/firstrun.sh script to complete and create any WiFi credentials entered by user. These are subsequently imported by worker.php at a later point in moOde startup.

Maybe this introduces a race condition issue for the code in mpd_oled startup that waits for 'wrkready' = 1 condition.

The "wait for Linux" code is at the top of worker.php.
Code:
.
.
pcntl_signal(SIGHUP, SIG_IGN);
workerLog('worker: Successfully daemonized');

// Check for login user ID
if (empty(getUserID())) {
    $logMsg = 'worker: ERROR: Login User ID does not exist, unable to continue';
    workerLog($logMsg);
    exit($logMsg . "\n");
}

// Check for Linux startup complete
workerLog('worker: Waiting for Linux startup...');
$maxLoops = 30;
$sleepTime = 6;
$linuxStartupComplete = false;
for ($i = 0; $i < $maxLoops; $i++) {
    $result = sysCmd('systemctl is-system-running');
    if ($result[0] == 'running' || $result[0] == 'degraded') {
        $linuxStartupComplete = true;
        break;
    } else {
        debugLog('worker: Wait ' . ($i + 1) . ' for Linux startup');
        sleep($sleepTime);
    }
}
if ($linuxStartupComplete === true) {
    workerLog('worker: Linux startup complete');
} else {
    $logMsg = 'worker: ERROR: Linux startup failed to complete after waiting ' . ($maxLoops * $sleepTime) . ' seconds';
    workerLog($logMsg);
    exit($logMsg . "\n");
}
.
.
.