RSSを音声で読み上げ
RSSを音声で読み上げしてみました。
http://moeten.info/flex/20080627_rssSound/bin-release/main.html
以下のように読み上げてほしいテキストを送ると
http://api.satoru.net/text2voice/?text=[読み上げテキスト]
作成されるmp3ファイルのURLが表示されますので、それをFlexで再生してあげればOK
Flexなソースはこちら
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" viewSourceURL="srcview/index.html" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#FFFFFF, #0E9600]"> <mx:Script> <![CDATA[ private function getRss():void{ //RSSデーターゲット hts2.send(); } private function onResult2():void{ //RSSデーターを音声へ変換 hts.send({ "text":hts2.lastResult.item.comment }); } private function onResult():void{ //myLog.text = "=>" + hts.lastResult; var mp3src:String = "" + hts.lastResult; var req:URLRequest = new URLRequest(mp3src); var sound:Sound = new Sound(req); sound.play(); } ]]> </mx:Script> <mx:HTTPService id="hts2" url="http://moeten.info/maidcafe/?type=dayinfo&tid=13&cid=1&sid=23&gps_lat=&gps_lon=&wgps_lat=&wgps_lon=&m=api" result="onResult2()" showBusyCursor="true" resultFormat="e4x"/> <mx:HTTPService id="hts" url="http://api.satoru.net/text2voice/" method="GET" result="onResult()" showBusyCursor="true"/> <mx:TileList dataProvider="{hts2.lastResult.item}" x="10" y="10" width="399" height="455" columnWidth="380" rowHeight="410" selectable="false" backgroundAlpha="0.3" > <mx:itemRenderer> <mx:Component> <mx:VBox width="350" height="400"> <mx:Text text="{data.comment}" textAlign="left" fontSize="18"/> </mx:VBox> </mx:Component> </mx:itemRenderer> </mx:TileList> <mx:Button x="417" y="11" label="RSS取得" click="getRss()"/> </mx:Application>