Skip to content

Instantly share code, notes, and snippets.

@gre
Created August 10, 2011 18:06
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gre/1137659 to your computer and use it in GitHub Desktop.
Save gre/1137659 to your computer and use it in GitHub Desktop.
Play framework + Scala : a text to speech in 2 line of code using google translate - this is an action, put it in any controller ;)
def speech(text:String) = {
val audio = WS.url("http://translate.google.com/translate_tts?tl=en").setParameter("q", text).get()
response.contentType = audio.getContentType()
audio.getStream()
}
/*
This is a Play! framework controller's action.
Put it in any scala controller.
Don't forget to import play.libs.WS
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment