IFlyISVRecognizer.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. //
  2. // IFlyISVRecognizer.h
  3. // ISV
  4. //
  5. // Created by wangdan on 14-9-6.
  6. // Copyright (c) 2014年 IFlyTEK. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import "IFlyISVDelegate.h"
  10. /**
  11. * 声纹接口类
  12. */
  13. @interface IFlyISVRecognizer : NSObject
  14. {
  15. }
  16. @property (assign) id<IFlyISVDelegate> delegate;
  17. /*
  18. * FlyISVRecognizer is a kind of Singleton calss
  19. * the function can be used as below:
  20. IFLyISVRecognizer *recognizer=[IFlyISVRecognizer creteRecognizer: self];
  21. */
  22. +(instancetype) sharedInstance;
  23. /*
  24. * genrerate a serial number password
  25. * princeple:
  26. 1.number serial has no 1 in itself;
  27. 2.the nuber serial has no same number("98765432"is right while "99876543" is wrong)
  28. * @length: the serial number's length,length of "98765432" is 8,
  29. generally length is 8 and other value is forbidden
  30. */
  31. -(NSString*) generatePassword:(int)length;
  32. /*
  33. * Used to get password from server
  34. * @pwdt:
  35. when pwdt is 1,the function will return chinese text;
  36. while pwdt is 2, the funciton will return number serial
  37. */
  38. -(NSArray*) getPasswordList:(int)pwdt;
  39. /*
  40. * Used to judge if the engine is running in listenning
  41. * return value:
  42. YES: the engine is listenning;
  43. No : the engine is not listenning
  44. */
  45. -(BOOL) isListening;
  46. /*
  47. * Used to query or delete the voiceprint model in server
  48. * @cmd:
  49. "del": delete model
  50. "que": query model
  51. * @authid: user id ,can be @"tianxia" or other;
  52. * @pwdt: voiceprint type
  53. 1: fixed txt voiceprint code ,like @"我的地盘我做主"
  54. 2: free voiceprint code , user can speek anything,but 5 times
  55. trainning the speech shall be same
  56. 3: number serial voiceprint code ,like @"98765432" and so on
  57. * @ptxt: voiceprint txt,only fixed voiceprint and number serial have this,
  58. in free voiceprint model this param shall be set nil
  59. * @vid: another voiceprint type model,user can use this to query or delete
  60. model in server can be @"jakillasdfasdjjjlajlsdfhdfdsadff",totally 32 bits;
  61. * NOTES:
  62. when vid is not nil,then the server will judge the vid first
  63. while the vid is nil, server can still query or delete the voiceprint model
  64. by other params
  65. */
  66. -(BOOL) sendRequest:(NSString*)cmd authid:(NSString *)auth_id pwdt:(int)pwdt ptxt:(NSString *)ptxt vid:(NSString *)vid err:(int *)err;
  67. /*
  68. * set the voiceprint params
  69. * @"sst" : @"train" or @"verify"
  70. * @"auth_id" : @"tianxia" or ther
  71. * @"sub" : @"ivp"
  72. * @"ptxt" :
  73. * @"rgn" : @"5"
  74. * @"pwdt" : @"1",or @"2", or @"3"
  75. * @"auf" : @"audio/L16;rate=16000" or @"audio/L16;rate=8000"
  76. * @"vad_enable : @"1" or @"0"
  77. * @"vad_timeout" : @"3000"
  78. * @"vad_speech_tail": @"100"
  79. */
  80. -(BOOL) setParameter:(NSString *)value forKey:(NSString *)key;
  81. /*
  82. * get the voiceprint params
  83. * used the same as function of setParameter
  84. */
  85. -(NSString*) getParameter:(NSString *)key;
  86. /*
  87. * start recording
  88. */
  89. -(void) startListening;
  90. /*
  91. * stop recording
  92. */
  93. -(void) stopListening;
  94. /*
  95. * cancel recording,like function stopListening
  96. */
  97. -(void) cancel; /* cancel recognization */
  98. @end