blob: d6f1fc66e1923cb713db9f8be32b569793a87ca8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
---
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.
<!--more-->
To achieve that, I did the following on my Raspberry Pi:
* install alsa-utils and pulseaudio
* 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).
|