Code Monkey home page Code Monkey logo

snapcast's Introduction

Snapcast

Snapcast Snapweb-Dark

Synchronous audio player

CI Github Releases GitHub Downloads Donate

Snapcast is a multiroom client-server audio player, where all clients are time synchronized with the server to play perfectly synced audio. It's not a standalone player, but an extension that turns your existing audio player into a Sonos-like multiroom solution.
Audio is captured by the server and routed to the connected clients. Several players can feed audio to the server in parallel and clients can be grouped to play the same audio stream.
One of the most generic ways to use Snapcast is in conjunction with the music player daemon (MPD) or Mopidy.

Overview

How does it work

The Snapserver reads PCM chunks from configurable stream sources:

  • Named pipe, e.g. /tmp/snapfifo
  • ALSA to capture line-in, microphone, alsa-loop (to capture audio from other players)
  • TCP
  • stdout of a process
  • Many more

The chunks are encoded and tagged with the local time. Supported codecs are:

  • PCM lossless uncompressed
  • FLAC lossless compressed [default]
  • Vorbis lossy compression
  • Opus lossy low-latency compression

The encoded chunks are sent via a TCP connection to the Snapclients. Each client does continuous time synchronization with the server, so that the client is always aware of the local server time. Every received chunk is first decoded and added to the client's chunk-buffer. Knowing the server's time, the chunk is played out using a system dependend low level audio API (e.g. ALSA) at the appropriate time. Time deviations are corrected by playing faster/slower, which is done by removing/duplicating single samples (a sample at 48kHz has a duration of ~0.02ms).

Typically the deviation is below 0.2ms.

For more information on the binary protocol, please see the documentation.

Installation

You can either install Snapcast from a prebuilt package (recommended for new users), or build and install snapcast from source.

Install Linux packages (recommended for beginners)

Snapcast packages are available for several Linux distributions:

Nightly builds

There are debian packages of automated builds for armhf, arm64 and amd64 in Snapcast Actions - Package workflow. Download and extract the archive for your architecture and follow the debian installation instructions.

Install using Homebrew

On macOS and Linux, snapcast can be installed using Homebrew:

brew install snapcast

Installation from source

Please follow this guide to build Snapcast for

Configuration

After installation, Snapserver and Snapclient are started with the command line arguments that are configured in /etc/default/snapserver and /etc/default/snapclient. Allowed options are listed in the man pages (man snapserver, man snapclient) or by invoking the snapserver or snapclient with the -h option.

Server

The server configuration is done in /etc/snapserver.conf. Different audio sources can by configured in the [stream] section with a list of source options, e.g.:

[stream]
source = pipe:///tmp/snapfifo?name=Radio&sampleformat=48000:16:2&codec=flac
source = file:///home/user/Musik/Some%20wave%20file.wav?name=File

Available stream sources are:

  • pipe: read audio from a named pipe
  • alsa: read audio from an alsa device
  • librespot: launches librespot and reads audio from stdout
  • airplay: launches airplay and read audio from stdout
  • file: read PCM audio from a file
  • process: launches a process and reads audio from stdout
  • tcp: receives audio from a TCP socket, can act as client or server
  • meta: read and mix audio from other stream sources

Client

The client will use as audio backend the system's low level audio API to have the best possible control and most precise timing to achieve perfectly synced playback.

Available audio backends are configured using the --player command line parameter:

