Search Unity

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

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

  1. HamFar

    HamFar

    Joined:
    Nov 16, 2014
    Posts:
    89
    Hi all,

    I have brought into a scene the "TextFileSpeaker" prefab and dragged and droppped a simple text file onto its size 1 "TextFiles" array. When I press the "Speak" button under "Test-Drive", the content of my simple text file is uttered. So far, so good...

    Now, I would like to be able to do this programmatically (i.e. trigger my text file reading via script) so I wrote the following test code. I don't mean using Speaker.Speak("blah blah blah") but instead, triggering the text file directly, the same way pressing the "Speak" button under "Test-Drive" operates...

    So, I digged into the TextFileSpeakerEditor.cs script to see how this is done, and then wrote the following. This script is attached to an empty manager game object...

    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. namespace Crosstales.RTVoice.Demo
    6. {
    7.     public class Test : MonoBehaviour
    8.     {
    9.         private Tool.TextFileSpeaker _myTextFile = "Assets/Test/Test.txt";
    10.  
    11.         private void OnGUI()
    12.         {
    13.             if ( GUI.Button(new Rect(Screen.width/2, Screen.height/2, 200, 50), "Read Out Text File") )
    14.             {
    15.                 // Read out the text file.
    16.                 StartCoroutine( ReadoutTextfile(10f) );
    17.             }
    18.         }
    19.  
    20.         private IEnumerator ReadoutTextfile(float delay)
    21.         {
    22.             yield return new WaitForSeconds(delay);
    23.             _myTextFile.Speak();
    24.         }
    25.     }
    26. }
    What am I missing or doing wrong? How do I modify this program to be able to have text files spoken without the need for the in-editor button?
     
  2. eggtart

    eggtart

    Joined:
    Feb 4, 2013
    Posts:
    23
    Hi,

    I have been using RT-Voice on my Mac, and so far it has been working great. But I build my project to run on an Android device, I did not get any sound at all. I have tried on my Galaxy S7 and Oculus Go. Is there anything specific that I need to do when building for Android? Thanks!
     
  3. Stefan-Laubenberger

    Stefan-Laubenberger

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

    you can add all desired text files to the "TextFileSpeaker", like this:
    upload_2018-8-8_9-31-47.png

    Then, you can call them like this:
    Code (CSharp):
    1. using UnityEngine;
    2. using Crosstales.RTVoice.Tool;
    3.  
    4. public class TextFileSpeakerTest : MonoBehaviour {
    5.  
    6.     public TextFileSpeaker TFS;
    7.  
    8.     public void Speak1()
    9.     {
    10.         TFS.SpeakText(0);
    11.     }
    12.  
    13.     public void Speak2()
    14.     {
    15.         TFS.SpeakText(1);
    16.     }
    17.  
    18.     public void Speak3()
    19.     {
    20.         TFS.SpeakText(2);
    21.     }
    22. }
    23.  
    Is that what you wanted?
     
    HamFar likes this.
  4. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,296
    Hmm, you should hear the speeches - we own the same devices and RTV works there...
    Please test our Android demo:
    Android

    Does it work on your Galaxy S7?
     
  5. eggtart

    eggtart

    Joined:
    Feb 4, 2013
    Posts:
    23
    I just tried the apk on my S7 and it does work. However, I noticed that there are very few voices available (my app uses Chinese), maybe that is the reason why I can't hear anything from my app. Is it possible to install additional voices to my Android devices? And if so, how? Thanks!

    P.S. I just found out how and installed a new voice on my S7. Now I can hear my app. Next is to find out how to do it on Oculus Go...
     
    Last edited: Aug 8, 2018
  6. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,296
    Afaik, Oculus Go has only English voices... if you find a solution, please let me know.
     
  7. eggtart

    eggtart

    Joined:
    Feb 4, 2013
    Posts:
    23
    I have another question. I am now using RT-Voice with Dialog System. Will I be able to save the audio generated from RT-Voice as voice files so that I can reuse them later (like in the case of Oculus Go where it does not have the voice that I need for realtime generation)? Thanks!
     
  8. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,296
    Yes, Dialogue System has a save function for all dialogs.

    You could also use our "AudioFileGenerator" to export the speeches as audio files.
     
  9. eggtart

    eggtart

    Joined:
    Feb 4, 2013
    Posts:
    23
    Thanks! Will explore that.
     
  10. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,615
    The Dialogue System menu item is Tools > Pixel Crushers > Dialogue System > Third Party Support > RT-Voice > Save Audio Files.... It's handy because it can process all the text from a dialogue database in one step and save it in entrytag format to make it easy to play back in the Dialogue System. If you're using Dialogue System for Unity 2.0.3.1 or earlier, after saving the audio files, you'll need to right-click on the directory containing the files and select Reimport. You won't have to do this step in the next version.
     
    Stefan-Laubenberger likes this.
  11. Driiade

    Driiade

    Joined:
    Nov 21, 2017
    Posts:
    62
    Hello,

    Nothing seems to work :
     

    Attached Files:

  12. HamFar

    HamFar

    Joined:
    Nov 16, 2014
    Posts:
    89
    Thank you Sir, That is what I wanted, but I cannot seem to get it working. Please see the attached images...

    My caller script is attached to the prefab, so it should have had no problem finding the text file, but even when I get a reference to it, it still gives me a null reference error that traces back to the line of code that is supposed to speak the file.

    Am I missing something?
     

    Attached Files:

    • 1.PNG
      1.PNG
      File size:
      100.3 KB
      Views:
      317
    • 2.PNG
      2.PNG
      File size:
      13 KB
      Views:
      286
    • 3.PNG
      3.PNG
      File size:
      14.9 KB
      Views:
      298
  13. Driiade

    Driiade

    Joined:
    Nov 21, 2017
    Posts:
    62
    With a lot of luck I found my solution.
    In VoiceProviderWindows :
    Code (CSharp):
    1.  
    2.         private static string prepareText(Model.Wrapper wrapper)
    3.         {
    4.             System.Text.StringBuilder sbXML = new System.Text.StringBuilder();
    5.  
    6.              sbXML.Append("<prosody pitch='");
    7.  
    8.              float _pitch = wrapper.Pitch;
    9.                 sbXML.Append(_pitch.ToString("0.0"));
    10.             /* if (_pitch >= 0f)
    11.              {
    12.                  sbXML.Append(_pitch.ToString("+#0%"));
    13.              }
    14.              else
    15.              {
    16.                  sbXML.Append(_pitch.ToString("#0%"));
    17.              }*/
    18.  
    19.              sbXML.Append("'>");
    20.  
    21.             sbXML.Append(wrapper.Text);
    22.  
    23.             sbXML.Append("</prosody>");
    24.  
    25.             Debug.Log(sbXML);
    26.  
    27.             return sbXML.ToString().Replace('"', '\'');
    28.         }
    the xml is not well formatted
     
  14. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,296
    Hmm, the pitch value seem to be wrong... Normally it should display 0.761 (with a point) and not 0,761 (with comma).
    Please try it with a point.
     
  15. Driiade

    Driiade

    Joined:
    Nov 21, 2017
    Posts:
    62
    Yes it's because my system is in French. So for us it's a ",".
    However the pitch doesn't work with my modification, I don't know how really to correct this, I just make it sound for the moment xD
     
  16. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,296
    If you send me your invoice, I can give you access to the latest beta of 2.9.9. This problem is fixed there.
     
  17. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,296
    Have you added the "TextFileSpeaker" to the "TextFileSpeakerTest"-component (field "TFS")?
     
    HamFar likes this.
  18. Driiade

    Driiade

    Joined:
    Nov 21, 2017
    Posts:
    62
    Sent, Hope you can give me this fast =/ I can do nothing for the moment x)
     
  19. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,296
    I sent you the link.
     
  20. HamFar

    HamFar

    Joined:
    Nov 16, 2014
    Posts:
    89
    Got it! Thank you
     
    Stefan-Laubenberger likes this.
  21. jsw_simart_center

    jsw_simart_center

    Joined:
    Aug 9, 2018
    Posts:
    5
    Hi,

    We are considering buying this asset, however could somebody answer simple question:
    Is there any self-contained voice that supports polish language? Are there any self-contained lanaguages at all in MarryTTS? We don't want to be depended on platform TTS systems.

    Thank you.
     
  22. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,296
    Hmm, MaryTTS has not Polish voice so far, but the project would be happy to get one ;-) As you probably know, you can create your own voices in MaryTTS. It's a bit of work, but I think it could pay off.

    However, we will release an AWS Polly provider for RTV in the next few weeks and they have four Polish voices:
    https://docs.aws.amazon.com/polly/latest/dg/voicelist.html

    There are also 3rd party providers like Cereproc, Ivona etc., but this is not an easy and cheap solution.
     
    HamFar likes this.
  23. Driiade

    Driiade

    Joined:
    Nov 21, 2017
    Posts:
    62
    Sooooooooo
    Thanks again for your very fast correction =).

    An other question, I may have more than one speaker on the app, Is there a way to check if a LiveSpeaker is speaking ?

    For the moment I can only check if the entire system is speaking : upload_2018-8-9_14-56-49.png
     
  24. jsw_simart_center

    jsw_simart_center

    Joined:
    Aug 9, 2018
    Posts:
    5
    Thank you - we will consider then buying and making own voice or waiting for AWS Polly in RTV.
     
  25. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,296
    Sure, you can listen to the callbacks on the "Speaker"-component, for more see chapter 5.2 in the documentation:
    https://www.crosstales.com/media/data/assets/rtvoice/RTVoice-doc.pdf

    e.g. OnSpeakStart or OnSpeakComplete

    Every "Speak"-call returns an uid and this uid is the same inside the wrapper you receive as parameter in the callbacks. This is how you know which speech has started, ended etc.
     
    Driiade likes this.
  26. jsw_simart_center

    jsw_simart_center

    Joined:
    Aug 9, 2018
    Posts:
    5
    Hi there,

    Any idea why on Android build the voice is set to default google/android instead of MaryTTS which was selected in Voice prefab? Is it realted to using the demo MaryTTS account?
    In editor works just fine.

    Cheers
     
  27. Stefan-Laubenberger

    Stefan-Laubenberger

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

    Yes, you can't use the demo account for builds. You have to provide your own server or apply for an account on our test server.

    Cheers
    Stefan
     
  28. jsw_simart_center

    jsw_simart_center

    Joined:
    Aug 9, 2018
    Posts:
    5
    Thank you. We already applied for an account.
     
  29. jsw_simart_center

    jsw_simart_center

    Joined:
    Aug 9, 2018
    Posts:
    5
    Hi,

    As I commanded RT-Voice to use the voice "dfki-spike" with Speaker.VoiceForName, this Speaker.VoiceForName method was constantly returning "dfki-spike-hsmm" voice.

    In that method I changed that voice name string must equal the voice in the loop iteration instead of returing first that contains the string.
    I belive it is not desired behaviour.

    Cheers

    Code (CSharp):
    1. public static Model.Voice VoiceForName(string name)
    2.         {
    3.         ....
    4.                     foreach (Model.Voice voice in voiceProvider.Voices)
    5.                     {
    6.                         if (voice.Name.Equals(name))
    7.                         {
    8.                             result = voice;
    9.                             break;
    10.                         }
    11.                     }
    12.        
    13.  
    14.             return result;
    15.         }
     
    Stefan-Laubenberger likes this.
  30. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,296
    We are happy to announce that the next version 2.9.9 of RT-Voice will be fully compatible with @Crazy-Minnow-Studio Amplitude and SALSA under WebGL!
    Finally, you will have lip-synced characters in your browser!

    Party time!:cool::):D
     
  31. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,296
    This was requested by many users, because they e.g wanted to write "David" instead of "Microsoft David Desktop", but you are right, it's not fitting for everyone. So I changed the method to this:
    Code (CSharp):
    1. /// <summary>Get a voice for a given name from the current TTS-system.</summary>
    2. /// <param name="name">Name of the voice (e.g. "Alex")</param>
    3. /// <param name="isExact">Exact match for the voice name (default: false, optional)</param>
    4. /// <returns>Voice for the given name or null if not found.</returns>
    5. public static Model.Voice VoiceForName(string name, bool isExact = false)
    6. {
    7.     Model.Voice result = null;
    8.  
    9.     if (string.IsNullOrEmpty(name))
    10.     {
    11.         Debug.LogWarning("The given 'name' is null or empty! Returning null.");
    12.     }
    13.     else
    14.     {
    15.         if (voiceProvider != null)
    16.         {
    17.             if (isExact) {
    18.                 foreach (Model.Voice voice in voiceProvider.Voices)
    19.                 {
    20.                     if (voice.Name.CTEquals(name))
    21.                     {
    22.                         result = voice;
    23.                         break;
    24.                     }
    25.                 }
    26.             }
    27.             else
    28.             {
    29.                 foreach (Model.Voice voice in voiceProvider.Voices)
    30.                 {
    31.                     if (voice.Name.CTContains(name))
    32.                     {
    33.                         result = voice;
    34.                         break;
    35.                     }
    36.                 }
    37.             }
    38.         }
    39.         else
    40.         {
    41.             logVPIsNull();
    42.         }
    43.     }
    44.  
    45.     return result;
    46. }

    That should make everybody happy ;)
     
  32. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,296
    Important notice for all "standard" customers:

    We constantly try to push our assets to the next level by adding new features and deliver the best support for our customers. In the past we've kept updating the asset in a 2-month cycle. However, after careful consideration, we feel like this needs to happen at a faster pace. We've received numerous input from the community that a faster pace would help out a lot. Because Unity is ever evolving and we want to keep our assets relevant we need to be able to keep up the fast pace that is Unity's second nature. Packaging and maintaining a separate DLL-version poses a problem in regards to this goal.

    With this in mind, we decided to phase out the DLL-version by the end of August 2018.
    Besides being able to update the asset more often, we are convinced that phasing out the DLL-version in favor of the PRO version will also bring these improvements for our customers:
    1. More functionalities and supported platforms due the source code (e.g. WSA (UWP), IL2CPP under Android and Linux)
    2. Less frictions with different Unity versions within the same company
    3. Fast hotfixes and high priority support

    We understand that this may impact you negatively. However we hope with the upgrade-path we offer to you - our loyal DLL-customers - can alleviate your concerns and win you over once more:
    PRO edition

    Please rest assured we will continue to support and improve the PRO version over the years to come.

    I hope you understand our decision.


    Cheers
    Stefan
     
    Last edited: Jul 28, 2019
  33. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,296
    Crazy-Minnow-Studio likes this.
  34. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    583

    Then provide for the standard version a free upgrade to pro. Everything else is not appropriate. I'm not sure that you can explain this to Unity. I bought the standard version for some weeks ago and now it is not anymore supported. I'm not agree to pay any money for the upgrade.
     
  35. Stefan-Laubenberger

    Stefan-Laubenberger

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

    We are well aware that not everybody is happy with our move to deprecate the standard versions.

    However, the standard version was improved and supported over the last three years without any additional charges.
    The current version is working flawlessly with all current Unity versions higher than 5.3+.
    All our users of the standard version have still a functional software, so I don't get the point.
    You bought it and it worked - if you want new features, upgrade to PRO. ;)

    We certainly can't give away the upgrade for free because this would be totally unfair to our customers who bought the PRO version.

    Our approach is approved by Unity - in fact they allowed us to leave the standard version in the store to give our customers the reduced upgrade price...
    Normally, publishers just deprecate their assets which would mean you would have to pay the full price.


    Cheers
    Stefan
     
    Last edited: Sep 16, 2018
  36. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,296
    Awesome news:

    The next release of RT-Voice will contain support for AWS Polly!
    polly-social-1024x512.jpg


    Happy time! ;):D
     
  37. Akimania

    Akimania

    Joined:
    Dec 8, 2016
    Posts:
    8
  38. Stefan-Laubenberger

    Stefan-Laubenberger

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

    Thank you for your interest in RT-Voice!

    On Android, there are normally much more voices available. However, RT-Voice has a provider to access those voices.
    The functions are the same on all platforms, you only need the Speak-methods with the same parameters.
    MaryTTS is an open-source server solution and can be used on all platforms.

    I hope this clarifies the situation.


    Cheers
    Stefan
     
  39. bilterystlaura

    bilterystlaura

    Joined:
    Sep 26, 2018
    Posts:
    4
    7553964.jpg already bought, android not compatible marytts
     
  40. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,296
    It is compatible, click on MaryTTS ;)
     
  41. bilterystlaura

    bilterystlaura

    Joined:
    Sep 26, 2018
    Posts:
    4
  42. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,296
    yeah, it won't work without an account on our server or your own MaryTTS-server. See logcat :)
     
    bilterystlaura likes this.
  43. bilterystlaura

    bilterystlaura

    Joined:
    Sep 26, 2018
    Posts:
    4
    I bought, am I entitled to an account at home for my tests, I just sent you an email to rtvoice@crosstales.com :(
     
  44. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,296
    Sure, just send me the invoice ;)
     
  45. jijithnr

    jijithnr

    Joined:
    Jul 6, 2018
    Posts:
    1
    Hi Stefan
    I am successful in using all kinds of SSML with RTVoice. But no luck with Emotional ML. Always get some error, like "could not speak the text". Unity version 2018.2.13f and RTVoice version 2018.3.1. Please help! If you can also point to some good example of the strings that contain Emotional ML that too will be of very help. I see lot of examples of how to use SSML with RTVoice but not much on how to use Emotional ML with RTVoice, no forums or video tutorials as far as I know.
     
  46. Stefan-Laubenberger

    Stefan-Laubenberger

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

    EmotionML is only supported under MaryTTS.
    This could be the root of the issues you mentioned.
    There is a small "EmotionML" manual under "Documentation" inside the asset.


    Cheers
    Stefan
     
  47. cubaschi

    cubaschi

    Joined:
    Oct 23, 2012
    Posts:
    43
    Hi Stefan,
    we are considering using your TTS solution. Can I add sfx components to your prefab ? I would expect a Audio Source there...

    Cheers,
    Simon
     
  48. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,296
    Hi Simon

    Thank you for your interest in RT-Voice!

    Yes, RT-Voice provides the speeches to normal AudioSources (if you are using the "Speak"-method).
    So, you can do whatever you want, add pitch, echo and so on. Please checkout our demos to see it in action (look on the left):
    upload_2018-10-25_13-20-36.png

    WebGL
    Windows
    Mac
    Android


    Cheers
    Stefan
     
  49. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,615
    The Dialogue System for Unity's support package has been updated for RT-Voice version 2018.3.1. It's available on the Dialogue System Extras.
     
    Stefan-Laubenberger likes this.
  50. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,296
    Thank you Tony for your constant updates and support!