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 - adrii - 06-11-2021

Hi f.omar

If mpd_oled is installed as a service then check for errors with


Code:
systemctl status mpd_oled


If the screen is frozen then mpd_oled may have crashed. Check what is running before and after you play a song

Code:
ps ax | grep 'mpd_oled\|cava'


If mpd_oled is crashing: use the command above to make sure that mpd_oled is not running, then run it from the command line and check for any error messages when it crashes.
 
If mpd_oled is not crashing: start it again and run 

Code:
top

And check, before and after the freeze -- How much CPU mpd_oled/cava is using? Are other processes using a lot of CPU? How much memory is being used? Etc.

Also check all the wires are good. In your photo the wires are connected to a DAC board attached to the Pi. You could check that none of the pins you are using are reserved for use by the DAC.

Adrian.


RE: 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi - f.omar - 06-11-2021

(06-11-2021, 09:07 AM)adrii Wrote: Hi f.omar

If mpd_oled is installed as a service then check for errors with


Code:
systemctl status mpd_oled


Hi Adrii 
thanks for your help!


Before Play Song

pi@moode:~ $ systemctl status mpd_oled
● mpd_oled.service - MPD OLED Display
   Loaded: loaded (/etc/systemd/system/mpd_oled.service; enabled; vendor preset:
   Active: active (running) since Fri 2021-06-11 12:03:52 CEST; 28s ago
  Process: 6585 ExecStartPre=/usr/local/bin/mpd_oled_launch_test (code=exited, s
 Main PID: 6593 (mpd_oled)
    Tasks: 2 (limit: 2063)
   CGroup: /system.slice/mpd_oled.service
           └─6593 /usr/local/bin/mpd_oled -o 1 -b 10 -g 1 -f 20 -c alsa,hw:Loopb

Jun 11 12:03:51 moode systemd[1]: Starting MPD OLED Display...
Jun 11 12:03:52 moode systemd[1]: Started MPD OLED Display.



After Play Song

pi@moode:~ $ systemctl status mpd_oled
● mpd_oled.service - MPD OLED Display
   Loaded: loaded (/etc/systemd/system/mpd_oled.service; enabled; vendor preset:
   Active: active (running) since Fri 2021-06-11 12:03:52 CEST; 1min 27s ago
  Process: 6585 ExecStartPre=/usr/local/bin/mpd_oled_launch_test (code=exited, s
 Main PID: 6593 (mpd_oled)
    Tasks: 3 (limit: 2063)
   CGroup: /system.slice/mpd_oled.service
           └─6593 /usr/local/bin/mpd_oled -o 1 -b 10 -g 1 -f 20 -c alsa,hw:Loopb

Jun 11 12:03:51 moode systemd[1]: Starting MPD OLED Display...
Jun 11 12:03:52 moode systemd[1]: Started MPD OLED Display.
Jun 11 12:05:06 moode mpd_oled[6593]: open file /tmp/cava_fifo_6593 for writing
Jun 11 12:05:06 moode mpd_oled[6593]: Segmentation fault



Quote:If mpd_oled is crashing: use the command above to make sure that mpd_oled is not running, then run it from the command line and check for any error messages when it crashes.

pi@moode:~ $ ps ax | grep 'mpd_oled\|cava'
10350 ?        Rsl    0:09 /usr/local/bin/mpd_oled -o 1 -b 10 -g 1 -f 20 -c alsa,hw:Loopback,1
11884 pts/0    S+     0:00 grep --color=auto mpd_oled\|cava



Quote:Also check all the wires are good. In your photo the wires are connected to a DAC board attached to the Pi. You could check that none of the pins you are using are reserved for use by the DAC.

First I installed without the DAC Board and it freezes. Than I have formatted the SD Card and installed again with DAC and I had the same problem.



Quote:And check, before and after the freeze -- How much CPU mpd_oled/cava is using? Are other processes using a lot of CPU? How much memory is being used? Etc.

when it freezes it uses at most 5% of CPU
There isn't other processes using a lot of CPU


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

Hi f.omar

Thank you for posting the output from the commands.

The issue appears to be that you are using 'hw:Loopback' instead of 'plughw:Loopback', and I am able to reproduce the freeze here.

If you install mpd_oled with the following command then this will hopefully fix the issue for you

Code:
sudo mpd_oled_service_edit -o 1 -b 10 -g 1 -f 20 -c alsa,plughw:Loopback,1

I have reviewed the current install instructions for mpd_oled on Moode and they say to use 'plughw:Loopback', but older instructions said to use 'hw:Loopback'. (I can see the mpd_oled_moode_audio_copy_install script says to use 'hw:Loopback, but this script shouldn't be run on Moode 7.2.1., and 'hw:Loopback' worked fine on 7.0 and 7.1)

Please let me know if there are any changes I could make to avoid this happening for other people.

Adrian.


RE: 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi - f.omar - 06-11-2021

(06-11-2021, 11:23 AM)adrii Wrote: Hi f.omar

Thank you for posting the output from the commands.

The issue appears to be that you are using 'hw:Loopback' instead of 'plughw:Loopback', and I am able to reproduce the freeze here.

If you install mpd_oled with the following command then this will hopefully fix the issue for you

Code:
sudo mpd_oled_service_edit -o 1 -b 10 -g 1 -f 20 -c alsa,plughw:Loopback,1

I have reviewed the current install instructions for mpd_oled on Moode and they say to use 'plughw:Loopback', but older instructions said to use 'hw:Loopback'. (I can see the mpd_oled_moode_audio_copy_install script says to use 'hw:Loopback, but this script shouldn't be run on Moode 7.2.1., and 'hw:Loopback' worked fine on 7.0 and 7.1)

Please let me know if there are any changes I could make to avoid this happening for other people.

Adrian.

Hi Adrian
I ran the command. It still freezes.

systemctl status mpd_oled   After Play Song   now is


pi@moode:~ $ 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 Fri 2021-06-11 13:56:13 CEST; 51s ago
  Process: 2230 ExecStartPre=/usr/local/bin/mpd_oled_launch_test (code=exited, status=0/SUCCESS)
 Main PID: 2247 (mpd_oled)
    Tasks: 5 (limit: 2063)
   CGroup: /system.slice/mpd_oled.service
           ├─2247 /usr/local/bin/mpd_oled -o 1 -b 10 -g 1 -f 20 -c alsa,plughw:Loopback,1
           ├─3021 sh -c mpd_oled_cava -p /tmp/cava_config_tJWcBT
           └─3022 mpd_oled_cava -p /tmp/cava_config_tJWcBT

Jun 11 13:56:09 moode systemd[1]: Starting MPD OLED Display...
Jun 11 13:56:13 moode systemd[1]: Started MPD OLED Display.
Jun 11 13:56:59 moode mpd_oled[2247]: open file /tmp/cava_fifo_2247 for writing raw output


RE: 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi - fdealexa - 06-11-2021

@f.omar
Hi,
sorry for the triviality of the question: have you enabled ALSA loopback in Configure - Audio - ALSA Options?
Greetings,
Francesco


RE: 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi - f.omar - 06-11-2021

(06-11-2021, 01:10 PM)fdealexa Wrote: @f.omar
Hi,
sorry for the triviality of the question: have you enabled ALSA loopback in Configure - Audio - ALSA Options?
Greetings,
Francesco

Ciao Francesco,
Yes I have enabled ALSA loopback in Configure - Audio - ALSA options.


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

Hi f.omar

The change from hw:Loopback to plughw:Loopback is important, and the screen will freeze without it (you can see that the status report no longer includes a segfault after this change).

However, by unlucky coincidence, there is a second issue also causing a screen freeze! You have an extra status message that I didn't have

Code:
Jun 11 13:56:59 moode mpd_oled[2247]: open file /tmp/cava_fifo_2247 for writing raw output

I upgraded to the latest cava, and I now have this message and also a screen freeze when I start to play music.

For now, if you are installing from source you can install a version of cava from before this change was made. The following fixed the issue for me

Code:
mkdir cava_old
cd cava_old
git clone https://github.com/karlstav/cava.git
cd cava
git checkout -b cava_old 57b39f5a8e2e3af005a6d5609f820467426c7389
./autogen.sh
./configure --disable-input-portaudio --disable-input-sndio --disable-output-ncurses --disable-input-pulse --program-prefix=mpd_oled_
make
sudo make install-strip

Then restart mpd_oled

Code:
sudo systemctl restart mpd_oled


I'll look into the issue.


Note: this only affects installation from source, the current binary install of mpd_oled was made before this change to cava, and should work correctly.

Adrian.


RE: 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi - fdealexa - 06-11-2021

(06-11-2021, 01:54 PM)f.omar Wrote:
(06-11-2021, 01:10 PM)fdealexa Wrote: @f.omar
Hi,
sorry for the triviality of the question: have you enabled ALSA loopback in Configure - Audio - ALSA Options?
Greetings,
Francesco

Ciao Francesco,
Yes I have enabled ALSA loopback in Configure - Audio - ALSA options.
Ciao,
would you please send back the result of the following commands?
Code:
ls -lia /etc/alsa/conf.d
cat /etc/alsa/conf.d/_audioout.conf
cat /etc/alsa/conf.d/_deviceout.conf
cat /etc/alsa/conf.d/_sndaloop.conf

sudo service mpd_oled status  

Thanks and ciao,
Francesco


RE: 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi - fdealexa - 06-11-2021

(06-11-2021, 02:29 PM)adrii Wrote: Hi f.omar

The change from hw:Loopback to plughw:Loopback is important, and the screen will freeze without it (you can see that the status report no longer includes a segfault after this change).

However, by unlucky coincidence, there is a second issue also causing a screen freeze! You have an extra status message that I didn't have

Code:
Jun 11 13:56:59 moode mpd_oled[2247]: open file /tmp/cava_fifo_2247 for writing raw output

I upgraded to the latest cava, and I now have this message and also a screen freeze when I start to play music.

For now, if you are installing from source you can install a version of cava from before this change was made. The following fixed the issue for me

Code:
mkdir cava_old
cd cava_old
git clone https://github.com/karlstav/cava.git
cd cava
git checkout -b cava_old 57b39f5a8e2e3af005a6d5609f820467426c7389
./autogen.sh
./configure --disable-input-portaudio --disable-input-sndio --disable-output-ncurses --disable-input-pulse --program-prefix=mpd_oled_
make
sudo make install-strip

Then restart mpd_oled

Code:
sudo systemctl restart mpd_oled


I'll look into the issue.


Note: this only affects installation from source, the current binary install of mpd_oled was made before this change to cava, and should work correctly.

Adrian.
Hi Adrian, Hi Omar,
sorry I have sent the message before read yours: sorry again,
Francesco


RE: 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi - f.omar - 06-11-2021

(06-11-2021, 02:29 PM)adrii Wrote: Hi f.omar

The change from hw:Loopback to plughw:Loopback is important, and the screen will freeze without it (you can see that the status report no longer includes a segfault after this change).

However, by unlucky coincidence, there is a second issue also causing a screen freeze! You have an extra status message that I didn't have

Code:
Jun 11 13:56:59 moode mpd_oled[2247]: open file /tmp/cava_fifo_2247 for writing raw output

I upgraded to the latest cava, and I now have this message and also a screen freeze when I start to play music.

For now, if you are installing from source you can install a version of cava from before this change was made. The following fixed the issue for me

Code:
mkdir cava_old
cd cava_old
git clone https://github.com/karlstav/cava.git
cd cava
git checkout -b cava_old 57b39f5a8e2e3af005a6d5609f820467426c7389
./autogen.sh
./configure --disable-input-portaudio --disable-input-sndio --disable-output-ncurses --disable-input-pulse --program-prefix=mpd_oled_
make
sudo make install-strip

Then restart mpd_oled

Code:
sudo systemctl restart mpd_oled


I'll look into the issue.


Note: this only affects installation from source, the current binary install of mpd_oled was made before this change to cava, and should work correctly.

Adrian.

Hi Adrian

I did as you said and now it works great!
Thanks for your invaluable help!

Omar


Quote:Hi Adrian, Hi Omar,
sorry I have sent the message before read yours: sorry again,
Francesco

Francesco thank you for intervening.