ALSA, MPD and Pulseaudio output capturing
To be able to visualize my laptop’s sound output with a python script, I needed an extra audio input that made it possible to capture the system’s audio output.
To achieve that, I did the following on my Raspberry Pi:
- install alsa-utils and pulseaudio
- get the pulseaudio init script here
- add the users to the group “pulse-access”, I got
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect
without it even as root - create an ALSA monitor source
It is also possible to redirect audio to a FIFO.
MPD:
audio_output {
type: "fifo"
name: "FIFO"
path: "/tmp/mpd.fifo"
format: "44100:16:1"
}
Pulseaudio:
pacmd load-module module-pipe-sink file=/tmp/pulse.fifo
pacmd list-sinks # search your default sink
pacmd load-module module-combine-sink slaves=yoursink,fifo_output
pacmd set-default-sink combined
ALSA:
pcm.writeFile {
type file
slave.pcm null
file "/tmp/alsa.fifo"
format "raw"
}
See also the snapcast readme.