Reply To: Delay pocketsphinxDidDetectSpeech

Home Forums OpenEars Delay pocketsphinxDidDetectSpeech Reply To: Delay pocketsphinxDidDetectSpeech

#15079
kelvin
Participant

I have tried suspending the recognition after flite finished speaking and after a delay of 5 seconds before playing a sound file but it seems that pocketsphinx did detect the sound file which is not what i wanted. Following are my functions for your reference.

– (void) fliteDidFinishSpeaking {
[self.pocketsphinxController suspendRecognition];
[self performSelector:@selector(playAudioAlert:) withObject:nil afterDelay:5.0f];
}

-(void) playAudioAlert{
self.player = [[AVAudioPlayer alloc] initWithContentsOfURL:
[NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:@”Audio1″ ofType:@”wav”]] error:nil];

player.delegate = self;
[self.player play];
}

-(void) audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag{
if(flag == YES){
[self.pocketsphinxController resumeRecognition];
}
}