Last active
August 23, 2021 01:06
-
-
Save mgoltzsche/8a08cd11c5d1dad76096a5d139322446 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Creates a new pulseaudio PCM device that streams into a unix pipe from which it is distributed by a local snapcast server to all snapcast clients within the local network. | |
# After this command has been run, "Snapcast" can be selected as output device, using `pavucontrol`. | |
# See https://github.com/badaix/snapcast/blob/master/doc/player_setup.md#pulseaudio | |
# | |
SNAPFIFO=/tmp/snapfifo | |
set -eux | |
# To reset pulseaudio settings, kill it (it will be restarted automatically) | |
pulseaudio -k | |
# Create virtual pulseaudio output device that streams to the unix pipe at /tmp/snapfifo. Rename it to "Snapcast". | |
pacmd load-module module-pipe-sink file=$SNAPFIFO sink_name=Snapcast format=s16le rate=48000 | |
pacmd update-sink-proplist Snapcast device.description=Snapcast | |
# restart snapserver (that reads the /tmp/snapfifo unix pipe - configured by default within /etc/snapserver.conf) | |
service snapserver restart | |
# To improve audio quality, set `resample-method = soxr-vhq` in /etc/pulse/daemon.conf. | |
# To reduce the latency, reduce the `buffer` in /etc/snapserver.conf. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment