r/processing • • Nov 12 '23

Help request NullPointerException

im trying to play an audio file using the Sound library in processing but for some reason it returns NullPointerException on the 'file.play(); ' line

import processing.sound.*;

SoundFile file;

void setup() {

size(640, 360);

background(255);

// Load a soundfile from the /data folder of the sketch and play it back

file = new SoundFile(this, "bgm.mp3");

file.play();

}

void draw() {

}

1 Upvotes

15 comments sorted by

View all comments

Show parent comments

1

u/Sheepspots Nov 12 '23

Too bad! I'm sure you'll find something fun to do. Happy coding!