haileys / bark

live sync audio streaming for local networks
GNU Affero General Public License v3.0
663 stars 11 forks source link

bark!

low latency multi-receiver synchronised audio streaming for local networks.

Running the server under Pipewire or Pulse

Note: if using Pipewire, you must have pipewire-alsa installed for this to work.

Running the receiver

Configuration

As well as on the command line, Bark's options can be set by environment variable or configuration file. Command line options and their corresponding environment variables are shown in bark --help.

Bark also searches the XDG config directories for a bark.toml configuration file, respecting any custom directories set in XDG_CONFIG_DIRS.

By default, Bark will look in $HOME/.config/bark.toml first, and then /etc/bark.toml. Options set in the configuration file take lowest precedence, are overriden by environment variables, and then finally command line options take highest precedence.

The config file supports all command line options Bark supports. Here's an example:

multicast = "224.100.100.100:1530"

[source]
device = "Bark"
delay_ms = 15

[receive.device]
name = "pipewire:NODE=MyNodeName"
period = 120 # default: send audio to hardware in discrete chunks of 120 frames
buffer = 240 # default: buffer 240 frames of decoded audio in memory

Monitoring the stream

Run bark stats to see a live view of the state of all Bark receivers.

Four timing fields are shown for each receiver:

Tuning

The stream source is responsible for setting the delay of the audio stream. The delay wants to be as low as possible without causing receivers to slew or underrun their buffers too much. Receivers will always experience some slewing to keep in sync - the network is not perfectly reliable, and clocks always run at slightly different rates - but ideally slewing should be kept to a minimum to ensure best quality. Keep an eye on bark stats while tuning this value.

The optimal delay value depends on your network, particularly with respect to packet loss and latency stability (receivers connecting wirelessly will need more delay to remain stable than those hard-wired), as well as the latency introduced by sound cards. I've observed that my desktop, which has a USB DAC, consistently tends to have less in its buffer than receivers with PCI DACs.