Advertisement
metalx1000

Translate Your Voice to Another Language - BASH - Linux

Dec 4th, 2011
772
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.75 KB | None | 0 0
  1. #!/bin/bash
  2. #Created By Kris Occhipinti
  3. #April 13th 2011
  4. #Released under the GPLv3
  5. #http://FilmsByKris.com
  6. #http://filmsbykris.com/wordpress/?p=1283
  7.  
  8. lng="es"
  9.  
  10. rec -r 16000 -t alsa default /tmp/recording.flac silence 1 0.1 5% 5 1.0 5%
  11.  
  12. x=$(wget -q -U "Mozilla/5.0" --post-file recording.flac --header="Content-Type: audio/x-flac; rate=16000" -O - "http://www.google.com/speech-api/v1/recognize?lang=en-us&client=chromium"|cut -d\" -f12)
  13.  
  14. clear
  15. echo "$x"
  16.  
  17. y=$(wget -U "Mozilla/5.0" -qO - "http://translate.google.com/translate_a/t?client=t&text=$x&sl=auto&tl=$lng" | sed 's/\[\[\[\"//' | cut -d \" -f 1)
  18.  
  19. echo "$y"
  20.  
  21. mplayer -user-agent Mozilla "http://translate.google.com/translate_tts?tl=$lng&q=$(echo "$y" | sed 's#\ #\+#g')" > /dev/null 2>&1 ;
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement