Skip to content

Instantly share code, notes, and snippets.

@dylansturg
Created June 6, 2016 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dylansturg/b1827c4d5e4d56fd321edafcd779d026 to your computer and use it in GitHub Desktop.
Save dylansturg/b1827c4d5e4d56fd321edafcd779d026 to your computer and use it in GitHub Desktop.
C# example of using Android's TextToSpeech API
protected void SpeakText()
{
var speaker = new TextToSpeech(this, this);
speaker.SetLanguage(Java.Util.Locale.Default);
speaker.SetPitch(1); // Normal speech
speaker.SetSpeechRate(1); // Normal speech
var speechId = "1"; // Each speak call needs a unique identifier
speaker.Speak("Hello From Android", QueueMode.Flush, null, speechId);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment