ddf.minim problem: AudioPlayer::loop() is not smooth

edited October 2013 in Questions about Code

Using Minim, when the Audioplayer loops, set using AudioPlayer::setLoopPoints, there is a fraction of a second of silence in between. I've made sure that the loop times are accurate (and there is no silence on either end, so that shouldn't be the problem). Here's the relevant code:

import ddf.minim.*;
AudioPlayer player;
Minim minim;

void setup() {
  minim = new Minim(this);
  player = minim.loadFile("cowboy.mp3", 2048);
  player.loop();
}

void draw() {
  if(player.position()>60000) player.setLoopPoints(59070, 198500);
}

Note: the reason I didn't just set the loop time in setup is because I want it to play from the start once and then start looping

Is the gap in sound a problem with the library or something stupid I did?

Tagged:

Answers

  • Hello jorgen, try that:

    import ddf.minim.*;
    AudioPlayer player;
    Minim minim;
    
    void setup() {
      minim = new Minim(this);
      player = minim.loadFile("cowboy.mp3", 2048);
      player.loop();
      player.setLoopPoints(59070, 198500);
    }
    
    void draw() {
      println(player.position());
    }
    
  • Hello, thanks for the answer!

    However this doesn't solve the problem; the gap is still there. Also, I wrote the code as I did so that the song would play once from the start and then start looping in the selected timeframe (I forgot to mention this in the question, I'll edit it in).

  • Gently bumping this, in case someone knows a solution..

Sign In or Register to comment.