private IEnumerator CallSpeakService(AgentGender gender) { if (gender == AgentGender.Male) { _service.Voice = VoiceType.en_US_Michael; } else { _service.Voice = VoiceType.en_US_Allison; } _service.ToSpeech(HandleToSpeechCallback, OnFail, textToSpeak, true); while (!_synthesizePlayed) { yield return(null); } }
public void SpeakText(AgentController currentAgent, string text) { textToSpeak = "<speak version=\"1.0\">"; textToSpeak += "<voice-transformation type=\"Custom\" pitch=\" " + sp_pitch + " % \" pitch_range =\"" + sp_pitchRange + " % \" rate =\"" + sp_rate + " % \" breathiness =\"" + sp_breathiness + " % \" glottal_tension =\" " + sp_glottalTension + " % \" >"; currentPlainTalkText = ""; textToSpeak += text; currentPlainTalkText += text; AgentGender gender = currentAgent.agentGender; if (OnlySaveToWav) { gender = saveGenders[saveIndex]; } if (_synthesizePlayed) { _synthesizePlayed = false; textToSpeak += "</voice-transformation>" + "</speak>"; // finalize if (OnlySaveToWav) { Debug.Log("Saving to: " + saveNames[saveIndex] + ", " + textToSpeak); } else { Debug.Log("Saying:" + textToSpeak); } agentToTalkNewIK = currentAgent; Runnable.Run(CallSpeakService(gender)); } }