I have a snapcast audio server, which is configured to have three audio streams (fifos): music, broadcast, and output. My speakers play the audio from the output stream, and my music players pipe input into the music stream. I can successfully pipe the music into the output so that I hear the music on the speakers with the command:
cat /tmp/music > /tmp/output
Now I want to implement an "override" feature where input from the broadcast stream causes the output to instead play the (alert) from the broadcast, temporarily ignoring the stream from music until the broadcast ends. However, most of the time /tmp/broadcast is empty and has no input. Even a simple attempt to peek at the contents via
dd bs=1 count=1 if=/tmp/broadcast hangs the terminal until there's data available in the broadcast. Therefore my attempts to do things like merge streams is unsuccessful.
I have looked into ffmpeg and pulseaudio, but cannot figure out if such a "selective override" is possible. Ffmpeg further appears to have bugs with multi-fifo input. The ideal solution would also "sound nice," i.e., perhaps do a 1/4 second fade between the streams as the broadcast takes over.
Ubuntu Desktop 18.04. Whoops!