Click the buttons to play or pause the audio.




Play sound file
















let song; function setup() { song = loadSound('Asaf_Avidan.mp3'); createCanvas(720, 200); background(255, 0, 0); } function mousePressed() { if (song.isPlaying()) { // .isPlaying() returns a boolean song.stop(); background(255, 0, 0); } else { song.play(); background(0, 255, 0); } }