The first option, to use the timeupdate callback, monitor towards the end to rewind to the beginning. Disadvantage of this method is that colback rarely triggered, and each repetition will be of unequal length. It can be heard. Besides, you can skip to the end because of kolbek never on the endpoint won't work.
The second option, to do the same using reqest animation frame. It to work more often, but also has its disadvantages. If the master is closed on weak devices can Theoretically be invoked less frequently. But from experience I can say that it works better and hear the roughness in duration almost impossible.
In both cases, it may be such a situation: in odnoselchane file comes colbeck parameter 0,9799, and next is 0. Ie bypassing 1. The reason that colbeck generated periodically.
Third option. If you are doing something where a really steady beat (e.g., metronome), the only way to read the audioBuffer, copy it many times, to stitch together into one long array and lose the long file. It works fast and very accurate.
alessandra.Johnston85 answered on April 7th 20 at 10:51
In the same file left and right, add 3 seconds repeat:
1. the end of the last 3 seconds,
2. the main piece
3. basic start - first 3 seconds.
Then, when ready, play from the beginning of basic to the end of normal: only the middle!
At the end, set the position back to the beginning of the main.
I.e., create a software loop.