Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question RTVoice NotImplementedException HELP

Discussion in 'Audio & Video' started by LtKelleyUSMC, Mar 1, 2023.

  1. LtKelleyUSMC

    LtKelleyUSMC

    Joined:
    Oct 6, 2012
    Posts:
    44
    When running my program in Unity, I am getting this error:
    NotImplementedException: The method or operation is not implemented.
    Crosstales.RTVoice.Speaker.Speak (System.String strToWrite, System.Object p, System.String voiceName) (at Assets/Plugins/crosstales/RTVoice/Scripts/Speaker.cs:268)
    VoiceRecognition_Script.TurnLightsOff () (at Assets/Scripts/VoiceRecognition_Script.cs:199)
    VoiceRecognition_Script.OnKeywordsRecognized (UnityEngine.Windows.Speech.PhraseRecognizedEventArgs args) (at Assets/Scripts/VoiceRecognition_Script.cs:64)
    UnityEngine.Windows.Speech.PhraseRecognizer.InvokePhraseRecognizedEvent (System.String text, UnityEngine.Windows.Speech.ConfidenceLevel confidence, UnityEngine.Windows.Speech.SemanticMeaning[] semanticMeanings, System.Int64 phraseStartFileTime, System.Int64 phraseDurationTicks) (at <ca42919df2b74e53b11002749c8755af>:0)
    I DO NOT understand this error:
    I have recently purchased the RTVoice from the Asset Store, and added it to my game.

    So, in my code, I have the following:
    using Crosstales.RTVoice;

    and so, to use the voice, I have the following in my code:
    string strToWrite = "You have turned on the lights";
    Speaker.Speak(strToWrite,null, "Microsoft David Desktop");

    AND what is worse, when compiling the game and running the Stand Alone version of the game, I am using:
    public string VoiceName = "Microsoft Zira Desktop";

    Then, when I use the following code...
    Speaker.Speak(strToWrite,null, VoiceName);
    the logfile shows me this error:
    Voice is invalid: @VOICE:Microsoft Irina::Female:Adult:ru-RU
    UnityEngine.StackTraceUtility:ExtractStackTrace () (at C:/buildslave/unity/build/Runtime/Export/Scripting/StackTrace.cs:37)
    UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    UnityEngine.Logger:Log (UnityEngine.LogType,object)
    UnityEngine.Debug:LogWarning (object)
    Crosstales.RTVoice.Provider.VoiceProviderWindows/<getVoices>d__45:MoveNext () (at F:/RAMTest/RAMTest/Assets/Plugins/crosstales/RTVoice/Scripts/Provider/VoiceProviderWindows.cs:536)
    UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr) (at C:/buildslave/unity/build/Runtime/Export/Scripting/Coroutines.cs:17)
     
  2. SeventhString

    SeventhString

    Unity Technologies

    Joined:
    Jan 12, 2023
    Posts:
    290
    Hi!

    Are you sure you are using the good method? The error you're getting says that the method you are using is not implemented (aka has not been coded and triggers an error knowing this).

    I found this doc on their website, it looks like you might need to use
    Speaker.Instance.Speak
    rather than
    Speaker.Speak


    Code (CSharp):
    1. 5.1.1. Speak
    2. Speaks a text with a given voice and optional AudioSource.
    3. For example:
    4. //Immediately speak "hello world" with the first available voice
    5. Speaker.Instance.Speak("hello world", audioSource);
    6. //Immediately speak "hello world" with the first English voice (if available
    7. else it uses the first voice on the OS)
    8. Speaker.Instance.Speak("hello world", audioSource,
    9. Speaker.Instance.VoiceForCulture("en"));
    10. // Prepare speak "hello world" with the first available voice (without
    11. AudioSource.Play() - this is up to you). With this technique, all audio texts
    12. of a scene can be created in advance and the AudioSource can be modified in
    13. various ways
    14. Speaker.Instance.Speak("hello world", audioSource, null, false);
    15.  
     
  3. LtKelleyUSMC

    LtKelleyUSMC

    Joined:
    Oct 6, 2012
    Posts:
    44
     
  4. LtKelleyUSMC

    LtKelleyUSMC

    Joined:
    Oct 6, 2012
    Posts:
    44
    Wow, very interesting. I will give that a try, and post if that was the answer to my problem, or not.
    I appreciate your response. Thanks
    Okay, so I am back, and your response HELPED ME SOLVE THIS PROBLEM.
    After researching the possibilities of using this, I decided to go with the following, and IT WORKED... OORAH.
    Code (CSharp):
    1. string strToWrite = "This is a test of me speaking";
    2. Speaker.Instance.Speak(strToWrite);
    THANKS EVER SO MUCH. It always helps to get a second opinion of what we are doing, because,
    in my case, I am so overwhelmed with what I am doing, that I can not see
    the forest for the trees, so to speak.
    This NOW works in Unity, as well, as the Stand Alone version.
    I had an earlier version of RTVoice, and this new version is somewhat of a rewrite of their code, so I think I was using what they had before, which did not include the .Instance.
    EXCELLENT!!!
     
    Last edited: Mar 1, 2023
    SeventhString likes this.