Skip to content

Instantly share code, notes, and snippets.

@pierceboggan
Last active August 29, 2015 13:56
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 pierceboggan/8969724 to your computer and use it in GitHub Desktop.
Save pierceboggan/8969724 to your computer and use it in GitHub Desktop.
Make your Xamarin.iOS 7+ app speak using AVSpeechSynthesizer. See http://blog.xamarin.com/make-your-ios-7-app-speak/ for more information.
using System;
using MonoTouch.AVFoundation;
namespace Example
{
public class SpeechSynthesizer
{
public static void Speak (string toSpeak)
{
var speechSynthesizer = new AVSpeechSynthesizer ();
var speechUtterance = new AVSpeechUtterance (toSpeak) {
Rate = AVSpeechUtterance.MaximumSpeechRate / 3
};
speechSynthesizer.SpeakUtterance (speechUtterance);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment