OpenEars/Pocketsphinx turns audio player volume down and won't let go

Home Forums OpenEars OpenEars/Pocketsphinx turns audio player volume down and won't let go

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

  • Author
    Posts
  • #1022258
    Darth Flyeater
    Participant

    Hello,

    I have a learn to read app that has background sounds as well as my own speech files that get called as avaudioplayer instances. I incorporated OpenEars into the app and everything works great except for some volume issues. When Pocketsphinx initializes, it lowers the sound volume on everything and doesn’t let it come back up. During the logging, it goes thru and says everything is incorrect and says that it’s setting it to 1 (my volume on the background sound was already set to 1, unless 1 doesn’t really equal 1 in OpenEars/Pocketsphinx).

    Is there something I’m missing?

    Thanks in advance.

    #1022267
    Halle Winkler
    Politepix

    Welcome,

    This is a known issue, and unfortunately a bug with the PlayAndRecord audio session that OpenEars has to use in order to do low-latency recording. If you search these forums for the keyword PlayAndRecord you’ll see more discussion about it. I’m continuing to look into workarounds and in the meantime one option is to use AVAudioPlayer to play back sounds or audio if possible without experiencing the volume drop.

    my volume on the background sound was already set to 1, unless 1 doesn’t really equal 1 in OpenEars/Pocketsphinx

    This doesn’t refer to the volume of the system audio or audio objects you own.

    #1022270
    Darth Flyeater
    Participant

    Thanks for the reply, Halle. I’ll take a look at the PlayAndRecord posts.

    I am using AVAudioPlayer for all my sounds/audio and the volume is still getting sacked (unless I’m doing something wrong). Below is my code for the background sounds:

    AVAudioPlayer *_backgroundSoundPlayer; //declared at the top of the implementation

    – (void)playBackgroundSound:(NSString *)filename
    {
    NSError *error;
    NSURL *backgroundSoundURL = [[NSBundle mainBundle] URLForResource:filename withExtension:nil];
    _backgroundSoundPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:backgroundSoundURL error:&error];
    _backgroundSoundPlayer.numberOfLoops = -1;
    _backgroundSoundPlayer.volume = vB;
    [_backgroundSoundPlayer prepareToPlay];
    }

    [_backgroundSoundPlayer play]; //this gets called in another method

    What other workarounds are you looking at, and could I help test them?

    Thanks again.

    #1022271
    Halle Winkler
    Politepix

    Interesting – OpenEars shouldn’t do anything to your AVAudioPlayers, that’s not expected. FliteController and NeatSpeech also use AVAudioPlayer for speech playback so coexistence there gets a fair amount of testing. What happens if you omit volume settings from your player? Can you search your app for the word ‘audiosession’ and make sure you don’t have any calls to AudioSession or AVAudioSession? That is sometimes a factor in unexpected results when PocketsphinxController restores its required audio session settings.

    #1022274
    Darth Flyeater
    Participant

    I have AudioSession as part of the standard PocketSphinx methods:

    – (void) audioSessionInterruptionDidBegin
    {
    NSLog(@”AudioSession interruption began.”);

    [self.pocketsphinxController stopListening]; // React to it by telling Pocketsphinx to stop listening since it will need to restart its loop after an interruption.
    }

    – (void) audioSessionInterruptionDidEnd
    {
    NSLog(@”AudioSession interruption ended.”);

    // We’re restarting the previously-stopped listening loop.
    [self startListening];
    }

    But nothing should be calling those methods.

    And I also tried this: pocketsphinxController.audioSessionMixing = TRUE; in the pocket sphinx lazy initiator method to try and fix the problem with the volume after I noticed it.

    I don’t have any AVAudioSessions.

    I tried killing all the AudioSessions references and my background sound volume control and it still cuts the volume once active listening starts.

    I’m not using FliteController or NeatSpeech. Can I get my sound files to be played thru FliteController?

    I’ll try some of the suggestions on the PlayAndRecord forum posts and see if I can get it to work properly.

    #1022275
    Halle Winkler
    Politepix

    OK, are we talking about sound which is occurring simultaneously with listening or sound which is being played at times when listening is not in progress? Sound can’t be routed out of a speaker at the same time as there is an attempt to recognize speech using the external mic since the recognition will just be performed on the sound. FliteController only plays speech back when listening isn’t underway (unless headphones are plugged in) since otherwise it would be FliteController’s speech that would be recognized instead of the user’s.

    #1022276
    Darth Flyeater
    Participant

    I have a background track that starts when the app is launched. There is a toggle button where the user can turn it on or off. I then have an instruction audio track that plays before I have the listening begin. Background sounds and instruction track play at normal volume. When pocket sphinx is calibrated and starts listening, the background track volume is cut at least in half (but continues to play). The active listening works perfectly at that point (even with the background track still playing). I then have kudos audio play if the correct word is recognized. This also works perfectly and doesn’t care if listening is active or suspended (I’ve tried both ways). However, this volume is also reduced. The only way to get the volume back to normal is to exit the app completely and restart. I have an exit button which takes you back to the start scene (which has no listening, just a title and a start button along with the background track still playing), but the volume remains degraded.

    Since other users are reporting that avaudioplayer should work with openears, I think I’ll make a test app with nothing but my background track and openears to see if I can get it to work.

    #1022531
    rw86347
    Participant

    did you ever find a solution?

    #1022556
    Darth Flyeater
    Participant

    I did not ever find a perfect solution. I used Audacity to boost the volume levels of all my sound files. Then, I put the pocket sphinx calibration as one of the first things to get called in the scene (before the instructions track started), so the sound level drop isn’t as noticeable. With the boosted levels of the instructions and other sound tracks, the lowered levels caused by the active listening is overcome.

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