OpenEars + Unity3D: Audio playback conflicts

Home Forums OpenEars OpenEars + Unity3D: Audio playback conflicts

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

  • Author
  • #1022018

    Hello Halle,

    I’m integrating OpenEars with a Unity3D game, and the game relies heavily on music and sound effects.
    When OpenEars starts listening, it will change the audio playback settings in a way that conflicts with Unity (which uses FMOD for sound).

    I’ve noticed two issues when OpenEars starts listening:
    – Unity3D audio will completely stop unless I set a very high buffer size on the Unity side, which introduces latency
    – OpenEars will change the sample rate from 24000 Hz (Unity’s sample rate on iOS) to 16000 Hz, causing the sound playback quality to degrade considerably

    Despite these audio playback issues, OpenEars recognition works perfectly.

    I’m not using Flite, so I don’t require any audio playback from OpenEars. Is it possible to make OpenEars deal only with input from the mic, while not interfering with audio playback settings?

    Thanks very much!

    PS.: I tried using AudioSessionGetProperty and AudioSessionSetProperty to check and restore the sample rate back to 24000 Hz, and while it fixed my sound quality, it broke OpenEars recognition, so I guess that’s not a viable solution.

    Below is the log from the audio setup part, thought you’d be interested to see it:

    2014-07-20 11:56:59.409 amoraleite[12650:1b03] Leaving sample rate at the default of 16000.
    2014-07-20 11:56:59.411 amoraleite[12650:1b03] The audio session has already been initialized but we will override its properties.
    2014-07-20 11:56:59.412 amoraleite[12650:1b03] Checking and resetting all audio session settings.
    2014-07-20 11:56:59.414 amoraleite[12650:1b03] audioCategory is incorrect, we will change it.
    2014-07-20 11:56:59.789 amoraleite[12650:1b03] audioCategory is now on the correct setting of kAudioSessionCategory_PlayAndRecord.
    2014-07-20 11:56:59.810 amoraleite[12650:1b03] audioMode is incorrect, we will change it.
    2014-07-20 11:57:00.203 amoraleite[12650:1b03] audioMode is now on the correct setting.
    2014-07-20 11:57:00.207 amoraleite[12650:1b03] bluetoothInput is incorrect, we will change it.
    2014-07-20 11:57:00.221 amoraleite[12650:1b03] bluetooth input is now on the correct setting of 1.
    2014-07-20 11:57:00.222 amoraleite[12650:1b03] Output Device: SpeakerAndMicrophone.
    2014-07-20 11:57:00.223 amoraleite[12650:1b03] categoryDefaultToSpeaker is correct, we will leave it as it is.
    2014-07-20 11:57:00.225 amoraleite[12650:1b03] preferredBufferSize is incorrect, we will change it.
    2014-07-20 11:57:00.228 amoraleite[12650:1b03] PreferredBufferSize is now on the correct setting of 0.128000.
    2014-07-20 11:57:00.230 amoraleite[12650:1b03] preferredSampleRateCheck is incorrect, we will change it.
    2014-07-20 11:57:00.465 amoraleite[12650:1b03] preferred hardware sample rate is now on the correct setting of 16000.000000.
    2014-07-20 11:57:00.902 amoraleite[12650:1b03] AudioSessionManager startAudioSession has reached the end of the initialization.
    2014-07-20 11:57:00.904 amoraleite[12650:1b03] Exiting startAudioSession.


    By the way, forgot to mention I tested on iPad 2, iPhone 4 and iPhone 5S. All with same results.

    Halle Winkler


    This is a known limitation, if you’d like to read more about it the search keywords audio playback will probably show most of the previous discussions, and there is info in the FAQ.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.