Hello, I'm running into a little probem try to get Ess to play my audio files. This is what pops up. Basically it doesn't load the sound files, but I can't figure out why.
This is the source code.
Code:import JMyron.*;
import krister.Ess.*;
import processing.video.*;
AudioChannel myChannelR;
AudioChannel myChannelB;
AudioChannel myChannelG;
Capture video;
int myR = 0;
int myG = 0;
int myB = 0;
int u;
int l;
int f = 0;
PImage c;
void setup() {
size(320, 240);
noStroke();
smooth();
Ess.start(this);
myChannelR=new AudioChannel("A2.mp3");
myChannelB=new AudioChannel("B2.mp3");
myChannelG=new AudioChannel("C2.mp3");
//String path = dataPath("");
noLoop();
}
void draw() {
String[] filenames = listFileNames(dataPath(""));
println(filenames);
for (int z = 0; z < filenames.length; z++){
String myImage = filenames[z];
c = loadImage(myImage);
for(int x = 0; x < width; x++){
for(int i = 0; i < height; i++){
myR += red(get(x,i));
myG += green(get(x,i));
myB += blue(get(x,i));
}
}
if(myR > myG && myR > myB){
myChannelR.play();
}
if(myG > myR && myG > myB){
myChannelB.play();
}
if(myB > myR && myR > myG){
myChannelG.play();
}
// if(myR > myG && myR > myB && myB > myG);
// {
// u = myB;
// l = myG;
// }
// if(myR > myG && myR > myB && myG > myB);
// {
// u = myG;
// l = myB;
// }
// if(myG > myR && myG > myB && myR > myB);
// {
// u = myR;
// l = myB;
// }
// if(myG > myR && myG > myB && myB > myR);
// {
// u = myB;
// l = myR;
// }
// if(myB > myR && myB > myG && myR > myB);
// {
// u = myR;
// l = myG;
// }
// if(myB > myR && myB > myG && myG > myR);
// {
// u = myG;
// l = myR;
// }
}
}
String[] listFileNames(String dir) {
File file = new File(dir);
if (file.isDirectory()) {
String names[] = file.list();
String finalNames[] = new String[names.length-1];
int k = 0;
for(int i = 0; i < names.length; i++){
if(!names[i].equals(".DS_Store")){
finalNames[k] = names[i];
k++;
}
}
return finalNames;
}
else {
// If it's not a directory
return null;
}
}
Basically what the script does is load the image and analyze it based on R/G/B values and then it should play a sound based on those values.
This is the error message.
Unable to load sound A2.mp3
Unable to load sound B2.mp3
Unable to load sound C2.mp3
[0] "A2.mp3"
[1] "Afbeelding 1.png"
[2] "B2.mp3"
[3] "C2.mp3"
Could not find a method to load A2.mp3
Could not find a method to load B2.mp3
Could not find a method to load C2.mp3
Thanks for anyone willing to look into this.