1. java報錯:The operator != is undefined for the argument type(s) int,null
null只是對對象有用,基本類型沒有null。
package cn.e.shu.web.test;
public class TestInteger {
public static void main(String[] args) {
/**
* 問題來源是在Struts2的action中,如果從session中取值,如果取不到的話,那麼應該為null,由於我將其強轉為Integer類型了,其後再將其與Integer比較時,居然拋空指針異常
*/
Object one = null;
Integer two = (Integer) one;
System.out.println(null == two);// out put true
System.out.println(two instanceof Integer);// out put false
System.out.println(two instanceof Object);// out put false
// System.out.println(0 == two);// 拋出空指針異常
// 思索,由於JDK有自動拆裝箱操作,所以即使用的是Integer,其也會被拆箱為int類型,這樣在使用操作符時,不滿足int型和null型比較
// 編譯錯誤: The operator == is undefined for the argument type(s) int, null
System.out.println(0 == null);
}
}
(1)javaspeech擴展閱讀
JAVA報錯:Theoperator%isundefinedfortheargumenttype(s)int,String
importjavax.speech.Central;
importjavax.speech.EngineException;
importjavax.speech.synthesis.*;
publicclassTrySpeech{
staticSynthesizersynthesizer;
publicstaticvoidmain(String[]args){
try{
synthesizer=Central.createSynthesizer(null);
synthesizer.allocate();//這行運行時拋出空指針異常
}catch(EngineExceptione){
}try{
synthesizer.speak("HelloIamacomputer",null);synthesizer.speak("HelloIama<EMP>computer</EMP>",null);
synthesizer.speak("HelloIama<PROSPITCH="10%">computer</PROS>",null);
}catch(Exceptione){e.printStackTrace();
}
}}
2. java使用freeTTS,怎麼能讓機器輸出中文語言
FreeTTS可以輸出中文語言過程:
①導入Java 語音API包
②為語音合成器聲明實例變數
③語音合成器的初始化
初始化是FreeTTS應用中關鍵的部分。首先需要建立一個SynthesizerModeDesc 對象,該對象用於指明語音合成器的屬性,包括語音引擎的的名稱、語音引擎的操作模式、支持的語言、語音引擎的運行狀態以及其發音能力等。
④創建語音合成器
創建語言合成器時需要用到Cen t ral 類, 其作用是提供用來訪問所有語音輸入和輸出的能力, 同時也可以定為語言引擎, 根據描述符所定義的屬性集合選擇匹配的引擎, 從而創建語音識別器和語音合成器。語音合成器的創建需使用Central類的createSynthesizer方法,該方法接受一個SynthesizerModeDesc描述符並返回同描述符中所指定屬性相匹配的一個Synthesizer對象,用以實現語音合成。
⑤准備用於朗讀的Synthesizer 對象
該部分通過Synthesizer對象的allocate和resume方法分配語音引擎所需要的資源並取得可用於朗讀的語音合成器。實現較為簡單:speechSynthesizer1allocate();speechSynthesizer1resume();
⑥設置Syn thesizer 對象的屬性
利用getSynthesizerProperties 方法可以獲得Synthesizer對象的屬性,其返回值是與語音合成器相關聯的SynthesizerProperties對象,該對象包含語音合成器的多種屬性, 每種屬性可以通過setProperties方法設置。例如: setSpeakingRate方法可設置speakingRate屬性,實現每分鍾朗讀單詞速率的控制。
⑦事件處理程序設計
speak ingRate 屬性, 實現每分鍾朗讀單詞速率的控制。完成應用程序界面中JButton「讀出號碼」的事件程序設計, 首先通過JComboBox(選擇人名的下拉列表)取得人名(namesArray)的一個索引,該索引與電話號碼索引(numbersArray)保持對應,然後調用Synthesizer對象speakingPlainText方法朗讀整理後的電話號碼字元串。
3. 在Java中如何使用speechSDK5.1
沒看明白你說的是什麼 java做語音有個JMF
4. java和.net哪個更好用呢
各有各的用處:
java可以在各種系統上運行,其實.net也有這個潛力,只不過裡面的一些和windows api相關的類就不能用了,網路方面的類應該是可以很好運行的。.net有一套開發工具,可以提高開發速度。
如果是比較大型的應用的話,還是java比較適合。不過java對伺服器的要求一般比較高。.net有一套MS自成體系的東西(windows + sql server + office + .net +...)他們之間沒有兼容性問題。java的話老是會遇到些兼容問題。.net依賴的windows價格還可以。linux是免費的,但是如果大型應用用IBM的話,簡直是天價。 .net比較新,借鑒了java,不能否認.net是比java先進
j2ee的優勢:
1.j2ee應用程序伺服器一般集成了很多組件程序:
web server, jms, app server. ejb component 封裝得比.net組件要多些,它可以進行事務處理,persistence等功能。
2..net組件沒法完成事務處理功能,要進行事務處理,必須用COM+的transaction processing function. .net中沒有非同步消息功能(i.e. jms function),在COM+中可以用消息隊列來完成這樣的功能。.net對資料庫的處理功能,ado.net是面向無連接的應用,但事務處理等功能需要自己編寫程序或用在資料庫中處理。.net web server, .net framework等各server不是集成在一起,多少有些不方便。 以上是認為.net相對來說比較不方便的地方。 .net的優勢
1..net的元數據功能強大。
2.部署非常方便。
3.side by side execution,解決了版本問題,允許多版本共存,resolved dll hell.
4. This is a remarkable one, code behind technology.
5. Also a remarkable one, easier Web Service development and deployment.
6. back compatible,對以前產品的兼容,如果用java,以前用com+實現的東西就會變成一堆廢品。
7. vsa,方便開發script application.可以開發一個應用程序象office一樣有一個script editor.這點很誘人。
8. .net speech technology,前景廣闊,call center中大有前途,和Voice xml競爭產品,version1.0馬上要release了。
ms以前有Smart Card sdk1.1,但在.net中好像還沒有實現。而Java Card非常好用,j2me功能覺得還不夠強大,同時.net在這方面也還不是很強大。.Net最大的優勢是簡單和window結合緊密 java的優勢在於跨平台和大型企業應用。
5. JAVA的環境變數java_home,PATH, CLASSPATH,按要求設置了,apk反編譯時但還是不行,求解決
確定都是32bit或者都是64bit。
使用javac -version來確定java版本。
刪除之前的JDK之後需要刪除相關的環境變數。
這個軟體我沒有過,可能是固有漏洞或者需要修改其配置文件。
6. 在java怎麼調用julius做語音識別啊求介面代碼
package com.cnblogs.htynkn;
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.IntByReference;
public interface QTSR extends Library {
QTSR INSTANCE = (QTSR) Native.loadLibrary("msc", QTSR.class);
/**
* 初始化MSC的ISR部分
*
* @param configs
* 初始化時傳入的字元串,以指定合成用到的一些配置參數,各個參數以「參數名=參數值」的形式出現,大小寫不敏感,不同的參數之間以「
* ,」或「\n」隔開,不設置任何值時可以傳入NULL或空串:
* @return 如果函數調用成功返回MSP_SUCCESS,否則返回錯誤代碼,錯誤代碼參見msp_errors
*/
public int QISRInit(String configs);
/**
* 開始一個ISR會話
*
* @param grammarList
* uri-list格式的語法,可以是一個語法文件的URL或者一個引擎內置語法列表。可以同時指定多個語法,不同的語法之間以「,」
* 隔開。進行語音聽寫時不需要語法,此參數設定為NULL或空串即可;進行語音識別時則需要語法,語法可以在此參數中指定,
* 也可以隨後調用QISRGrammarActivate指定識別所用的語法。
* @param params
* 本路ISR會話使用的參數,可設置的參數及其取值范圍請參考《可設置參數列表_MSP20.xls》,各個參數以「參數名=參數值」
* 的形式出現,不同的參數之間以「,」或者「\n」隔開。
* @param errorCode
* 如果函數調用成功則其值為MSP_SUCCESS,否則返回錯誤代碼,錯誤代碼參見msp_errors。幾個主要的返回值:
* MSP_ERROR_NOT_INIT 未初始化 MSP_ERROR_INVALID_PARA 無效的參數
* MSP_ERROR_NO_LICENSE 開始一路會話失敗
* @return MSC為本路會話建立的ID,用來唯一的標識本路會話,供以後調用其他函數時使用。函數調用失敗則會返回NULL。
*/
public String QISRSessionBegin(String grammarList, String params,
IntByReference errorCode);
/**
* 傳入語法
*
* @param sessionID
* 由QISRSessionBegin返回過來的會話ID。
* @param grammar
* 語法字元串
* @param type
* 語法類型,可以是uri-list、abnf、xml等
* @param weight
* 本次傳入語法的權重,本參數在MSP 2.0中會被忽略。
* @return 如果函數調用成功返回MSP_SUCCESS,否則返回錯誤代碼,錯誤代碼參見msp_errors
*/
public int QISRGrammarActivate(String sessionID, String grammar,
String type, int weight);
/**
* 寫入用來識別的語音
*
* @param sessionID
* 由QISRSessionBegin返回過來的會話ID。
* @param waveData
* 音頻數據緩沖區起始地址
* @param waveLen
* 音頻數據長度,其大小不能超過設定的max_audio_size
* @param audioStatus
* 用來指明用戶本次識別的音頻是否發送完畢,可能值如下:
* MSP_AUDIO_SAMPLE_FIRST = 1 第一塊音頻
* MSP_AUDIO_SAMPLE_CONTINUE = 2 還有後繼音頻
* MSP_AUDIO_SAMPLE_LAST = 4 最後一塊音頻
* @param epStatus
* 端點檢測(End-point detected)器所處的狀態,可能的值如下:
* MSP _EP_LOOKING_FOR_SPEECH = 0 還沒有檢測到音頻的前端點。
* MSP _EP_IN_SPEECH = 1 已經檢測到了音頻前端點,正在進行正常的音頻處理。
* MSP _EP_AFTER_SPEECH = 3 檢測到音頻的後端點,後繼的音頻會被MSC忽略。
* MSP _EP_TIMEOUT = 4 超時。
* MSP _EP_ERROR= 5 出現錯誤。
* MSP _EP_MAX_SPEECH = 6 音頻過大。
* @param recogStatus
* 識別器所處的狀態
* @return
*/
public int QISRAudioWrite(String sessionID, Pointer waveData, int waveLen,
int audioStatus, IntByReference epStatus, IntByReference recogStatus);
/**
* 獲取識別結果
*
* @param sessionID 由QISRSessionBegin返回過來的會話ID。
* @param rsltStatus 識別結果的狀態,其取值范圍和含義請參考QISRAudioWrite的參數recogStatus
* @param waitTime 與伺服器交互的間隔時間,可以控制和伺服器的交互頻度。單位為ms,建議取值為5000。
* @param errorCode 如果函數調用成功返回MSP_SUCCESS,否則返回錯誤代碼,錯誤代碼參見msp_errors
* @return 函數執行成功並且獲取到識別結果時返回識別結果,函數執行成功沒有獲取到識別結果時返回NULL
*/
public String QISRGetResult(String sessionID, IntByReference rsltStatus,
int waitTime, IntByReference errorCode);
/**
* 結束一路會話
*
* @param sessionID 由QISRSessionBegin返回過來的會話ID。
* @param hints 結束本次會話的原因描述,用於記錄日誌,便於用戶查閱或者跟蹤某些問題。
* @return
*/
public int QISRSessionEnd(String sessionID, String hints);
/**
* 獲取與識別交互相關的參數
*
* @param sessionID 由QISRSessionBegin返回過來的會話ID。
* @param paramName 要獲取的參數名稱;支持同時查詢多個參數,查詢多個參數時,參數名稱按「,」 或「\n」分隔開來。
* @param paramValue 獲取的參數值,以字元串形式返回;查詢多個參數時,參數值之間以「;」分開,不支持的參數將返回空的值。
* @param valueLen 參數值的長度。
* @return
*/
public int QISRGetParam(String sessionID, String paramName,
String paramValue, IntByReference valueLen);
/**
* 逆初始化MSC的ISR部分
*
* @return
*/
public int QISRFini();
}
*Msp_errors
?
package com.cnblogs.htynkn;
import com.sun.jna.win32.StdCallLibrary;
public interface Msp_errors extends StdCallLibrary {
public static final int MSP_SUCCESS = 0;
public static final int ERROR_FAIL = -1;
public static final int ERROR_EXCEPTION= -2;
public static final int ERROR_GENERAL= 10100; /* 0x2774 */
public static final int ERROR_OUT_OF_MEMORY= 10101; /* 0x2775 */
public static final int ERROR_FILE_NOT_FOUND= 10102; /* 0x2776 */
public static final int ERROR_NOT_SUPPORT= 10103; /* 0x2777 */
public static final int ERROR_NOT_IMPLEMENT= 10104; /* 0x2778 */
public static final int ERROR_ACCESS= 10105; /* 0x2779 */
public static final int ERROR_INVALID_PARA= 10106; /* 0x277A */
public static final int ERROR_INVALID_PARA_VALUE= 10107; /* 0x277B */
public static final int ERROR_INVALID_HANDLE= 10108; /* 0x277C */
public static final int ERROR_INVALID_DATA= 10109; /* 0x277D */
public static final int ERROR_NO_LICENSE= 10110; /* 0x277E */
public static final int ERROR_NOT_INIT= 10111; /* 0x277F */
public static final int ERROR_NULL_HANDLE= 10112; /* 0x2780 */
public static final int ERROR_OVERFLOW= 10113; /* 0x2781 */
public static final int ERROR_TIME_OUT= 10114; /* 0x2782 */
public static final int ERROR_OPEN_FILE= 10115; /* 0x2783 */
public static final int ERROR_NOT_FOUND= 10116; /* 0x2784 */
public static final int ERROR_NO_ENOUGH_BUFFER= 10117; /* 0x2785 */
public static final int ERROR_NO_DATA= 10118; /* 0x2786 */
public static final int ERROR_NO_MORE_DATA= 10119; /* 0x2787 */
public static final int ERROR_NO_RESPONSE_DATA= 10120; /* 0x2788 */
public static final int ERROR_ALREADY_EXIST= 10121; /* 0x2789 */
public static final int ERROR_LOAD_MODULE= 10122; /* 0x278A */
public static final int ERROR_BUSY = 10123; /* 0x278B */
public static final int ERROR_INVALID_CONFIG= 10124; /* 0x278C */
public static final int ERROR_VERSION_CHECK= 10125; /* 0x278D */
public static final int ERROR_CANCELED= 10126; /* 0x278E */
public static final int ERROR_INVALID_MEDIA_TYPE= 10127; /* 0x278F */
public static final int ERROR_CONFIG_INITIALIZE= 10128; /* 0x2790 */
public static final int ERROR_CREATE_HANDLE= 10129; /* 0x2791 */
public static final int ERROR_CODING_LIB_NOT_LOAD= 10130; /* 0x2792 */
/* Error codes of network 10200(0x27D8)*/
public static final int ERROR_NET_GENERAL= 10200; /* 0x27D8 */
public static final int ERROR_NET_OPENSOCK= 10201; /* 0x27D9 */ /* Open socket */
public static final int ERROR_NET_CONNECTSOCK= 10202; /* 0x27DA */ /* Connect socket */
public static final int ERROR_NET_ACCEPTSOCK = 10203; /* 0x27DB */ /* Accept socket */
public static final int ERROR_NET_SENDSOCK= 10204; /* 0x27DC */ /* Send socket data */
public static final int ERROR_NET_RECVSOCK= 10205; /* 0x27DD */ /* Recv socket data */
public static final int ERROR_NET_INVALIDSOCK= 10206; /* 0x27DE */ /* Invalid socket handle */
public static final int ERROR_NET_BADADDRESS = 10207; /* 0x27EF */ /* Bad network address */
public static final int ERROR_NET_BINDSEQUENCE= 10208; /* 0x27E0 */ /* Bind after listen/connect */
public static final int ERROR_NET_NOTOPENSOCK= 10209; /* 0x27E1 */ /* Socket is not opened */
public static final int ERROR_NET_NOTBIND= 10210; /* 0x27E2 */ /* Socket is not bind to an address */
public static final int ERROR_NET_NOTLISTEN = 10211; /* 0x27E3 */ /* Socket is not listening */
public static final int ERROR_NET_CONNECTCLOSE= 10212; /* 0x27E4 */ /* The other side of connection is closed */
public static final int ERROR_NET_NOTDGRAMSOCK= 10213; /* 0x27E5 */ /* The socket is not datagram type */
public static final int ERROR_NET_DNS= 10214; /* 0x27E6 */ /* domain name is invalid or dns server does not function well */
/* Error codes of mssp message 10300(0x283C) */
public static final int ERROR_MSG_GENERAL= 10300; /* 0x283C */
public static final int ERROR_MSG_PARSE_ERROR= 10301; /* 0x283D */
public static final int ERROR_MSG_BUILD_ERROR= 10302; /* 0x283E */
public static final int ERROR_MSG_PARAM_ERROR= 10303; /* 0x283F */
public static final int ERROR_MSG_CONTENT_EMPTY= 10304; /* 0x2840 */
public static final int ERROR_MSG_INVALID_CONTENT_TYPE = 10305; /* 0x2841 */
public static final int ERROR_MSG_INVALID_CONTENT_LENGTH = 10306; /* 0x2842 */
public static final int ERROR_MSG_INVALID_CONTENT_ENCODE = 10307; /* 0x2843 */
public static final int ERROR_MSG_INVALID_KEY= 10308; /* 0x2844 */
public static final int ERROR_MSG_KEY_EMPTY= 10309; /* 0x2845 */
public static final int ERROR_MSG_SESSION_ID_EMPTY= 10310; /* 0x2846 */
public static final int ERROR_MSG_LOGIN_ID_EMPTY= 10311; /* 0x2847 */
public static final int ERROR_MSG_SYNC_ID_EMPTY= 10312; /* 0x2848 */
public static final int ERROR_MSG_APP_ID_EMPTY= 10313; /* 0x2849 */
public static final int ERROR_MSG_EXTERN_ID_EMPTY= 10314; /* 0x284A */
public static final int ERROR_MSG_INVALID_CMD= 10315; /* 0x284B */
public static final int ERROR_MSG_INVALID_SUBJECT= 10316; /* 0x284C */
public static final int ERROR_MSG_INVALID_VERSION= 10317; /* 0x284D */
public static final int ERROR_MSG_NO_CMD= 10318; /* 0x284E */
public static final int ERROR_MSG_NO_SUBJECT= 10319; /* 0x284F */
public static final int ERROR_MSG_NO_VERSION= 10320; /* 0x2850 */
public static final int ERROR_MSG_MSSP_EMPTY= 10321; /* 0x2851 */
public static final int ERROR_MSG_NEW_RESPONSE= 10322; /* 0x2852 */
public static final int ERROR_MSG_NEW_CONTENT= 10323; /* 0x2853 */
public static final int ERROR_MSG_INVALID_SESSION_ID = 10324; /* 0x2854 */
/* Error codes of DataBase 10400(0x28A0)*/
public static final int ERROR_DB_GENERAL= 10400; /* 0x28A0 */
public static final int ERROR_DB_EXCEPTION= 10401; /* 0x28A1 */
public static final int ERROR_DB_NO_RESULT= 10402; /* 0x28A2 */
public static final int ERROR_DB_INVALID_USER= 10403; /* 0x28A3 */
public static final int ERROR_DB_INVALID_PWD= 10404; /* 0x28A4 */
public static final int ERROR_DB_CONNECT= 10405; /* 0x28A5 */
public static final int ERROR_DB_INVALID_SQL= 10406; /* 0x28A6 */
public static final int ERROR_DB_INVALID_APPID= 10407; /* 0x28A7 */
/* Error codes of Resource 10500(0x2904)*/
public static final int ERROR_RES_GENERAL= 10500; /* 0x2904 */
public static final int ERROR_RES_LOAD = 10501; /* 0x2905 */ /* Load resource */
public static final int ERROR_RES_FREE = 10502; /* 0x2906 */ /* Free resource */
public static final int ERROR_RES_MISSING = 10503; /* 0x2907 */ /* Resource File Missing */
public static final int ERROR_RES_INVALID_NAME = 10504; /* 0x2908 */ /* Invalid resource file name */
public static final int ERROR_RES_INVALID_ID = 10505; /* 0x2909 */ /* Invalid resource ID */
public static final int ERROR_RES_INVALID_IMG = 10506; /* 0x290A */ /* Invalid resource image pointer */
public static final int ERROR_RES_WRITE= 10507; /* 0x290B */ /* Write read-only resource */
public static final int ERROR_RES_LEAK = 10508; /* 0x290C */ /* Resource leak out */
public static final int ERROR_RES_HEAD = 10509; /* 0x290D */ /* Resource head currupt */
public static final int ERROR_RES_DATA = 10510; /* 0x290E */ /* Resource data currupt */
public static final int ERROR_RES_SKIP = 10511; /* 0x290F */ /* Resource file skipped */
/* Error codes of TTS 10600(0x2968)*/
public static final int ERROR_TTS_GENERAL= 10600; /* 0x2968 */
public static final int ERROR_TTS_TEXTEND = 10601; /* 0x2969 */ /* Meet text end */
public static final int ERROR_TTS_TEXT_EMPTY= 10602; /* 0x296A */ /* no synth text */
/* Error codes of Recognizer 10700(0x29CC) */
public static final int ERROR_REC_GENERAL= 10700; /* 0x29CC */
public static final int ERROR_REC_INACTIVE= 10701; /* 0x29CD */
public static final int ERROR_REC_GRAMMAR_ERROR= 10702; /* 0x29CE */
public static final int ERROR_REC_NO_ACTIVE_GRAMMARS = 10703; /* 0x29CF */
public static final int ERROR_REC_DUPLICATE_GRAMMAR= 10704; /* 0x29D0 */
public static final int ERROR_REC_INVALID_MEDIA_TYPE = 10705; /* 0x29D1 */
public static final int ERROR_REC_INVALID_LANGUAGE= 10706; /* 0x29D2 */
public static final int ERROR_REC_URI_NOT_FOUND= 10707; /* 0x29D3 */
public static final int ERROR_REC_URI_TIMEOUT= 10708; /* 0x29D4 */
public static final int ERROR_REC_URI_FETCH_ERROR= 10709; /* 0x29D5 */
/* Error codes of Speech Detector 10800(0x2A30) */
public static final int ERROR_EP_GENERAL= 10800; /* 0x2A30 */
public static final int ERROR_EP_NO_SESSION_NAME= 10801; /* 0x2A31 */
public static final int ERROR_EP_INACTIVE = 10802; /* 0x2A32 */
public static final int ERROR_EP_INITIALIZED = 10803; /* 0x2A33 */
/* Error codes of TUV */
public static final int ERROR_TUV_GENERAL= 10900; /* 0x2A94 */
public static final int ERROR_TUV_GETHIDPARAM = 10901; /* 0x2A95 */ /* Get Busin Param huanid*/
public static final int ERROR_TUV_TOKEN= 10902; /* 0x2A96 */ /* Get Token */
public static final int ERROR_TUV_CFGFILE= 10903; /* 0x2A97 */ /* Open cfg file */
public static final int ERROR_TUV_RECV_CONTENT = 10904; /* 0x2A98 */ /* received content is error */
public static final int ERROR_TUV_VERFAIL = 10905; /* 0x2A99 */ /* Verify failure */
/* Error codes of IMTV */
public static final int ERROR_LOGIN_SUCCESS= 11000; /* 0x2AF8 */ /* 成功 */
public static final int ERROR_LOGIN_NO_LICENSE = 11001; /* 0x2AF9 */ /* 試用次數結束,用戶需要付費 */
public static final int ERROR_LOGIN_SESSIONID_INVALID = 11002; /* 0x2AFA */ /* SessionId失效,需要重新登錄通行證 */
public static final int ERROR_LOGIN_SESSIONID_ERROR= 11003; /* 0x2AFB */ /* SessionId為空,或者非法 */
public static final int ERROR_LOGIN_UNLOGIN = 11004; /* 0x2AFC */ /* 未登錄通行證 */
public static final int ERROR_LOGIN_INVALID_USER = 11005; /* 0x2AFD */ /* 用戶ID無效 */
public static final int ERROR_LOGIN_INVALID_PWD = 11006; /* 0x2AFE */ /* 用戶密碼無效 */
public static final int ERROR_LOGIN_SYSTEM_ERROR= 11099; /* 0x2B5B */ /* 系統錯誤 */
/* Error codes of HCR */
public static final int ERROR_HCR_GENERAL= 11100;
public static final int ERROR_HCR_RESOURCE_NOT_EXIST = 11101;
public static final int ERROR_HCR_CREATE= 11102;
public static final int ERROR_HCR_DESTROY= 11103;
public static final int ERROR_HCR_START= 11104;
public static final int ERROR_HCR_APPEND_STROKES= 11105;
public static final int ERROR_HCR_GET_RESULT= 11106;
public static final int ERROR_HCR_SET_PREDICT_DATA= 11107;
public static final int ERROR_HCR_GET_PREDICT_RESULT = 11108;
/* Error codes of http 12000(0x2EE0) */
public static final int ERROR_HTTP_BASE= 12000; /* 0x2EE0 */
/*Error codes of ISV */
public static final int ERROR_ISV_NO_USER = 13000; /* 32C8 */ /* the user doesn't exist */
/* Error codes of Lua scripts */
public static final int ERROR_LUA_BASE= 14000; /* 0x36B0 */
public static final int ERROR_LUA_YIELD= 14001; /* 0x36B1 */
public static final int ERROR_LUA_ERRRUN= 14002; /* 0x36B2 */
public static final int ERROR_LUA_ERRSYNTAX= 14003; /* 0x36B3 */
public static final int ERROR_LUA_ERRMEM= 14004; /* 0x36B4 */
public static final int ERROR_LUA_ERRERR= 14005; /* 0x36B5 */
7. 請問以下JAVA說明應該怎樣操作關於使用dll的.
只是路徑正確是不行的。.dll放置路徑正確就ok,但是.jar需要引入classpath才行。如果你是用eclipse開發的話,需要配置工程,在libraries選項下加入新的jar包。參考下圖:
8. java 怎樣調用windows的tts
採用JNI調用Windows自帶的(或者其他TTS引擎安裝的)TTS,提供Java介面,方便其他Java程序調用系統TTS。
使用說明:
1)拷貝CamelTTS.dll到你的java項目的lib目錄,因為java程序引用這個dll的路徑是「System.loadLibrary("lib/CamelTTS");」。
2)拷貝CamelTTS.jar到你的java項目的lib目錄,當然要引入到classpath。
3)在你的程序裡面call這個介面,例子如下:
public static void main(String args[])
{
DoSpeak doSpeak = new DoSpeak();
doSpeak.speakString("\u8BF7N002\u52301\u53F7\u67DC\u53F0");
}
4)最後的一步,安裝你的Windows的TTS,比如:NeoSpeech,發音很標准,當然Windows預設的也有,可以用這個方式決定啟用哪個 TTS:「開始-設置-控制面板-語音-文字/語音轉換」,選擇LH Michael(男聲),LH Michelle(女聲)。
9. java web jacob 調用微軟語音庫獲取音頻流
生成 wav,然後網頁中嵌入
請參考生成wave的C#代碼
/// <summary>
/// 輸出WAV
/// </summary>
/// <param name="path">保存路徑</param>
/// <param name="str">要轉換的文本內容</param>
/// <returns></returns>
public bool WreiteToWAV(string path,string str,SpeechAudioFormatType SpAudioType)
{
SpeechStreamFileMode SpFileMode = SpeechStreamFileMode.SSFMCreateForWrite;
SpFileStream SpFileStream = new SpFileStream();
SpeechVoiceSpeakFlags SpFlags = SpeechVoiceSpeakFlags.SVSFlagsAsync;
SpAudioFormat SpAudio = new DotNetSpeech.SpAudioFormat();
SpAudio.Type = SpAudioType;
SpFileStream.Format = SpAudio;
SpFileStream.Open(path, SpFileMode, false);
voice.AudioOutputStream = SpFileStream;
voice.Speak(str, SpFlags);
voice.WaitUntilDone(Timeout.Infinite);
SpFileStream.Close();
return File.Exists(path);
}
10. java,javaweb中怎麼調用microsoft speech sdk 5.1
估計需要microsoft 的架構包,你找找這樣的包通過build path 加進去試下,祝你好運