-
Notifications
You must be signed in to change notification settings - Fork 432
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from balenalabs/multi-room-snapcast
Multi room support
- Loading branch information
Showing
28 changed files
with
477 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
# balenaSound device type support | ||
|
||
|
||
| Device Type | Multi-room disabled (`DISABLE_MULTI_ROOM=1`) | Multi-room server | Multi-room client | | ||
| ------------- | ------------- | ------------- | ------------- | | ||
| Raspberry Pi (v1 / Zero / Zero W) | ✔ | ✘ [1] | ✔ | | ||
| Raspberry Pi 2 | ✔ | [2] | [2] | | ||
| Raspberry Pi 3 [3] | ✔ | ✔ [4] | ✔ | | ||
| Raspberry Pi 4 [3] | ✔ | ✔ | ✔ | | ||
|
||
|
||
**Notes** | ||
- [1] Multi-room master server functionality is disabled by default on Raspberry Pi 1 family devices due to performance constraints. | ||
- [2] Not tested. Feel free to share your results. | ||
- [3] Currently balenaSound can not run on balenaOS 64 bit versions, please use 32 bit alernative. See this [issue](https://github.com/balenalabs/balena-sound/issues/82) for more informaton and an up to date status. | ||
- [4] There is a [known issue](https://github.com/raspberrypi/linux/issues/1444) with all variants of the Raspberry Pi 3 where Bluetooth and WiFi interfere with each other. This will only impact the performance of balenaSound if you use a **Pi 3 as the master server to do multi-room bluetooth streaming**, resulting in stuttering audio (Airplay and Spotify Connect will work fine, as well as all streaming methods with multi-room disabled). In this cases we recommend the use of a Raspberry Pi 4 as the `master` server or a Pi 3 with a bluetooth dongle. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Set the device broadcast name for AirPlay | ||
if [[ -z "$BLUETOOTH_DEVICE_NAME" ]]; then | ||
BLUETOOTH_DEVICE_NAME=$(printf "balenaSound Airplay %s" $(hostname | cut -c -4)) | ||
fi | ||
|
||
exec shairport-sync -a "$BLUETOOTH_DEVICE_NAME" | printf "Device is discoverable as \"%s\"\n" "$BLUETOOTH_DEVICE_NAME" | ||
# Use pipe output if multi room is enabled | ||
# Don't pipe for Pi 1 family devices since snapcast-server is disabled by default | ||
if [[ -z $DISABLE_MULTI_ROOM ]] && [[ $BALENA_DEVICE_TYPE != "raspberry-pi" ]]; then | ||
SHAIRPORT_BACKEND="-o pipe -- /var/cache/snapcast/snapfifo" | ||
fi | ||
|
||
# Start AirPlay | ||
exec shairport-sync -a "$BLUETOOTH_DEVICE_NAME" $SHAIRPORT_BACKEND | printf "Device is discoverable as \"%s\"\n" "$BLUETOOTH_DEVICE_NAME" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
pcm.!default { | ||
type plug | ||
slave.pcm rate44100Hz | ||
} | ||
|
||
pcm.rate44100Hz { | ||
type rate | ||
slave { | ||
pcm writeFile # Direct to the plugin which will write to a file | ||
format S16_LE | ||
rate 44100 | ||
} | ||
} | ||
|
||
pcm.writeFile { | ||
type file | ||
slave.pcm null | ||
file "/var/cache/snapcast/snapfifo" | ||
format "raw" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,63 @@ | ||
version: '2' | ||
services: | ||
bluetooth-audio: | ||
network_mode: host | ||
restart: always | ||
build: ./bluetooth-audio | ||
restart: always | ||
network_mode: host | ||
privileged: true | ||
labels: | ||
io.balena.features.dbus: 1 | ||
volumes: | ||
- bluetoothcache:/var/cache/bluetooth | ||
- snapcast:/var/cache/snapcast | ||
airplay: | ||
build: ./airplay | ||
restart: always | ||
network_mode: host | ||
privileged: true | ||
labels: | ||
io.balena.features.dbus: 1 | ||
volumes: | ||
- snapcast:/var/cache/snapcast | ||
spotify: | ||
build: ./spotify | ||
restart: always | ||
network_mode: host | ||
privileged: true | ||
volumes: | ||
- spotifycache:/var/cache/raspotify | ||
- snapcast:/var/cache/snapcast | ||
fleet-supervisor: | ||
build: ./fleet-supervisor | ||
restart: on-failure | ||
network_mode: host | ||
privileged: true | ||
ports: | ||
- 3000:3000 | ||
labels: | ||
io.balena.features.supervisor-api: 1 | ||
snapcast-server: | ||
build: | ||
context: ./snapcast-server | ||
args: | ||
SNAPCAST_VERSION: 0.17.1 | ||
restart: on-failure | ||
ports: | ||
- 1704:1704 | ||
- 1705:1705 | ||
volumes: | ||
- snapcast:/var/cache/snapcast | ||
snapcast-client: | ||
build: | ||
context: ./snapcast-client | ||
args: | ||
SNAPCAST_VERSION: 0.17.1 | ||
restart: on-failure | ||
network_mode: host | ||
privileged: true | ||
volumes: | ||
- snapcast:/var/cache/snapcast | ||
volumes: | ||
spotifycache: | ||
bluetoothcache: | ||
snapcast: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM balenalib/%%BALENA_MACHINE_NAME%%-alpine-node | ||
WORKDIR /usr/src | ||
|
||
COPY . . | ||
RUN JOBS=MAX npm install --only=production | ||
|
||
COPY start.sh /usr/src/ | ||
RUN chmod +x /usr/src/start.sh | ||
|
||
CMD [ "/bin/bash", "/usr/src/start.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "fleet-supervisor", | ||
"version": "1.0.0", | ||
"description": "Fleet controller for balenaSound", | ||
"main": "server.js", | ||
"scripts": { | ||
"start": "node server.js" | ||
}, | ||
"author": "Tomás Migone <[email protected]", | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
"cote": "^1.0.0" | ||
} | ||
} |
Oops, something went wrong.