- This topic has 9 replies, 4 voices, and was last updated 8 years, 6 months ago by tbrandt78.
-
AuthorPosts
-
February 4, 2014 at 12:19 am #1020026wfillemanParticipant
Hi Halle,
Just wanted to thank you again for getting arm64 supported. I’m just about to submit my app to the App Store for approval, but I’m running into a problem.
I’ve got a couple of very short sound effects that play in response to user input. Since I’ve got the speech recognizer running in the background, I’m having a hard time figuring out how to also play small sound effects.
Do you have a recommended way or sample code on the acceptable way to play short .wav files?
Other info: I’m not using the FliteController at all. Not instantiated or created anywhere. Only using PocketsphinxController with the flags:
outputAudio = NO;
audioSessionMixing = YES;I’ve tried setting the audioMode flag to “VoiceChat” with no difference.
Thanks for the help and suggestions.
Wes
February 4, 2014 at 5:55 pm #1020033Halle WinklerPolitepixHi Wes,
Have you tried playing them with an AVAudioPlayer, for instance, ones that are properties of the view controller that you can load and prepareToPlay in advance so they aren’t laggy? It’s the only audio object that has absolutely no issues I’m aware of being played while the PlayAndRecord audio session is in place. You can also easily suspend and resume before and after playback so it doesn’t interfere with recognition accuracy. Let me know if that works for you.
February 4, 2014 at 9:15 pm #1020036wfillemanParticipantHi Halle,
Perfect, thanks. I can confirm that using AVAudioPlayer works as well as another method I found where you make a call to:
OSStatus error = AudioServicesCreateSystemSoundID((CFURLRef)aFileURL, &aSoundID);
with your sound URL to create a system sound ID that can be played back later using:
AudioServicesPlaySystemSound(_soundID);
Just for completeness, while both worked, I found that the AudioServices method worked the best in my scenario.
Thanks Halle!
WesFebruary 4, 2014 at 9:23 pm #1020037wfillemanParticipantUPDATE:
For clarity, I did have to set the .audioMode flag of the PocketsphinxController object to @”VoiceChat” in order to get iOS to play and record from the mic.
Wes
February 4, 2014 at 9:23 pm #1020038Halle WinklerPolitepixGood to know — there was an old bug preventing AudioServicesPlaySystemSound from working with PlayAndRecord, so I’m happy to hear that it’s working better now.
February 4, 2014 at 9:25 pm #1020039Halle WinklerPolitepixFor clarity, I did have to set the .audioMode flag of the PocketsphinxController object to @”VoiceChat” in order to get iOS to play and record from the mic.
Aha, maybe having VoiceChat available now is the reason this works.
February 4, 2014 at 9:28 pm #1020041wfillemanParticipantSounds reasonable. I’m happy to have stumbled into it. :)
April 23, 2014 at 10:15 am #1020979loryParticipantHi,
Can you confirm I can’t use SoundSystem when Openears is started ?
Before startListening call, I can play my sound with:
AudioServicesPlaySystemSound(answerSounds[0]);Then it’s doesn’t work even if I suspend recognition. No error but I can’t hear the sound. Do you have a trick ? I’ve to use AVAudioPlayer way ?
I’m not using PlayAndRecord, juste simple recognition.
April 23, 2014 at 10:21 am #1020980Halle WinklerPolitepixHello,
PlayAndRecord is always used with recognition so this system sounds bug is always in effect when performing recognition. I can confirm that if you want to have sound effects it’s necessary to queue them up in an AVAudioPlayer by instantiating them and calling prepareToPlay.
October 14, 2015 at 2:27 am #1027030tbrandt78ParticipantPosted in wrong forum – edited to delete.
Excuse me. -
AuthorPosts
- You must be logged in to reply to this topic.