February 6, 2017 at 12:50 pm #1031556
first of all – great product, great forum…
I’ve been searching solution for longer time but I gave up and I need a help
there were plenty similar topics already but somehow i couldn’t find solution …
so as I noticed soundmixing is enabled by default and that’s great… from what I see when I try to play any sound via avplayer and already established (by openears) audio session – all is as expected – so mixing is working fine (no pausing background sound etc)
but it works only for sounds started already after openears is started… i have scenario that for example i listen to youtube music or any other player i guess and then i start my app with openears enabled to add some voice commands and unfortunately at this moment (of start of openears) mixing doesn’t work fine – meaning while my app is started – background sound is paused and doesn’t resume…
do i overlook something obvious? I really digged deep into that (or at least i think so)
MichaelFebruary 6, 2017 at 3:58 pm #1031558Halle WinklerPolitepix
I think this would be unlikely to work (or unlikely to always work the same on every device and OS), because OpenEars has to change the session category in order to begin but not vice versa. That is, while the audio is compatible with both its preferred category and OpenEars’ category so it wouldn’t need to change the category if started during a listening session, OpenEars is not compatible with the audio’s preferred category, requiring a session restart that can interrupt playback. Regretfully, this is an OS implementation detail rather than an OpenEars implementation detail (audio session isn’t a very deeply specified API), meaning that it is unlikely that the same thing happens identically even from OS version to OS version so it would be challenging to try to control these kinds of results from OpenEars. Issues with audio coexistence are covered in more detail in the support FAQ, but generally, I’m sorry that it isn’t possible to cover every case like this.February 6, 2017 at 4:21 pm #1031559
OK I understand. Thanks for the answer.
But for example – if i create my own app with simple AVAudioPlayer and i set category to AVAudioSessionCategoryAmbient it works always (so it never stops background [already started before] music) – and i tested it on different devices and OS versions…
can i somehow modify OE audio session to specific category so it uses it from very beginning?
don’t wont to be pain in the a** but can you explain me
” OpenEars has to change the session category in order to begin but not vice versa”
regards!February 6, 2017 at 4:32 pm #1031560
UUh sorry for double posting but I can’t edit my post any more and i wanted to make it clear
by “if i create my own app with simple AVAudioPlayer”
if i create another app with simple AVAudioPlayer – not using openears audiosession but “normal” AVAudioSession
February 6, 2017 at 5:00 pm #1031562Halle WinklerPolitepix
- This reply was modified 3 years, 5 months ago by MichaelZet.
AVAudioPlayer in the foreground has very little behaviorally to do with background Youtube music or AVPlayer in general – it is a simpler API and generally pretty compatible with OpenEars (I think this is also in the FAQ). However, OEPocketsphinxController will (again, depending on device and OS since this isn’t specified by Apple) often change the sample rate or volume of AVAudioPlayers which are running at the time that recognition is started, for similar reasons to those I mentioned previously. A category of AVAudioSessionCategoryAmbient is unquestionably being changed, since it doesn’t have audio input, even if isn’t changing it in a way that you are noticing affecting the audio output (there are a few questions posted here about how to prevent changes to existing AVAudioPlayer sessions at the time of starting OEPocketsphinxController). I’ll go ahead and close this up since the problems of audio framework coexistence are covered in the FAQ and many questions here so I can’t shed further light on this, which is a side-effect of the design of audio APIs on the device and the limited specification for audio behavior on the platform rather than something I can help out with. Best of luck and take a look at the FAQ for a bit more background here, thanks!
- The topic ‘audiosession – mix while starting’ is closed to new replies.