Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- eng2audio () {
- # see this: https://gist.github.com/michalfapso/3110049/raw
- # http://michalfapso.blogspot.com.br/2012/01/using-google-text-to-speech.html
- # http://mostovenko.blogspot.com.br/2012/04/voicing-messages-in-python-or-fun-with.html
- # versão no snipt: https://snipt.net/voyeg3r/
- # how truncate string --> echo ${var:start:end}
- # removendo o último caractere de uma variável ${var:0:-1}
- # vou precisar truncar a string::::: echo "Sua string contém "${#var}" caracteres"
- if ping -q -c2 www.google.com >/dev/null ; then
- FILENAME="${@:?Usage: $0 give me some words to speech}"
- FILENAME=`awk '{print tolower($0)}' <<< "$FILENAME"`
- url="http://translate.google.com/translate_tts?ie=UTF-8&tl=en&q="
- wget -q -U Mozilla -O "${FILENAME// /_}.mp3" "${url}${FILENAME// /+}+' '"
- [ -f "${FILENAME// /_}.mp3" -a ! -s "${FILENAME// /_}.mp3" ] && { rm -f "${FILENAME// /_}.mp3" ; echo 'error!'; }
- command -v mpg321 > /dev/null && mpg321 -q "${FILENAME// /_}.mp3"
- echo "[sound:${FILENAME// /_}.mp3]" | xclip -selection c
- fi
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement