0

I am making an voice recognition application which recognize my voice in the absence of network for this I am using OpenEars sdk. I have taken a sample code of it and I have made a similar app of sample code but in my code my openearsEventDelegate methods are not call. I have adopt the protocol <openEarsEventObserverDelegate> and in my viewDidLoad method I have set openEarseventObserver.delegate=self.

Please guide me if I am missing something. Thank you.

Krishnachandra Sharma
  • 1,332
  • 2
  • 20
  • 42
  • This link might get you started: [Delegate Methods not being called](http://www.politepix.com/forums/topic/delegate-methods-not-being-called) – Jeremy Feb 07 '13 at 12:02
  • Is there any warning or something ? Did you add the confirm to protocol syntax on .h ? Also check you are setting the delegate to self. – Midhun MP Feb 07 '13 at 12:04
  • 2
    Just follow the tutorial at http://www.politepix.com/openears/tutorial in order to create your own app. It covers how to connect the OpenEarsEventsObserver delegate in copy/paste-able form. – Halle Feb 08 '13 at 08:18
  • 1
    Jeremy, that link was to a discussion that didn't apply to 1.x versions of OpenEars so I archived the discussion and it won't be available there anymore (it would unfortunately give the impression that there are multiple steps to follow when setting the OpenEarsEventsObserver delegate should be like setting any other delegate). – Halle Feb 08 '13 at 08:21
  • 1
    BTW, the protocol is OpenEarsEventsObserverDelegate so the issue might be the lowercase 'o' in your declaration. – Halle Feb 08 '13 at 20:10

2 Answers2

1

Without more code it's hard to say exactly what your problem is, but here are a few things I would try:

Ensure your OpenEarsEventObserver object is not nil when you set the delegate:

        OpenEarsEventsObserver* openEarsEventsObserver = [[OpenEarsEventsObserver alloc] init];
        [openEarsEventsObserver setDelegate:self];

Make sure your pocketsphinxController is not nil and that you have correctly started listening, for this I use lazy instantiation:

   - (PocketsphinxController *)pocketsphinxController {
      if (_pocketsphinxController == nil) {
          _pocketsphinxController = [[PocketsphinxController alloc] init];
          }
     return _pocketsphinxController;
    }

Then when you would like to start recognizing speech use:

      [self.pocketsphinxController startListeningWithLanguageModelAtPath:<#(NSString *)#> dictionaryAtPath:<#(NSString *)#> acousticModelAtPath:<#(NSString *)#> languageModelIsJSGF:<#(BOOL)#>];
     // Change "AcousticModelEnglish" to "AcousticModelSpanish" to perform Spanish recognition instead of English.

All of this info can be found at: OpenEars Tutorials

mdewitt
  • 762
  • 6
  • 13
0

I had the same problem. When I tried to set the delegate before starting listening self.openEarsEventsObserver was nil so you can simply check if it's nil before starting listening and then set a new OpenEarsEventsObserver instance to your property. It was a quick fix for me.

ayberkt
  • 105
  • 1
  • 5