Skip to content

Instantly share code, notes, and snippets.

@bradymholt
Created November 10, 2014 04:03
Show Gist options
  • Select an option

  • Save bradymholt/8f4fc9ae2429a287a8ef to your computer and use it in GitHub Desktop.

Select an option

Save bradymholt/8f4fc9ae2429a287a8ef to your computer and use it in GitHub Desktop.
Text to Speech - Airport Express
#!/bin/bash
if [ ! -f /tmp/"$1".mp3 ]
then
echo "Downloading TTS file from Google Translate..."
wget -O /tmp/"$1".mp3 --user-agent="Mozilla/4.0" http://translate.google.com/translate_tts?q="$1"
else
echo "Skipping download, cached file found."
fi
echo "Sending audio to Airport..."
sox -t mp3 /tmp/"$1".mp3 -t raw -r 87k - pad 0 4 | mono /opt/JustePort/JustePort.exe - "$2" "$3"
#wget -O- --user-agent="Mozilla/4.0" http://translate.google.com/translate_tts?q="$1" | sox -t mp3 - -t raw -r 87k - pad 0 4 | mono /opt/JustePort/JustePort.exe - "$2" "$3"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment