package {
import flash.media.Sound;
import flash.net.URLRequest;
import flash.display.MovieClip;
import flash.media.SoundChannel;
public class textspeech extends MovieClip
{
public function textspeech()
{
say("hello there");
}
public static function say(value:String):void
{
var s:Sound = new Sound();
s.load(new URLRequest(generateAudioURL(value)));
s.play();
}
protected static function generateAudioURL(value:String):String
{
var generatedString:String = 'http://translate.google.com/translate_tts?q=' + value;
return generatedString;
}
}
}
Google Text to Speech API and AIR
最新推荐文章于 2025-06-19 16:36:24 发布