Sitelet https://mdn.github.io/webaudio-examples/audio-buffer-source-node/loop/

Web Audio API examples: looping a track

Set loop start and loop end

Starts at 0 s.
Stops at 0 s.

If the stop time is lower or equal to the start time, it'll loop over the whole track.