Forum Replies Created
-
AuthorPosts
-
benwirzParticipant
Try stopping you avaudio instances in the pocketsphinxDidStopListening call back. This solved a similar issue for me. -Ben
– (void) pocketsphinxDidStopListening
{
// stop the audio sessions here after pocketspinx has already stopped
if (_speechSynthesizer &&
_speechSynthesizer.speaking)
[_speechSynthesizer stopSpeakingAtBoundary: AVSpeechBoundaryImmediate];
if (_audioPlayerVoiceControlStart &&
_audioPlayerVoiceControlStart.playing)
[_audioPlayerVoiceControlStart stop];NSLog(@”Pocketsphinx has stopped.”);
}benwirzParticipantHi Halle,
The symptoms goes away if I DON’T make the stopListening call when going into the background. Now I’m only calling stopListening during an audio interruption or route change. I believe that my AVAudioPlayer instances were interfering with the stopListening in some way. I had been stopping the instances right before making the stopListeningCall. The trick turned out be to stop them in the didStopListening delegate call back. This way I only try to stop them after I know OEPocketsphinxController has itself stopped avoiding the conflict. This seems to work fine for the audio interruption related situations but for not going to the background.
I think this solves this issue, thanks for your help!
-Ben
benwirzParticipantHi Halle,
My app doesn’t run in the background and I’m not trying to do background recognition. Not sending [OEPocketsphinxController sharedInstance] stopListening] in the appWillResignActive solves the problem for going to the background and returning from the background. I also don’t get the get the red bar across the top like the previous 1.x version. I’ll test the audio interruptions next.
Thanks
BenBTW I understand the necessity of creating a simple test case and I’m happy to do so if required but I just wanted to make sure that I’m using it correctly before going to the effort of putting a test case together for you.
benwirzParticipantHi Halle,
Thanks for the instantaneous reply! Just to make sure I understand correctly, should I execute [OEPocketsphinxController sharedInstance] stopListening] in the appWillResignActive notification or appEnteredBackground notification?
I noticed the example app doesn’t do this but I used to get the Red Bar across the top after pressing the home button if I didn’t send the stopListening in the previous 1.x versions so I left in it for the new version as well.
Thanks,
BenbenwirzParticipantI was able to solve the problem of Siri/Voice Control breaking OpenEars after the user holds the home button on iOS7 with the following code. Do you think this is the correct technique?
Thanks,
Ben– (PocketsphinxController *)pocketsphinxController {
if (pocketsphinxController == nil) {
pocketsphinxController = [[PocketsphinxController alloc] init];
pocketsphinxController.returnNbest = TRUE;
pocketsphinxController.nBestNumber = 2;
pocketsphinxController.audioSessionMixing = true; // Allow audio interuptions
}
return pocketsphinxController;
}// User started Voice Control / Siri
– (void) audioSessionInterruptionDidBegin
{
[pocketsphinxController suspendRecognition];
[pocketsphinxController stopListening];
pocketsphinxController = nil;
}– (void) audioSessionInterruptionDidEnd
{
[self setupOpenEars]; // Restart Open Ears after the Interruption Ends
}benwirzParticipantThanks for the thoughtful reply Halle. You do an excellent job supporting your customers. One suggestion I would offer is that you should add this info to the FAQ. It would have saved me 2-3 days of time to know that OpenAL and System Sounds are incompatible with OpenEars. I’m sure this info is buried in the forums somewhere but I didn’t find during the search I did prior to starting. I’ll give AVAudioPlayer a try. Thanks again. -Ben
benwirzParticipantHi Halle,
Thanks for the reply. Everyone seems to recommend using OpenAL for short sound effects where the starting time latency is important and AVAudioPlayer for background music. I see this recommendation repeated time and time again online. Is it the case that it’s not possible to use OpenAL/Finch with OpenEars or you don’t feel that it is required for my application? If there is variable latency between the user pressing the start recording button and the phone playing the start tone, I’m worried it will create a bad user experience.
Also, if I start using the FliteController will it conflict with AVAudioPlayer?
Thanks,
BenbenwirzParticipantAlso I should note that I repeated the test using a systemsounds instead of Finch and I get the same result. Starting pocketsphinxController seems to stop both.
-Ben
-
AuthorPosts