askrobots / dbbasic-face
Public
Puppet Stage: a browser puppet that lip-syncs to local text-to-speech and takes stage directions, live or from a screenplay.
setup.sh · 1.4 KB · 46 lines
| 1 | #!/usr/bin/env bash |
| 2 | # Downloads Rhubarb Lip Sync (MIT) into tools/ and checks for required commands. |
| 3 | set -euo pipefail |
| 4 | cd "$(dirname "$0")" |
| 5 | |
| 6 | RHUBARB_VERSION="1.14.0" |
| 7 | |
| 8 | case "$(uname -s)" in |
| 9 | Darwin) RHUBARB_OS="macOS" ;; |
| 10 | Linux) RHUBARB_OS="Linux" ;; |
| 11 | *) echo "Unsupported OS: $(uname -s)"; exit 1 ;; |
| 12 | esac |
| 13 | |
| 14 | if ls tools/*/rhubarb >/dev/null 2>&1; then |
| 15 | echo "✓ Rhubarb already present in tools/" |
| 16 | else |
| 17 | url="https://github.com/DanielSWolf/rhubarb-lip-sync/releases/download/v${RHUBARB_VERSION}/Rhubarb-Lip-Sync-${RHUBARB_VERSION}-${RHUBARB_OS}.zip" |
| 18 | echo "Downloading Rhubarb Lip Sync ${RHUBARB_VERSION} (${RHUBARB_OS})..." |
| 19 | mkdir -p tools |
| 20 | curl -sL -o tools/rhubarb.zip "$url" |
| 21 | unzip -q -o tools/rhubarb.zip -d tools/ |
| 22 | rm tools/rhubarb.zip |
| 23 | echo "✓ Rhubarb installed in tools/" |
| 24 | fi |
| 25 | |
| 26 | echo |
| 27 | echo "Checking required commands:" |
| 28 | missing=0 |
| 29 | for cmd in node ffmpeg ffprobe; do |
| 30 | if command -v "$cmd" >/dev/null; then echo " ✓ $cmd"; else echo " ✗ $cmd (brew install ${cmd/ffprobe/ffmpeg})"; missing=1; fi |
| 31 | done |
| 32 | |
| 33 | echo |
| 34 | echo "TTS engines (at least one needed):" |
| 35 | found_tts=0 |
| 36 | for cmd in say espeak espeak-ng; do |
| 37 | if command -v "$cmd" >/dev/null; then echo " ✓ $cmd"; found_tts=1; fi |
| 38 | done |
| 39 | [ "$found_tts" = 1 ] || { echo " ✗ none found — install espeak (brew/apt install espeak) or use macOS"; missing=1; } |
| 40 | |
| 41 | echo |
| 42 | if [ "$missing" = 0 ]; then |
| 43 | echo "All set. Run: node server.js" |
| 44 | else |
| 45 | echo "Install the missing pieces above, then run: node server.js" |
| 46 | fi |