# Incorrect .loop() behavior in p5.SoundFile

**URL:** <https://discourse.processing.org/t/incorrect-loop-behavior-in-p5-soundfile/34947>\
**Category:** Libraries\
**Created:** [February 3, 2022, 12:59am UTC](https://discourse.processing.org/t/incorrect-loop-behavior-in-p5-soundfile/34947 "2022-02-03T00:59:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaschanarveson](https://avatars.discourse-cdn.com/v4/letter/j/b9e5f3/32.png) [@jaschanarveson](https://discourse.processing.org/u/jaschanarveson)\
**Post date:** [February 3, 2022, 12:59am UTC](https://discourse.processing.org/t/incorrect-loop-behavior-in-p5-soundfile/34947/1 "2022-02-03T00:59:52Z")

</div>

The .loop() function in p5.SoundFile isn’t working correctly for me.

Behavior: I set loop start and end points: it will start at the start point, but then loop back to 0 upon hitting the end point, instead of looping back to the start point.

To try it, go to the example [https://p5js.org/reference/#/p5.SoundFile/loop](https://p5js.org/reference/#/p5.SoundFile/loop), but then change one line:

in canvasPressed(), instead of `soundFile.loop()` try `soundFile.loop(0, 1, 1, 0.5, 0.1);`

This _should_ start at 0.5seconds and play a repeating 0.1second loop: for me, I can hear it play the first 0.1 chunk, but then it clearly is starting from the beginning after that.

Help?

thank you!

cheers,

j
