3

I am using a SuperpoweredAdvancedAudioPlayer to play a wav file in a loop. The problem is, every time the track loops, there is a little hiccup with a popping sound and a very small delay. It is noticeable and makes looping totally useless

Here is the callback function I am using to loop

// Called by the playerA.
static void playerEventCallbackA (
        void * __unused clientData,
        SuperpoweredAdvancedAudioPlayerEvent event,
        void *value
) {
    switch (event) {
        case SuperpoweredAdvancedAudioPlayerEvent_LoadSuccess:
            break;
        case SuperpoweredAdvancedAudioPlayerEvent_LoadError:
            log_print(ANDROID_LOG_ERROR, "Player", "Open error: %s", (char *)value);
            break;
        case SuperpoweredAdvancedAudioPlayerEvent_EOF:
            playerA->seek(0);    // loop track
            break;
        default:;
    };
}

Considering the entire point of this SDK is to have minimal latency with recording and playback, I figure I must be doing something wrong.

Any tips?

Connor S
  • 353
  • 2
  • 12
  • Where do your wav files come? from have you tried looping them in other audio software? I was having the same issue when trying to load m4a files. When I went back and used the source audio wavs it looped fine. – Will Munn Jul 10 '19 at 12:18
  • The wav files are recorded to the ExternalStorateDirectory, which is where they are read from. Howeverm they should only load once and remain in memory. Also, the files loop fine in other software. The sound im hearing is less of a click and more of a stutter/hesitation/static right before each loop – Connor S Jul 10 '19 at 23:29

1 Answers1

0

Sample-precise looping is possible with the SuperpoweredAdvancedAudioPlayer->loop() and loopBetween() methods.

Gabor Szanto
  • 1,329
  • 8
  • 12
  • To do this, would I set the loop points with loopBetween(), then play the audio by calling player->loop() instead of player->play()? – Connor S Aug 21 '19 at 23:46
  • player->play() basically, but you can start audio with one of the parameters of player->loop() as well – Gabor Szanto Aug 22 '19 at 15:52
  • Thank you, I'm excited to try this out. So do I use loopBetween after creating my player object? Or do I put it in the callback function? Also, is it necessary to use both loopBetween and loop? Or can I use loopBetween, then later on call player->play()? Thanks for your time, it is extremely helpful – Connor S Aug 23 '19 at 12:32
  • Certainly you need to call player->loopBetween() after your player instance is created. Use loop() OR loopBetween(). – Gabor Szanto Aug 26 '19 at 14:24