shairport-sync [-djvw] [-a name] [-A latency] [-B command] [-c configurationfile] [-E command] [--get-cover-art] [--logOutputLevel] [-L latency] [-m backend] [--meta-dir=directory] [-o backend] [--password=secret] [-r threshold] [--statistics] [-S mode] [-t timeout] [--tolerance=frames] [-- audio_backend_options] shairport-sync -D shairport-sync -k shairport-sync -h shairport-sync -R shairport-sync -V

shairport-sync plays audio streamed from iTunes or from an AirPlay device to an ALSA compatible audio output device (available on Linux and FreeBSD) , to a "sndio" output device (available on OpenBSD, FreeBSD and Linux) or to a PulseAudio output stream (available on Linux).

A feature of shairport-sync is that the audio is played synchronously. This means that if many devices are playing the same stream at the same time, all the outputs will stay in step with one another. This allows multiple devices to play the same source without getting out of phase with one another, enabling, for example, simultaneous multi-room operation.

shairport-sync can be compiled to stream audio, without synchronisation, to a pipe, to stdout or to a libao output device (an "AO" device). It can also be compiled to stream metadata to a pipe or socket.

Settings can be made using the configuration file (recommended for all new installations) or by using command-line options.

You should use the configuration file for setting up shairport-sync. This file is usually shairport-sync.conf and is generally located in the System Configuration Directory, which is normally the /etc directory in Linux or the /usr/local/etc directory in BSD unixes. You may need to have root privileges to modify it.

(Note: Shairport Sync may have been compiled to use a different configuration directory. You can determine which by performing the command $ shairport-sync -V. One of the items in the output string is the value of the sysconfdir, i.e. the System Configuration Directory.)

Within the configuraton file, settings are organised into groups, for example, there is a "general" group of standard settings, and there is an "alsa" group with settings that pertain to the ALSA back end. Here is an example of a typical configuration file:

general = {

name = "Mike's Boombox";

interpolation = "soxr";

password = "secret";

output_backend = "alsa";

};

alsa = {

output_device = "hw:0";

mixer_control_name = "PCM";

};

Most settings have sensible default values, so -- as in the example above -- users generally only need to set (1) the service name, (2) a password (if desired) and (3) the output device. If the output device has a mixer that can be used for volume control, then (4) the volume control's name should be specified. It is highly desirable to use the output device's mixer for volume control, if available -- response time is reduced to zero and the processor load is reduced. In the example above, "soxr" interpolation was also enabled.

A sample configuration file with all possible settings, but with all of them commented out, is installed at shairport-sync.conf.sample, within the System Configuration Directory -- /etc in Linux, /usr/local/etc in BSD unixes.

To retain backwards compatibility with previous versions of shairport-sync you can use still use command line options, but any new features, etc. will be available only via configuration file settings.

The configuration file is processed using the libconfig library -- see .

These are the settings available within the general group:

These settings are for the ALSA back end, used to communicate with audio output devices in the ALSA system. (By the way, you can use tools such as alsamixer or aplay to discover what devices are available.) Use these settings to select the output device and the mixer control to be used to control the output volume. You can additionally set the desired size of the output buffer and you can adjust overall latency. Here are the alsa group settings:

These settings are for the SNDIO back end, used to communicate with audio output devices in the SNDIO system.

These settings are for the new PulseAudio backend.

These settings are for the PIPE backend, used to route audio to a named unix pipe. The audio is in raw CD audio format: PCM 16 bit little endian, 44,100 samples per second, interleaved stereo.

There are no settings for the STDOUT backend.

There are no configuration file settings for the AO backend.

shairport-sync can process metadata provided by the source, such as Track Number, Album Name, cover art, etc. and can provide additional metadata such as volume level, pause/resume, etc. It sends the metadata to a pipe, by default /tmp/shairport-sync-metadata. To process metadata, shairport-sync must have been compiled with metadata support included. You can check that this is so by running the command $ shairport-sync -V; the identification string will contain the word metadata.

Please note that different sources provide different levels of metadata. Some provide a lot; some provide almost none.

The metadata group of settings allow you to enable metadata handling and to control certain aspects of it:

shairport-sync can run programs just before it starts to play an audio stream and just after it finishes. You specify them using the sessioncontrol group settings run_this_before_play_begins and run_this_after_play_ends.

This section is about the command-line options available in shairport-sync.

Note: if you are setting up shairport-sync for the first time or are updating an existing installation, you are encouraged to use the configuration file settings described above. Most of the command-line options described below simply replicate the configuration settings and are retained to provide backward compatibility with older installations of shairport-sync.

Many command-line options take sensible default values, so you can normally ignore most of them. See the EXAMPLES section for typical usages.

There are two kinds of command-line options for shairport-sync: regular program options and audio backend options. Program options are always listed first, followed by any audio backend options, preceded by a -- symbol.

These command-line options are used by shairport-sync itself.

These command-line options are passed to the chosen audio backend. The audio backend options are preceded by a -- symbol to introduce them and to separate them from any program options. In this way, option letters can be used as program options and also as audio backend options without ambiguity.

In the ALSA backend, audio is sent to an output device which you can specify using the -d option. The output level (the "volume") is controlled using a level control associated with a mixer. By default, the mixer is implemented in shairport-sync itself in software. To use a hardware level control on a mixer on the sound card, specify the name of the mixer control with the -c option. If the mixer is not associated with the output device, then you need to specify where the mixer is to be found with the -m option.

Here is a slightly contrived example:

shairport-sync -d -a "Joe's Stereo" -S soxr -- -d hw:1,0 -m hw:1 -c PCM

The program will run in daemon mode ( -d ), will be visible as "Joe's Stereo" ( -a "Joe's Stereo" ) and will use the SoX Resampler Library-based stuffing ( -S soxr ). The audio backend options following the -- separator specify that the audio will be output on output 0 of soundcard 1 ( -d hw:1,0 ) and will take advantage of the same sound card's mixer ( -m hw:1 ) using the level control named "PCM" ( -c "PCM" ).

The example above is slightly contrived in order to show the use of the -m option. Typically, output 0 is the default output of a card, so the output device could be written -d hw:1 and then the mixer option would be unnecessary, giving the following, simpler, command:

shairport-sync -d -a "Joe's Stereo" -S soxr -- -d hw:1 -c PCM

Mike Brady developed shairport-sync from the original Shairport by James Laird.

shairport-sync can be found at

Shairport can be found at

This man page was written using by Oliver Kurth.