OpenEars suspendRecognition not working in ViewDidAppear

Home Forums OpenEars OpenEars suspendRecognition not working in ViewDidAppear

Viewing 12 posts - 1 through 12 (of 12 total)

  • Author
  • #1020519

    I am using OpenEars framework for speech recognition.

    In my viewdidload method i am calling

    [self.pocketsphinxController startListeningWithLanguageModelAtPath:lmPath dictionaryAtPath:dicPath acousticModelAtPath:[AcousticModel pathToModel:@”AcousticModelEnglish”] languageModelIsJSGF:NO]; // Change “AcousticModelEnglish” to “AcousticModelSpanish” to perform Spanish recognition instead of English.

    Now i want to suspend it viewdidapper method so i place a method call

    [self.pocketsphinxController suspendRecognition];

    But still the recognition is not suspended, i placed a button on my VC and in function of that button is only to suspend the recognition and its working there with button but not with view did appear method.

    Can anyone suggest the probable reason ?

    Thanks in advance .

    Halle Winkler


    Calls to suspend are ignored when listening isn’t in progress (you can probably see this explanation for why your call is being ignored if you turn on OpenEarsLogging). Listening won’t be in progress there because the call to suspend is coming milliseconds after the call to startListening and the listening startup takes a few seconds. You might have better luck if you put the call to suspend in your OpenEarsEventsObserver callback indicating that listening has begun.


    Basically i was trying to find a way that if the device is speaking then it should stop listening and once the speech of device is complete then it should start listening , Logic i applied in view did appear is:

    [self.pocketsphinxController suspendRecognition];
    [self.fliteController say:message withVoice:self.slt];
    [self.pocketsphinxController resumeRecognition];

    i want my app should say welcome to the user and then ask the user do you want to continue say YES or NO ?

    and then it should resume listening .

    kindly help me with this logic.

    Halle Winkler

    That is done automatically by FliteController.


    In my case i have put a statement in view did appear that will ask a question to user in YES/NO
    at this scenario the listening should be suspended but the logs says that device is listening something and it takes words as input from the text what it is speaking , so i want to separate the device speech and user’s speech .

    A snippet will be helpful :)

    Halle Winkler

    The device speech causes listening for speech to be suspended so you don’t have to worry about having a secondary UI to manage it. You can see this working in the sample app (also a great source of snippets).


    Hey still issue persist i have uploaded my source code which i am trying .

    Check the logs once the view appear it ask the user for YES/NO and this is being processed as a speech text and taken as input.

    Please check the source code on this link:

    Halle Winkler

    Sorry, I can only look at very small source excerpts that can be put in this forum. Just check out the sample app, which performs this precise function of not performing recognition when speaking using FliteController by default. It’s only necessary to compare your implementation with the implementation there.


    Thanks for the help ,

    I need to use this function rather place voice data in in view did appear for the welcome speech:

    – (void) pocketsphinxDidCompleteCalibration {
    NSLog(@”Pocketsphinx calibration is complete.”);
    [self instructUser:@”Do you want to read the NEWS , say YES or NO ?”];


    Halle Winkler

    Try not starting FliteController speech until speech recognition has started (using pocketsphinxDidStartListening instead of pocketsphinxDidCompleteCalibration).


    Yup this was the issue , thanks for your suggestion and time.


    Halle Winkler

    Glad to help!

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.