科大訊飛語音識別

2022-07-16 06:03:07 字數 1542 閱讀 4753

//2.登陸訊飛伺服器  

建立乙個訊飛語音識別物件,可以對他進行一系列的呼叫

[objc]view plain

copy

///帶介面的識別物件  

@property (nonatomic,strong)iflyrecognizerview *iflyrecognizerview;  

[objc]view plain

copy

_iflyrecognizerview = [[iflyrecognizerviewalloc]initwithcenter:self.view.center];  

_iflyrecognizerview.delegate = self;  

[_iflyrecognizerviewsetparameter:@"iat"forkey:[iflyspeechconstantifly_domain]];  

//asr_audio_path儲存錄音檔名,如不再需要,設定value為nil表示取消,預設目錄是documents  

[_iflyrecognizerviewsetparameter:@"asrview.pcm "forkey:[iflyspeechconstantasr_audio_path]];  

訊飛對識別結果的處理採用的****的方法,實現iflyspeechsynthesizerdelegate協議的onresult:islast:方法.

注意!!!!這裡的是onresult,不是onresults,後者是無介面提示的語音解析的結果**函式.

**時預設傳回來的資料是json資料,咱們大可不必疑惑解析到底使用哪種方式,科大訊飛已經為我們考慮到這些問題了,他官方提供了乙個叫做「isrdatahelper」用它解析就可以了。**如下:

[objc]view plain

copy

- (void)onresult:(nsarray *)resultarrayislast:(bool)islast  

nsstring * resu = [isrdatahelperstringfromjson:result];  

//結果要顯示在lable上  

_showtextlable.text = [nsstringstringwithformat:@"%@%@",_showtextlable.text,resu];  

}  拖動乙個button,給乙個響應事件,用於開始監聽語音識別;**如下:

[objc]view plain

copy

- (ibaction)voicerecognize:(id)sender   

科大訊飛語音識別demo

2017年12月,雲 社群對外發布,從最開始的技術部落格到現在擁有多個社群產品。未來,我們一起乘風破浪,創造無限可能。最近在做乙個文字轉語音tts text to speech 的第三方軟體封裝,使用的是國內語音技術龍頭安徽科大訊飛公司提供的離線引擎aisound5.0,主要用於汽車導航用途。科大訊...

關於整合科大訊飛語音識別

一 新增靜態庫 將開發工具包中lib目錄下地iflymsc.framework新增到工程中去。再新增如下圖所示的庫 二 匯入標頭檔案 1 import 2 import 3 4 import 5 import 6 7 import 8 9 import 10 import 11 12 import ...

科大訊飛語音合成 iOS

使用示例如下 c c code 標頭檔案定義 需要實現iflyspeechsynthesizerdelegate,為合成會話的服務 inte ce ttsviewcontroller uiviewcontroller 建立合成物件,為單例模式 iflyspeechsynthesizer iflysp...