• Stars
    star
    655
  • Rank 68,491 (Top 2 %)
  • Language
    Rust
  • License
    GNU Affero Genera...
  • Created about 1 year ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

live sync audio streaming for local networks

bark!

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

  • Transmits uncompressed 48khz stereo audio over UDP multicast

  • Built-in time synchronisation and latency detection - no high precision NTP required!

  • Adjusts audio playback rate with the Speex resampler to stay in sync

Running the server under Pipewire or Pulse

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

  • First create a virtual node for Bark to receive audio from. You will configure applications to send audio to this node.

    $ pactl load-module module-null-sink media.class=Audio/Duplex sink_name=Bark audio.position=FL,FR
  • You can list all sources on your system with pactl:

    $ pactl list sources short
    145     Bark    PipeWire        float32le 2ch 48000Hz   SUSPENDED
    3676    alsa_output.usb-Focusrite_Scarlett_Solo_USB-00.analog-stereo.monitor     PipeWire        s32le 2ch 44100Hz       IDLE
    3677    alsa_input.usb-Focusrite_Scarlett_Solo_USB-00.analog-stereo      PipeWire        s32le 2ch 44100Hz       SUSPENDED
    3678    alsa_input.usb-046d_Logitech_Webcam_C930e-02.analog-stereo     PipeWire        s16le 2ch 44100Hz       SUSPENDED
  • Run the Bark server passing the name of the sink you created with the --device option:

    $ bark stream --multicast 224.100.100.100:1530 --device Bark