Backend OS Description Parameters
alsa Linux ALSA buffer_time=<total buffer size [ms]> (default 80, min 10)
fragments=<number of buffers> (default 4, min 2)
pulse Linux PulseAudio buffer_time=<buffer size [ms]> (default 100, min 10)
server=<PulseAudio server> - default not-set: use the default server
property=<key>=<value> set PA property, can be used multiple times (default media.role=music)
oboe Android Oboe, using OpenSL ES on Android 4.1 and AAudio on 8.1
opensl Android OpenSL ES
coreaudio macOS Core Audio
wasapi Windows Windows Audio Session API
file All Write audio to file filename=<filename> (<filename> = stdout, stderr, null or a filename)
`mode=[w

Parameters are appended to the player name, e.g. --player alsa:buffer_time=100. Use --player <name>:? to get a list of available options.
For some audio backends you can configure the PCM device using the -s or --soundcard parameter, the device is chosen by index or name. Available PCM devices can be listed with -l or --list
If you are running MPD and Shairport-sync into a soundcard that only supports 48000 sample rate, you can use --sampleformat <arg> and the snapclient will resample the audio from shairport-sync, for example, which is 44100 (i.e. --sampleformat 48000:16:*)

Test

You can test your installation by copying random data into the server's fifo file

cat /dev/urandom > /tmp/snapfifo

All connected clients should play random noise now. You might raise the client's volume with "alsamixer". It's also possible to let the server play a WAV file. Simply configure a file stream in /etc/snapserver.conf, and restart the server:

[stream]
source = file:///home/user/Musik/Some%20wave%20file.wav?name=test

When you are using a Raspberry Pi, you might have to change your audio output to the 3.5mm jack:

#The last number is the audio output with 1 being the 3.5 jack, 2 being HDMI and 0 being auto.
amixer cset numid=3 1

To setup WiFi on a Raspberry Pi, you can follow this guide

Control

Snapcast can be controlled using a JSON-RPC API over plain TCP, HTTP, or Websockets:

  • Set client's volume
  • Mute clients
  • Rename clients
  • Assign a client to a stream
  • Manage groups
  • ...

WebApp

The server is shipped with Snapweb, this WebApp can be reached under http://<snapserver host>:1780.

Snapweb-Light Snapweb-Dark

Android client

There is an Android client snapdroid available in Releases and on Google Play

Snapcast for Android

Contributions

There is also an unofficial WebApp from @atoomic atoomic/snapcast-volume-ui. This app lists all clients connected to a server and allows you to control individually the volume of each client. Once installed, you can use any mobile device, laptop, desktop, or browser.

There is also an unofficial FHEM module from @unimatrix27 which integrates a Snapcast controller into the FHEM home automation system.

There is a snapcast component for Home Assistant which integrates a Snapcast controller in to the Home Assistant home automation system and a snapcast python plugin for Domoticz to integrate a Snapcast controller into the Domoticz home automation system.

For a web interface in Python, see snapcastr, based on python-snapcast. This interface controls client volume and assigns streams to groups.

Another web interface running on any device is snapcast-websockets-ui, running entirely in the browser, which needs websockify. No configuration needed; features almost all functions; still needs some tuning for the optics.

A web interface called HydraPlay integrates Snapcast and multiple Mopidy instances. It is JavaScript based and uses Angular 7. A Snapcast web socket proxy server is needed to connect Snapcast to HydraPlay over web sockets.

For Windows, there's Snap.Net, a control client and player. It runs in the tray and lets you adjust client volumes with just a few clicks. The player simplifies setting up snapclient to play your music through multiple Windows sound devices simultaneously: pc speakers, hdmi audio, any usb audio devices you may have, etc. Snap.Net also runs on Android, and has limited support for iOS.

Setup of audio players/server

Snapcast can be used with a number of different audio players and servers, and so it can be integrated into your favorite audio-player solution and make it synced-multiroom capable. The only requirement is that the player's audio can be redirected into the Snapserver's fifo /tmp/snapfifo. In the following configuration hints for MPD and Mopidy are given, which are base of other audio player solutions, like Volumio or RuneAudio (both MPD) or Pi MusicBox (Mopidy).

The goal is to build the following chain:

audio player software -> snapfifo -> snapserver -> network -> snapclient -> alsa

This guide shows how to configure different players/audio sources to redirect their audio signal into the Snapserver's fifo:

Roadmap

Unordered list of features that should make it into the v1.0

  • Remote control JSON-RPC API to change client latency, volume, zone,...
  • Android client JSON-RPC client and Snapclient
  • Streams Support multiple streams
  • Debian packages prebuild deb packages
  • Endian independent code
  • OpenWrt port Snapclient to OpenWrt
  • Hi-Res audio support (like 96kHz 24bit)
  • Groups support multiple Groups of clients ("Zones")
  • Ports Snapclient for Windows, Mac OS X,...
  • JSON-RPC Possibility to add, remove, rename streams
  • Protocol specification Snapcast binary streaming protocol, JSON-RPC protocol

snapcast's People

Contributors

airdrummingfool avatar amak79 avatar axelsimon avatar badaix avatar celevra avatar cmfcmf avatar debfx avatar duhow avatar frafall avatar heitbaum avatar joerg-krause avatar jonahquark81 avatar jwillikers avatar kutmasterk avatar l3d00m avatar nimonimonimo avatar pille avatar pmalessa avatar realglotzi avatar rusitschka avatar santreim avatar slackline avatar solideus avatar ssiegel avatar stijnvdb88 avatar tgurr avatar thecb1 avatar unimatrix27 avatar uspike avatar xabolcs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

snapcast's Issues

Configuring Zones

Hi,

Firstly, thanks for an awesome system, I'm in the process of configuring it to link in to OpenHAB via Mopidy and it's looking promising!

I'm interested in knowing how to configure "zones", allowing me to move music throughout the house or allow my kids to play one song in one room and a different one somewhere else (I've got three girls, it's going to happen sooner or later!)

The README.md suggests that Zones are "complete", however, I can't find any documentation on how to configure them and the code on the "master" branch doesn't say anything when run with "-h" for either the client or the server.

Thanks in advance for any help you can give,

Matt

Cracks on sound with flat parts

Hello,

I'm using snapcast and python-snapcast with a ubuntu-server and 2 x raspberry pi as clients.
Works very fine.
Hint: If you are using a raspberry pi as client, with phat dac and pam8403 as amp, don't power the amp using operating voltage from raspberry pi. I could hear the "heart beat" of the raspberry on the speaker. Only when I supply power to the amp from a serparate power supply, there was no noise anymore.

But here starts my question:
While having very good quality of sound listening to music, I recently noticed sometimes some sort of tiny cracks on the client. Some investigation made me discover it seem to appear only during news (meaning not music, rather somebody talking). I have the impression it is related to flat parts of the sound. I there is talking with background music there are no cracks to hear.

Any idea?

Any chance for an Android client?

Thanks for creating this! One question though - are there plans to port the client to Android?

My setup is the following - I have an MPD server with speakers in one room and want ocassionally to stream into a different room using my phone via HTTP streaming of MPD, which of course is awful if you hear both sources. So I would like to have a snapcast client on my phone, or I would have to install an RPi in the second room permanently, which I do not want for multiple reasons.

Setup Instructions with RuneAudio

Hi,

I'm trying to get SnapCast running with RuneAudio so I can have music in two rooms running on 2 different Raspberry Pi's.

I found this thread: http://www.runeaudio.com/forum/rune-transmitter-t210.html and have tried to compile a high level list of steps by reading the Snapcast instructions to see how I can set it up.

However as per my post there http://www.runeaudio.com/forum/rune-transmitter-t210.html#p10931 I've come up short on the last few steps to get the music to play on the master instance of RuneAudio and the slave which is running the Snapcast client.

I found this link for Volumio which is very similar to RuneAudio
https://volumio.org/forum/multiroom-audio-output-from-volumio-with-snapcast-t3217.html

Are you able to comment either here on the RuneAudio forum as to what the missing steps are?

Thanks in advance.

Ciaran

Windows client

I would really like a Windows Client too, first as I don't need another device when I work on my PC and secondly with the Raspberry Pi supporting Windows 10 IoT it might be a good alternative for a music player.

We discussed this a bit in #22, and I just wanted to add a issue for this so it's not forgotten.

I will try to provide information for this, maybe I even find the time to start on it myself. But I unfortunately am pretty much occupied with Greenshot so there are no guarantees.

Here is some information which might help:

Yesterday someone from Microsoft added example documentation for writing a Background audio app for the Universal Windows Platform (UWP):
https://blogs.windows.com/buildingapps/2016/01/13/the-basics-of-background-audio/
This might be a nice way to integrate SnapCast into Windows 10, having a standard volume/play/pause control.

There is also sample code available for an AdaptiveStreaming application:
https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/AdaptiveStreaming
Maybe this, combined with the information on how SnapCast works, can result in an Rapsberry Pi music "box". :)

Exception in Controller::worker()

Since last update ( I think I jumped from v 0.4.1 but im not 100% sure) to 0.7.0 my raspberry client cant connect any more. On the client I see:

May 18 07:11:25 rapi2 snapclient[2889]: Connected to 172.16.1.117 
May 18 07:11:26 rapi2 snapclient[2889]: Exception in Controller::worker(): sum timeout exceeded 10s

In the systemd logs and on the server I get:

May 18 08:58:53 serv snapserver[1272]: StreamServer::NewConnection: 172.16.1.83
May 18 08:58:54 serv snapserver[1272]: 2016-05-18 08-58-54 [Err] Exception in StreamSession::reader(): read_some: End of file
May 18 08:58:54 serv snapserver[1272]: 2016-05-18 08-58-54 [out] onDisconnect:
May 18 08:58:54 serv snapserver[1272]: Exception in StreamSession::reader(): read_some: End of file

I also run a client instance on the same machine as the server. This client does work without error message.

For wat its worth, I use Arch Linux on both machines (client raspberry pi, server x86) and the packages are compiled from source.

Run in different arch machine

Hi, When I try to run snapserver in my mips board and run snapclient in my x86 linux computer, I have got some problem like:
snapserver log:
2015-12-25 02-34-45 [out] getNextMessage: 1536, size: 33554432, id: 3328, refers: 0
snapclient log:
2015-12-25 10-34-46 [out] timeout while waiting for response to: 13, timeout 12000
it's just like snapclient sent message type different from snapserver received message type.

The second problem is when I run snapserver and snapclient in one mips board, snapserver can't receive request type, request type always 0:
snapserver log:
2015-12-25 03-25-37 [out] Adding service 'SnapCast'
2015-12-25 03-25-38 [out] Service 'SnapCast' successfully established.
2015-12-25 03-25-43 [out] getNextMessage: 6, size: 2, id: 2, refers: 0
2015-12-25 03-25-44 [out] getNextMessage: 6, size: 2, id: 3, refers: 0
2015-12-25 03-25-44 [out] request: 0 (requestMsg.request )
2015-12-25 03-25-45 [out] getNextMessage: 6, size: 2, id: 4, refers: 0
2015-12-25 03-25-45 [out] request: 0 (requestMsg.request )
2015-12-25 03-25-46 [out] getNextMessage: 6, size: 2, id: 5, refers: 0
2015-12-25 03-25-47 [out] getNextMessage: 6, size: 2, id: 6, refers: 0

snapclient log:
2015-12-25 03-25-43 [out] Service 'SnapCast' of type '_snapcast._tcp' in domain 'local':
2015-12-25 03-25-43 [out] OpenWrt-2.local:33229 (192.168.0.118)
2015-12-25 03-25-43 [out] Found server 192.168.0.118:33229
2015-12-25 03-25-43 [out] Connecting
2015-12-25 03-25-43 [out] My MAC: "de:06:59:fa:8f:88"
2015-12-25 03-25-43 [out] request type 4
2015-12-25 03-25-44 [out] timeout while waiting for response to: 2, timeout 1000
2015-12-25 03-25-44 [out] request type 4
2015-12-25 03-25-45 [out] timeout while waiting for response to: 3, timeout 2000
2015-12-25 03-25-45 [out] request type 4
2015-12-25 03-25-46 [out] timeout while waiting for response to: 4, timeout 3000
2015-12-25 03-25-46 [out] request type 4
2015-12-25 03-25-47 [out] timeout while waiting for response to: 5, timeout 4000
2015-12-25 03-25-47 [out] request type 4

Bitrate and bitdepth

Thanks for this very easy to use software.

Please can you give some directions on how to configure Mopidy and possibly also the server and client for a FLAC stream with higher bitrate (48kHz) and bitdepth (24bits) with a high quality resampling (default is 4, max is 10?) ?

Snapclient breaks up after ~30 minutes when using alsa plugins

On the following setup, I'm experiencing short but continuous dropouts (ca. 1 sec every 5 - 25 seconds):

Two armhf devices, one with snapclient + snapserver 0.4.1 + Mopidy 2.0.0 (configured like suggested in README.md) installed, the other with just snapclient. Reproducing is possible, but sometimes it works some minutes fine until the problem begins.

The dropouts are mostly occuring on just one of the two devices (so one device has continous dropouts, other works fine). It's not clear to me why, but the problem mostly occurs on the system where snapclient connects to localhost. Sometimes, localhost works fine, but then remote host has the dropouts. Less often, both devices have these dropouts. Often, the problem also occurs if I just run server + client standalone on the same device without any additional client.

I already tried some things out including:

  • increasing buffers
  • changing codecs

On mopidy / gstreamer side I tried:
output = audioresample ! audioconvert ! audio/x-raw,rate=44100,channels=2,format=S16LE ! wavenc ! filesink location=/tmp/snapfifo
and
output = audioresample ! audioconvert ! wavenc ! filesink location=/tmp/snapfifo

everything without success.

I could reproduce the problem on the following system combinations:

  • RPI3 OSMC server + UDOObuntu client
  • RPI3 OSMC server + RPI2 OSMC client
  • RPI3 Raspbian Jessie server + UDOObuntu client

Tomorrow I'll test RPI3 Raspbian Jessie server + RPI2 Raspbian Jessie client with v0.5.0-beta-2. Any advices what could be wrong? Maybe permormance of these devices is just to low? Average Load on server is up to ~0.7...

This is a typically log output of snapclient from the device with dropouts:

v0.4 client dropouts.txt

.deb package: Dependency conflict on Ubuntu 14.04 LTS

When trying to install snapcast on Ubuntu 14.04 LTS, there is a dependency problem with the package init-system-helpers. Snapcast requires version 1.18, but only 1.14 is available. Maybe it's possible to decrease the required version aiming to support also Ubuntu 14.04? Currently I'm running snapclient on 14.04 without any problem, but atm my package management is broken due to the conflict...

XRUN at snapserver/client device

First I would like to thanks the developers for this awesome server.

I'm kind newbie on linux, maybe my problem can be a simple misconfiguration. I'm doing some tests for my multi-room audio for future home. The issue #26 are very close of my configuration:

device 1 = ubuntu 14.04 (parallels VM) - macbook - mopidy + mopidy-mopify + snapserver + snapclient

device 2 = Volumio 2.0 RC1 - RPi 3 - snap client

I made a clean install on both devices. After connect the device 2 on device 1, playing music with mopify, it works perfect, but when I connect the snapclient on snapserver at device 1 I'm getting XRUN at the snapclient, and the audio cutting out.

device 1 snapclient log:

2016-05-04 10-10-19 [err] XRUN
2016-05-04 10-10-19 [out] sleep < -bufferDuration/2: -36 < -15, sleep: -34
2016-05-04 10-10-19 [out] sleep < -bufferDuration/2: -34 < -15, sleep: -32
2016-05-04 10-10-19 [err] XRUN
2016-05-04 10-10-19 [out] sleep < -bufferDuration/2: -32 < -15, sleep: -31
2016-05-04 10-10-19 [out] sleep < -bufferDuration/2: -31 < -15, sleep: -29
2016-05-04 10-10-19 [err] XRUN
2016-05-04 10-10-19 [out] sleep < -bufferDuration/2: -29 < -15, sleep: -28
2016-05-04 10-10-19 [out] sleep < -bufferDuration/2: -28 < -15, sleep: -27
2016-05-04 10-10-19 [err] XRUN
2016-05-04 10-10-19 [out] sleep < -bufferDuration/2: -27 < -15, sleep: -25
2016-05-04 10-10-19 [out] sleep < -bufferDuration/2: -25 < -15, sleep: -24
2016-05-04 10-10-19 [err] XRUN
2016-05-04 10-10-19 [out] sleep < -bufferDuration/2: -24 < -15, sleep: -22
2016-05-04 10-10-19 [out] sleep < -bufferDuration/2: -22 < -15, sleep: -21
2016-05-04 10-10-19 [err] XRUN
2016-05-04 10-10-19 [out] sleep < -bufferDuration/2: -21 < -15, sleep: -20
2016-05-04 10-10-19 [out] sleep < -bufferDuration/2: -20 < -15, sleep: -18
2016-05-04 10-10-19 [err] XRUN
2016-05-04 10-10-19 [out] sleep < -bufferDuration/2: -18 < -15, sleep: -13
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -13, age: -13, bufferDuration: 30
2016-05-04 10-10-19 [out] Chunk: -137   -137    -137    -137    1   29
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -13, age: -42, bufferDuration: 30
2016-05-04 10-10-19 [err] XRUN
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -13, age: -70, bufferDuration: 30
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -13, age: -99, bufferDuration: 30
2016-05-04 10-10-19 [err] XRUN
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -13, age: -127, bufferDuration: 30
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -13, age: -155, bufferDuration: 30
2016-05-04 10-10-19 [err] XRUN
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -13, age: -184, bufferDuration: 30
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -13, age: -212, bufferDuration: 30
2016-05-04 10-10-19 [err] XRUN
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -12, age: -241, bufferDuration: 30
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -12, age: -269, bufferDuration: 30
2016-05-04 10-10-19 [err] XRUN
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -12, age: -297, bufferDuration: 30
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -12, age: -326, bufferDuration: 30
2016-05-04 10-10-19 [err] XRUN
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -12, age: -354, bufferDuration: 30
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -12, age: -383, bufferDuration: 30
2016-05-04 10-10-19 [err] XRUN
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -12, age: -411, bufferDuration: 30
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -12, age: -440, bufferDuration: 30
2016-05-04 10-10-19 [err] XRUN
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -12, age: -468, bufferDuration: 30
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -12, age: -497, bufferDuration: 30
2016-05-04 10-10-19 [err] XRUN
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -11, age: -525, bufferDuration: 30
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -11, age: -551, bufferDuration: 30
2016-05-04 10-10-19 [err] XRUN
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -11, age: -578, bufferDuration: 30
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -11, age: -607, bufferDuration: 30
2016-05-04 10-10-19 [err] XRUN
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -11, age: -636, bufferDuration: 30
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -11, age: -665, bufferDuration: 30
2016-05-04 10-10-19 [err] XRUN
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -11, age: -693, bufferDuration: 30
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -11, age: -722, bufferDuration: 30
2016-05-04 10-10-19 [err] XRUN
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -11, age: -750, bufferDuration: 30
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -11, age: -779, bufferDuration: 30
2016-05-04 10-10-19 [err] XRUN
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -10, age: -807, bufferDuration: 30
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -10, age: -836, bufferDuration: 30
2016-05-04 10-10-19 [err] XRUN
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -10, age: -865, bufferDuration: 30
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -10, age: -893, bufferDuration: 30
2016-05-04 10-10-19 [err] XRUN
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -10, age: -917, bufferDuration: 30
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -10, age: -944, bufferDuration: 30
2016-05-04 10-10-19 [err] XRUN
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -10, age: -953, bufferDuration: 30
2016-05-04 10-10-19 [out] correction: -4, factor: 0.997222
2016-05-04 10-10-19 [out] Sleep -10, age: -964, bufferDuration: 30
2016-05-04 10-10-19 [err] XRUN
2016-05-04 10-10-19 [out] Failed to get chunk
2016-05-04 10-10-19 [out] age > 200: -987
2016-05-04 10-10-19 [out] sleep < -bufferDuration/2: -987 < -15, sleep: -987
2016-05-04 10-10-19 [out] sleep < -bufferDuration/2: -987 < -15, sleep: -956

The bufferDuration/2 starts at some value value close to -1000 and starts increasing, when drops to <-15 value give another error, then starts all over again. does anyone know what this issue might be?

regards,

New release?

I see that there's been a lot of interesting developments in the develop branch since 0.4.0. Is it getting ready for a release anytime soon? Thanks for developing this awesome piece of software!

Android App crashed with more then 2 Input Sources

I have made 3 Input Sources, one for Volumio, one for Spotify-Connect and one for Airplay. When i switch the input channels in the app the app crash. When i disable Airplay in the config everything is fine.

there is an “XRUN” error on openwrt

When I run snapclient on openwrt, use mpd as audio output source,there is an error about "XRUN",and the sound could not comes out,it seem the "snd_pcm_prepare(handle_)" not restore the alsa play,when I modify in "void Player::initAlsa()",
as:
snd_pcm_hw_params_set_period_time_near(handle_, params, &period_time, 0);
snd_pcm_hw_params_set_buffer_time_near(handle_, params, &buffer_time, 0);
snd_pcm_sw_params_set_avail_min(handle_, swparams, frames_); snd_pcm_sw_params_set_start_threshold(handle_, swparams, frames_);
modify to:
//snd_pcm_hw_params_set_period_time_near(handle_, params, &period_time, 0);
//snd_pcm_hw_params_set_buffer_time_near(handle_, params, &buffer_time, 0);
//snd_pcm_sw_params_set_avail_min(handle_, swparams, frames_); //snd_pcm_sw_params_set_start_threshold(handle_, swparams, frames_);

After that modify,the sound can come out for 30s,but there also occur "XRUN",and no sound comes out.
log is:

12-28-04 [out] correction: 4, factor: 1.00391
2016-05-11 12-28-04 [out] Sleep 2, age: -190, bufferDuration: 23
2016-05-11 12-28-04 [err] XRUN
2016-05-11 12-28-04 [out] correction: 4, factor: 1.00391
2016-05-11 12-28-04 [out] Sleep 2, age: -190, bufferDuration: 23
2016-05-11 12-28-04 [out] correction: 4, factor: 1.00391
2016-05-11 12-28-05 [out] Sleep 2, age: -193, bufferDuration: 23
2016-05-11 12-28-05 [out] Chunk: -1937 -1937 -1937 -1937 1 0
2016-05-11 12-28-05 [err] XRUN
2016-05-11 12-28-05 [out] correction: 4, factor: 1.00391
2016-05-11 12-28-05 [out] Sleep 2, age: -199, bufferDuration: 23
2016-05-11 12-28-05 [out] correction: 4, factor: 1.00391
2016-05-11 12-28-05 [out] Sleep 2, age: -209, bufferDuration: 23
2016-05-11 12-28-05 [err] XRUN
2016-05-11 12-28-05 [out] correction: 4, factor: 1.00391
2016-05-11 12-28-05 [out] Sleep 2, age: -215, bufferDuration: 23
2016-05-11 12-28-05 [out] correction: 4, factor: 1.00391
2016-05-11 12-28-05 [out] Sleep 2, age: -219, bufferDuration: 23
2016-05-11 12-28-05 [err] XRUN
2016-05-11 12-28-05 [out] correction: 4, factor: 1.00391
2016-05-11 12-28-05 [out] Sleep 2, age: -222, bufferDuration: 23
2016-05-11 12-28-05 [out] correction: 4, factor: 1.00391
2016-05-11 12-28-05 [out] Sleep 1, age: -220, bufferDuration: 23
2016-05-11 12-28-05 [err] XRUN
2016-05-11 12-28-05 [out] correction: 4, factor: 1.00391
2016-05-11 12-28-05 [out] Sleep 1, age: -227, bufferDuration: 23
2016-05-11 12-28-05 [out] correction:

Slow playback and seek issue

So I'm having two issues. I started playing with this with mopidy. Your instructions work great for Spotify and web streaming, but when I try to play local mp3 files they play back at about half speed.

I'm also having an issue with mopidy where it won't advance to the next track because it tries to do a seek at the end of the file that fails. Probably a mopidy bug, but I wanted to put it out there in case there's a known seek issue.

Any clue on where to start troubleshooting these issues. Otherwise the clients work wonderfully. I've been adding a small webserver using libevent to allow changing the server a client is pointed at and will hopefully be building a front end for that as well.

Develop Running 100% cpu on one core

Hi!
Thank's for a great program.
I'm using the master bransh with a Rasperry PI, it's working very good.
But when i try the devel bransh i have problem with the processor load,
its only using one core 100% and the rest about 5-10% and the sound is jittering.
I'm running Volumio 1.5 with iqaudio Pi-dac+ Server and client.
It's it anything i can try to avoid the jittering?
I compiled from the source code, Kernel 3.18.5-v7+, no pulse audio, gcc version 4.9.2 (Raspbian 4.9.2-10). I got same problem with the deb package.
br
Tommy

Precompiled Raspberry Pi Version

Hi badaix,
I really like your project here! I think the best deployment of this would be within a minimalistic tinycore linux on a raspberry pi. This way very quick boot times could be achieved compared to a full-blown raspian and the risk of damaging the sd-card by simply cutting the power is zero. I have been trying to build such an image, but I didn't succeed in compiling this on the tinycore system. Also my knowledge is too limited to successfully cross-compile this on a different system myself.

Would it be possible for you to provide a precompiled arm version for the raspberry? I would then go ahead and try to put together an image that can be used for raspy clients.

Video/audio synchronization

Hi all,

thanks for this great add-on, I had been looking for that for months!
I am running a media server on the following config:
Media server -> pulseaudio -> snapserver -> network -> snapclient

Besides issue #52 (I just need to remove the /tmp/snapfifo file and restart pulseaudio at the beginning of the session to make everything work), I still have the following issues:

Playing music is fine and perfectly synchronized, but whenever I play a video

  1. there seems to be a sound distortion, the pitch is much higher than usually (setting a fixed bitrate in the media server to match snapserver's might help?)
  2. There is a lag of a couple of seconds which makes it impossible to look at the video if there are dialogues

I'd like to keep a consistent config for my media server for both video and audio so helping me resolve these two issues would be awesome.

terminate called without an active exception

Hi all,
I tried to install snapserver on Raspberry Pi + OSMC which is based on Debian Jessie, but snapserver fails to start. Output of running /usr/sbin/snapserver directly:

pure virtual method called
terminate called without an active exception
Aborted

Snapclient doesn't fail (even though I couldn't test functionality yet). Interestingly, I had a very similar issue with a completely other application, but it was also OSMC specific: 50ButtonsEach/fliclib-linux-dist#22

I'll also raise an issue on osmc so maybe we can examine together.

Module load failed.

The readme tells:

pacmd load-module module-pipe-sink file=/tmp/snapfifo

but this doesn't work when a snapfifo file already exists. Was this working at some point? Is one supposed to first star the pulseaudio snapfifo file and then start snapserver?

Distorted sound in combination with Mopidy on Pi Musicbox

I installed Snapserver and client on my Pi Musicbox in preparation of a multiroom setup as described in issue #26. The sound of Mopidy comes out of the speakers without much stuttering for most radio streams, but it is in all streams noticeably distorted. It's like the radio presenters are on antidepressants; they speak slower and lower.

Could you point me in the right direction to debug and experiment with settings until its good again? I assume it has something to do with the sample rates, but I have only basic knowledge of digital sound and don't know where to start. (I don't use pulseaudio by the way, so its not issue #16).

Mopidy compatibility

Hi, I am looking for a setup for streaming from Google Play Music to multiple outpus (raspberries) and snapcast is looking very interesting. As mopidy is based on MPD, is snapcast compatible to mopidy? How would I go about adding the fifo sink for snapcast there?
The snapcast and mopidy server would be running on a debian system.

White noise

Hi :)
First I tried installing the deb. I used the arm version on a raspi B+
That resulted in only white noise from mopidy and .wav files.
Next I tried compiling from source(same pi).
It gave white noise for the wav test but I could make out the song playing with mopidy faintly, also engulfed by white noise.
Clients:

  • LMDE2(.deb package)
  • Android phone(.apk)

The white noise from the two clients are also different, and not just time delay, actually different noises.

The Pi is connected via a switch to the AP serving the clients. I have a local client installed from source on the Pi itself, but I haven't found speakers to hook up to it yet. Wifi network is 150Mbps, but on iwconfig Bit Rate=11 Mb/s

Distorted playback

Hey so after setting this up and actually playing a track for more then 30 seconds in my tests, I've run into an issue where after about 10 minutes or so of playing a track, it will start being very jumpy/stuttery
Running snapclient, here is the output when this starts happening

2016-01-20 11-02-10 [out] sleep > chunkDuration: 39 > 26, chunks: 37, out: 6, needed: 30
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 14, age: -11, bufferDuration: 30
2016-01-20 11-02-10 [out] Chunk: -116   -116    -116    -116    1   6
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 14, age: -12, bufferDuration: 30
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 14, age: -9, bufferDuration: 30
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 14, age: -3, bufferDuration: 30
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 13, age: 5, bufferDuration: 30
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 13, age: 12, bufferDuration: 30
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 13, age: 18, bufferDuration: 30
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 13, age: 18, bufferDuration: 30
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 13, age: 18, bufferDuration: 30
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 13, age: 16, bufferDuration: 30
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 13, age: 14, bufferDuration: 30
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 13, age: 13, bufferDuration: 30
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 13, age: 10, bufferDuration: 30
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 13, age: 7, bufferDuration: 30
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 12, age: 2, bufferDuration: 30
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 12, age: -2, bufferDuration: 30
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 12, age: -3, bufferDuration: 30
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 12, age: -7, bufferDuration: 30
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 12, age: -10, bufferDuration: 30
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 12, age: -14, bufferDuration: 30
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 12, age: -19, bufferDuration: 30
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 12, age: -22, bufferDuration: 30
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 12, age: -26, bufferDuration: 30
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 12, age: -27, bufferDuration: 30
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 11, age: -29, bufferDuration: 30
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 11, age: -33, bufferDuration: 30
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 11, age: -35, bufferDuration: 30
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 11, age: -38, bufferDuration: 30
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 11, age: -40, bufferDuration: 30
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 11, age: -41, bufferDuration: 30
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 11, age: -43, bufferDuration: 30
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 11, age: -44, bufferDuration: 30
2016-01-20 11-02-10 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-10 [out] Sleep 11, age: -45, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 11, age: -46, bufferDuration: 30
2016-01-20 11-02-11 [out] Chunk: -462   -462    -462    -462    1   93
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 10, age: -46, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 10, age: -47, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 10, age: -47, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 10, age: -47, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 10, age: -47, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 10, age: -47, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 10, age: -46, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 10, age: -46, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 10, age: -45, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 10, age: -45, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 9, age: -44, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 9, age: -43, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 9, age: -43, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 9, age: -43, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 9, age: -42, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 9, age: -41, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 9, age: -40, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 9, age: -39, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 9, age: -39, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 9, age: -38, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 8, age: -37, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 8, age: -37, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 8, age: -36, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 8, age: -35, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 8, age: -35, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 8, age: -34, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 8, age: -33, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 8, age: -33, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 8, age: -32, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 8, age: -31, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 7, age: -31, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 7, age: -30, bufferDuration: 30
2016-01-20 11-02-11 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-11 [out] Sleep 7, age: -30, bufferDuration: 30
2016-01-20 11-02-12 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-12 [out] Sleep 7, age: -29, bufferDuration: 30
2016-01-20 11-02-12 [out] Chunk: -297   -297    -297    -297    1   118
2016-01-20 11-02-12 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-12 [out] Sleep 7, age: -29, bufferDuration: 30
2016-01-20 11-02-12 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-12 [out] Sleep 7, age: -28, bufferDuration: 30
2016-01-20 11-02-12 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-12 [out] Sleep 7, age: -28, bufferDuration: 30
2016-01-20 11-02-12 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-12 [out] Sleep 7, age: -28, bufferDuration: 30
2016-01-20 11-02-12 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-12 [out] Sleep 7, age: -28, bufferDuration: 30
2016-01-20 11-02-12 [out] correction: 4, factor: 1.00302
2016-01-20 11-02-12 [out] Sleep 7, age: -27, bufferDuration: 30
2016-01-20 11-02-44 [out] time sync main loop

There are also alot of

[err] XRUN 

errors throughout it too

the time sync main loop is after i have paused the music. The only output from the server around this time is

 2016-01-20 11-00-12 [out] onResync 280ms
2016-01-20 11-00-13 [out] onResync 80ms
2016-01-20 11-00-40 [out] onResync 80ms
2016-01-20 11-00-52 [out] onResync 281ms
2016-01-20 11-00-53 [out] onResync 81ms
2016-01-20 11-01-07 [out] onResync 81ms
2016-01-20 11-05-13 [out] onResync 154045ms

What could be the cause of this? anyway to fix
I have the server as an rpi2, and client is rpi1 (model B) both wired connection

Bluetooth connectivity?

Do you know if there is any way you could connect a bluetooth speaker to a RPi running Snapcast? I know snapcast generates a temp file to pipe the audio to which is consumed by a snapcast client. But could you pipe to that file as well as whatever is required to pipe to bluetooth?

systemd unit file

I plan to use snapcast on Archlinux, which uses systemd. It implies writting systemd unit files. Hence two questions:

  • Would you agree to include them? I'll probably be able to write them, but including them implies to maintain them in the future.
  • As far as I can see, starting snapcast client and server is simply a matter of running snapclient -d and snapserver -d, respectively, and a kill signal to stop them. Am I right?

There's also one point I don't realy get: how does the client know about the server's IP when running as a daemon? I don't see where the init script gives it, if it does.

snapclient_0.5.0.beta-2_armhf.deb dies on startup

Bananian 15.08, on Banana Pi hardware

snapclient

2016-03-23 22-44-47 out NEW: service 'Snapcast' of type '_snapcast._tcp' in domain 'local'
2016-03-23 22-44-47 out CACHE_EXHAUSTED
2016-03-23 22-44-47 out ALL_FOR_NOW
2016-03-23 22-44-47 [out] Service 'Snapcast' of type '_snapcast._tcp' in domain 'local':
2016-03-23 22-44-47 [out] music.local:1704 (XXX.XXX.XXX.XXX)
2016-03-23 22-44-47 [out] Found server XXX.XXX.XXX.XXX:1704
2016-03-23 22-44-47 [out] Latency: 0
pure virtual method called
terminate called without an active exception
Abgebrochen

bluetooth speaker lag?

i have a raspberry pi running snapserver and mopidy and then i have installed your android apk onto my phone. when running the client over my phone speaker or a cable connected to my phone its amazing but when i hook my phone up to a bluetooth speaker it gets out of sync quickly and just lags.

is this a known issue? it makes sense theres an extra delay via bluetooth but didn't see anything mentioned so i thought i would ask.

ps thank you for an amazing project!

Compile errors on Raspberry Pi

Hi
I am getting compile errors in both the server and client.
Here is the output after trying to make all:

/usr/bin/g++ -std=c++0x -static-libgcc -static-libstdc++ -Wall -Wno-unused-function -O3 -pthread -DASIO_STANDALONE -DVERSION=\"0.5.0\" -I.. -I../externals/asio/asio/include -I../externals/popl/include -c controlServer.cpp -o controlServer.o
controlServer.cpp: In member function ‘void ControlServer::handleAccept(socket_ptr)’:
controlServer.cpp:106:21: error: ‘class asio::basic_stream_socket<asio::ip::tcp>’ has no member named ‘native’
  setsockopt(socket->native(), SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
                     ^
controlServer.cpp:107:21: error: ‘class asio::basic_stream_socket<asio::ip::tcp>’ has no member named ‘native’
  setsockopt(socket->native(), SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
                     ^
In file included from ../externals/asio/asio/include/asio/detail/impl/posix_mutex.ipp:24:0,
                 from ../externals/asio/asio/include/asio/detail/posix_mutex.hpp:71,
                 from ../externals/asio/asio/include/asio/detail/mutex.hpp:25,
                 from ../externals/asio/asio/include/asio/detail/service_registry.hpp:20,
                 from ../externals/asio/asio/include/asio/impl/execution_context.hpp:20,
                 from ../externals/asio/asio/include/asio/execution_context.hpp:406,
                 from ../externals/asio/asio/include/asio/detail/scheduler.hpp:21,
                 from ../externals/asio/asio/include/asio/system_executor.hpp:19,
                 from ../externals/asio/asio/include/asio/associated_executor.hpp:21,
                 from ../externals/asio/asio/include/asio.hpp:19,
                 from controlServer.h:22,
                 from controlServer.cpp:19:
../externals/asio/asio/include/asio/error.hpp: At global scope:
../externals/asio/asio/include/asio/error.hpp:256:36: warning: ‘asio::error::system_category’ defined but not used [-Wunused-variable]
 static const asio::error_category& system_category
                                    ^
../externals/asio/asio/include/asio/error.hpp:258:36: warning: ‘asio::error::netdb_category’ defined but not used [-Wunused-variable]
 static const asio::error_category& netdb_category
                                    ^
../externals/asio/asio/include/asio/error.hpp:260:36: warning: ‘asio::error::addrinfo_category’ defined but not used [-Wunused-variable]
 static const asio::error_category& addrinfo_category
                                    ^
../externals/asio/asio/include/asio/error.hpp:262:36: warning: ‘asio::error::misc_category’ defined but not used [-Wunused-variable]
 static const asio::error_category& misc_category
                                    ^
make: *** [controlServer.o] Error 1
make: Leaving directory `/root/snapcast-master/server'

