{"id":241,"date":"2010-04-04T06:39:52","date_gmt":"2010-04-03T23:39:52","guid":{"rendered":"http:\/\/blog.bebensiganteng.com\/?p=241"},"modified":"2016-03-14T08:08:00","modified_gmt":"2016-03-14T08:08:00","slug":"a-very-simple-text-to-speech-using-google-api-for-flash","status":"publish","type":"post","link":"https:\/\/rahmat-hidayat.com\/?p=241","title":{"rendered":"Simple Text to Speech method for Flash"},"content":{"rendered":"<blockquote><p><strong>UPDATE: October 1st, 2012<\/strong><br \/>\nI noticed that the code doesn&#8217;t work anymore, since they&#8217;ve added a crossdomain reference and modified the API a bit, but a simple proxy should do the trick, check this <a href=\"http:\/\/blog.onebyonedesign.com\/actionscript\/googles-text-to-speech-engine-in-flash\/\" title=\"Text to voice\">blog<\/a> for solution.<\/p><\/blockquote>\n<p>I&#8217;ve just discovered an ultra-simple way of converting text to speech utilizing an undocumented Google API code.<\/p>\n<pre class=\"brush: as3; title: ; notranslate\" title=\"\">\r\nimport flash.media.Sound;\r\nimport flash.net.URLRequest;\r\n\r\nvar _path:String = 'http:\/\/translate.google.com\/translate_tts?q=';\r\nvar _sound:Sound = new Sound();\r\n\r\n\/\/ all it takes is just to pass the words to the path\t\t\t\t\t\t\r\n_sound.load(new URLRequest(_path+ 'hello world'));\r\n_sound.addEventListener(Event.COMPLETE, soundLoaded);\r\n\r\nfunction soundLoaded(e:Event):void\r\n{\r\n\t_sound.play();\r\n\t\t\r\n\t_sound.removeEventListener(Event.COMPLETE, soundLoaded);\r\n\t_sound = null;\r\n}\r\n<\/pre>\n<p>It&#8217;s limited, yet the practical uses of it are endless.<\/p>\n<p>Here&#8217;s a little <a href=\"http:\/\/labs.bebensiganteng.com\/flash\/texttospeech\/\" target=\"_blank\">demo<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>UPDATE: October 1st, 2012 I noticed that the code doesn&#8217;t work anymore, since they&#8217;ve added a crossdomain reference and modified the API a bit, but a simple proxy should do the trick, check this blog for solution. I&#8217;ve just discovered an ultra-simple way of converting text to speech utilizing an undocumented Google API code. It&#8217;s [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4,7,28],"tags":[64,69,75,96,102,140],"_links":{"self":[{"href":"https:\/\/rahmat-hidayat.com\/index.php?rest_route=\/wp\/v2\/posts\/241"}],"collection":[{"href":"https:\/\/rahmat-hidayat.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rahmat-hidayat.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rahmat-hidayat.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rahmat-hidayat.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=241"}],"version-history":[{"count":1,"href":"https:\/\/rahmat-hidayat.com\/index.php?rest_route=\/wp\/v2\/posts\/241\/revisions"}],"predecessor-version":[{"id":1627,"href":"https:\/\/rahmat-hidayat.com\/index.php?rest_route=\/wp\/v2\/posts\/241\/revisions\/1627"}],"wp:attachment":[{"href":"https:\/\/rahmat-hidayat.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=241"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rahmat-hidayat.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=241"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rahmat-hidayat.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}