- Home /
Unity WebPlayer Text To Speech
Hello Guys,
I need a help or a direction to implement a method to use "text to speech" in unity web player.I have try several methods but no good result. I have try to use Google translator but the mp3 it return cannot play using WWW.GetAudioClip method. Only method I was able to use "SpeechSynthesisUtteranc" which I add to the webpage and call it using Application.ExternalCall
Example :-
IN Web Page using javascript :
function Speak(Text)
{
var msg = new SpeechSynthesisUtterance(Text);
window.speechSynthesis.speak(msg);
}
and call this in unity by,
Application.ExternalCall("Speak", "Hello");
But unfortunately this only works in google chrome. Please help me or show me a direction to use text to speech in any browser
Thanks in advance.
So this is the code part I'm using to get audio file
IEnumerator GetSpeechAudio()
{
WWW _GoogleT = new WWW("http://translate.google.com/translate_tts?tl=en&q=helloworld");
yield return _GoogleT;
this.GetComponent<AudioSource>().clip = _GoogleT.GetAudioClip(false, true, AudioType.$$anonymous$$PEG);
this.GetComponent<AudioSource>().Play();
}
but i have error saying in the editor
"Strea$$anonymous$$g of '' on this platform is not supported UnityEngine.WWW:GetAudioClip(Boolean, Boolean, AudioType)"
even i deployed as a webplayer i cant here a thing