We are about to switch to a new forum software. Until then we have removed the registration on this forum.
For now i'm only trying to do some keyPressed to change music. But this is showing me an error, that i dont kow how tot fix it. Error name is "ArrayIndexOutOfBoundsExceptation:1".
<
pre lang="c"> import ddf.minim.*; import ddf.minim.analysis.*;
Minim minim; AudioPlayer[] som=new AudioPlayer[1];
void setup() { size(1280, 720);
minim = new Minim(this);
som[1]=minim.loadFile("C:/Users/User/Documents/Processing/brain_colors/som/Jason - Timeflip.wav"); som[2]=minim.loadFile("C:/Users/User/Documents/Processing/brain_colors/som/metal/Slipknot - The Devil In I.mp3");
for (int i =0; i<som.length; i++) {
som[i].play();
}
}
void draw() { background(0);
//BRAIN SKETCH }
void keyPressed () { if (key == '0') exit(); else { if (key == '2') { som[2].play(); } } }
void stop() {
for (int i =0; i<som.length; i++) {
som[i].play();
}
{
minim.stop();
}
}
Answers
all arrays in processing start with the index 0
so 1st entry = 0
so 2nd entry = 1
I fixed lines 12 and 13 above
the error
the error is shown because in line 13 you had 2 which was higher than the maximum value of the array
Kk. Thank you for the help
also line 29
i've been changing my code, i've made some attempts for what i want now, but i fail in all. This is my last save before i do my tests.
I'm uploading the img to try explain better what i'm trying to do. The img on the left shows what i've got so far, the one on the right shows what i'm trying. What i want for now is t put the name of the music playing and use the icons (play, pause), which is the eyes of the sketch to pause and play the music.
this is a simple button example
it
println
s something when you press a buttonsorry, I posted the wrong code
ok, i'm going to try it
http://www.openprocessing.org/sketch/48351
Thank you for all the help. but my teacher said i couldnt do any of my idea because some of the things i need to use, we dont give in class yet, and now i got to think in a new project, do a report and send all to him before 9.30am. Sorry for all the time you take with me in this failed project, ahahah. I hope I can count on your help in a next idea
you could do a simple image viewer
show an image
click a button, he goes to next image in folder etc.
I need to do something generative. I was thinking, in some geometric stuff (squares, lines, etc) in illustrator, save the images individually and make random stuff in processing.
Something like this image
and make a void keyPressed, to every time i click on a letter the all img goes random, a do new stuff
ok
this is 3D?
https://www.processing.org/examples/texturecube.html
you need a image file and name it berlin-1.jpg
Im not sure...I was searching for some geometric images, and seeing the deep of the image, maybe.
and change P3D to OPENGL
use this maybe http://www.emgu.com/wiki/images/OpenCV_Chessboard.png
i'm getting an error because a library
I have to leave now...
bye....
Ok, thank you for all. Bye