- Home /
Text to Speech in a web player build
I'm hoping to get text to speech working in a webplayer build using Unity Pro 3.3. I've seen the plugin on the forums and have that working in stand alone builds, but I'm trying just the most basic implementation for a webplayer: adding a .NET assembly (Interop.SpeechLib.dll) to my assets folder and attaching this script to a game object:
using UnityEngine; using System.Collections; using SpeechLib;
public class SkinTest : MonoBehaviour {
void OnGUI()
{
if (GUI.Button(new Rect(Screen.width/2, Screen.height/2,120,80),"Speak!")) {
SpVoice voice = new SpVoice();
voice.Speak("Hello World!", SpeechVoiceSpeakFlags.SVSFDefault);
}
}
}
It works in a stand alone Windows build, but not in a webplayer build. I guess this is as expected since I don't think the web player includes the assembly.
Is there any way to get text to speech working in a web player build?
Thanks
Answer by makisig.du · Sep 18, 2011 at 01:14 PM
I wish we can deploy plug-ins webplayer builds but unfortunately, Unity does not allow it for security reasons.
http://unity3d.com/support/documentation/Manual/Plugins.html
Have you considered setting up your text to speech as a web service that your web build can access over HTTP? It's a suggestion I haven't tried myself but I just thought that might work.
Answer by kabel · Nov 03, 2011 at 07:55 PM
You can try to use a web service like Google which will deliver you a mpeg file. I dont know about sound loading in unity but I think you can do it.
test: http://translate.google.com/translate_tts?tl=en&q=hello world!
If so this will work for MAC users too.
Your answer
Follow this Question
Related Questions
Text To Speech? 0 Answers
Speech to text 2 Answers
load file with www on webplayer 1 Answer
Big text field GUI. 1 Answer
SpeechLib.SpVoiceClass:GetVoices does crash my Unity executable 1 Answer