Reply To: RapidEars 2.04 – crash when using within Cocos2d

Home Forums OpenEars plugins RapidEars 2.04 – crash when using within Cocos2d Reply To: RapidEars 2.04 – crash when using within Cocos2d

#1026474
anhtu
Participant

I’m using the default “AcousticModelEnglish.bundle” in OpenEars package.
I want the app can recognize letters A-Z.
The crash appears event if I keep “LanguageModelGeneratorLookupList.text” in the default or just keep A-Z.

NSString *name = [NSString stringWithFormat:@"lession_vocal_%@_%d",
                  [[QuestionManager sharedManager] getWordAtIndex:[index intValue]], [index intValue]];

NSError *error = nil;
NSString * curLetter = [[QuestionManager sharedManager] getWordAtIndex:[index intValue]];
arrWords = @[curLetter];

if(![GlobalData sharedInstance].isRejectoON){

  error = [_languageModelGenerator generateLanguageModelFromArray:arrWords
                                                   withFilesNamed:name
                                           forAcousticModelAtPath:[OEAcousticModel pathToModel:@"AcousticModelEnglish"]];
  
}else{
  error = [_languageModelGenerator generateRejectingLanguageModelFromArray:arrWords
                                                            withFilesNamed:name
                                                    withOptionalExclusions:[GlobalData sharedInstance].optionalExclusion
                                                           usingVowelsOnly:[GlobalData sharedInstance].usingVowelsOnly
                                                                withWeight:[NSNumber numberWithFloat: [GlobalData sharedInstance].weight_rejecto]
                                                    forAcousticModelAtPath:[OEAcousticModel pathToModel:@"AcousticModelEnglish"]];
}

lmPath = nil;
dicPath = nil;

if(error != noErr) {
  NSLog(@"Dynamic language generator reported error %@", [error description]);
} else {
  dicPath = [_languageModelGenerator pathToSuccessfullyGeneratedDictionaryWithRequestedName:name];
  lmPath = [_languageModelGenerator pathToSuccessfullyGeneratedLanguageModelWithRequestedName:name];
}

  [openEarsEventsObserver setDelegate:self];
  //call before set properties
  [pocketsphinxController setActive:TRUE error:nil];
  [pocketsphinxController setRapidEarsToVerbose:YES];
  [pocketsphinxController setFinalizeHypothesis:NO];
  [pocketsphinxController setReturnDuplicatePartials:false];
  [pocketsphinxController setReturnNullHypotheses:false];
  [pocketsphinxController setSecondsOfSilenceToDetect:0.2];
  [OELogging startOpenEarsLogging];
  
    if(!pocketsphinxController.isListening) {
      [pocketsphinxController startRealtimeListeningWithLanguageModelAtPath:lmPath dictionaryAtPath:dicPath acousticModelAtPath:[OEAcousticModel pathToModel:@"AcousticModelEnglish"]];
    }else{
      
      [pocketsphinxController changeLanguageModelToFile:lmPath withDictionary:dicPath];
      if (pocketsphinxController.isSuspended) {
        [pocketsphinxController resumeRecognition];
      }
    }

The crash occurs rarely randomly and so weird. Because it doesn’t appear if I turn on Rejecto (using Rejecto)

The crash occurs on RapidEars 2.03 also.