java文本轉語音



import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;

public class TTStest {

 public static void main(String[] args){
     ActiveXComponent sap = new ActiveXComponent("Sapi.SpVoice");
     Dispatch sapo = sap.getObject();
     try {
         sap.setProperty("Volume", new Variant(100));
         sap.setProperty("Rate", new Variant(-2));


         Dispatch.call(sapo, "Speak", new Variant("Hi,Nice to meet you!"));
         Dispatch.call(sapo, "Speak", new Variant("明天北京天氣如何?"));
         Dispatch.call(sapo, "Speak", new Variant("明天北京下雨嗎?"));
 
         System.out.println("end!!!");
     } catch (Exception e) {
         e.printStackTrace();
     } finally {
         sapo.safeRelease();
         sap.safeRelease();
     }
     }

}


匹配jar包可以去此下載:http://download.csdn.net/detail/qitehuanjue/9635100



發佈了17 篇原創文章 · 獲贊 5 · 訪問量 3萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章