Any help much appreciated.

Android Client without Controller

Is it possible to get a Android Client without the Controller thing ?
So you can run it on a FireTV, FireTV Stick or old Smartphone.
Maybe only a big streamlist and a mute/unmute button.

changing Audio output

Hi There,

I have installed snapcast to stream audio between two raspberry pies the server is running snapcast and mpd, but I would like to be able to route the audio in the client back through my DAC, is that possible? because it only seems to play through the 3.5mm jack.

Make a single client "master"

Would it be possible to make the clients configurable to operate in master-slave operation. This would enable definition of a single master that does not drop frames or adapts speed while other possibly mutliple clients adapt their timing to this "holy" master?

Server & Client Log file path

Hi,

Can someone tell me the path to the server and client log files please? I'm using SnapCast with Volumio and is generally working well. However sometimes after not using mpd for a few hours, when I start playing through volumio it appears to be playing something via the UI but I dont hear anything. Then about 5 minutes later the music just starts coming through the speakers.

I have enabled verbose logging on volumio but would like to investigate snapcast also. If I find something I will post the logs here.

onResync spikes followed by muted audio

Hi!

I'm noticing that, after a few hours, my audio stops.

I'm using arecord to pipe data from a line in; there's no obvious reason or signal...except that my onResync numbers jump from ~100ms to 10000ms.

