0

I have an Alsa sink on a Raspberry Pi (lite OS — no desktop) which plays music (from the house) to my speakers. I would like to be able to gracefully interrupt this music.

  1. The Pi has a USB soundcard. If the microphone (line in) is plugged in and receiving music (from my computer), I'd like this audio input to take priority and be played to the speakers instead.
  2. There is a fifo audio stream (at /tmp/snapcast). If this stream becomes active, I'd like it to interrupt either of the other two audio streams.

In either case, ideally the interruptions will cross-fade.

In other words, I want to combine 3 sinks, where a higher number sinks takes priority when it becomes active (i.e., has data).

What is the simplest way to achieve this? I am mildly familiar with Alsa and somewhat with PulseAudio. Beyond that, I have little experience with sound mixing.

1 Answer 1

1

In general, alsa loopbacks are handles by alsaloop.

I found that HiFiBerry (who makes DAC/Amp HATs for Raspberry Pis) created this python script based upon alsaloop: https://github.com/hifiberry/alsaloop/

It's not an out-of-the-box solution for my problem, but it does get me most of the way there. The script provides a Python example for detecting the presence of volume on a line in order to switch which input source is looping into the output.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .