Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

RT-Voice - Run-time text-to-speech solution

Discussion in 'Assets and Asset Store' started by Stefan-Laubenberger, Jul 10, 2015.

  1. SreehariCA

    SreehariCA

    Joined:
    Oct 22, 2019
    Posts:
    3


    Hi Stefan,

    I facing a similar issue when I try to add SSML to my text from script.
    This is the code is I am writing in script:
    voiceOutput = "<s>I am now < prosody rate = \"x -slow\" > speaking at half speed.</ prosody >"+
    "I am now<prosody rate= \"slow\" > speaking at 2 / 3 speed.</ prosody >"+
    "I am now<prosody rate= \"medium\" > speaking at normal speed.</ prosody >"+
    "I am now<prosody rate= \"fast\" > speaking 33 % faster.</ prosody ></s>";
    Speaker.Speak(voiceOutput, null, Speaker.VoiceForName(Voice));

    It works fine when I use it directly in the RTV text box.
    Also works fine for break strength property in SSML through script.

    But in other cases as the above example the sentences are read correctly but the SSML tags are ignored.
    How to solve it?
    Thanks in advance.
     
  2. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,446
    Hi

    I assume your builds are for Windows?
    Because I just did a test and after some minor tweaks to your text examples, it works.
    Here is the code:
    Code (CSharp):
    1. using Crosstales.RTVoice;
    2. using UnityEngine;
    3.  
    4. public class RTVTest : MonoBehaviour
    5. {
    6.     public string Voice = "Zira";
    7.  
    8.     [TextArea]
    9.     public string VoiceOutput = "<s>I am now <prosody rate=\"x-slow\"> speaking at half speed.</prosody>"+
    10.                          "I am now<prosody rate=\"slow\"> speaking at 2 / 3 speed.</prosody>"+
    11.                          "I am now<prosody rate=\"medium\"> speaking at normal speed.</prosody>"+
    12.                          "I am now<prosody rate=\"fast\"> speaking 33 % faster.</prosody></s>";
    13.    
    14.     public void OnEnable()
    15.     {
    16.         Speaker.OnVoicesReady += onVoicesReady;
    17.     }
    18.  
    19.     public void OnDisable()
    20.     {
    21.         Speaker.OnVoicesReady -= onVoicesReady;
    22.     }
    23.  
    24.     public void Speak()
    25.     {
    26.         Speaker.Speak(VoiceOutput, null, Speaker.VoiceForName(Voice));
    27.     }
    28.  
    29.     private void onVoicesReady()
    30.     {
    31.         Speak();
    32.     }
    33. }
    Btw, it's important to wait for the "OnVoicesReady"-callback before calling RT-Voice.

    I hope this helps you further, please let me know.


    Cheers
    Stefan
     
  3. SreehariCA

    SreehariCA

    Joined:
    Oct 22, 2019
    Posts:
    3


    Thanks for the quick reply.

    Yes, the builds are for Windows.

    According to my understanding OnVoicesReady is to check if the voices in unity have been initialized and set and if we try playing the speech text before that, then there wont be any voice heard.

    But in my case, I was able to hear the voice, just the SSML tags were ignored.

    Anyways found the issue in my case.
    It was due to additional empty spaces in my tags in the script. (silly from my part :p)
    Thanks for the help :)
     
    Stefan-Laubenberger likes this.
  4. chgeorgiadis

    chgeorgiadis

    Joined:
    Jan 30, 2018
    Posts:
    22
    I would like to ask if you have a suggestion for a use case. For now i have an avatar with SALSA and RT Voice. I also added a Text to Speech plug in from SALSA in order to provide a text for the avatar to speak. What i would like to do is to use RT Voices with Google Text To Speech plug in. (and of course to have the avatar with salsa working with the same way as before) Is that possible and if yes can you suggest general instructions? Not with details (for now) Just a basic technical thought
     
  5. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,446
    Hi

    You just have to install the following plugin:
    https://assetstore.unity.com/packages/slug/115170?aid=1011lNGT

    Afterwards, install our integration package from the "3rd party"-folder inside the asset.
    Then you have to configure the plugin with you Google Cloud API-key and your good to go.

    Does that help you further?


    Cheers
    Stefan
     
  6. chgeorgiadis

    chgeorgiadis

    Joined:
    Jan 30, 2018
    Posts:
    22
    Yes it was very helpfull! Thank you again Stefan.
     
    Stefan-Laubenberger likes this.
  7. jason416

    jason416

    Joined:
    Nov 8, 2018
    Posts:
    25
    I'm sure this is something dumb but I having an issue getting my string into speechText.cs . After I set the string, it will throw the following error unless click in the text field to force OnValidate :

    Could not start process: System.ComponentModel.Win32Exception (0x80004005): ApplicationName='say', CommandLine=' -v "Samantha" -r 169 -o "/var/folders/wj/tcqktw9s2l921j8khcs4fwy80000gp/T/DefaultCompany/Reader/rtvoice_a8b66ecc-9cf8-4952-958a-c22331661368.aiff" --file-format=AIFFLE " ////// 'my big "string" here.' //////"

    I'm doing this:
    Code (CSharp):
    1. speechText.Text = myParsedParagraph;
    2. speechText.Speak();
    My suspicion is it has something to do with \" characters in my string but I'm not sure.
     
  8. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,446
    Is your text " ////// 'my big "string" here.' //////"?

    What's your Unity and RT-Voice version?
     
    Last edited: Jan 29, 2020
  9. jason416

    jason416

    Joined:
    Nov 8, 2018
    Posts:
    25
    no it's a long string (around 1700 characters) that was joined from multi lines.
     
  10. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,446
    Is it possible that you send me the text for further analysis?
     
  11. jason416

    jason416

    Joined:
    Nov 8, 2018
    Posts:
    25
    Wow thanks, I have emailed...
     
    Stefan-Laubenberger likes this.
  12. LumoKvin

    LumoKvin

    Joined:
    Sep 28, 2019
    Posts:
    195
    My game is for Android and iOS. So, these questions pertain to those platforms.

    Pre-purchase Questions:
    • Does it work with AAB and IL2CPP?
    • Does the user have to manually change any settings on their device, or will it just work?
    • What languages/cultures are supported? Is there a list somewhere that I could take a look at? Is it different for each device?
    • In the documentation there is a method for errors. Do you have a list of potential errors? What is the most common error?
    Thanks
     
  13. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,446
    Hi

    Thank you for your interst in RT-Voice!

    Here are the answers to your questions:
    1. Yes, RT-Voice works with IL2CPP and AAB
    2. It just works with the installed voices; no changes needed
    3. iOS has the same voices on every device; Android is mostly Google TTS but can slightly differ due the fragmented versions
    4. Errors are very rare and will most likely never occur on mobile
    I hope this helps you further,

    Cheers
    Stefan
     
  14. LumoKvin

    LumoKvin

    Joined:
    Sep 28, 2019
    Posts:
    195
    upload_2020-2-2_14-56-43.png
    https://www.crosstales.com/media/data/assets/rtvoice/RTVoice-doc.pdf


    I added the VoiceInitalizer to the first scene. I clicked to initialize all voices. As soon as the scene loads, it keeps saying "Crosstales" with each voice.
    • Is there a way to initialize the voices without saying "Crosstales"?
    • Am I supposed to add the initializer to each scene or only the first scene?

    Code (CSharp):
    1. Speaker.SpeakNative("Hello World!", Speaker.VoiceForCulture("en"));
    I would like to use a female gender by default with SpeakNative. How would I do that?
     
    Last edited: Feb 2, 2020
  15. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,446
    Hi

    "VoiceInitalizer" must only be used when you encounter any problems with voices, like long response times.
    If you really need it, it should be added to the first scene.

    To use a specific gender, do it like that:
    Code (CSharp):
    1. Speaker.SpeakNative("Hello World!", Speaker.VoiceForGender(Model.Enum.Gender.FEMALE, "en"));
    I hope this helps you further.


    Cheers
    Stefan
     
    LumoKvin likes this.
  16. LumoKvin

    LumoKvin

    Joined:
    Sep 28, 2019
    Posts:
    195
    I copied and pasted the code but it says "The name 'Model' does not exist in the current context."

    Screen Shot 2020-02-02 at 5.39.45 PM.png

    Screen Shot 2020-02-02 at 5.40.49 PM.png
     
  17. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,446
    Can you please try "Crosstales.RTVoice.Model.Enum.Gender.FEMALE"?
     
    LumoKvin likes this.
  18. LumoKvin

    LumoKvin

    Joined:
    Sep 28, 2019
    Posts:
    195
    It works.
     
    Stefan-Laubenberger likes this.
  19. LumoKvin

    LumoKvin

    Joined:
    Sep 28, 2019
    Posts:
    195
    I put the RTVoice prefab on my Map scene, but it gets deleted for no apparent reason.

    Everything is working properly:
    Screen Shot 2020-02-04 at 3.13.41 PM.png

    The RTVoice prefab disappeared for no reason:
    Screen Shot 2020-02-04 at 3.13.26 PM.png

    I figured out how to reproduce the error:
    • Add RTVoice prefab to Map scene.
    • Change to a different scene.
    • Go back to the Map scene and the RTVoice prefab is gone.
    Do you know why this is happening and how I can fix it?
     

    Attached Files:

    Last edited: Feb 4, 2020
  20. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,446
    The last picture shows it's not gone; RT-Voice is a singleton and has "DontDestroyOnLoad" enabled. When you hit play, it seems to be gone, but it's under "DontDestroyOnLoad" in the scene.

    Does that answer your question?
     
  21. LumoKvin

    LumoKvin

    Joined:
    Sep 28, 2019
    Posts:
    195
    I uploaded that last picture by mistake. Sorry for the confusion.

    I will figure out how to record my screne so that I can show you exactly what is happening. Thanks for the quick support. I appreciate it!
     
    Last edited: Feb 5, 2020
  22. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,446
    Hmm, that sounds strange. Did you hit save before switching the scene?


    Edit:
    Adding the prefab via menu won't set the scene dirty and it won't be marked as "changed".
    Therefore, Unity will not ask to save the changes and you have to do it manually.
    However, this will be fixed in the next version.
     
    Last edited: Feb 5, 2020
  23. LumoKvin

    LumoKvin

    Joined:
    Sep 28, 2019
    Posts:
    195
    edit
     
    Last edited: Feb 5, 2020
  24. LumoKvin

    LumoKvin

    Joined:
    Sep 28, 2019
    Posts:
    195
    Yes, I tried saving the scene and also the project.
     
  25. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,446
    Please add the prefab manually from "Assets/Plugins/crosstales/RTVoice/Prefabs" and try it again.
     
  26. LumoKvin

    LumoKvin

    Joined:
    Sep 28, 2019
    Posts:
    195
    I did that and it is working now. Do you know what was happening in case I run into this problem again? I have a feeling that this is a bug in Unity, but what do you think?

    Thanks for the quick support. I appreciate it!
     
  27. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,446
    It will be fixed with the next release; just remember until then ;)
     
    LumoKvin likes this.
  28. iVizUnity

    iVizUnity

    Joined:
    May 23, 2018
    Posts:
    3
    Hi Crosstales,

    We've been using the old RTVoice for our project for a while and today decided to update/upgrade.
    When Importing, RTVoice seemed to have caused a bunch of errors (they all seem the same but for different scripts). Here's one of them:
    Assets/Plugins/crosstales/Common/Editor/Util/BaseEditorHelper.cs(402,22): error CS0121: The call is ambiguous between the following methods or properties: `Crosstales.ExtensionMethods.CTEquals(this string, string, System.StringComparison)' and `Crosstales.ExtensionMethods.CTEquals(this string, string, System.StringComparison)'

    Could you please help with resolving this error?

    Thanks!
     
  29. LumoKvin

    LumoKvin

    Joined:
    Sep 28, 2019
    Posts:
    195
    Stefan-Laubenberger likes this.
  30. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,446
    Hi

    Yes, the chapter 10 of the documentation is normally the way.
    But your version of our asset seems quite old, therefore, I recommend creating an empty scene, delete the whole "Assets/Plugins/crosstales"-folder and import the asset from scratch.


    Cheers
    Stefan
     
  31. LumoKvin

    LumoKvin

    Joined:
    Sep 28, 2019
    Posts:
    195
    Code (CSharp):
    1. Speaker.SpeakNative("Hello World!", Speaker.VoiceForGender(Model.Enum.Gender.FEMALE, "en-GB", 0, "en"));
    The above code causes the voice to fallback to Alice (it-IT, FEMALE). This is an Italian voice.

    Screen Shot 2020-02-05 at 4.27.58 PM.png

    My device has "en-US" and "en-AU" in a female voice.

    How can I ensure that the fallback is both female and English?
     
  32. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,446
    Are you using macOS or iOS as platform?
    Which is the version of the asset and Unity?
     
  33. LumoKvin

    LumoKvin

    Joined:
    Sep 28, 2019
    Posts:
    195
    My game will be developed for Android and iOS. I am testing through the Unity editor on a Mac Mini.

    Asset Version: 29.01.2020
    Unity Version: 2019.2.18

    Screen Shot 2020-02-05 at 5.40.25 PM.png Screen Shot 2020-02-05 at 5.40.13 PM.png Screen Shot 2020-02-05 at 5.39.57 PM.png
     
    Last edited: Feb 6, 2020
  34. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,446
    Do you wait for the OnVoicesReady-callback before executing the "Speak"-method?

    Here is an example:
    Code (CSharp):
    1. using UnityEngine;
    2. using Crosstales.RTVoice;
    3.  
    4. public class SpeakWhenReady : MonoBehaviour {
    5.  
    6.     public void OnEnable()
    7.     {
    8.         // Subscribe event listeners
    9.         Speaker.OnVoicesReady += onVoicesReady;
    10.     }
    11.  
    12.     public void OnDisable()
    13.     {
    14.         // Unsubscribe event listeners
    15.         Speaker.OnVoicesReady -= onVoicesReady;
    16.     }
    17.  
    18.     private void onVoicesReady()
    19.     {
    20.         Speaker.SpeakNative("Hello World!", Speaker.VoiceForGender(Model.Enum.Gender.FEMALE, "en-GB", 0, "en"));
    21.     }
    22. }
    23.  
     
    Last edited: Feb 6, 2020
  35. LumoKvin

    LumoKvin

    Joined:
    Sep 28, 2019
    Posts:
    195
    Screen Shot 2020-02-05 at 6.26.30 PM.png

    Screen Shot 2020-02-05 at 6.27.53 PM.png

    Screen Shot 2020-02-05 at 6.26.46 PM.png

    Screen Shot 2020-02-05 at 6.28.10 PM.png

    I can hear that the voice is Italian.
     
  36. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,446
  37. LumoKvin

    LumoKvin

    Joined:
    Sep 28, 2019
    Posts:
    195
    I don't know what changed, but I am now getting Fiona as the fallback voice.
     
    Last edited: Feb 6, 2020
  38. LumoKvin

    LumoKvin

    Joined:
    Sep 28, 2019
    Posts:
    195
    The fallback is working properly with "en-GB":
    Screen Shot 2020-02-06 at 3.37.45 PM.png

    The fallback doesn't work with "en-CA". I am getting the Italian voice again. There is no alert message in the console.

    Can you try "en-CA" to see if the fallback works for you?

    PS. I just tested it on Android. I am getting the wrong voice for "en-CA". It sounds like a French voice. The fallback isn't working.
     
    Last edited: Feb 6, 2020
  39. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,446
    VoiceForGender has a fifth parameter, called "isFuzzy", which is optional and set to true by default.
    Setting it to false will solve the issues you encounter:
    Code (CSharp):
    1. Model.Voice v = Speaker.VoiceForGender(Model.Enum.Gender.FEMALE, "en-GB", 0, "en", false);
    We will change the parameter to false as default in the next release.
     
    LumoKvin likes this.
  40. jason416

    jason416

    Joined:
    Nov 8, 2018
    Posts:
    25
    I'm using the demo SpeechText components along with the Audio Source component for reverb. All works great in the Editor, but in my iOS build there are two issues:
    1. I don't hear the reverb fx
    2. calling the method TextSpeech.Silence() does not appear to work, though it works in the editor
    Any idea what could be causing this?
     
  41. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,446
    Hi Jason

    The TTS from iOS doesn't support audio file generation and therefore, no Unity audio effects are possible.
    If you need them on iOS, please use another (online) provider like MaryTTS, AWS Polly etc.

    About the issue on iOS: what's the iOS version on your device?


    Cheers
    Stefan
     
  42. jason416

    jason416

    Joined:
    Nov 8, 2018
    Posts:
    25
    Ah ok. I'm testing on iOS 12.4.1 / RTvoice 2020.1.1 / Unity 2018.4.14
     
  43. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,446
    Please send us your invoice via email and we will give you access to the latest version.
     
    jason416 likes this.
  44. AaronOjeda

    AaronOjeda

    Joined:
    Oct 31, 2017
    Posts:
    5
    Hi Stefan,

    We are using RT-Voice and we need to play different voices depending on the customer's language. In my PC there are four Microsoft voices installed (Spanish female, English male and female, Portuguese female) but every time it is played the same: Spanish female.

    RT-Voice version: 2.9.8
    Unity version: 2018.4.14f
    OS: Windows 10

    I have been debugging and it seems that RT-Voice is detecting the four voices right (Speaker.Voices has the right values), but calling Speaker.Speak with the desired voice is not giving me the expected results. Looking deeper into the code, in VoiceProviderWindow the args string passed to the speakToFileProcessprocess thread call is the following (the dir argument has been shortened for clarity and privacy):

    --speakToFile "<prosody pitch='+0%'>Esta é uma frase de exemplo, para ouvir no simulador de direção.</prosody>" "C:/...104cb3b9-e20d-4fbc-9634-e7f880701ee6.wav" 0 100 "Microsoft Maria Desktop"

    But even if the last parameter has the right value (Maria is the Portuguese voice) , I am hearing the Spanish voice.

    I have also tried to change the default voice in Windows but the result is the same. Do you have any advice? Thanks in advance,

    Aarón.
     
  45. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,446
    Hi Aaron

    That's because not every voice has SSML support. Enable "Auto Clear Tags" on the "Speaker"-component to select the right voice.
    We also strongly recommend updating to the latest version of RT-Voice PRO, since 2.9.8 and the DLL version are no longer supported.


    Cheers
    Stefan
     
  46. AaronOjeda

    AaronOjeda

    Joined:
    Oct 31, 2017
    Posts:
    5
    Hello,

    Thank you for your quick answer. Sadly enabling "Auto Clear Tags" makes no difference in this case. Regardless of which voice I choose, I hear "You have selected the [right_voice_name]" with the same not-selected voice in the Test.

    Since enabling "Auto Clear Tags" should solve any SSML compatibility issues, sould I discard SSML compatibility as the problem? Any tip would be really appreciated. Thanks again!
     
  47. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,446
    I really can't say, it's been a long time since the version you are using.
    It will work with the current version, so please consider updating.
     
  48. AaronOjeda

    AaronOjeda

    Joined:
    Oct 31, 2017
    Posts:
    5
    Ok, I will update and let you know.
     
  49. AaronOjeda

    AaronOjeda

    Joined:
    Oct 31, 2017
    Posts:
    5
    As you said, after updating it worked. Thanks a lot.
     
    Stefan-Laubenberger likes this.
  50. LumoKvin

    LumoKvin

    Joined:
    Sep 28, 2019
    Posts:
    195
    The first time that the audio is played, it reads properly. The second time, it spells the word. For example, it would spell "v", "o", "i", "c", "e", instead of saying "voice".

    Edit: I think I figured it out. The string had a misspelled word in it.
     
    Last edited: Feb 15, 2020
    Stefan-Laubenberger likes this.
unityunity