If I kill and restart arecord everything works again - this produces a little gap in output but nothing major. According to arecord's VU meter it is continually sending audio.

The clients and server are just using default values - it's a wired network of 6 rPi2 clients with 1 rPi2 broadcaster.

Happy to provide any additional logs or details if it helps - I couldn't quite figure out what onResync means but a 100x spike seems relevant. :)

snapserver segfault if $HOME is not set

Running snapserver on command line works fine, but when running it as a systemd service it segfaults. Debugging led me to string dir = getenv("HOME") + string("/.config/Snapcast/"); in Config::Config() which will segfault if HOME is not set in the environment. Adding HOME=/root to /etc/default/snapserver solved this problem for me, but maybe settings.json should be stored somewhere else when running as a systemd service?

I'm running Snapcast v0.5.0-beta-1.

Adding volume control using Phat DAC

Hello,

first of all thanks for the litte piece of magic work delivering after 30min of setup, what more than 2 days of pusleaudio & co. could not deliver. Great work!!!

I'd say I have a rather standard setup.

  • Ubuntu server running snapserver & mpd
  • 2 raspi clients running snapclient

Using the 3.5mm audio jack the setup on clients was running fine, with the issue of the well known bad quality of the sound using this output mode of a raspi. So I invested in 2 Phat DACs. The new setup run out of the box.

