/// <summary> /// Enqueues an utterance to be spoken with using specific parameters /// </summary> /// <param name="speechUtterance">A chunk of text to be spoken, along with parameters that affect its speech.</param> public static void Speak(SpeechUtterance speechUtterance) { var voiceIdentifier = speechUtterance.Voice == null ? string.Empty : speechUtterance.Voice.Identifier; TTS_iOS.Speak(speechUtterance.SpeechString, speechUtterance.PitchMultiplier, speechUtterance.PreUtteranceDelay, speechUtterance.PostUtteranceDelay, speechUtterance.SpeechRate, voiceIdentifier, speechUtterance.Volume); }
private ReadOnlyCollection <ISpeechSynthesisVoice> InitializeVoices() { var availableVoicesCount = TTS_iOS.GetNumberOfAvailableVoices(); var availableVoices = new ISpeechSynthesisVoice[availableVoicesCount]; for (var voiceIndex = 0; voiceIndex < availableVoicesCount; voiceIndex++) { var identifier = TTS_iOS.GetVoiceIdentifier(voiceIndex); var name = TTS_iOS.GetVoiceName(voiceIndex); var language = TTS_iOS.GetVoiceLanguage(voiceIndex); var quality = TTS_iOS.GetVoiceQuality(voiceIndex); availableVoices[voiceIndex] = new SpeechSynthesisVoice(identifier, name, language, (VoiceQuality)quality); } return(new ReadOnlyCollection <ISpeechSynthesisVoice>(availableVoices)); }
private void SetupCallbacks() { TTS_iOS.SetupCallbacks(OnSpeechCancelledCallback, OnSpeechContinuedCallback, OnSpeechFinishedCallback, OnSpeechPausedCallback, OnSpeechStartedCallback, OnWillSpeakCallback); }
/// <summary> /// Returns a voice object for the specified language and locale. /// </summary> /// <param name="language">A BCP 47 code specifying language and locale for a voice.</param> /// <returns>Returns null if no voice available for the specified language</returns> public static ISpeechSynthesisVoice GetVoiceForLanguage(string language) { var voiceId = TTS_iOS.GetVoiceIdentifierFromLanguageCode(language); return(AllAvailableVoices.FirstOrDefault(voice => voice.Identifier == voiceId)); }
/// <summary> /// Stops all speech at the specified boundary constraint. /// </summary> /// <param name="speechBoundary">A constant describing whether speech should stop immediately or only after finishing the word currently being spoken.</param> /// <returns>true if speech has stopped, or false otherwise.</returns> public static bool Stop(SpeechBoundary speechBoundary) { return(TTS_iOS.StopSpeaking(speechBoundary)); }
/// <summary> /// Stops all speech at default boundary constraints. /// </summary> /// <returns>true if speech has stopped, or false otherwise.</returns> public static bool Stop() { return(TTS_iOS.StopSpeaking(DefaultSpeechBoundaryForStop)); }
/// <summary> /// Pauses speech at the specified boundary constraint. /// </summary> /// <param name="speechBoundary">A constant describing whether speech should pause immediately or only after finishing the word currently being spoken.</param> /// <returns>true if speech has paused, or false otherwise.</returns> public static bool Pause(SpeechBoundary speechBoundary) { return(TTS_iOS.PauseSpeaking(speechBoundary)); }
/// <summary> /// Pauses speech at default boundary constraints. /// </summary> /// <returns>true if speech has paused, or false otherwise.</returns> public static bool Pause() { return(TTS_iOS.PauseSpeaking(DefaultSpeechBoundaryForPause)); }
/// <summary> /// Continues speech from the point at which it left off. /// </summary> /// <returns>true if speech has continued, or false otherwise.</returns> public static bool Continue() { return(TTS_iOS.ContinueSpeaking()); }