To add speech on Air Tap gesture, we can instantiate the TextToSpeechManager and call the SpeakText() method. To integrate speech while doing Air Tap on the Lenses, navigate to the LensGestureHandler class and add the following code snippet while tapped is true.
if (isTapped)
{
....
var soundManager= GameObject.FindWithTag("SoundManager");
TextToSpeechManager tt =
soundManager.GetComponent<TextToSpeechManager>();
tt.SpeakText("The HoloLens display is basically a set of
transparent lenses placed just in front of the eyes.");
}
TextToSpeechManager supports four different types of voices. You can choose a specific voice in your code from the TextToSpeechVoice enumeration.