But, no volume control anymore possible. Some recherche told me this is normal behavior of this hardware. Well some more recherche introduced the ALSA plugin softvol to me being an option to try.

I managed to get this plugin to work, meaning I've got a volume control able to control volume of application except snapclient. (applying -s parameter pointing on the new plugin device).

Any help possible from the experts out there for a new user of snapcast?

Thanks in advance

STO

Some output:
pi@raspberrypi:~ $ snapclient -l
0: null
Discard all samples (playback) or generate zero samples (capture)
1: default
2: softvole
3: sysdefault:CARD=sndrpihifiberry
snd_rpi_hifiberry_dac,
Default Audio Device
4: dmix:CARD=sndrpihifiberry,DEV=0
snd_rpi_hifiberry_dac,
Direct sample mixing device
5: dsnoop:CARD=sndrpihifiberry,DEV=0
snd_rpi_hifiberry_dac,
Direct sample snooping device
6: hw:CARD=sndrpihifiberry,DEV=0
snd_rpi_hifiberry_dac,
Direct hardware device without any conversions
7: plughw:CARD=sndrpihifiberry,DEV=0
snd_rpi_hifiberry_dac,
Hardware device with all software conversions

pi@raspberrypi:~ $ vi /home/pi/.asoundrc
pcm.!default {
type plug
slave.pcm "softvole"
}
pcm.softvole {
type softvol
slave {
pcm "sysdefault"
}
control {
name "softvolume"
card 0
}
}

control: playing state

Hi, it would be really helpful if Server.GetStatus could report if the snapserver was playing or not.

Snapclient hangs

I'm seeing an issue where audio plays for maybe 10 minutes on a Raspberry Pi B, then stops with no warning or message half the time, where other times I get an XRUN message.

I am running snapserver on an Ubuntu computer with ethernet, and I'm also running snapclient on that computer. That instance of snapclient does not hang, but the Pi running snapclient does eventually hang.

I am using a Pulse Audio sink as specified in the readme. Both snapserver and snapclient report an audio format of 44100:16:2. I am running both snapclients with PULSE_LATENCY_MSEC=60, from issue #16, and I am also running with --latency 750 on the Pi, which I've noticed tends to sync just right with the main computer.

This is the latest version of snapcast, pulled from git and made from source. Here is what the Pi reports - looks normal until it suddenly hangs (and then I have to issue Ctrl+\ to get it to quit):

...
2016-02-01 07-00-56 [out] Chunk: 4 4 10 4 500 80
2016-02-01 07-00-57 [out] Chunk: 5 5 5 5 500 71
2016-02-01 07-00-58 [out] Chunk: 1 4 5 5 500 67
2016-02-01 07-00-59 [out] Chunk: -8 -7 4 4 500 68
2016-02-01 07-01-00 [out] Chunk: 3 -1 -1 4 500 67
2016-02-01 07-01-01 [out] Chunk: 0 3 -1 4 500 56

