[PLUGIN] MPD OLED - installation & configuration plugin

Hi Adrian,
I just tried it with the cava version you suggested but the behavior on the OLED still seems to be the same. I now however spotted another error message at the mpd_oled service status when a track is played:

volumio@volumio:~$ 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 Sun 2022-11-20 12:07:44 CET; 22s ago
  Process: 1238 ExecStartPre=/usr/local/bin/mpd_oled_launch_test (code=exited, s
 Main PID: 1239 (mpd_oled)
    Tasks: 3 (limit: 2133)
   CGroup: /system.slice/mpd_oled.service
           └─1239 /usr/local/bin/mpd_oled -o SSD1309,128X64,I2C -b 10 -g 1 -c al

Nov 20 12:07:44 volumio systemd[1]: Starting MPD OLED Display...
Nov 20 12:07:44 volumio systemd[1]: Started MPD OLED Display.
Nov 20 12:08:06 volumio mpd_oled[1239]: ALSA lib pcm_hw.c:1822:(_snd_pcm_hw_open) Invalid value for card
Nov 20 12:08:06 volumio mpd_oled[1239]: error opening stream: No such device

Hi @Zhapox

The mpd_oled command in the output is cut off, but ends " -c al…", and so cava is reading audio data from an ALSA audio stream, presumably the loopback device. Have you configured this? The installation instructions I provide for Volumio 3 are a hack, and simply configure mpd to output to a FIFO that cava can be configured to read from. Ideally the development version would be wrapped in a Volumio 3 plugin, so it would be compatible with all audio sources. You could probably hack the existing plugin to ignore the configuration values and run a hard-coded mpd_oled development version command.

I will be reviewing the plugin situation with ALSA loopback, and so could look at a simple modification to run a hardcoded command at that time, and test with the development mpd_oled. I will also be reviewing posible issues with the current cava. It might take me a few days to do this.

Adrian.

3 Likes

Hi Adrian,

Yes the original command was the following I used to configure the service:

sudo mpd_oled_service_edit -o SSD1309,128X64,I2C -b 10 -g 1 -c alsa,plughw:Loopback,1

I based it on the example you provided on the dev page. I also have the suspicion that alsa as source causes troubles with the setup I have. I use an allo Piano 2.1 DAC and throughout all the troubleshooting I always had issues with one or the other channel being dead when I had Piano set in dual-mono. Now that I removed parameter -c cava works and I have sound on both channels! Thank you so much! :slight_smile:

Hi @Zhapox

For cava to read audio data from the loopback device there also needs to be an ALSA configuration that sends data to the loopback device, and on Volumio 3 the ALSA configuration is meant to be created using a plugin.

Regarding the delay, it may be occurring in your audio hardware. Are you using a reclocker? This is a previous report I received Is it possible to implement aPeak Hold · Issue #18 · antiprism/mpd_oled · GitHub I don’t have a fix for this.

Adrian.

Hi Adrian,

That makes sense. For now everything seems to be working. I guess I’ll just stick with that until your dev version goes into production. If you ever need a test candidate please let me know. I’d gladly help!

I indeed use Kali as reclocker but I dropped the line about the delay as it disappeared after I did another reboot after all those reconfigrations. Now it seems to be fine.

Thanks!

I looked at this and, while I couldn’t completely confirm it, I suspect that the problem is that the plugin mpd_oled binary is built for a different architecture (so it also runs on the Pi Zero) than the replacement cava binary that is built on the Pi 4.

In testing here, the plugin mpd_oled and cava work fine together. If I build mpd_oled and cava on the Pi 4 they work fine together. If I use the same cava I built on the Pi 4 with the plugin mpd_oled binary then it appears that cava crashes in some way and causes mpd_oled to crash.

I‘m running on a Pi 3 B+. Not sure if that makes any additional difference to a 4. If you want me to test any other plugin/binary combination just let me know.

@Zhapox Thanks, but I don’t think it is worth pursuing it. Previously the plugin built the mpd_oled and cava binaries from source on the Volumio machine where they would be running, so it was possible to later build a replacement cava on the same Volumio machine and it would work fine. Now that the plugin installs binaries, in order to update cava with a locally built binary will mean also building mpd_oled and updating that binary too, i.e. more work, but still possible.

@supercrab there is a potential problem that if someone builds mpd_oled from source on their machine and then later installs the plugin, then the original mpd_oled_cava binary will not be overwritten and so the plugin may crash as soon as music is played: volumio-plugins-sources/install.sh at 8fe8886851fba992e17fa2100eb668827ec18b93 · volumio/volumio-plugins-sources · GitHub I included the rename of cava to mpd_oled_cava so it wouldn’t overwrite an existing cava binary that might be used for some other purpose, so it seems fine to overwrite mpd_oled_cava. Is there a reason that the plugin doesn’t always install the mpd_oled_cava binary? Maybe previously it was to save time building the binary?

Adrian.

I can change the installer to not overwrite cava if it exists? Would that be any help? It was @balbuze idea to include cava I don’t know all the reasons for it, I guess to save time building. :grimacing:

The reason is that plugin must not compile anything. It requires to download lot of lib (build essentials + other) and takes time. Not convenient for user…

Is there a different CAVA build for each architecture? Would I have to bundle them all into the plugin?

1 Like

In that case, I think it is likely fine to remove the section that installs cava. The plugin installs the binary package that I provide for the normal mpd_oled binary install, and this package always installs mpd_oled_cava (to /usr/bin).

The single binary package for the lowest common requirements (build on a Pi Zero running debian Buster) will work fine on Volumio and Moode. The problems are only arising when mpd_oled and cava have been built on different machines.

That’s strange the install script will only install CAVA it is not already installed, so it won’t actaully overwrite and previous installations! From install.sh

##############################
# install CAVA if not present
if [ ! -f "/usr/local/bin/mpd_oled_cava" ]
then
  echo "Installing CAVA"
  sudo cp ./cava /usr/local/bin/mpd_oled_cava
  sudo mkdir /usr/local/share/consolefonts
  sudo cp ./cava.psf /usr/local/share/consolefonts
else
  echo "CAVA already installed"
fi

I believe…

If the plugin is installed on a fresh Volumio, the deb package will install mpd_oled_cava to /usr/bin, however the plugin itself will copy its own cava binary to /usr/local/bin, and this is the binary that will then be used by mpd_oled. The cava binary appears to be compatible with the deb package mpd_oled binary.

If mpd_oled is installed from source on a Pi 4 then the mpd_oled and mpd_oled_cava binaries will be installed into /usr/local/bin. If the plugin was installed before the source installation then the source installation will overwrite the plugin mpd_oled_cava. If the plugin is installed after the source installation then the plugin will not overwrite the source installation mpd_oled_cava. Either way the plugin mpd_oled will end up using the source installation mpd_oled_cava.

So I just need to change the install and check location to /usr/bin instead of /usr/local/bin?:persevere::roll_eyes:

1 Like

Hi Mase

The plugin doesn´t need to install cava separately, as the deb package already installs it, and so the plugin code that you quoted could be removed (and the plugin cava binary). When the plugin used to install cava from source, there could sometimes be breakage due to changes in cava, and so it was useful to be able to install an older version of cava and use that. This is never needed now the plugin installs the binary package, as the version of cava is fixed.

Regarding a solution to the potential problem, it should be fairly rare for anyone to install from source on Volumio 3, and so I could just include a note in the installation documentation that installing cava from source will likely create an incompatibity with the plugin. I don’t think it is worth adding a check in the plugin. but if you feel it would be useful then maybe it could be done when mpd_oled is activated, for example popping up a warning dialogue if /usr/local/bin/mpd_oled exists.

Adrian.

This has now been fixed.

Cool! If CAVA doesn’t need to be installed then I’ll remove it from the install script! Easy peasy!

44 posts were split to a new topic: DEV: MPD_OLED for x86 based systems