Processing: Unable to find sound file

373 Views Asked by At

I've been trying to add some music to a sketch I'm making, unfortunately a sound library error keeps popping up saying it's unable to find the file even though my sound files are in the data folder, have the same name and doesn't seem to have syntax errors.

import processing.sound.*;
SoundFile[] backMusic = new SoundFile [4];
PImage[] dnFrames = new PImage[10];
int sIndex = 0;
int musicIndex = 0;
String[] credits;

void setup() {
  size(800, 800);
  frameRate(15); 
  backMusic [0] = new SoundFile(this, "00.mp3");
  backMusic [1] = new SoundFile(this, "01.mp3");
  backMusic [2] = new SoundFile(this, "02.mp3");
  backMusic [3] = new SoundFile(this, "03.mp3");
  backMusic[musicIndex].play();
  
  PImage dn = loadImage("spritesheet.png");
  dn.resize(3000, 600);
  for(int n = 0; n < 10; n++){
    dnFrames[n] = dn.get(n*dn.width/10, 0, dn.width/10, dn.height);
  }
  credits = loadStrings("Credits.txt");
  textSize(40);
}

void draw() {
  if(frameCount < 250)
    sceneOne(frameCount);
  else
    sceneTwo(frameCount - 250);    
}

void keyPressed() {
  if(key == 'm' || key == 'M') {
    musicIndex = musicIndex + 1;
    }
  }  

The error looks like this:

May 12, 2022 9:50:18 PM com.jsyn.devices.javasound.JavaSoundAudioDevice <init>
INFO: JSyn: default output latency set to 80 msec for Windows 10
Sound library error: unable to find file 00.mp3
Sound library error: unable to find file 01.mp3
Sound library error: unable to find file 02.mp3
Sound library error: unable to find file 03.mp3
NullPointerException
NullPointerException
NullPointerException
NullPointerException
NullPointerException
NullPointerException
Could not run the sketch (Target VM failed to initialize).
For more information, read Help ? Troubleshooting.

I do have two other tabs but they have nothing to do with the sound files.

0

There are 0 best solutions below