Error in playing sound

#1

So I just started learning on how to add sound into the program but ran into a problem that I can’t exactly understand. I had this code

import processing.sound.*;

SoundFile file;

void setup() {
  size(500,500);
  background(0);
  file = new SoundFile(this, "Song.mp3");
  file.play();
}

void draw() {
  
}

But it gave me this error message when I played it


Can someone explain to me what I am doing wrong and/or how to fix this?

1 Like

#2

pls read
https://processing.org/reference/libraries/sound/SoundFile.html mp3
for this file type better use
http://code.compartmental.net/minim/minim_method_loadfile.html (import needed)

File / Examples / Contributed Libraries / Minim / Basics / PlayAFile
work perfect ( even on my 40 Euro computer. )

1 Like

#3

@CodeTime despite the message being printed in red this isn’t actually an error message, just information about the Sound library starting up successfully. Was there actually a problem with the sound file not being played back?

1 Like