Reply To: OpenEars & Finch

Home Forums OpenEars OpenEars & Finch Reply To: OpenEars & Finch

#1017960
Halle Winkler
Politepix

Hi Ben,

The issue is that OpenEars requires the playandrecord audio session and an side-effect of this audio session is that it blocks background sounds and system sounds. I think there are a bunch of past threads about this (maybe with possible workarounds IIRC) that would be worth some searching in these forums. But I would never expect OpenAL or a wrapper around it to coexist well with OpenEars because OpenEars needs a great deal of control over audio for its own latency requirements and as a result of that it is nearly an audio framework on its own, with a constant input stream and its own output settings.

I have heard the advice to use OpenAL for game sound design with the expectation that there will be an entire library of tones that need to be close-to-zero latency (although I might personally do this with a remoteio queue instead), but I’m not sure most would necessarily recommend using an OpenAL audio engine simultaneous to another very audio-intensive framework for the purpose of playing back two sound files.

The common approach for lowest latency is remoteio or audio queue services (not available in this case because the input stream is being entirely used by PocketsphinxController), while AVAudioPlayer is preferred for simplicity, and system sounds are good for one-offs (but in this case they are interfered with by playandrecord).

I think you should be fine with a dedicated AVAudioPlayer that you can keep primed for lower-latency playback like so:

[myAVAudioPlayer prepareToPlay];
[myAVAudioPlayer play];
[myAVAudioPlayer stop];

And just have a different one instantiated and available for each of your two tones. I’d recommend making your tones 16k uncompressed mono WAVs.

Also, if I start using the FliteController will it conflict with AVAudioPlayer?

Nope, not if you aren’t trying to play them simultaneously.