davestrand

Forum Replies Created

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

  • Author
    Posts
  • in reply to: stopListening hangs using iOS9 #1031461
    davestrand
    Participant

    Hi, I too was noticing the 10 second delay in my App but after your latest update that issue is resolved. However now I am noticing some other strange issues, and was wondering if you could check to see if your 2.504 version experiences anything like it. Keep in mind that I haven’t touched this application in a while, until the error with the 10 second delay, so these issues could be related to new iOS releases and not OpenEars.

    1.) My application uses background audio which allows it to play when minimized or screen dimmed. Now, if I minimize my application and try to play video or audio from a different application, it used to stop my App audio playback and switch over to their application. Now certain applications, like playing a regular recorded Video inside of the default Photos application on iPhone will not work at all. The play button does not function. Curiously, the only way for me to get the Photos application working again is to launch Pandora, which seems to wake up the audio/video processes again. If I then go back to my OpenEars enabled app, play audio, and minimize, the same playback issue is replicated. Could certainly be a problem with how I am handling background services, but I thought I’d ask and see if you are noticing anything similar in your latest version.

    2.) My Apps audio playback will be silent after stopListen unless I pause, clear queue, add audio, then pause it again, then try audio playback again. It’s very strange.. I wrote this code a long time ago, and it’s messy, so it could easily be a bug in my logic which I am looking into. This is probably my problem, not yours, but I thought I’d mention it just in case.

    My Application is a choose your own adventure audio book. So it plays an mp3, waits for you to respond with a voice command, and then plays the next section.

    in reply to: Bluetooth Remote Control Ver 2.0.3 #1025556
    davestrand
    Participant

    So, one last question before I continue… Below I have a screenshot from my app with the remote control functions. Put simply the Pause never changes to a Play button when the OEPocketsphinxController starts listening. What I am noticing is that when I remove the startListening and insert a bit of code it works again… Is this an audio coexistence problem too?

    I remove this…
    [[OEPocketsphinxController sharedInstance] startListeningWithLanguageModelAtPath:self.lmPath dictionaryAtPath:self.dicPath acousticModelAtPath:[OEAcousticModel pathToModel:@"AcousticModelEnglish"] languageModelIsJSGF:FALSE]; // this start listen specifically messes up the bluetooth control.

    and insert this… and Pause/Play works again.

    NSError *error = nil;
                    
                    AVAudioSession *aSession = [AVAudioSession sharedInstance];
                    [aSession setCategory:AVAudioSessionCategoryPlayAndRecord
                              withOptions:AVAudioSessionCategoryOptionAllowBluetooth
                                    error:&error];
                    [aSession setMode:AVAudioSessionModeDefault error:&error];
                    [aSession setActive: YES error: &error];

    Quick Remote Control IOS

    in reply to: Bluetooth Remote Control Ver 2.0.3 #1025542
    davestrand
    Participant

    I see. I’ll continue to search around the forums in regards to “Audio Coexistence”. Perhaps this thread will be of assistance.

    in reply to: Bluetooth Remote Control Ver 2.0.3 #1025540
    davestrand
    Participant

    Yes,

    I am trying to allow remote control events from bluetooth headsets. On many bluetooth headsets there is a button which normally allows the user to pause/play rewind/fast forward. My app plays mp3s, and then listens for audio commands. Until OpenEars starts listening these remote controls still work. Once OpenEars starts listening the audio switches into a different mode where these controls are disabled and audio quality is reduced. Perhaps this is just a limitation of the ‘mode’.

    in reply to: Bluetooth Audio Quality / Stop Listen Option #1025404
    davestrand
    Participant

    Okay thanks. Yeah, it turns out that my issues are more in regards to gracefully handling interruptions to audio playback. Apparently if the bluetooth re-dials and launches into a phone call, when it returns to my App the audio playback stops working. Probably not an OpenEars thing at all, but thanks for the hasty reply… and the new version of the speech recognition is great.

    in reply to: pathToTestFile vs runRecognitionOnWave #1024012
    davestrand
    Participant

    p.s. I did read the text below quite a few times… but I can’t seem to get the audio file to trigger the recognition.

    In contrast with using the method runRecognitionOnWavFileAtPath to receive a single recognition from a file, with this approach the audio file will have its buffers injected directly into the audio driver circular buffer for maximum fidelity to the goal of testing the entire codebase that is in use when doing a live recognition, including the whole driver and the listening loop including all of its features. This is for creating tests for yourself and for sharing automatically replicable issue reports with Politepix.

    in reply to: [Resolved] No recognition #1024009
    davestrand
    Participant

    That’s pretty fast. I’ll experiment with starting the listen right when it’s needed. Thanks, the voice recognition does seem to be much more responsive and forgiving with 2.0. Great job.

    in reply to: [Resolved] No recognition #1024005
    davestrand
    Participant

    Well, when the view loads there is audio (mp3) almost instantly playing. I don’t want the device to use voice recognition on any (mp3) audio it happens to hear at that point. I could delay the startListen until the first time it is needed, but that would mean that the first time using the voice recognition it may not start working until the loop has begun. Hence a small delay the first time it fires up. It’s a minor detail, but I wouldn’t want to give a bad first impression.

    in reply to: [Resolved] No recognition #1024001
    davestrand
    Participant

    Would it be safe to begin to suspend and resume listening after the recognition loop has begun. I mean, is that the proper timing needed before starting any suspended listening?

    in reply to: [Resolved] No recognition #1024000
    davestrand
    Participant

    Ok great. Thank you.

    in reply to: [Resolved] No recognition #1023998
    davestrand
    Participant

    So, you are saying that we should no longer use suspend or resume? I looked in the sample app to see how those situations should be handled and I found [[OEPocketsphinxController sharedInstance] suspendRecognition]; and [[OEPocketsphinxController sharedInstance] resumeRecognition];

    Still, I have since removed suspend and resume in my app in favor of startListeningWithLanguageModelAtPath and stopListening, however I do find there seemed to be quicker response time with the suspend and resume function. The start listening seems to take about a second to actually start the listening loop… which is pretty fast, but not as fast as it used to be..

    My app does a lot of switching back and forth between playing audio and expecting voice commands.

    Any suggestions?

    in reply to: Audio playback bit rate reduction during #1023086
    davestrand
    Participant

    Thanks, I’ll keep looking.

    in reply to: Stop/Start Listening or Speech Recognition Suspended? #1021554
    davestrand
    Participant

    Ok. I’ll look over that, and see what I find. Thanks!

    in reply to: Stop/Start Listening or Speech Recognition Suspended? #1021552
    davestrand
    Participant

    Ok. I tried using the suspendRecognition but it didn’t seem to work.. I’ll poke around and try and figure out what is triggering it to resume before I say to.

    in reply to: Stop/Start Listening or Speech Recognition Suspended? #1021551
    davestrand
    Participant

    *correction ‘I’m calling stopListening when the MP3 starts and *startListening to happen when the MP3 is done playing’

    davestrand
    Participant

    Removing the commas made the voice recognition work a million times better. Thank you so much! The commas were in there for the visual element of the app, I didn’t know they would impact the speech recognition. I will also look into the “NO YES” stuff as well. :) Thanks a million!

    davestrand
    Participant

    Sounds like a plan. I think we will find out that even the slower vocabulary transitions have some kind of error. You are correct, there are three files created, the arpa, dic, and DMP. I’m not too sure how to inspect them, so I have uploaded them to a folder for you to scope out.

    In this scenario, I am trying to say the word NO, but it always thinks I am saying YES. No means no, right?

    Here are the files:
    http://secret.strandland.com/halle/

    and..
    Users/davelevy/Library/Application Support/iPhone Simulator/7.1-64/Applications/E3667FB5-52D3-4F18-9C54-D9ED81BB304C/Library/Caches/JxCJL6ji2xJYlBdpWhFI.DMP and the following dictionary: /Users/davelevy/Library/Application Support/iPhone Simulator/7.1-64/Applications/E3667FB5-52D3-4F18-9C54-D9ED81BB304C/Library/Caches/JxCJL6ji2xJYlBdpWhFI.dic

    in reply to: Updating Version of OpenEars #1021439
    davestrand
    Participant

    It said 1.7.. (not 1.71) but seems to be working well thanks for the excellent instructions.

    in reply to: Updating Version of OpenEars #1021437
    davestrand
    Participant

    Oh, yep. Activating the OpenEarsLogging showed me that I am using version 1.64.

    in reply to: hypothesis for multiple string match #1019804
    davestrand
    Participant

    I ultimately modified your solution to be more generic using some ideas here.

    Thanks again, if you take tips email me a paypal address. You helped me out a bunch with this.

    in reply to: hypothesis for multiple string match #1019801
    davestrand
    Participant

    Sweet nectar of the Gods! Thank you so much, that totally makes sense now.

    I was kind of close with a couple attempts yesterday, I forgot to BREAK out of the For loop. :)

    in reply to: hypothesis for multiple string match #1019794
    davestrand
    Participant

    Okee dokes, hello again. My beer function helped me sleep on it, but I’m still missing something. Here’s some of my code I’m working on.

      objectsInRoom = [playerIsNowAt objectForKey:@"ObjectsInLocation"]; //Bringing objects based on location
    
    NSLog(@"Here are objects in room - %@", objectsInRoom); //logged below
    
        //Failed experiments
        //NSArray *objectWords = [objectsInRoom allKeys];
        //NSString *objectString = [NSString stringWithFormat:@"%@",objectWords];
        //NSArray *spokenWords = [hypothesis componentsSeparatedByString:@" "];
        //NSString *spokenString = [NSString stringWithFormat:@"%@",spokenWords];
       //if([hypothesis isEqualToString:@"BEER"]) { //only works if they just say BEER 
        
        
        if ([hypothesis rangeOfString:@"BEER"].location != NSNotFound){ // ok but how do i make it search thru allkeys for my dictionary??  maybe the next room has WINE or MIMOSA.
            
            NSLog(@"HOPE KEPT ALIVE");
            
        }

    THE LOG :
    Here are objects in room – {
    BEER = Beer;
    PEANUTS = Peanuts;
    READ = Menu;
    }

    So, as you see I can seem to pull single words in using Range, but am stuck on returning a value based on the dictionary.

    Other related code.. in .h
    @property (copy, nonatomic) NSDictionary *objectsInRoom;

    in .m
    @synthesize objectsInRoom; //hm, I think i’m supposed to not synthesize these days and use that underscore thingy?

    I’ve only been coding for a few months, so understanding is appreciated.

    in reply to: hypothesis for multiple string match #1019793
    davestrand
    Participant

    Thanks! My code is a mess right now, I’ll put together my best effort and then post back. I am learning about componentSeparatedByString now. I was not familiar with that, thanks!

    in reply to: No google juice on NBest #1019786
    davestrand
    Participant

    Ah, ok thanks. :)

    in reply to: Change vocabulary array on the fly? #1019437
    davestrand
    Participant

    One last question.. once it’s up and running, based on the need to create random file names, won’t that be generating a lot of .dic and associated files? Do you think it necessary that I programmatically remove those files and clear the cache?

    in reply to: Change vocabulary array on the fly? #1019431
    davestrand
    Participant

    Of course, you are right. :) I will work through the sample app and streamline my app.
    Thank you for your time.

    in reply to: Change vocabulary array on the fly? #1019428
    davestrand
    Participant

    Sorry, here’s from the initial setup..

        //[OpenEarsLogging startOpenEarsLogging]; // Uncomment me for OpenEarsLogging
        
    	[self.openEarsEventsObserver setDelegate:self];
        
        // This is the language model we're going to start up with.
        
    #pragma mark STARTING LANGUAGE
    
        
    	self.pathToGrammarToStartAppWith = [NSString stringWithFormat:@"%@/%@",[[NSBundle mainBundle] resourcePath], @"OpenEars1.languagemodel"];
        
    	self.pathToDictionaryToStartAppWith = [NSString stringWithFormat:@"%@/%@",[[NSBundle mainBundle] resourcePath], @"OpenEars1.dic"];
        
    	self.usingStartLanguageModel = TRUE;
         
    
    	
    #pragma mark CUSTOM LANGUAGE
        
        [self reLoadLanguageBasedOnNewVariables]; //----DL ADDED TO TRY AND PULL LOCATION INFO FROM FUNCTION
        
        [self startListening]; //--- DL ADDED THIS FROM ABOVE
        
    	[self startDisplayingLevels];
        
    	// Here is some UI stuff that has nothing specifically to do with OpenEars implementation
    	self.startButton.hidden = TRUE;
    	self.stopButton.hidden = TRUE;
    	self.suspendListeningButton.hidden = TRUE;
    	self.resumeListeningButton.hidden = TRUE;
        
        
        
    
        
        
        
        
        //DL EXPERIMENTS BELOW//
        
       
        [self.pocketsphinxController changeLanguageModelToFile:self.pathToDynamicallyGeneratedGrammar withDictionary:self.pathToDynamicallyGeneratedDictionary]; //I'M FORCING IT into our VoiceGameCorpus.txt..  eventually simplify startup language, or learn how to switch based on city/location.
        self.usingStartLanguageModel = FALSE;
        
        
       
    
        
    
        
       
    }
    in reply to: Change vocabulary array on the fly? #1019426
    davestrand
    Participant

    Yeah, ‘busted’.. I was being lazy and couldn’t suss out how to keep all the other functionality of your “Change Model” example, so I forced it to “Change Model” early on. I don’t think it ever changes back after that first change command.

    I’ll buckle down and try and streamline the integration by defaulting to the correct vocabulary. It’s a bit (lot) over my head, but I like to learn.

    The last bit of code that may pertain is located in pocketsphinxDidReceiveHypothesis… which among other things has this inside.

    [self reLoadLanguageBasedOnNewVariables];

    in reply to: Change vocabulary array on the fly? #1019424
    davestrand
    Participant

    Sure thing.. thank you SOO much for taking the time.

    - (void) startListening {
        
        [self.pocketsphinxController startListeningWithLanguageModelAtPath:self.pathToGrammarToStartAppWith dictionaryAtPath:self.pathToDictionaryToStartAppWith acousticModelAtPath:[AcousticModel pathToModel:@"AcousticModelEnglish"] languageModelIsJSGF:FALSE];
        
    }
    

    and in viewDidLoad..

      [self startListening];
    

    ` [self.pocketsphinxController changeLanguageModelToFile:self.pathToDynamicallyGeneratedGrammar withDictionary:self.pathToDynamicallyGeneratedDictionary]; //I’M FORCING IT into our VoiceGameCorpus.txt.. eventually simplify startup language, or learn how to switch based on city/location.
    self.usingStartLanguageModel = FALSE;`

    in reply to: Change vocabulary array on the fly? #1019422
    davestrand
    Participant

    So, I did get a random name generating.. I was able to confirm it’s functionality because I located the Cache folder and saw the three files being created… When I opened the .dic file I saw the appropriate Words. I think I’m still missing a piece of code that loads this new dictionary into use and turns it on. I posted my code in the thread above. Do you see anything terribly wrong or missing? Something special must happen at the viewDidLoad, because it starts up ok, but then never changes.

    in reply to: Change vocabulary array on the fly? #1019420
    davestrand
    Participant

    Sorry to keep posting.. it looks like my tests might have been inconclusive. Looks like I call the function once when the app starts, so the filename wasn’t a new one. I’m not entirely sure how to rotate and then call upon a filename.. Trying to learn up on that now.

    in reply to: Change vocabulary array on the fly? #1019418
    davestrand
    Participant

    Hm.. I am not noticing any difference if I change the name.. Are you referring to the LanguageModelGenerator *languageModelGenerator and the NSArray *languageArray names? I tried changing those as well as many of the other *names, and the NSString *name = @”VoiceGameModelFiles1 <– “; Figured they might at least work once, if the name needs to rotate.

    in reply to: Change vocabulary array on the fly? #1019417
    davestrand
    Participant

    Hm. I’ll give that a shot and see what happens, thanks!

    in reply to: Change vocabulary array on the fly? #1019414
    davestrand
    Participant

    Here’s the function to attempt to reload based on plist data..

    
    - (void) reLoadLanguageBasedOnNewVariables {
        
        LanguageModelGenerator *languageModelGenerator = [[LanguageModelGenerator alloc] init];
     
        
        NSArray *languageArray = [[NSArray alloc] initWithArray:[NSArray arrayWithObjects: // All capital letters.
                                                                 
                                                                 
                                                            
                                                                 @"YES",
                                                                 @"NO",
                                                                 @"MAYBE",
                                                           
                                                                 @"DIAPER",
                                                                 
                                                                 
                                                                
                                                                 @"%@",[NSString stringWithFormat:@"%@", [playerIsNowAt valueForKey:@"ObjectsInLocation"]],
                                                                 
                                                                 nil]];
        
        NSLog(@"Checking the objects in the room are correct %@", [playerIsNowAt valueForKey:@"ObjectsInLocation"]);//Yep, it's loading the new objects
        
         NSString *name = @"VoiceGameModelFiles";
         NSError *err = [languageModelGenerator generateLanguageModelFromArray:languageArray withFilesNamed:name forAcousticModelAtPath:[AcousticModel pathToModel:@"AcousticModelEnglish"]]; // Change "AcousticModelEnglish" to "AcousticModelSpanish" to create a Spanish language model instead of an English one.
    
        
    	NSDictionary *dynamicLanguageGenerationResultsDictionary = nil;
         
    	if([err code] != noErr) {
    		NSLog(@"Dynamic language generator reported error %@", [err description]);
    	
        } else {
    	
            dynamicLanguageGenerationResultsDictionary = [err userInfo];
    		
            NSString *lmPath = [dynamicLanguageGenerationResultsDictionary objectForKey:@"LMPath"];
    	NSString *dictionaryPath = [dynamicLanguageGenerationResultsDictionary objectForKey:@"DictionaryPath"];
    		
            self.pathToDynamicallyGeneratedGrammar = lmPath; // We'll set our new .languagemodel file to be the one to get switched to when the words "CHANGE MODEL" are recognized.
    		self.pathToDynamicallyGeneratedDictionary = dictionaryPath; // We'll set our new dictionary to be the one to get switched to when the words "CHANGE MODEL" are recognized.
            
        }
        
    }
Viewing 34 posts - 1 through 34 (of 34 total)