Skip to content

Instantly share code, notes, and snippets.

@frederikstroem
Last active August 2, 2023 20:36
Show Gist options
  • Save frederikstroem/c6b3d40abd9124dddecadbce4ada65ca to your computer and use it in GitHub Desktop.
Save frederikstroem/c6b3d40abd9124dddecadbce4ada65ca to your computer and use it in GitHub Desktop.
Cogai TTS using docker & script placed at ~/.local/bin/tts
#!/usr/bin/env bash
# Test: `echo "This should be read up for me" | tts`
# Read all input into variable and replace newlines with spaces
input=$(cat | tr '\n' ' ')
# Save current time in ISO8601 format and replace special characters with underscore
timestamp=$(date -u +"%Y_%m_%dT%H_%M_%SZ")
# Run the Docker command with CPU version
# https://github.com/coqui-ai/TTS/discussions/1891
vits_speaker_idx="p234" # Pretty smooth British male voice.
docker run --rm -v ~/tts-output:/root/tts-output \
ghcr.io/coqui-ai/tts-cpu \
--out_path "/root/tts-output/$timestamp.wav" \
--model_name "tts_models/en/vctk/vits" \
--speaker_idx "$vits_speaker_idx" \
--text "$input"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment