Beginner who is desperate for help! Audio keeps crashing

edited June 2017 in Library Questions

Im completely new to processing and am in a desperate need for help.. Each time I click my mouse, the sound file doesnt not play and it all crashes; with a error stating :

Error: Soundfile doesn't exist. Pleae check path java.lang.NullPointerException at processing.sound.SoundFile.channels(Unknown Source) at Source) at POSSIBLYNEEDSSOUND.mousePressed( at processing.core.PApplet.mousePressed( at processing.core.PApplet.handleMouseEvent( at processing.core.PApplet.dequeueEvents( at processing.core.PApplet.handleDraw( at processing.awt.PSurfaceAWT$12.callDraw( at processing.core.PSurfaceNone$

If someone can please help that would be greatly appreciate. Thanks

import processing.sound.*;

SoundFile tone;

void setup(){ size(1300,1300); noFill(); background(0); smooth();

tone = new SoundFile(this, "sample.mp3");


void mousePressed(){

tone = new SoundFile(this, "sample.mp3");



void mouseReleased(){





  • edited June 2017 Answer ✓

    Can any forum goer confirm if this code works in your machine? It doesn't work in mine, Processing 3.3.3 and Win 10. After confirmation, i could do a follow up in github.


    Please edit your post (gear icon in the top right corner of your post), select your code and hit ctrl+o to format your code. Make sure there is an empty line above and below your code.

    You need to make sure you have the mp3 file in the proper folder. When you are in the Processing IDE, open your sketch and then hit ctrl+k. This will open a window showing your folders. This folder is called the sketch folder (of your current sketch) In that folder, you need to have a folder named data and inside this folder you put your mp3 file. Is that what you did?

    Now, I confirm this code doesn't work. You will need to use the minim library. I have provided a sample code below.


    import ddf.minim.*;
    Minim minim;
    AudioPlayer song;
    void setup() {
      minim = new Minim(this);
      song = minim.loadFile("sample.mp3");
    void draw() {
    void mousePressed() {;
    void mouseReleased() {
  • edited June 2017 Answer ✓

    Soundfile doesn't exist. Please check path

    Have you checked the path? The more file should be in the data directory within your sketch folder. You can drag and drop it or add it via the menu option. The filename should match exactly.

Sign In or Register to comment.