Answer the question
In order to leave comments, you need to log in
Difficulties with Yandex SpeechKit voice activation?
Good afternoon.
As a hobby, I am developing a robot controlled via WiFi with an iOS application (iPad iOS 8.1).
Having learned that Yandex has developed speech technologies and offers libraries for iOS (SpeechKit), I decided to attach control of fixed voice commands (voice activation). I received an API key, a model of several voice commands, and advice from Yandex SpeechKit API support specialists on how to solve my simple task. I must say right away that I am by no means an expert in programming in XCode (ver. 6.2) for iOS.
Wrote, took into account all the advice (including those that are not in the documentation: setting the -ObjC flag in Project->Build Settings-> Linking->Other Linker Flags). Doesn't recognize! Does not recognize neither in iOSimulator'e, nor on iPad'e (control is not transferred to phraseSpotterDidSpotPhrase). I sent my entire XCod project to the Yandex SpeechKit API support service - it recognizes them!
Here is my code (errorView, ypsStatus, resultView are UI TextFields; the voice model files are in the activation folder; the microphone works on a Mac, the microphone on an iPad works and is available to the application; the project file structure is attached). We exchanged a bunch of letters with the Yandex SpeechKit API support service - no result. They kind of backed off.
// ViewController.m
#import "ViewController.h"
#import <YandexSpeechKit/SpeechKit.h>
#import <YandexSpeechKit/YSKPhraseSpotter.h>
#import <YandexSpeechKit/YSKPhraseSpotterDelegate.h>
@interface ViewController () <YSKPhraseSpotterDelegate>
@end
@implementation ViewController
- (void)viewDidLoad
{ [super viewDidLoad];
// привязка к API-ключу
[[YSKSpeechKit sharedInstance] configureWithAPIKey:@"8d67e88f-……4ca78beb7b30"];
// инициализация YSKPhraseSpotter
NSString *resourcePath = [[NSBundle mainBundle] resourcePath];
NSString *modelPath = [resourcePath stringByAppendingPathComponent:@"activation"];
NSError *error1 = [YSKPhraseSpotter initializeWithConfigDirectory:modelPath andDelegate:self];
if ([error1 code]) [self.errorView setText:@"error1"];
// запуск YSKPhraseSpotter
NSError *error2 = [YSKPhraseSpotter start];
if ([error2 code]) [self.errorView setText:@"error2"];
// проверка активности YSKPhraseSpotter
if ([YSKPhraseSpotter isRunning] ) {[self.ypsStatus setText:@" активирован"];}
else {[self.ypsStatus setText:@"неактивирован!!!"];}
}
- (void)didReceiveMemoryWarning {[super didReceiveMemoryWarning];}
- (void)phraseSpotterDidSpotPhrase:(NSString *)phrase withIndex:(int)phraseIndex
{ // если хоть что-то узнал
[self.resultView setText:@"YPS uznal"]; }
@end
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question