Running the receiver

  • Find the sink you want the receiver to output to:

    $ pactl list sinks short
    145     Bark    PipeWire        float32le 2ch 48000Hz   SUSPENDED
    3676    alsa_output.usb-Focusrite_Scarlett_Solo_USB-00.analog-stereo     PipeWire        s32le 2ch 44100Hz       RUNNING
  • Run the Bark receiver:

    $ bark receive --multicast 224.100.100.100:1530 --device alsa_output.usb-Focusrite_Scarlett_Solo_USB-00.analog-stereo

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 = "alsa_output.usb-Focusrite_Scarlett_Solo_USB-00.analog-stereo"

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:

  • Audio: The time offset of the audio stream, from when it should be according to the stream presentation timestamp, to when the receiver is actually playing. A positive offset means the receiver is ahead of the stream, a negative offset means the receiver is behind the stream.

  • Buffer: The length of the audio data in the receiver buffer.

  • Network: The one-way packet delay between stream source and receiver. For best sync, this should be as stable as possible.

  • Predict: The offset from the data timestamp in an audio packet (the stream source's time when the packet was sent), to what the receiver thinks the data timestamp should be according to measured clock difference and network latency.

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.

More Repositories

1

doslinux

Run Linux programs on DOS
C
1,517
star
2

rustboot

A tiny 32 bit kernel written in Rust
Ruby
1,501
star
3

jsos

An operating system written in JavaScript
C
1,037
star
4

twostroke

A Javascript implementation in Ruby!
JavaScript
305
star
5

Fructose

A Ruby-like language that compiles to PHP
PHP
142
star
6

mixlab

Digital audio/video workstation
Rust
118
star
7

fast_open_struct

open struct that does not invalidate ruby's method cache every time it is instantiated
Ruby
111
star
8

old-website

JavaScript
108
star
9

ws_parser

Streaming WebSocket parser
C
71
star
10

future.rb

A simple concurrent futures library for Ruby with the goal of making concurrent/asynchronous programming easier.
Ruby
68
star
11

crabos

My hobby operating system written in Rust
Rust
51
star
12

xgem

A very tiny shim that dramatically speeds up gem requires
Ruby
43
star
13

rgr

Ruby Grep
Ruby
38
star
14

ffmpeg-cookbook

Because every time I need to use ffmpeg I end up spending half an hour googling
35
star
15

rustcast

Icecast compatible streaming server in Rust
Rust
26
star
16

mini64

64 bit hobby OS
C
25
star
17

noscroll

Blocks web pages from attaching to scroll events
JavaScript
25
star
18

vc6-sys

Rust bindings to the Visual C++ 6 SDK
Rust
25
star
19

coffee-script-pure

A CoffeeScript compiler in pure Ruby
Ruby
25
star
20

BBsharp

A BBCode implementation written in C#
C#
22
star
21

voze

Open source torrent tracker software
Ruby
22
star
22

thredis

Threadsafe, pipelined Redis client in C based on Hiredis.
C
21
star
23

twitter-vanity-suite

My personal set of twitter tools, packaged up as a gem
Ruby
20
star
24

BlockBlockAdBlock

Blocks the BlockAdBlock script
JavaScript
19
star
25

ttypipe

Remote control for your TTYs
C
18
star
26

win32-helloworld

Rust
17
star
27

6502

my toy 6502 emulator
Assembly
16
star
28

australia_postcode

Gem for manipulating Australian postcodes
Ruby
15
star
29

historical-rubies

Set of patches for historical Ruby versions to make them compile cleanly on modern systems
14
star
30

toml2

The better Ruby parser for TOML
Ruby
13
star
31

MANDEL.COM

Mandelbrots for MS-DOS
Assembly
13
star
32

diffcalc

differential calculator
JavaScript
13
star
33

quickserve

easy and convenient HTTP file server
Shell
12
star
34

radium

hobby OS
C
12
star
35

ptydo

runs a command in its own pseudo-terminal exposed as stdin/stdout
C
12
star
36

lame-rs

Rust bindings for libmp3lame
Rust
12
star
37

heroku-buildpack-cgi

Shell
11
star
38

fdk-aac-rs

Rust bindings to libfdk-aac
Rust
11
star
39

aubio-rs

Rust bindings to aubio
Rust
10
star
40

axel

Mirror of svn://svn.debian.org/svn/axel/
C
10
star
41

bfjit

JIT compiler for the Brainfuck language
C
10
star
42

kvmlinux

experiment bringing up linux on kvm
Rust
9
star
43

edifm

Rust
8
star
44

cast19

Ruby's C parsing dog. Woof.
Ruby
7
star
45

CSOS

my operating system
C
7
star
46

d16cc

A C compiler for notch's DCPU16
Ruby
7
star
47

mrb-rs

Safe, low level mruby bindings for Rust
Rust
7
star
48

RShot

RShot is a Ruby library that takes screenshots of web pages
Objective-C
7
star
49

daikin-toolkit

Stuff for my Daikin air conditioner
C
6
star
50

dedeadname

automatic git repo cleaning
Shell
6
star
51

fork-wrapper

Spawns a program and then waits for all children to terminate
C
6
star
52

rnews

social link sharing and commenting app (totally not inspired by reddit, hacker news or slashdot)
Ruby
6
star
53

vst-host

sample rust vst host
Rust
5
star
54

neos

C
5
star
55

h8086

8086 emulator in Haskell
Haskell
5
star
56

subsume

an experiment with virtual 8086 mode
C
5
star
57

herald-sans

CSS
5
star
58

dmoji

dmenu emoji picker
Rust
4
star
59

magic-keyboard-2-parts

replacement parts for the apple magic keyboard 2
4
star
60

axum-range

http range responses for axum
Rust
4
star
61

thread-executor

Lightweight futures executor using `std:๐Ÿงต:park`
Rust
4
star
62

giftopia2038

gifcity but from the future
Rust
4
star
63

kitchune

A thingy to let me control Spotify from my kitchen
Rust
4
star
64

here

Webserver Here
C
4
star
65

arc4-haskell

toy RC4 implementation in haskell
Haskell
4
star
66

errexec

Executes a command and colours its stderr output red.
C
4
star
67

mango

Everyone writes their own Lisp interpreter while learning Haskell. Here's mine.
Haskell
4
star
68

jellyfish

ruby's very own superfast jellyfish
Ruby
4
star
69

go_parser

Ragel
4
star
70

phpnews

lol
PHP
3
star
71

unshare-14.04

unshare(1) hacked up to work on ubuntu 14.04
C
3
star
72

arduboy-chess

โ™–โ™˜โ™—โ™•โ™”โ™—โ™˜โ™–
C++
3
star
73

slash-dis

Slash discussion forums
Slash
3
star
74

refine

an experiment in flow sensitive type analysis
Haskell
3
star
75

lq-plus

wip
C++
3
star
76

luaby

Lua in Ruby
Ruby
3
star
77

mandelbrot

ruby c extension for rendering the mandelbrot set
C
3
star
78

2fa-demo

two factor auth demo app
Ruby
3
star
79

execr

linux sandboxing stuff
C++
3
star
80

shiraz

experimenting with embedding wine
Rust
3
star
81

win9x-sync-rs

Windows 9x compatible synchronization primitives for Rust
Rust
3
star
82

track-explorer

explore similar tracks according to 1001tracklists
Ruby
3
star
83

sinatra-barebones

Ruby
3
star
84

TwitterPlus

Hax for Twitter.app
Objective-C++
3
star
85

sqlitemapper

Rust
3
star
86

makefile-1-2-3

Spreadsheets in make
Shell
3
star
87

funny

syntax sugar for the lambda calculus
Ruby
3
star
88

kari

currying programming language that's actually kinda cool
C
3
star
89

tangara-companion

Rust
3
star
90

heroku-cgi-example

2
star
91

guessthecodebase

Ruby
2
star
92

edicast

Streaming audio server
Rust
2
star
93

giffy_stardust

playing with GIF decoding in Rust
Rust
2
star
94

rangetar

synthesizes tar files on the fly, allowing random access reads
2
star
95

mandelbrot_site

Ruby
2
star
96

insomnia

Prevent your Mac from going to sleep
Objective-C
2
star
97

cget

parallel downloader using ssh as a control connection
Ruby
2
star
98

problems

aio training site stufff
2
star
99

superauther

a better password manager for mac osx
Ruby
2
star
100

battlecars

C++
2
star