When I run my file i'm getting this NullPointerException error:
==== JavaSound Minim Error ====
==== java.io.FileNotFoundException: background.mp3
=== Minim Error ===
=== Couldn't load the file background.mp3
I have declared the audioplayer and also defined minim. The file is also in the correct folder as mp3. I can't understand at all why it shouldn't work. The code for the audio file is below. Any help would be much appreciated, thanks
This is the code for the audio:
import ddf.minim.*;
AudioPlayer player;
Minim minim;
void setup() {
size(800, 800);
background(0, 0, 0);
//p2 play sound file
//Construct a new instance of minim
minim = new Minim(this);
//Load the file we want to play, 2048 is the buffer size
player = minim.loadFile("background.mp3", 2048);
//play the file
player.play();
}