Spacesound

From NURDspace
Revision as of 01:55, 30 December 2021 by Melan (talk | contribs) (Created page with "=== Info === Audio VM running Snapcast. All audio related stuff for the space happens here, such as MPD, the soundboard etc. However, due to the nature of Snapcast there is a...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Info

Audio VM running Snapcast. All audio related stuff for the space happens here, such as MPD, the soundboard etc. However, due to the nature of Snapcast there is a artifical delay introduced to keep all the clients in-sync. As such, audio visualisation such as LedFX would still be running on Slabpi to provide a low-latency audio RGB-barfing experience in zaal 1.

Under the hood, Snapcast provides a FIFO under /tmp/snapfifo where you can dump audio. Pulseaudio for example is configured to send audio to this fifo. We are still running Pulseaudio under the hood, to provide an interface for multiple audio programs to run at once.

Notes

  • Disabled protected fifos sudo sysctl fs.protected_fifos=0 (Set in sysctl.conf)
  • Added user nurds to the group pulse
  • Added user pulse to the group snapserver usermod -aG snapserver pulse

Config changes

system.pa

Both native-protocol-tcp and module-native-protocol-unix have been enabled to allow programs to access pulseaudio. Without the latter line for example, everything trying to play audio through pulse gets a access denied. For native-protocol-unix to work, remove the other entries.

load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;10.0.0.0/24  
load-module module-native-protocol-unix auth-anonymous=1

To make Pulseaudio send audio to snapcast

load-module module-pipe-sink file=/tmp/snapfifo sink_name=Snapcast format=s16le rate=48000
update-sink-proplist Snapcast device.description=Snapcast
client.conf

Needed to make clients know where to connect to, because we are running system wide.

default-server = 127.0.0.1

Running services

  • Icecast + Darkice
  • themesongs.service (/home/nurds/scripts)
  • espeak-server (/home/nurds/scripts)
  • icecast-title (/home/nurds/scripts)

Configs

/etc/default/snapserver
snapserver.conf
source = pipe:///tmp/snapfifo?name=default&mode=create  

buffer = 100
sampleformat = 48000:16:2
codec = pcm
/usr/share/dbus-1/system.d/pulseaudio.conf
<source lang="xml"><?xml version="1.0"?> <!--*-nxml-*-->  
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"  
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">  
<busconfig>  
<policy group="pulse">  
<allow own="org.pulseaudio.Server"/>  
</policy>  
  
<policy context="default">  
<allow send_destination="org.pulseaudio.Server"/>  
<allow receive_sender="org.pulseaudio.Server"/>  
</policy>  
</busconfig>
/etc/systemd/system/pulseaudio.service
</source>
[Unit]<br />
Description=PulseAudio Daemon

[Install]<br />
WantedBy=multi-user.target

[Service]<br />
Type=simple<br />
ExecStart=/usr/bin/pulseaudio –system –realtime –disallow-exit –no-cpu-limit

<pre>

- OS: Ubuntu 20.01 LTS

Installed

apt-get install alsa-utils alsa-tools mpc mpd ncmpcpp pamix nfs-common mplayer pulseaudio espeak