Files
Emberwild/tools/voice/make_voice.sh

22 lines
1.0 KiB
Bash
Executable File

#!/bin/sh
# Old Tam's voice (tools/voice/make_voice.py). Run after changing any line in
# data/tutorial.json or data/hints.json:
#
# tools/voice/make_voice.sh # just the lines that changed
# tools/voice/make_voice.sh --all # every line again
#
# The first run sets up a Python 3.12 environment for Kokoro in
# tools/voice/.venv (about 1 GB, with PyTorch; needs uv) and downloads the
# Kokoro model (about 330 MB) from Hugging Face.
cd "$(dirname "$0")/../.." || exit 1
V=tools/voice/.venv
command -v ffmpeg >/dev/null || { echo "needs ffmpeg (brew install ffmpeg)"; exit 1; }
if [ ! -x "$V/bin/python" ]; then
command -v uv >/dev/null || { echo "needs uv (https://docs.astral.sh/uv/)"; exit 1; }
uv venv -q --python 3.12 "$V" || exit 1
uv pip install -q --python "$V/bin/python" "kokoro==0.9.4" "misaki[en]==0.9.4" "soundfile==0.14.0" \
"en_core_web_sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.8.0/en_core_web_sm-3.8.0-py3-none-any.whl" || exit 1
fi
exec "$V/bin/python" tools/voice/make_voice.py "$@"