203 | * - (void) onResults:(NSArray *) results{
204 | * NSMutableString *result = [[NSMutableString alloc] init];
205 | * NSDictionary *dic = [results objectAtIndex:0];
206 | * for (NSString *key in dic){
207 | * [result appendFormat:@"%@",key];//合并结果
208 | * }
209 | * }
210 | *
211 | *
212 | * @param results -[out] 识别结果,NSArray的第一个元素为NSDictionary,NSDictionary的key为识别结果,sc为识别结果的置信度。
213 | * @param isLast -[out] 是否最后一个结果
214 | */
215 | - (void) onResults:(NSArray *) results isLast:(BOOL)isLast{
216 | NSLog(@"Speech :: onResults - %@", results);
217 | if (self.callbackId) {
218 | NSMutableString *text = [[NSMutableString alloc] init];
219 | NSDictionary *dic = [results objectAtIndex:0];
220 | for (NSString *key in dic) {
221 | [text appendFormat:@"%@",key];
222 | }
223 | NSLog(@"Recognize Result: %@",text);
224 |
225 | // NSString * resultFromJson = [ISRDataHelper stringFromJson:text];
226 | //
227 | // NSLog(@"---------%@",resultFromJson);
228 |
229 | NSDictionary* info = [NSDictionary dictionaryWithObjectsAndKeys:@"SpeechResults",STR_EVENT,text,STR_RESULTS, nil];
230 | CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:info];
231 | [result setKeepCallbackAsBool:YES];
232 | [self.commandDelegate sendPluginResult:result callbackId:self.callbackId];
233 | }
234 | }
235 |
236 | /*!
237 | * IFlySpeechRecognizerDelegate 音量变化回调
238 | * 在录音过程中,回调音频的音量。
239 | *
240 | * @param volume -[out] 音量,范围从0-30
241 | */
242 |
243 | - (void) onVolumeChanged:(int)volume
244 | {
245 | NSLog(@"Speech :: onVolumeChanged - %d", volume);
246 | if (self.callbackId) {
247 | NSDictionary* info = [NSDictionary dictionaryWithObjectsAndKeys:@"VolumeChanged",STR_EVENT,[NSNumber numberWithInt:volume],STR_VOLUME, nil];
248 | CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:info];
249 | [result setKeepCallbackAsBool:YES];
250 | [self.commandDelegate sendPluginResult:result callbackId:self.callbackId];
251 | }
252 | }
253 |
254 |
255 | /*!
256 | * 识别结束回调
257 | *
258 | * @param error 识别结束错误码
259 | */
260 | - (void)onError: (IFlySpeechError *) error{
261 | NSLog(@"Speech :: onError - %d", error.errorCode);
262 | if (self.callbackId) {
263 | NSDictionary* info = [NSDictionary dictionaryWithObjectsAndKeys:@"11SpeechError",STR_EVENT,[NSNumber numberWithInt:error.errorCode],STR_CODE,error.errorDesc,STR_MESSAGE, nil];
264 | CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:info];
265 | [result setKeepCallbackAsBool:YES];
266 | [self.commandDelegate sendPluginResult:result callbackId:self.callbackId];
267 | }
268 | }
269 |
270 |
271 | #pragma mark IFlySpeechSynthesizerDelegate
272 | - (void) onCompleted:(IFlySpeechError*)error
273 | {
274 | NSLog(@"Speech :: onCompleted - %d", error.errorCode);
275 | if (self.callbackId) {
276 | NSDictionary* info = [NSDictionary dictionaryWithObjectsAndKeys:@"SpeakCompleted",STR_EVENT,[NSNumber numberWithInt:error.errorCode],STR_CODE,error.errorDesc,STR_MESSAGE, nil];
277 | CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:info];
278 | [result setKeepCallbackAsBool:YES];
279 | [self.commandDelegate sendPluginResult:result callbackId:self.callbackId];
280 | }
281 | }
282 |
283 | - (void) onSpeakBegin
284 | {
285 | NSLog(@"Speech :: onSpeakBegin");
286 | [self fireEvent:@"SpeakBegin"];
287 | }
288 |
289 | - (void) onBufferProgress:(int)progress message:(NSString *)msg
290 | {
291 | NSLog(@"Speech :: onBufferProgress - %d", progress);
292 | if (self.callbackId) {
293 | NSDictionary* info = [NSDictionary dictionaryWithObjectsAndKeys:@"BufferProgress",STR_EVENT,[NSNumber numberWithInt:progress],STR_PROGRESS,msg,STR_MESSAGE, nil];
294 | CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:info];
295 | [result setKeepCallbackAsBool:YES];
296 | [self.commandDelegate sendPluginResult:result callbackId:self.callbackId];
297 | }
298 | }
299 |
300 | - (void) onSpeakProgress:(int)progress
301 | {
302 | NSLog(@"Speech :: onSpeakProgress - %d", progress);
303 | if (self.callbackId) {
304 | NSDictionary* info = [NSDictionary dictionaryWithObjectsAndKeys:@"SpeakProgress",STR_EVENT,[NSNumber numberWithInt:progress],STR_PROGRESS, nil];
305 | CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:info];
306 | [result setKeepCallbackAsBool:YES];
307 | [self.commandDelegate sendPluginResult:result callbackId:self.callbackId];
308 | }
309 | }
310 |
311 | - (void) onSpeakPaused
312 | {
313 | NSLog(@"Speech :: onSpeakPaused");
314 | [self fireEvent:@"SpeakPaused"];
315 | }
316 |
317 | - (void) onSpeakResumed
318 | {
319 | NSLog(@"Speech :: onSpeakResumed");
320 | [self fireEvent:@"SpeakResumed"];
321 | }
322 |
323 | - (void) onSpeakCancel
324 | {
325 | NSLog(@"Speech :: onSpeakCancel");
326 | [self fireEvent:@"SpeakCancel"];
327 | }
328 |
329 | - (void) fireEvent:(NSString*)event
330 | {
331 | if (self.callbackId) {
332 | NSDictionary* info = [NSDictionary dictionaryWithObject:event forKey:STR_EVENT];
333 | CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:info];
334 | [result setKeepCallbackAsBool:YES];
335 | [self.commandDelegate sendPluginResult:result callbackId:self.callbackId];
336 | }
337 | }
338 |
339 |
340 |
341 |
342 |
343 | @end
344 |
--------------------------------------------------------------------------------
/src/ios/iflyMSC.framework/Headers/IFlyContact.h:
--------------------------------------------------------------------------------
1 | //
2 | // IFlyContact.h
3 | // msc
4 | //
5 | // Created by ypzhao on 13-3-1.
6 | // Copyright (c) 2013年 IFLYTEK. All rights reserved.
7 | //
8 |
9 | #import *参数 | 描述 | 94 | *
---|---|
domain | 应用的领域: 取值为:iat、search、video、poi、music、asr; iat:普通文本听写; search:热词搜索; video:视频音乐搜索; video:视频音乐搜索; asr:关键词识别; |
vad_bos | 前端点检测: 静音超时时间,即用户多长时间不说话则当做超时处理; 单位:ms; engine指定iat识别默认值为5000; 其他情况默认值为 4000,范围 0-10000。 |
vad_eos | 后断点检测: 后端点静音检测时间,即用户停止说话多长时间内即认为不再输入, 自动停止录音;单位:ms; sms 识别默认值为 1800; 其他默认值为 700,范围 0-10000。 |
sample_rate | 采样率:目前支持的采样率设置有 16000 和 8000。 |
asr_ptt | 标点符号设置: 默认为 1,当设置为 0 时,将返回无标点符号文本。 |
result_type | 返回结果的数据格式: 可设置为json,xml,plain,默认为json。 |
grammarID | 识别的语法id: 只针对 domain 设置为”asr”的应用。 |
asr_audio_path | 音频文件名: 设置此参数后,将会自动保存识别的录音文件。 路径为Documents/(指定值)。 不设置或者设置为nil,则不保存音频。 |
params | 扩展参数: 对于一些特殊的参数可在此设置,一般用于设置语义。 |
*日志打印等级 | 描述 | 70 | *
---|---|
LVL_ALL | 全部打印 |
LVL_DETAIL | 高,异常分析需要的级别 |
LVL_NORMAL | 中,打印基本日志信息 |
LVL_LOW | 低,只打印主要日志信息 |
LVL_NONE | 不打印 |
*云端发音人名称 | 参数 | 350 | *
---|---|
小燕 | xiaoyan |
小宇 | xiaoyu |
凯瑟琳 | catherine |
亨利 | henry |
玛丽 | vimary |
小研 | vixy |
小琪 | vixq |
小峰 | vixf |
小梅 | vixl |
小莉 | vixq |
小蓉(四川话) | vixr |
小芸 | vixyun |
小坤 | vixk |
小强 | vixqa |
小莹 | vixying |
小新 | vixx |
楠楠 | vinn |
老孙 | vils |
*参数 | 描述 | 81 | *
---|---|
domain | 应用的领域: 取值为:iat、search、video、poi、music、asr; iat:普通文本听写; search:热词搜索; video:视频音乐搜索; video:视频音乐搜索; asr:关键词识别; |
vad_bos | 前端点检测: 静音超时时间,即用户多长时间不说话则当做超时处理; 单位:ms; engine指定iat识别默认值为5000; 其他情况默认值为 4000,范围 0-10000。 |
vad_eos | 后断点检测: 后端点静音检测时间,即用户停止说话多长时间内即认为不再输入, 自动停止录音;单位:ms; sms 识别默认值为 1800; 其他默认值为 700,范围 0-10000。 |
sample_rate | 采样率:目前支持的采样率设置有 16000 和 8000。 |
asr_ptt | 标点符号设置: 默认为 1,当设置为 0 时,将返回无标点符号文本。 |
result_type | 返回结果的数据格式: 可设置为json,xml,plain,默认为json。 |
grammarID | 识别的语法id: 只针对 domain 设置为”asr”的应用。 |
asr_audio_path | 音频文件名: 设置此参数后,将会自动保存识别的录音文件。 路径为Documents/(指定值)。 不设置或者设置为nil,则不保存音频。 |
params | 扩展参数: 对于一些特殊的参数可在此设置,一般用于设置语义。 |
[_iFlySpeechRecognizer setParameter:@"audio_source" value:@"-1"];
160 | * [_iFlySpeechRecognizer startListening];
161 | * [_iFlySpeechRecognizer writeAudio:audioData1];
162 | * [_iFlySpeechRecognizer writeAudio:audioData2];
163 | * ...
164 | * [_iFlySpeechRecognizer stopListening];
165 | *
166 | *
167 | * @param audioData 音频数据
168 | *
169 | * @return 写入成功返回YES,写入失败返回NO
170 | */
171 | - (BOOL) writeAudio:(NSData *) audioData;
172 |
173 | @end
174 |
175 |
--------------------------------------------------------------------------------
/src/ios/iflyMSC.framework/Headers/IFlySpeechRecognizerDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // IFlySpeechRecognizerDelegate.h
3 | // MSC
4 | //
5 | // Created by ypzhao on 13-3-27.
6 | // Copyright (c) 2013年 iflytek. All rights reserved.
7 | //
8 |
9 | #import
46 | * - (void) onResults:(NSArray *) results{
47 | * NSMutableString *result = [[NSMutableString alloc] init];
48 | * NSDictionary *dic = [results objectAtIndex:0];
49 | * for (NSString *key in dic){
50 | * [result appendFormat:@"%@",key];//合并结果
51 | * }
52 | * }
53 | *
54 | *
55 | * @param results -[out] 识别结果,NSArray的第一个元素为NSDictionary,NSDictionary的key为识别结果,sc为识别结果的置信度。
56 | * @param isLast -[out] 是否最后一个结果
57 | */
58 | - (void) onResults:(NSArray *) results isLast:(BOOL)isLast;
59 |
60 | @optional
61 |
62 | /*!
63 | * 音量变化回调
64 | * 在录音过程中,回调音频的音量。
65 | *
66 | * @param volume -[out] 音量,范围从0-30
67 | */
68 | - (void) onVolumeChanged: (int)volume;
69 |
70 | /*!
71 | * 开始录音回调
72 | * 当调用了`startListening`函数之后,如果没有发生错误则会回调此函数。
73 | * 如果发生错误则回调onError:函数
74 | */
75 | - (void) onBeginOfSpeech;
76 |
77 | /*!
78 | * 停止录音回调
79 | * 当调用了`stopListening`函数或者引擎内部自动检测到断点,如果没有发生错误则回调此函数。
80 | * 如果发生错误则回调onError:函数
81 | */
82 | - (void) onEndOfSpeech;
83 |
84 | /*!
85 | * 取消识别回调
86 | * 当调用了`cancel`函数之后,会回调此函数,在调用了cancel函数和回调onError之前会有一个
87 | * 短暂时间,您可以在此函数中实现对这段时间的界面显示。
88 | */
89 | - (void) onCancel;
90 |
91 | #ifdef _EDUCATION_
92 | /**
93 | * 返回音频Key
94 | *
95 | * @param key 音频Key
96 | */
97 | - (void) getAudioKey:(NSString *)key;
98 |
99 | #endif
100 |
101 | /**
102 | * 扩展事件回调
103 | * 根据事件类型返回额外的数据
104 | *
105 | * @param eventType 事件类型,具体参见IFlySpeechEventType的IFlySpeechEventTypeVoiceChangeResult枚举。
106 | * @param arg0 arg0
107 | * @param arg1 arg1
108 | * @param eventData 事件数据
109 | */
110 | - (void) onEvent:(int)eventType arg0:(int)arg0 arg1:(int)arg1 data:(NSData *)eventData;
111 |
112 | @end
113 |
--------------------------------------------------------------------------------
/src/ios/iflyMSC.framework/Headers/IFlySpeechSynthesizer.h:
--------------------------------------------------------------------------------
1 | //
2 | // IFlySpeechSynthesizer.h
3 | // MSC
4 | //
5 | // Created by 侯效林 on 16-4-22.
6 | // Copyright (c) 2016年 iflytek. All rights reserved.
7 | //
8 |
9 | #import 参数 | 描述 | 62 | *
---|---|
speed | 合成语速,取值范围 0~100 |
volume | 合成的音量,取值范围 0~100 |
voice_name | 默认为”xiaoyan”;可以设置的参数列表可参考个性化发音人列表 |
sample_rate | 采样率:目前支持的采样率设置有 16000 和 8000。 |
tts_audio_path | 音频文件名 设置此参数后,将会自动保存合成的音频文件。 路径为Documents/(指定值)。不设置或者设置为nil,则不保存音频。 |
params | 扩展参数: 对于一些特殊的参数可在此设置。 |
*参数 | 描述 | 97 | *
---|---|
domain | 应用的领域: 取值为:iat、search、video、poi、music、asr; iat:普通文本听写; search:热词搜索; video:视频音乐搜索; video:视频音乐搜索; asr:关键词识别; |
vad_bos | 前端点检测: 静音超时时间,即用户多长时间不说话则当做超时处理; 单位:ms; engine指定iat识别默认值为5000; 其他情况默认值为 4000,范围 0-10000。 |
vad_eos | 后断点检测: 后端点静音检测时间,即用户停止说话多长时间内即认为不再输入, 自动停止录音;单位:ms; sms 识别默认值为 1800; 其他默认值为 700,范围 0-10000。 |
sample_rate | 采样率:目前支持的采样率设置有 16000 和 8000。 |
asr_ptt | 标点符号设置: 默认为 1,当设置为 0 时,将返回无标点符号文本。 |
result_type | 返回结果的数据格式: 可设置为json,xml,plain,默认为json。 |
grammarID | 识别的语法id: 只针对 domain 设置为”asr”的应用。 |
asr_audio_path | 音频文件名: 设置此参数后,将会自动保存识别的录音文件。 路径为Documents/(指定值)。 不设置或者设置为nil,则不保存音频。 |
params | 扩展参数: 对于一些特殊的参数可在此设置,一般用于设置语义。 |
{\"userword\":[{\"name\":\"iflytek\",\"words\":[\"科大讯飞\",
21 | * \"云平台\",\"用户词条\",\"开始上传词条\"]}]}
22 | *
23 | * @param json 初始化时传入的数据
24 | *
25 | * @return IFlyUserWords对象
26 | */
27 | - (id) initWithJson:(NSString *)json;
28 |
29 | /*!
30 | * 将数据转化为上传的数据格式
31 | *
32 | * @return 没有数据或者格式不对时返回nil
33 | */
34 | - (NSString *) toString;
35 |
36 | /*!
37 | * 返回key对应的数据
38 | *
39 | * @param key 在putword:value中设置的key
40 | *
41 | * @return key对应的数组
42 | */
43 | - (NSArray *) getWords: (NSString *) key;
44 |
45 | /*!
46 | * 添加一条用户词数据
47 | *
48 | * @param key 用户词对应的key
49 | * @param value 上传的用户词数据
50 | *
51 | * @return 成功返回YES,失败返回NO
52 | */
53 | - (BOOL) putWord: (NSString *) key value:(NSString *)value;
54 |
55 | /*!
56 | * 添加一组数据
57 | *
58 | * @param key 用户词对应的key
59 | * @param words 上传的用户词数据
60 | *
61 | * @return 成功返回YES,失败返回NO
62 | */
63 | - (BOOL) putwords: (NSString *) key words:(NSArray *)words;
64 |
65 | /*!
66 | * 是否包含key对应的用户词数据
67 | *
68 | * @param key 用户词对应的key
69 | *
70 | * @return 成功返回YES,失败返回NO
71 | */
72 | - (BOOL) containsKey: (NSString *) key;
73 | @end
74 |
--------------------------------------------------------------------------------
/src/ios/iflyMSC.framework/Headers/IFlyVoiceWakeuper.h:
--------------------------------------------------------------------------------
1 | //
2 | // IFlyVoiceWakeuper.h
3 | // wakeup
4 | //
5 | // Created by admin on 14-3-18.
6 | // Copyright (c) 2014年 iflytek. All rights reserved.
7 | //
8 |
9 |
10 | #import