From b3efc1755be2fd3c4c6450f4899d145a8092dbde Mon Sep 17 00:00:00 2001 From: schneefux Date: Wed, 22 Jun 2016 16:58:12 +0200 Subject: update 'audio output capturing' post with MPD, PA, ALSA FIFO --- content/tech/audio-output-to-input.md | 39 +++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/content/tech/audio-output-to-input.md b/content/tech/audio-output-to-input.md index cc36313..420046f 100644 --- a/content/tech/audio-output-to-input.md +++ b/content/tech/audio-output-to-input.md @@ -1,8 +1,8 @@ --- categories: - software -date: 2015-11-28 -title: Route audio output to input +date: 2016-06-22 +title: 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. @@ -13,3 +13,38 @@ To achieve that, I did the following on my Raspberry Pi: * get the pulseaudio init script [here](https://www.raspberrypi.org/forums/viewtopic.php?p=619713#p619713) * 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](https://wiki.archlinux.org/index.php/PulseAudio/Examples#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: + +```bash +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](https://github.com/badaix/snapcast). -- cgit v1.3.1