Whereas the server gives no indication anything has frozen up. Any recommendations? Could it be the --latency 750 setting on the Pi?

to much logging

when i start snapclient on a limited resource pc running mint-14.04, after a while it starts logging several dozen lines per second:

[err] Failed to create simple poll object.

that uses CPU and RAM up to the point where the system swaps itself to death.
the whole time nothing is streamed to the box.

[not an issue] Nice stuff

Hey Just wanted to say awesome stuff! Was searching for a while to try and find something to close the gap on mopidy and multi-room playback. Will be awesome once you get "zones" working, wont have to fork out hundreds for sonos!

Anyway, this was pretty easy to install (probably should note that I had to upgrade my rpi's to Jessie, as the wheezy repo was too far behind on some of the dependancies) once that was done setup was super easy and playback started immediately!

Nice stuff

snapserver fifo and pulseaudio

I had some issues getting pulseaudio working with the snapserver. I tried following the indications from #2 and put "load-module module-pipe-sink file=/tmp/snapfifo" in by default.pa to have the sink in place automatically at ever boot, but it would fail.

The problem is that when module-pipe-sink is called, it tries to create the fifo (using mkfifo), and since it already exists because snapserver created it, it fails and doesn't load the module

As a workaround,I added some scripts to snapserver.service.

For ExecStartPost : I call a script that does "rm -f /tmp/snapfifo" and restart the pulseaudio daemon
For ExecStopPost: I call a script that does "rm -f /tmp/snapfifo"

I hope this can help someone else!

P.S. I am using pulseaudio to act as a bluetooth A2DP receiver, which now allows me to use snapcast as a whole-home bluetooth system :)

Making Mopidy-based multiroom speaker client and server at the same time

Say I have several Mopidy-based Raspberry Pi's I use as multiroom speakers. Is it possible to play the audiostream from one of them through its speaker AND at the same time transmit it via the snapcast server to the other pi's? Something like this:

 Mopidy on device1 -> snapcast server on device 1 -> snapcast client on device1 -> autoaudiosink on device 1
                                                  -> snapcast client on device2 -> autoaudiosink on device 2
                                                  -> snapcast client on device3 -> autoaudiosink on device 3

The goal would be not to need a seperate server device for multiroom streaming, but to be able to use any speaker as the server while at the same time playing the multiroom stream on that speaker locally. Together with some kind of way to set the Mopidy output remotely on each device this could create a user friendly synchronised multiroom experience. You start playing a Spotify playlist in your bedroom and stream it to the bathroom. But you could also start in the kitchen, etc.

Mopidy track control

Hi, first off, this is a fantastic initiative. Very happy to have found it.

I'm using it in conjunction with Mopidy, but I'm experiencing a problem with track control. If I hit pause/play/next/prev in Mopidy, my clients report:

2016-01-12 22-44-45 [out] Failed to get chunk
2016-01-12 22-44-49 [out] time sync main loop

No errors in the server.

Accompanying this on one of my clients is some audio artifacting - it sounds like it is playing back the last chunk in an infinite loop (I suspect this is actually a separate issue?)

If I let Mopidy transition to the next track without manual intervention, it works fine. I'm guessing this is more of a Mopidy problem than a snapcast problem, but I wanted to document the issue here just in case/as a note for other Mopidy users.

edit: I followed up on this with Mopidy - the track control is certainly a Mopidy issue, but this issue is still relevant due to the audio artifacting.

Add some documentation to the repository

This is certainly a cool project, with a lot of potential.

But I would also love to see clients on Windows 10 (phone, desktop etc.) and am willing to have a go at some of the basics of a .NET application.

The problem I am facing is a lack of documentation, I know that an answer would be "the code is the documentation", but some basic information might help... like "how" (format) are the packages transferred over the wire, how is the synchronization with the audio-clock made etc.

I found a nice document (master's thesis) on "Synchronization of streamed audio between multiple
playback devices over an unmanaged IP network" here: http://www.eit.lth.se/sprapport.php?uid=894
(don't know what license it covers, there is no real copyright on it). This should cover the basics for most people, but maybe it can help to make some parts more understandable or even have snapcast implement some standards...

Anyway, like I said, documentation would be nice. But even without, keep up the good work!

Only getting noise output

client and server are connected, tested with /dev/urandom.

mopidy config is writing to /tmp/snapfifo, but only delivering noise.

starting and stopping the server audio in mopidy does start/stop noise at client end.

local client (on same server as mopidy) also produces the same issue.

[running on Pi2 server and PiB on client]

  • tried upgrading to dev instance of mopidy - from 1.1.1 - no improvement

Multi-Zone Support?

Sorry to put this in issues... Would someone be able to tell me if the server supports multi zone setups, or is going to in the future? (ie. Music in one room, and different music in the other rooms) What I would love to be able to do is call an API endpoint on the server with a Client/Speaker identifier, and tell the server to send a certain audio stream to the client...

unusuable because of underruns

I tried this tonight and the server and client find each other instantly.
When running audio on the server, the client picks up the audio but playback is jerky at best.

2015-12-04 04-37-48 [out] Sleep -13, age: -397, bufferDuration: 30
2015-12-04 04-37-48 [err] XRUN
2015-12-04 04-37-48 [out] correction: -4, factor: 0.996977
2015-12-04 04-37-48 [out] Sleep -13, age: -426, bufferDuration: 30
2015-12-04 04-37-48 [out] correction: -4, factor: 0.996977
2015-12-04 04-37-48 [out] Sleep -13, age: -456, bufferDuration: 30
2015-12-04 04-37-48 [err] XRUN
2015-12-04 04-37-48 [out] correction: -4, factor: 0.996977
2015-12-04 04-37-48 [out] Sleep -13, age: -485, bufferDuration: 30
2015-12-04 04-37-48 [out] correction: -4, factor: 0.996977
2015-12-04 04-37-48 [out] Sleep -12, age: -515, bufferDuration: 30
2015-12-04 04-37-48 [err] XRUN

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.