Skip to content

Instantly share code, notes, and snippets.

@caquino
Created October 26, 2012 19:01
Show Gist options
  • Save caquino/3960738 to your computer and use it in GitHub Desktop.
Save caquino/3960738 to your computer and use it in GitHub Desktop.
Google TTS
#!/usr/bin/env bash
MESSAGE=${*}
LANGUAGE=pt
TTSURL="http://translate.google.com/translate_tts"
USERAGENT="Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20111114 Ubuntu/9.10 (karmic) Firefox/8.0.1"
curl  -s -G \
       --user-agent "${USERAGENT}" \
       --data-urlencode "tl=${LANGUAGE}" \
       --data-urlencode "q=${PREFIXMESSAGE} ${MESSAGE}" \
       --header "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" \
       --header "Accept-Language: en-us,en;q=0.5" \
       --header "Accept-Encoding: gzip,deflate" \
       --header "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7" \
       --header "Keep-Alive: 300" \
       --header "Connection: keep-alive" \
       ${TTSURL} > $$.mp3
echo "$$.mp3"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment