Hi Tim
mpd_oled includes a spectrum analyser visualisation, and for this to work it needs a copy of the audio that is playing.
A basic way to do this is to get MPD to make a copy and send it to a FIFO. The current mpd_oled installation instructions patch Moode to append the contents of a file (/usr/local/etc/mpd_oled_fifo.conf) to /etc/mpd.conf and enable mpd_oled_FIFO as a second output. The file contains
Code:
audio_output {
type "fifo"
name "mpd_oled_FIFO"
path "/tmp/mpd_oled_fifo"
format "44100:16:2"
}
For Moode to support this approach to duplicating the audio generally, a possibility is to have a directory, e.g. /etc/audio_outputs, which could contain files containing the lines that should appear in an audio_outputs section. You could check that lines have the formats (with appropriate extra whitespace)
key "value"
#comment
and put a limit on the file length.
If the file is valid, and there is a name key, then the contents would be written to an audio_output section in /etc/mpd.conf and the name would be enabled for ouput.
However, this approach doesn't work with Spotify, so it might not be worth the effort. For something simpler, perhaps you could have a UI box for the number of FIFO copies and just add them as
Code:
audio_output {
type "fifo"
name "audio_copy_1_FIFO"
path "/tmp/audio_copy_1_fifo"
format "44100:16:2"
}
Accepting that the format may not suit all applications (but this could now be the default for mpd_oled, as Cava, which produces the spectrum analysis, will now handle a 48000 sample rate FIFO for input).
A much better solution though would be for Moode to provide a duplicate copy (or copies) of the currently playing ALSA stream. You can see my attempt to do this with Moode here (works for me with an I2S device and a USB device)
https://github.com/antiprism/mpd_oled/is...-567146826
It seems like a lot of work for a little spectrum analyser, but imagine passing on the duplicate stream to another computer attached to a largescreen TV for an artistic-type audio visualisation that doesn't affect audio quality
https://github.com/projectM-visualizer/projectm
And, if the Pi Zero can run a spectrum analyser, maybe some lighter-weight visualisations could be run on a Pi directly, and displayed on a local screen (touchscreen or over HDMI).
[I also found, when researching the ALSA configuration, that some people want the same audio to go to more than one device e.g. headphones and speakers, which is also supported by duplicating the ALSA stream.]
I appreciate that providing a configuration option for duplicating the ALSA stream likely involves core changes to Moode and the potential for extreme breakage.
Thanks for your interest!
Adrian.