Sound Loops Not Working

edited October 2017 in Library Questions

Hello, I was just wondering if anyone knows why my sound won't loop, I am trying to make background music but it won't loop. Any help would be great, thanks.

(I know it's just the default processing sound code, but it doesn't work on either programs I tried.)

import processing.sound.*;
SoundFile file;

void setup() {
  size(640, 360);

  // Load a soundfile from the data folder of the sketch and play it back in a loop
  file = new SoundFile(this, "sample.mp3");

void draw() {


  • edited October 2017

    Does it play at all?

    Is the sample file in the data directory? Add it via the menu or drag and drop.

    Is the file name EXACTLY as you have it there?

    Are there any console warnings printed?

  • It plays once. The file is in my data folder and the console does not have any warnings.

  • This is happening for me as well. It is an mp3 file made with audacity.

  • Answer ✓

    I figured out the problem, most audio files are formatted as stereo, so you have to change the file to mono and then the loop should work.

  • That doesn't sound right. I have stereo files that loop.

  • Agreed, stereo audio files (in general) should loop just fine.

    It might be something specific about your particular file, or your sound card / drive audio setup...?

  • It also might be because they are school computers with an outdated version. My school computer is an iMac, but my home laptop is different so I will try sound loops on there with the newest version. My iMac specs are here

  • stop looking for complicated answers and upload the file somewhere so we can test it.

Sign In or Register to comment.