这里介绍的是iOS API关于声纹人脸(Verifier)的相关说明,点击右侧目录可快速找到相应文件。
IFlySpeechRecognizer Class Reference
Inherits from NSObject
Conforms to IFlySpeechRecognizerDelegate
Declared in IFlySpeechRecognizer.h
声纹接口类
The delegate of FlyISVRecognizer responsing to IFlyISVDelegate.
@property (assign) id<IFlyISVDelegate> delegate
Declared In
IFlyISVRecognizer.h
FlyISVRecognizer is a kind of Singleton calss.The function can be used as below:
IFLyISVRecognizer *recognizer=[IFlyISVRecognizer creteRecognizer: self];
+ (instancetype)sharedInstance
Declared In:
IFlyISVRecognizer.h
Genrerate a serial number password
Princeple:
1.Number serial has no 1 in itself;
2.The nuber serial has no same number(“98765432"is right while "99876543” is wrong)
- (NSString *)generatePassword:(int)length
Parameters
length: the serial number’s length,length of “98765432” is 8,generally length is 8 and other value is forbidden
Declared In
IFlyISVRecognizer.h
Used to get password from server
- (NSArray *)getPasswordList:(int)pwdt
Parameters
pwdt:
when pwdt is 1,the function will return chinese text;while pwdt is 2, the funciton will return number serial
Declared In
IFlyISVRecognizer.h
Used to judge if the engine is running in listenning
- (BOOL)isListening
Return Value
YES: the engine is listenning;
No : the engine is not listenning
Declared In:
IFlyISVRecognizer.h
Used to query or delete the voiceprint model in server
- (BOOL)sendRequest:(NSString *)cmd authid:(NSString *)auth_id pwdt:(int)pwdt ptxt:(NSString *)ptxt vid:(NSString *)vid err:(int *)err
Parameters
name | desc |
---|---|
cmd | “del”: delete model; “que”: query model; |
pwdt | voiceprint type 1: fixed txt voiceprint code ,like @“我的地盘我做主”; 2: free voiceprint code , user can speek anything,but 5 times trainning the speech shall be same; 3: number serial voiceprint code ,like @“98765432” and so on. |
ptxt | voiceprint txt,only fixed voiceprint and number serial have this,in free voiceprint model this param shall be set nil. |
vid | another voiceprint type model,user can use this to query or delete model in server can be @“jakillasdfasdjjjlajlsdfhdfdsadff”,totally 32 bits; NOTES: when vid is not nil,then the server will judge the vid first; while the vid is nil, server can still query or delete the voiceprint model by other params. |
authid: | user id ,can be @“tianxia” or other; |
Declared In
IFlyISVRecognizer.h
Set the voiceprint params
- (BOOL)setParameter:(NSString *)value forKey:(NSString *)key
Parameters
name | desc |
---|---|
value | 参数值 |
key | 参数类型 |
Return Value
设置成功返回YES,失败返回NO
Discussion
key | value |
---|---|
sst | @“train” or @“verify” |
auth_id | @“tianxia” or other |
sub | @“ivp” |
ptxt | |
rgn | @“5” |
pwdt | @“1”,or @“2”, or @“3” |
auf | @“audio/L16;rate=16000” or @“audio/L16;rate=8000” |
vad_enable | @“1” or @“0” |
vad_timeout | @“3000” |
vad_speech_tail | @“100” |
Declared In
IFlyISVRecognizer.h
Get the voiceprint params used the same as function of setParameter
- (NSString *)getParameter:(NSString *)key
Declared In
IFlyISVRecognizer.h
Start recording
- (void)startListening
Declared In
IFlyISVRecognizer.h
Used to query or delete the voiceprint model in server
Stop recording
Declared In
IFlyISVRecognizer.h
Cancel recording,like function stopListening
- (void)cancel
Declared In
IFlyISVRecognizer.h
IFlyIdentityResult Class Reference
Inherits from NSObject
Declared in IFlyIdentityResult.h
身份验证结果类
json字符串格式结果
@property (nonatomic, retain) NSString *result
Declared In
IFlyIdentityResult.h
创建身份验证结果类实例
+ (instancetype)identityResultWithString:(NSString *)jsonString
Parameters
name | desc |
---|---|
jsonString | json字符串 |
Return Value
身份验证结果类实例
Declared In
IFlyIdentityResult.h
返回字典格式的结果
- (NSDictionary *)dictionaryResults
Return Value
字典格式的结果
Declared In
IFlyIdentityResult.h
IFlyIdentityVerifier Class Reference
Inherits from NSObject
Declared in IFlyIdentityVerifier.h
身份验证功能类
设置委托对象
@property (nonatomic, assign) id<IFlyIdentityVerifierDelegate> delegate
Declared In
IFlyIdentityVerifier.h
返回身份验证对象的单例
+ (instancetype)sharedInstance
Return Value
身份验证对象的单例
Declared In
IFlyIdentityVerifier.h
销毁身份验证对象单例。
+ (void)purgeSharedInstance
Parameters
length: the serial number’s length,length of “98765432” is 8,generally length is 8 and other value is forbidden
Return Value
成功返回YES,失败返回NO。
Declared In
IFlyIdentityVerifier.h
设置参数
- (BOOL)setParameter:(NSString *)value forKey:(NSString *)key
Parameters
name | desc |
---|---|
value | 参数值 |
key | 参数名 |
Return Value
设置的参数和取值正确返回YES,失败返回NO
Declared In
IFlyIdentityVerifier.h
开始会话 在这之后会开始各项业务。
- (void)startWorking
Declared In
IFlyIdentityVerifier.h
写入子业务数据、或者进行模型操作、下载密码。
- (void)write:(NSString *)ssub data:(NSData *)data offset:(int)offset length:(int)length withParams:(NSString *)params
Parameters
name | desc |
---|---|
ssub | 子业务名 |
data | 数据 |
offset | 偏移量 |
length | 长度 |
params | 见下表 |
ifr参数 | 描述 |
---|---|
data_format | 数据格式:即图片格式,支持jpg(默认),gif |
data_encoding | 数据压缩编码:即图片压缩编码,支持raw(不压缩,默认值) |
wtt | 等待超时时间: 支持大于0的整数,默认为3000ms |
ivp参数 | 描述 |
rgn | 训练次数:取值2~9.无默认值,必须明确指定。 |
tsd | 声纹确认门限值,验证得分>=tsd验证通过,否则验证失败(该参数目前不支持,作为保留参数。)却只范围:0~100. |
ptxt | 密码文本。从服务端下载,比如数字密码所需要的数字串。 |
pwdt | 密码类型。取值:1(文本密码),2(自由说),3(数字密码). |
fin | 取消注册。取值:0(不取消,即不生效),1(取消本次注册). |
wtt | 等待超时时间:描述客户端等待结果的超时时间. |
vad_enable | VAD功能开关。是否启用VAD处理,取值:1(开启,默认),0(不开启)。 |
vad_bos | 头部静音最大长度。如果静音长度超过此值,则认为用户此次无有效音频输入。 此参数仅在打开VAD功能时生效。(云端暂时没有)。 取值:0~30000ms,默认为10000ms |
vad_eos | 尾部静音长度。如果尾部静音长度超过了此值,则认为音频已经结束。 此参数仅在打开VAD功能时生效。(云端暂时没有)。 取值:0~30000ms,默认为2000ms |
data_encoding | 数据压缩编码,音频压缩编码。 |
data_format | 在声纹业务中为音频采样率,取值:16000(默认),8000 |
ipt参数 | 描述 |
scope | 操作范围 person,group |
group_id | 指定鉴别的组数字或者字符串,唯一值 不为空 |
group_name | 组名称 “”或者不能包含^@,&=*'"等非法字符,且长度不得超过255.此参数可以为空,对于group_name约束不在云端控制,由前段控制 |
topc | 组名称[top candidates],返回得分最高的候选人数目 取值1-5 默认是1.可以开放由用户设置,最大topc值为5 |
Declared In
IFlyIdentityVerifier.h
停止子业务数据写入
- (void)stopWrite:(NSString *)ssub
Parameters
name | desc |
---|---|
ssub | 子业务名:ivp,ifr,ipt |
Declared In
IFlyIdentityVerifier.h
执行模型查询、删除和声纹密码下载等操作 *注意此方法不能与startWorking方法同时使用。
- (void)execute:(NSString *)ssub cmd:(NSString *)cmd params:(NSString *)params
Parameters:
name | desc |
---|---|
ssub | 子业务类型、可选值:ivp(声纹)、ifr(人脸)、ipt(鉴别) |
cmd | 操作命令,可选值:query、delete、download、add |
params | 子业务参数,参见write:data:offset:length:withParams: |
Declared In
IFlyIdentityVerifier.h
取消本次会话
- (void)cancel
Declared In
IFlyIdentityVerifier.h
IFlyVerifierUtil Class Reference
Inherits from NSObject
Declared in IFlyVerifierUtil.h
身份验证工具类
返回定长的随机数字字符串(不包含数字1,而且2和5不邻接)
+ (NSString *)generateNumberPassword:(int)length
Parameters
name | desc |
---|---|
length | 随机字符串长度 |
Return Value
随机字符串
Declared In
IFlyVerifierUtil.h
ARGB彩图转灰度图,Detector和Alignment需要灰度图的输入
+ (UIImage *)ARGBToGray:(UIImage *)sourceImage
Parameters
name | desc |
---|---|
sourceImage | ARGB彩图 |
Return Value
灰度图
Declared In
IFlyVerifierUtil.h
IFlyISVDelegate Protocol Reference
Declared in IFlyISVDelegate.h
声纹回调协议
声纹结果回调
- (void)onResult:(NSDictionary *)dic
Parameters
name | desc |
---|---|
dic | 结果 |
Declared In
IFlyISVDelegate.h
错误码回调
- (void)onCompleted:(IFlySpeechError *)errorCode
Parameters
name | desc |
---|---|
errorCode | 错误码 |
Return Value
灰度图
Declared In
IFlyISVDelegate.h
等待结果
- (void)onRecognition
Declared In
IFlyISVDelegate.h
音量改变回调
- (void)onVolumeChanged:(int)volume
Parameters
name | desc |
---|---|
volume | 音量值 |
Return Value
灰度图
Declared In
IFlyISVDelegate.h
IFlyIdentityVerifierDelegate Protocol Reference
Conforms to NSObject
Declared in IFlyIdentityVerifierDelegate.h
身份验证功能类回调
错误回调
- (void)onCompleted:(IFlySpeechError *)error
Parameters
name | desc |
---|---|
error | 错误描述类 |
Declared In
IFlyIdentityVerifierDelegate.h
结果回调
- (void)onResults:(IFlyIdentityResult *)results isLast:(BOOL)isLast
Parameters
name | desc |
---|---|
results | -[out] 结果。 |
isLast | -[out] 是否最后一条结果 |
Declared In
IFlyIdentityVerifierDelegate.h
扩展接口,用于抛出音量和vad_eos消息
- (void)onEvent:(int)eventType arg1:(int)arg1 arg2:(int)arg2 extra:(id)obj
Parameters
name | desc |
---|---|
eventType | 消息类型 |
arg1 | eventType为 Event_volume 时 arg1为音量值 |
arg2 | 参数2 |
obj | 扩展参数 |
Declared In:
IFlyIdentityVerifierDelegate.h