Looking for help with creating a delay between audio loops

Please provide the following:

  1. SDK Version: 43.0.2
  2. Platforms(Android/iOS/web/all): all
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

I’m trying to make an app that records a snippet of audio, and then loops it back with a delay. I’m struggling with the creating the loop that can also be paused/stopped on user action. What I tried to do was track the audio duration using durationMillis, and then configure a few setTimeouts() to artificially create a delayed loop using pauseAsync().

So, there are 2 issues I’m running into, for one my stopSound doesn’t actually stop the setTimeout() so it just keeps playing. And then the second issue is how best to handle creating an audio delay. The durationMillis technique I’m doing is not perfect and it seems to potentially clip audio. I’m guessing there is a much better way to do this, I just don’t know how to do it well so any suggestions would be great.