Is there any good TTS (Text to Speech Asset)? I am wanting to use something like Loquendo with Unity.
Is there anything that is good, solid and easy to implement.
Thanks
Is there any good TTS (Text to Speech Asset)? I am wanting to use something like Loquendo with Unity.
Is there anything that is good, solid and easy to implement.
Thanks
using UnityEngine;
using System.Collections;
using System.Text.RegularExpressions;
/// <summary>
/// <author>Jefferson Reis</author>
/// <explanation>Works only on Android, or platform that supports mp3 files. To test, change the platform to Android.</explanation>
/// </summary>
public class GoogleTextToSpeech : MonoBehaviour
{
public string words = "Hello";
public string language = "en";
IEnumerator Start ()
{
// Remove the "spaces" in excess
Regex rgx = new Regex ("\\s+");
// Replace the "spaces" with "% 20" for the link Can be interpreted
string result = rgx.Replace (words, "%20");
string url = "http://translate.google.com/translate_tts?tl=" + language + "&q=" + result;
WWW www = new WWW (url);
yield return www;
audio.clip = www.GetAudioClip (false, false, AudioType.MPEG);
audio.Play ();
}
void OnGUI ()
{
words = GUI.TextField (new Rect (Screen.width / 2 - 200 / 2, 10, 200, 30), words);
if (GUI.Button (new Rect (Screen.width / 2 - 150 / 2, 40, 150, 50), "Speak")) {
StartCoroutine (Start ());
}
}
}//closes the class