sound jump() and stop()

edited January 2016 in p5.js Library Questions

Hi,

From the example http://p5js.org/examples/examples/Sound_Load_and_Play_Sound.php I made a test

var song;

function setup() {
  song = loadSound('assets/lucky_dragons_-_power_melody.mp3');
  createCanvas(720, 200);
  background(255,0,0);
}

function mousePressed() {
  if ( song.isPlaying() ) { // .isPlaying() returns a boolean
    song.stop();
    song.jump(3);
    background(255,0,0);
  } else {
    song.play();
    background(0,255,0);
  }
}

When I click, there is more than one "song". I would like to make a jquery ui slider (https://api.jqueryui.com/slider/#entry-examples) and jump in the song. How to go to a position in the song without multiplaying it ?

Sign In or Register to comment.