private void onSpeakAudioGenerationComplete(Crosstales.RTVoice.Model.Wrapper wrapper) { Debug.Log("Speech generated: " + wrapper); if (sendAudioOnGenerationComplete) { SaveAudio(audioname); } }
public override IEnumerator Speak(Model.Wrapper wrapper) { Debug.Log("Speak: " + wrapper); // SKELETON CODE - replace with your own code! if (wrapper == null) { Debug.LogWarning("'wrapper' is null!"); } else { if (string.IsNullOrEmpty(wrapper.Text)) { Debug.LogWarning("'wrapper.Text' is null or empty!"); } else { yield return(null); //return to the main process (uid) silence = false; //GENERATE: audio file based on the Wrapper configuration (pitch, rate, volume, output file etc.) //... <code> onSpeakAudioGenerationStart(wrapper); //NECESSARY // WAIT: wait until speech is generated //... <code> //... load file (with WWW) and add the clip to the AudioSource (see VoiceProviderWindows) //... <code> onSpeakAudioGenerationComplete(wrapper); //NECESSARY //OPTIONAL: play audio file //... <code> if (wrapper.SpeakImmediately) { onSpeakStart(wrapper); //NECESSARY // WAIT: wait until speech is finished //... <code> //SIMULATE SPEECH (remove this) foreach (char character in wrapper.Text) { Debug.Log(character); yield return(null); } onSpeakComplete(wrapper); //NECESSARY } //OPTIONAL: broadcast possible errors //onErrorInfo(wrapper, "errorMessage"); } } }
private void onSpeakAudioGenerationComplete(Crosstales.RTVoice.Model.Wrapper wrapper) { Debug.Log("Speech generated: " + wrapper); //If not Mac, just send the autogenerated file as WAV if (sendAudioOnGenerationComplete && !isMacOrCompatiblityVoice()) { SaveAudio(audioname); } }
public override IEnumerator SpeakNative(Model.Wrapper wrapper) { Debug.Log("SpeakNative: " + wrapper); // SKELETON CODE - replace with your own code! if (wrapper == null) { Debug.LogWarning("'wrapper' is null!"); } else { if (string.IsNullOrEmpty(wrapper.Text)) { Debug.LogWarning("'wrapper.Text' is null or empty!"); } else { yield return(null); //return to the main process (uid) silence = false; // SPEAK: speech based on the Wrapper configuration (pitch, rate, volume, output file etc.) //... <code> onSpeakStart(wrapper); //NECESSARY // WAIT: wait until speech is finished //... <code> //SIMULATE SPEECH (remove this) foreach (char character in wrapper.Text) { //OPTIONAL: enable if you have access to the words, phonemes and visemes //onSpeakCurrentWord(wrapper, speechTextArray, wordIndex - 1); onSpeakCurrentPhoneme(wrapper, character.ToString()); onSpeakCurrentViseme(wrapper, character.ToString()); Debug.Log(character); yield return(null); } onSpeakComplete(wrapper); //NECESSARY //OPTIONAL: broadcast possible errors //onErrorInfo(wrapper, "errorMessage"); } } }
public override void GenerateInEditor(Model.Wrapper wrapper) { Debug.Log("Generate: " + wrapper); // SKELETON CODE - replace with your own code! if (wrapper == null) { Debug.LogWarning("'wrapper' is null!"); } else { if (string.IsNullOrEmpty(wrapper.Text)) { Debug.LogWarning("'wrapper.Text' is null or empty!"); } else { silence = false; // GENERATE: audio file based on the Wrapper configuration (pitch, rate, volume, output file etc.) //... <code> onSpeakAudioGenerationStart(wrapper); //NECESSARY // WAIT: wait until speech is generated //... <code> //... load file (with WWW) and add the clip to the AudioSource (see VoiceProviderWindows) //... <code> // SIMULATE GENERATE (remove this) foreach (char character in wrapper.Text) { Debug.Log(character); System.Threading.Thread.Sleep(100); } onSpeakAudioGenerationComplete(wrapper); //NECESSARY //OPTIONAL: broadcast possible errors //onErrorInfo(wrapper, "errorMessage"); } } }
protected virtual void OnSpeakComplete(Crosstales.RTVoice.Model.Wrapper wrapper) { voiceState = VoiceState.Silent; }
protected virtual void OnSpeakStart(Crosstales.RTVoice.Model.Wrapper wrapper) { voiceState = VoiceState.Speaking; }
/// <summary>Speaks a text with a given wrapper -> native mode.</summary> /// <param name="wrapper">Wrapper with the speech details.</param> public void SpeakNative(Model.Wrapper wrapper) { Speaker.SpeakNative(wrapper); }
/// <summary>Speaks a text with a given wrapper.</summary> /// <param name="wrapper">Wrapper with the speech details.</param> public void Speak(Model.Wrapper wrapper) { Speaker.Speak(wrapper); }