1

I'm currently working on a c# project and want the user to type a sentence and then speak this sentence using google text to speech engine. I can't use C# speech synthesizer because it only support English language and I want it in Arabic. does anyone know how to invoke google tts?

duffymo
  • 305,152
  • 44
  • 369
  • 561
user2148116
  • 195
  • 1
  • 2
  • 13

1 Answers1

0

This is a sample code that does it:

using (WebClient client = new WebClient())
{
    client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows)");
    client.DownloadFile("http://translate.google.com/translate_tts?tl=ar&q=مرحبا العالم", "HelloWorld.wav");
}

It will save a HelloWorld.wav file that contains the phrase behind the q parameter - sorry if it doesn't really mean something in arabic :-)

Simon Mourier
  • 132,049
  • 21
  • 248
  • 298