mirror of
https://github.com/badaix/snapcast.git
synced 2025-04-29 02:07:55 +02:00
Add configuration.md
This commit is contained in:
parent
a01ff08492
commit
894d457c80
2 changed files with 155 additions and 9 deletions
16
README.md
16
README.md
|
@ -95,14 +95,12 @@ The pipe stream (`stream = pipe`) will per default create the pipe. Sometimes yo
|
|||
|
||||
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
|
||||
- **tcp**: receives audio from a TCP socket, can act as client or server
|
||||
|
||||
Configuration options for the stream sources can be found in `/etc/snapserver.conf`.
|
||||
- [pipe](doc/configuration.md#pipe): read audio from a named pipe
|
||||
- [alsa](doc/configuration.md#alsa): read audio from an alsa device
|
||||
- [librespot](doc/configuration.md#librespot): launches librespot and reads audio from stdout
|
||||
- [airplay](doc/configuration.md#airplay): launches airplay and read audio from stdout
|
||||
- [file](doc/configuration.md#file): read PCM audio from a file
|
||||
- [tcp](doc/configuration.md#tcp-server): receives audio from a TCP socket, can act as client or server
|
||||
|
||||
## Test
|
||||
|
||||
|
@ -194,6 +192,6 @@ Unordered list of features that should make it into the v1.0
|
|||
- [X] **OpenWrt** port Snapclient to OpenWrt
|
||||
- [X] **Hi-Res audio** support (like 96kHz 24bit)
|
||||
- [X] **Groups** support multiple Groups of clients ("Zones")
|
||||
- [X] **Ports** Snapclient for Windows, Mac OS X,...
|
||||
- [ ] **JSON-RPC** Possibility to add, remove, rename streams
|
||||
- [ ] **Protocol specification** Snapcast binary streaming protocol, JSON-RPC protocol
|
||||
- [ ] **Ports** Snapclient for Windows, ~~Mac OS X~~,...
|
||||
|
|
148
doc/configuration.md
Normal file
148
doc/configuration.md
Normal file
|
@ -0,0 +1,148 @@
|
|||
# Configuration
|
||||
|
||||
## Sources
|
||||
|
||||
source URI of the PCM input stream, can be configured multiple times
|
||||
The following notation is used in this paragraph:
|
||||
- `<angle brackets>`: the whole expression must be replaced with your specific setting
|
||||
- `[square brackets]`: the whole expression is optional and can be left out
|
||||
- `[key=value]`: if you leave this option out, "value" will be the default for "key"
|
||||
|
||||
Format:
|
||||
|
||||
TYPE://host/path?name=<name>[&codec=<codec>][&sampleformat=<sampleformat>][&chunk_ms=<chunk ms>]
|
||||
|
||||
parameters have the form `key=value`, they are concatenated with an `&` character
|
||||
parameter `name` is mandatory for all sources, while `codec`, `sampleformat` and `chunk_ms` are optional
|
||||
and will override the default `codec`, `sampleformat` or `chunk_ms` settings.
|
||||
Non blocking sources support the `dryout_ms` parameter: when no new data is read from the source, send silence to the clients
|
||||
|
||||
Available types are:
|
||||
|
||||
### pipe
|
||||
|
||||
pipe:///<path/to/pipe>?name=<name>[&mode=create][&dryout_ms=2000], mode can be "create" or "read"
|
||||
|
||||
### librespot
|
||||
|
||||
librespot:///<path/to/librespot>?name=<name>[&dryout_ms=2000][&username=<my username>&password=<my password>][&devicename=Snapcast][&bitrate=320][&wd_timeout=7800][&volume=100][&onevent=""][&nomalize=false][&autoplay=false]
|
||||
|
||||
note that you need to have the librespot binary on your machine
|
||||
sampleformat will be set to "44100:16:2"
|
||||
|
||||
### file
|
||||
|
||||
file:///<path/to/PCM/file>?name=<name>
|
||||
|
||||
### process
|
||||
|
||||
process:///<path/to/process>?name=<name>[&dryout_ms=2000][&wd_timeout=0][&log_stderr=false][¶ms=<process arguments>]
|
||||
|
||||
### airplay
|
||||
|
||||
airplay:///<path/to/airplay>?name=<name>[&dryout_ms=2000][&port=5000]
|
||||
|
||||
note that you need to have the airplay binary on your machine
|
||||
sampleformat will be set to "44100:16:2"
|
||||
|
||||
### tcp server
|
||||
|
||||
tcp://<listen IP, e.g. 127.0.0.1>:<port>?name=<name>[&mode=server]
|
||||
|
||||
default for `port` (if omitted) is 4953, default for `mode` is `server`
|
||||
|
||||
mopidy.conf (running GStreamer in [client mode](https://www.freedesktop.org/software/gstreamer-sdk/data/docs/latest/gst-plugins-base-plugins-0.10/gst-plugins-base-plugins-tcpclientsink.html))
|
||||
|
||||
[audio]
|
||||
output = audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! wavenc ! tcpclientsink
|
||||
|
||||
### tcp client
|
||||
|
||||
tcp://<server IP, e.g. 127.0.0.1>:<port>?name=<name>&mode=client
|
||||
|
||||
mopidy.conf (running GStreamer in [server mode](https://www.freedesktop.org/software/gstreamer-sdk/data/docs/latest/gst-plugins-base-plugins-0.10/gst-plugins-base-plugins-tcpserversink.html))
|
||||
|
||||
[audio]
|
||||
output = audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! wavenc ! tcpserversink
|
||||
|
||||
### alsa
|
||||
|
||||
alsa://?name=<name>&device=<alsa device>
|
||||
|
||||
Snapcast v0.21 can capture audio from alsa, and to capture the output of a player, an alsa loopback device can be used:
|
||||
|
||||
1. setup the alsa loopback device by loading the kernel module:
|
||||
|
||||
```
|
||||
sudo modprobe snd-aloop
|
||||
```
|
||||
|
||||
2. the loopback device should show up in `aplay -l`
|
||||
|
||||
```
|
||||
aplay -l
|
||||
**** List of PLAYBACK Hardware Devices ****
|
||||
card 0: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM]
|
||||
Subdevices: 8/8
|
||||
Subdevice #0: subdevice #0
|
||||
Subdevice #1: subdevice #1
|
||||
Subdevice #2: subdevice #2
|
||||
Subdevice #3: subdevice #3
|
||||
Subdevice #4: subdevice #4
|
||||
Subdevice #5: subdevice #5
|
||||
Subdevice #6: subdevice #6
|
||||
Subdevice #7: subdevice #7
|
||||
card 0: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM]
|
||||
Subdevices: 8/8
|
||||
Subdevice #0: subdevice #0
|
||||
Subdevice #1: subdevice #1
|
||||
Subdevice #2: subdevice #2
|
||||
Subdevice #3: subdevice #3
|
||||
Subdevice #4: subdevice #4
|
||||
Subdevice #5: subdevice #5
|
||||
Subdevice #6: subdevice #6
|
||||
Subdevice #7: subdevice #7
|
||||
card 1: Intel [HDA Intel], device 0: CX20561 Analog [CX20561 Analog]
|
||||
Subdevices: 1/1
|
||||
Subdevice #0: subdevice #0
|
||||
card 1: Intel [HDA Intel], device 1: CX20561 Digital [CX20561 Digital]
|
||||
Subdevices: 1/1
|
||||
Subdevice #0: subdevice #0
|
||||
card 2: CODEC [USB Audio CODEC], device 0: USB Audio [USB Audio]
|
||||
Subdevices: 0/1
|
||||
Subdevice #0: subdevice #0
|
||||
```
|
||||
|
||||
On my system it's card 0 with devices 0 and 1, each having 8 subdevices. You can address them with `hw:<card idx>,<device idx>,<subdevice num>`, i.e. `hw:0,0,0`.
|
||||
If a process plays audio using `hw:0,0,x`, then this audio is looped back to `hw:0,1,x`, so
|
||||
|
||||
3. Configure your player to use a loopback device.
|
||||
|
||||
For mopidy (gstreamer) it should be something like this (not tested):
|
||||
|
||||
```
|
||||
output = audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! wavenc ! alsasink device=hw:0,0,0
|
||||
```
|
||||
|
||||
For mpd: in mpd.conf
|
||||
|
||||
```
|
||||
audio_output_format "48000:16:2"
|
||||
audio_output {
|
||||
type "alsa"
|
||||
name "My ALSA Device"
|
||||
device "hw:0,0,0" # optional
|
||||
# auto_resample "no"
|
||||
# mixer_type "hardware" # optional
|
||||
# mixer_device "default" # optional
|
||||
# mixer_control "PCM" # optional
|
||||
# mixer_index "0" # optional
|
||||
}
|
||||
```
|
||||
|
||||
4. Configure Snapserver to capture the loopback device:
|
||||
|
||||
```
|
||||
[stream]
|
||||
stream = alsa://?name=SomeName&sampleformat=48000:16:2&device=hw:0,1,0
|
||||
```
|
Loading…
Add table
Reference in a new issue