Skip to content

Instantly share code, notes, and snippets.

@allenmichael
Created January 30, 2019 19:47
Show Gist options
  • Save allenmichael/e93d6b9443b871653a67482f8ba71ac0 to your computer and use it in GitHub Desktop.
Save allenmichael/e93d6b9443b871653a67482f8ba71ac0 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
if [ -z "$1" ]
then
read -p "Please enter text: " TEXT
else
TEXT=$1
fi
if [ -z "$2" ]
then
read -p "Pick a voice: " VOICE
if [ -z "$VOICE" ]
then
VOICE="Justin"
fi
else
VOICE=$2
fi
# aws polly describe-voices will list all voices
# aws polly describe-voices --query 'Voices[?starts_with(LanguageCode, `en`)]' limits to only English speaking voices
aws polly synthesize-speech 'pol_bash.mp3' --text "$TEXT" --output-format 'mp3' --voice-id "$VOICE"
afplay pol_bash.mp3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment