Chinjoo
Chinjoo

Reputation: 2792

Text To Speech in Silverlight 4

I am creating an application which converts text to speech using silverlight 4.0. Two options which I found can be used are:

  1. Use TTS at client side, which requires the application to be run OOB. Also since it uses native windows components, can't be used in any other platforms (MAC).
  2. Use TTS conversion at WCF end. This again requires the WCF service to be hosted on IIS with Local System account for application pool.

Are there any other options in which we dont have to provide the elevated permissions?

Upvotes: 1

Views: 394

Answers (2)

Chinjoo
Chinjoo

Reputation: 2792

Another good solution is using google TTS - http://translate.google.com/translate_tts

The code would be like this:

string url = string.Format("http://translate.google.com/translate_tts?tl=en&q={0}", textToSay);
WebClient client = new WebClient();
return client.DownloadData(url);

If using silverlight, the data which is fetched from the above code(in byte array), can be set as the source of media element with converting to memore stream as below:

_audioPlayer.SetSource(new MemoryStream(textToSpeech));

Where textToSpeech is the byte array as returned from google tts.

Upvotes: 0

Paul Dixon
Paul Dixon

Reputation: 4257

The Bing translator service has TTS for several languages. Maybe it is possible to just use the TTS part without the translation. This blog post explains how to call the service and perform TTS from Silverlight: http://timheuer.com/blog/archive/2010/03/22/silverlight-translator-text-to-speech-api.aspx

Upvotes: 1

Related Questions