Mixing with other audio.

Home Forums OpenEars plugins Mixing with other audio.

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

  • Author
    Posts
  • #1032732
    pleirosei
    Participant

    Hello,

    I’m having trouble mixing with other audio. Here is my scenario:

    1. I’m playing music before app launches.
    2. I launch app.
    3. I login: upon login is when voice recognition begins

    Here is the code I am running upon logging in:

    //code

    OEPocketsphinxController.sharedInstance().disableBluetooth = false
    OEPocketsphinxController.sharedInstance().disableMixing = false
    OEPocketsphinxController.sharedInstance().disablePreferredBufferSize = true
    OEPocketsphinxController.sharedInstance().disablePreferredSampleRate = true
    OEPocketsphinxController.sharedInstance().disablePreferredChannelNumber = true
    OEPocketsphinxController.sharedInstance().secondsOfSilenceToDetect = 0.5
    OEPocketsphinxController.sharedInstance()?.use8kMode = true
    OEPocketsphinxController.sharedInstance().setLatencyTuning(4)

    try OEPocketsphinxController.sharedInstance()?.setActive(true)

    OEPocketsphinxController.sharedInstance().startRealtimeListeningWithLanguageModel(atPath: lmPath, dictionaryAtPath: dicPath, acousticModelAtPath: OEAcousticModel.path(toModel: LocalLanguage.acousticModel))

    //code

    Am I calling these in the wrong order? Is the Rapid Ears: .startRealTimeLIsteningWithLangueModel function creating it’s own AVAudioSession that is overriding “disableMixing” being set to false? My bluetooth headphones are still able to work, so I assume it’s not overriding “disableBluetooth.” Trying to figure this out. Any help would be appreciated, thanks.

    Also I have confirmed that calling setActive() on the PocketSphinx Controller does not interrupt the audio on an independent test (by which I mean afterwards I do not call the startRealTimeListening() function ).

    If there is a work around to achieve the same thing, please let me know. The music is playing from a separate app, so I do not have access to the AVAudioPlayer for the sound (unless there is a sharedInstance of AVAudioPlayer that I’m not aware of.)

    Thanks.

    #1032736
    Halle Winkler
    Politepix

    Welcome,

    Can you clarify the result you are seeking and what is actually happening?

    #1032739
    pleirosei
    Participant

    Yes:

    The result I am seeking is the following:

    1. Play music from any app, whether Apple Music app, Google Music, etc.

    2. Launch app.

    3. Login
    4. Speech recognition is initiated.
    5. Music continues to play while speech is recognized at the same time, without the music app being forced to pause or stop playing.

    What actually happens after #3:

    4. Speech recognition is initiated.
    5. Music fades out and is paused.
    6. In order to play in the background, I have to manually hit play on whatever music app I was using after speech recognition is initialized.
    7. Manually tap play on music app.
    8. Now music will play while speech recognition is working.

    #1032740
    Halle Winkler
    Politepix

    OK, thank you for the elaboration. This is the current expected behavior, sorry. The recognition is intended to be performed on a single audio input which is only mic speech, and PocketsphinxController performs its own audio session management to achieve this.

    #1032741
    pleirosei
    Participant

    Okay. So then what is the point of the .dsableMixing property? Does it then essentially do nothing? I’m guessing that would explain why setting it to false doesn’t change the result?

    #1032742
    Halle Winkler
    Politepix

    Sure, it’s in the API definition – it is for use while recognition isn’t in progress, if PocketsphinxController is usually doing something undesired to your session while recognition isn’t in progress. While recognition is in progress, it is expected that PocketsphinxController always normalizes to the session settings it is designed around.

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