Snapcast: Difference between revisions
imported>Mweinelt m Add audio category |
Article was severly outdated. I updated it using the settings I used., |
||
| Line 5: | Line 5: | ||
https://github.com/badaix/snapcast | https://github.com/badaix/snapcast | ||
If you are using MPD, you can directly output audio to a FIFO sink and read that sink using Snapcast. For example, see the setup in this blog: https://blog.firedrake.org/archive/2022/11/Home_audio_with_mpd_and_snapcast.html. | |||
== Pipewire Sink == | == Pipewire Sink == | ||
| Line 12: | Line 14: | ||
First create a local snapserver instance that creates the FIFO queue to stream into. | First create a local snapserver instance that creates the FIFO queue to stream into. | ||
< | <syntaxhighlight lang="nix"> | ||
services.snapserver = { | services.snapserver = { | ||
enable = true; | enable = true; | ||
settings = { | |||
stream.source = "pipe:///tmp/snapfifo?name=NAME"; | |||
}; | }; | ||
openFirewall = true; | |||
}; | }; | ||
</ | </syntaxhighlight> | ||
Tell Pipewire about the sink used by Snapcast. | |||
< | <syntaxhighlight lang="nix"> | ||
services.pipewire.extraConfig.pipewire-pulse."40-snapcast-sink" = { | |||
"pulse.cmd" = [ | |||
{ | |||
cmd = "load-module"; | |||
args = "module-pipe-sink file=/tmp/snapfifo sink_name=Snapcast format=s16le rate=48000"; | |||
" | } | ||
]; | ]; | ||
}; | }; | ||
</syntaxhighlight> | |||
There is a new direct connection of Pipewire with Snapcast in the making. However, as of March 16, 2026, the version of Pipewire in Nixpkgs (1.4.X) does not support this new feature yet (available starting with Pipewire version 1.6.0). | |||
== Playback == | == Playback == | ||
To have local audio synced up with remote clients it needs to be routed through a local snapclient instance. | To have local audio synced up with remote clients it needs to be routed through a local snapclient instance. | ||
< | <syntaxhighlight lang="nix"> | ||
systemd.user.services.snapclient-local = { | systemd.user.services.snapclient-local = { | ||
wantedBy = [ | wantedBy = [ | ||
| Line 62: | Line 52: | ||
]; | ]; | ||
serviceConfig = { | serviceConfig = { | ||
ExecStart = "${pkgs.snapcast}/bin/snapclient | ExecStart = "${pkgs.snapcast}/bin/snapclient tcp://localhost:1704"; | ||
}; | }; | ||
}; | }; | ||
</ | </syntaxhighlight> | ||
[[Category:Audio]] | [[Category:Audio]] | ||