Skip to content

Commit 4e745f2

Browse files
author
Florian Asche
committed
add new snapcast version
1 parent acf8cef commit 4e745f2

File tree

2 files changed

+47
-19
lines changed

2 files changed

+47
-19
lines changed
Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
1-
# Name for the client, given by the hostname variable which is set on piCompose run:
2-
CLIENT_NAME=${HOSTNAME:-no_hostname_found}
1+
# Snapcast-Client - Docker Environment Configuration
2+
# Copy this file to .env and customize for your setup by 'cp .env.example .env'
3+
4+
### Enable debug mode (optional):
5+
# ENABLE_DEBUG="1"
6+
7+
### User ID:
8+
# This is used to set the correct permissions for the accessing the audio device and accessing the PulseAudio socket
9+
SC_USER_ID="1000"
10+
SC_USER_GROUP="1000"
11+
12+
### Name for the client (optional):
13+
# by default it uses the HOSTNAME variable from the piCompose environment which includes the MAC from the network card
14+
# CLIENT_NAME="My Voice Assistant Speaker"
15+
16+
### PulseAudio socket path on the host:
17+
# PulseAudio Server: /run/user/1000/pulse
18+
# Pipewire Server: /run/user/1000/pulse/native
19+
SC_PULSE_SERVER="unix:/run/user/${SC_USER_ID}/pulse/native"
20+
SC_XDG_RUNTIME_DIR="/run/user/${SC_USER_ID}"
21+
22+
### Audio output device (optional):
23+
# AUDIO_OUTPUT_DEVICE="default"
324

425
# Remote Instance of Snapcast Server or MusicAssistant:
26+
#SNAPCAST_REMOTE_HOST="<tcp|ws|wss>://<snapserver host or IP>[:port]"
527
SNAPCAST_REMOTE_HOST="tcp://192.168.33.5"

03-stage-linux-voice-assistant/02-snapcast/files/snapcast/docker-compose.yml

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,38 @@
33
services:
44
snapcast:
55
# snapcast client for audio playback
6-
# note that CLIENT_NAME in command is only working when the variable is passed from the .env file not from env_file. And the hostname is set in the picompose shell script.
76
container_name: snapcast
87
image: "ghcr.io/florian-asche/docker-snapcast:latest"
98
restart: unless-stopped
109
network_mode: "host"
11-
entrypoint: /usr/bin/snapclient
10+
user: "${SC_USER_ID}:${SC_USER_GROUP}"
1211
environment:
1312
- START_SNAPCLIENT=true
14-
- PIPEWIRE_RUNTIME_DIR=/run
15-
- XDG_RUNTIME_DIR=/run
13+
# Pulseaudio
14+
- XDG_RUNTIME_DIR=${LVA_XDG_RUNTIME_DIR}
15+
- PULSE_SERVER=${LVA_PULSE_SERVER}
16+
- CLIENT_NAME=${HOSTNAME}
1617
env_file: .env
17-
command:
18-
#- "--list" # List devices
19-
- "--hostID"
20-
- ${CLIENT_NAME:-no_hostname_from_env}
21-
- "--soundcard"
22-
#- "hw:CARD=seeed2micvoicec,DEV=0"
23-
- "default"
24-
- ${SNAPCAST_REMOTE_HOST:-no_hostname_from_env}
25-
devices:
26-
- /dev/snd:/dev/snd
27-
- /dev/bus/usb
2818
group_add:
2919
- audio
20+
# Priority for audio process
21+
cap_add:
22+
- SYS_NICE
3023
volumes:
24+
# Time and zone
3125
- /etc/localtime:/etc/localtime:ro
3226
- /etc/timezone:/etc/timezone:ro
33-
# 1000 is my user id from the local user i used on my ubuntu desktop or pi-compose image
34-
- /run/user/1000/pipewire-0:/run/pipewire-0
27+
# Pulseaudio
28+
# /run/user/1000:/run/user/1000
29+
- ${SC_XDG_RUNTIME_DIR}:${SC_XDG_RUNTIME_DIR}
30+
# Health check for process
31+
healthcheck:
32+
test: ["CMD", "pgrep", "-f", "snapcast"]
33+
interval: 30s
34+
timeout: 5s
35+
retries: 3
36+
start_period: 90s
37+
#command:
38+
#- "--list" # List devices
39+
# - --additional-parameters-here
40+
# - --but-use-env-if-possible

0 commit comments

Comments
 (0)