diff --git a/Dockerfile b/Dockerfile index 1d1a412..1080205 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,17 +24,8 @@ RUN \ pip \ wheel && \ pip install -U --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ \ + piper-tts \ "wyoming-piper==${PIPER_VERSION}" && \ - if [ -z ${PIPER_BIN_VERSION+x} ]; then \ - PIPER_BIN_VERSION=$(curl -sL "https://api.github.com/repos/rhasspy/piper/releases/latest" \ - | awk '/tag_name/{print $4;exit}' FS='[""]'); \ - fi && \ - curl -sL -o \ - /tmp/piper.tar.gz -L \ - "https://github.com/rhasspy/piper/releases/download/${PIPER_BIN_VERSION}/piper_linux_x86_64.tar.gz" && \ - tar xzf \ - /tmp/piper.tar.gz -C \ - /usr/share && \ printf "Linuxserver.io version: ${VERSION}\nBuild-date: ${BUILD_DATE}" > /build_version && \ echo "**** cleanup ****" && \ rm -rf \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 0853039..a334cf3 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -24,17 +24,8 @@ RUN \ pip \ wheel && \ pip install -U --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ \ + piper-tts \ "wyoming-piper==${PIPER_VERSION}" && \ - if [ -z ${PIPER_BIN_VERSION+x} ]; then \ - PIPER_BIN_VERSION=$(curl -sL "https://api.github.com/repos/rhasspy/piper/releases/latest" \ - | awk '/tag_name/{print $4;exit}' FS='[""]'); \ - fi && \ - curl -sL -o \ - /tmp/piper.tar.gz -L \ - "https://github.com/rhasspy/piper/releases/download/${PIPER_BIN_VERSION}/piper_linux_aarch64.tar.gz" && \ - tar xzf \ - /tmp/piper.tar.gz -C \ - /usr/share && \ printf "Linuxserver.io version: ${VERSION}\nBuild-date: ${BUILD_DATE}" > /build_version && \ echo "**** cleanup ****" && \ rm -rf \ diff --git a/README.md b/README.md index 8bec235..8c28a56 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,7 @@ services: - PGID=1000 - TZ=Etc/UTC - PIPER_VOICE=en_US-lessac-medium + - LOCAL_ONLY= #optional - PIPER_LENGTH=1.0 #optional - PIPER_NOISE=0.667 #optional - PIPER_NOISEW=0.333 #optional @@ -106,6 +107,7 @@ docker run -d \ -e PGID=1000 \ -e TZ=Etc/UTC \ -e PIPER_VOICE=en_US-lessac-medium \ + -e LOCAL_ONLY= `#optional` \ -e PIPER_LENGTH=1.0 `#optional` \ -e PIPER_NOISE=0.667 `#optional` \ -e PIPER_NOISEW=0.333 `#optional` \ @@ -129,6 +131,7 @@ Containers are configured using parameters passed at runtime (such as those abov | `-e PGID=1000` | for GroupID - see below for explanation | | `-e TZ=Etc/UTC` | specify a timezone to use, see this [list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List). | | `-e PIPER_VOICE=en_US-lessac-medium` | The [Piper voice](https://huggingface.co/rhasspy/piper-voices/tree/main) to use, in the format `--` | +| `-e LOCAL_ONLY=` | If set to `true`, or any other value, the container will not attempt to download models from HuggingFace and will only use locally-provided models. | | `-e PIPER_LENGTH=1.0` | Voice speaking rate, 1.0 is default with < 1.0 being faster and > 1.0 being slower. | | `-e PIPER_NOISE=0.667` | Controls the variability of the voice by adding noise. Values above 1 will start to degrade audio. | | `-e PIPER_NOISEW=0.333` | Controls the variability of speaking cadence. Values above 1 produce extreme stutters and pauses. | @@ -300,6 +303,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions +* **29.08.25:** - Add support for local only mode. * **10.08.25:** - Add streaming support. * **18.07.24:** - Rebase to Ubuntu Noble. * **25.11.23:** - Initial Release. diff --git a/readme-vars.yml b/readme-vars.yml index 518162c..0010d1c 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -30,6 +30,7 @@ param_ports: # optional container parameters opt_param_usage_include_env: true opt_param_env_vars: + - {env_var: "LOCAL_ONLY", env_value: "", desc: "If set to `true`, or any other value, the container will not attempt to download models from HuggingFace and will only use locally-provided models."} - {env_var: "PIPER_LENGTH", env_value: "1.0", desc: "Voice speaking rate, 1.0 is default with < 1.0 being faster and > 1.0 being slower."} - {env_var: "PIPER_NOISE", env_value: "0.667", desc: "Controls the variability of the voice by adding noise. Values above 1 will start to degrade audio."} - {env_var: "PIPER_NOISEW", env_value: "0.333", desc: "Controls the variability of speaking cadence. Values above 1 produce extreme stutters and pauses."} @@ -86,6 +87,7 @@ init_diagram: | "piper:latest" <- Base Images # changelog changelogs: + - {date: "29.08.25:", desc: "Add support for local only mode."} - {date: "10.08.25:", desc: "Add streaming support."} - {date: "18.07.24:", desc: "Rebase to Ubuntu Noble."} - {date: "25.11.23:", desc: "Initial Release."} diff --git a/root/etc/s6-overlay/s6-rc.d/svc-piper/run b/root/etc/s6-overlay/s6-rc.d/svc-piper/run index 4212cf0..926806d 100755 --- a/root/etc/s6-overlay/s6-rc.d/svc-piper/run +++ b/root/etc/s6-overlay/s6-rc.d/svc-piper/run @@ -1,10 +1,16 @@ #!/command/with-contenv bash # shellcheck shell=bash +unset UPDATE_MODELS + +if [[ -z ${LOCAL_ONLY} ]]; then + UPDATE_MODELS=true +fi + exec \ s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 10200" \ s6-setuidgid abc python3 -m wyoming_piper \ - --piper '/usr/share/piper/piper' \ + --piper '/lsiopy/bin/piper' \ --uri 'tcp://0.0.0.0:10200' \ --length-scale "${PIPER_LENGTH:-1.0}" \ --noise-scale "${PIPER_NOISE:-0.667}" \ @@ -13,5 +19,6 @@ exec \ --voice "${PIPER_VOICE}" \ --max-piper-procs "${PIPER_PROCS:-1}" \ --data-dir /config \ - --download-dir /config --update-voices \ + --download-dir /config \ + ${UPDATE_MODELS:+--update-voices} \ ${STREAMING:+--streaming}