Home › Forums › OpenEars › pocketsphinxDidReceiveHypothesis not called on device – no problem in simulator
- This topic has 5 replies, 2 voices, and was last updated 7 years, 6 months ago by Halle Winkler.
-
AuthorPosts
-
May 24, 2016 at 3:00 pm #1030382RVParticipant
Hi,
I have implemented the OpenEars offline speech recognition in my app. Everything is working fine in the simulator.
However, when testing on the device “pocketsphinxDidReceiveHypothesis” is never called.
“pocketsphinxDidStartListening” and “pocketsphinxDidDetectSpeech” does get called.I have followed the tutorial to the letter. The sample project is working as intended on simulator and device, so I have no idea what’s wrong.
OEPocketsphinxController is not throwing an error either.
@interface BaseViewController () <OEEventsObserverDelegate>
- (void)viewDidLoad { [super viewDidLoad]; [self pocketSphinxSetup]; }
- (void)pocketSphinxSetup { self.openEarsEventsObserver = [[OEEventsObserver alloc] init]; [self.openEarsEventsObserver setDelegate:self]; OELanguageModelGenerator *lmGenerator = [[OELanguageModelGenerator alloc] init]; NSArray *words = @[ @"CHEER", @"THANKS", @"THANK YOU", @"CONTINUE", @"END" ]; NSString *name = @"voice"; NSError *err = [lmGenerator generateLanguageModelFromArray:words withFilesNamed:name forAcousticModelAtPath:[OEAcousticModel pathToModel:@"AcousticModelEnglish"]]; NSString *lmPath = nil; NSString *dicPath = nil; if(err == nil) { lmPath = [lmGenerator pathToSuccessfullyGeneratedLanguageModelWithRequestedName:name]; dicPath = [lmGenerator pathToSuccessfullyGeneratedDictionaryWithRequestedName:name]; } else { NSLog(@"Error: %@",[err localizedDescription]); } [[OEPocketsphinxController sharedInstance] setActive:TRUE error:nil]; [[OEPocketsphinxController sharedInstance] setVadThreshold:3]; [[OEPocketsphinxController sharedInstance] startListeningWithLanguageModelAtPath:lmPath dictionaryAtPath:dicPath acousticModelAtPath:[OEAcousticModel pathToModel:@"AcousticModelEnglish"] languageModelIsJSGF:NO]; }
May 24, 2016 at 3:03 pm #1030383Halle WinklerPolitepixWelcome,
Please check out the post Please read before you post – how to troubleshoot and provide logging info here so you can see how to turn on and share the logging that provides troubleshooting information for this kind of issue.
May 24, 2016 at 3:20 pm #1030384RVParticipantThanks.
I didn’t see anything in the logging but that’s because I was using
[OEPocketsphinxController sharedInstance].verbosePocketSphinx = TRUE;
instead of[OELogging startOpenEarsLogging]
, oops.This is the log from OELogging:
http://pastebin.com/Jtk28Sbr
I guess it has something to do with AVAudioSession, no?Version is 2.501 on iPhone 6, 6+ and iPad Mini, all running 9.3.
May 24, 2016 at 3:42 pm #1030386Halle WinklerPolitepixHi,
Thanks, it would be helpful to post the logs directly here so I can correlate them to other similar issues and easily link to them in my tickets. That logging output means that some other app or other part of your app is changing the audio category to a playback-only category while the OpenEars code the logging shows execution of was in progress. You can diagnose the origin of the other calls to change the audio session category by searching for non-OpenEars invocations to the audio session. They don’t originate with OpenEars.
May 24, 2016 at 3:53 pm #1030387RVParticipantThat was the problem indeed, I had to set
[[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayAndRecord error:&setCategoryErr];
Thanks again!
May 24, 2016 at 3:56 pm #1030388Halle WinklerPolitepixSure thing! OpenEars sets its own audio session settings so most of the time if you find yourself setting audio session settings in your app or letting another part of your app set them, it is likely to cause an issue.
-
AuthorPosts
- You must be logged in to reply to this topic.