Slideshow that changes image using sound/noise from microfon
in
Core Library Questions
•
2 years ago
Hello.
I need help with a small problem in Processing. I'm trying to write a code that displays a slide show. And I wish that the images will change by means of sound / noise in the room.
The problem is that I do not get this to work. Can anyone see what is wrong with my code?
I need help with a small problem in Processing. I'm trying to write a code that displays a slide show. And I wish that the images will change by means of sound / noise in the room.
The problem is that I do not get this to work. Can anyone see what is wrong with my code?
- String[] filenames = {"1.jpg", "2.jpg", "3.jpg", "4.jpg", "5.jpg", "6.jpg","7.jpg","8.jpg","9.jpg","10.jpg","11.jpg","12.jpg", "13.JPG", "14.jpg", "15.jpg", "16.jpg", "17.jpg","18.jpg","19.jpg","20.jpg","21.jpg","22.jpg", "23.jpg", "24.jpg", "25.JPG", "26.jpg","27.jpg","28.jpg","29.jpg","30.jpg","31.jpg","32.JPG", "33.jpg"};
- PImage[] images = new PImage[filenames.length];
- int imageIndex = 0;
- PFont f;
- import ddf.minim.*;
- Minim minim;
- AudioInput in;
- void setup() {
- size(1024,768);
- minim = new Minim(this);
- minim.debugOn();
- // get a line in from Minim, default bit depth is 16
- in = minim.getLineIn(Minim.STEREO, 500);
- for(int i = 0; i<filenames.length; i++)
- { images[i] = loadImage(filenames[i]);
- }
- }
- void draw() {
- background(0);
- image(images[imageIndex],0,0,width,height);
- fill(200);
- text(imageIndex,0,0);
- for(int i = 0; i < in.bufferSize() - 1; i++)
- {
- if(in.left.get(i)>0.8){
- }
- }
- }
- {
- // always close Minim audio classes when you are done with them
- in.close();
- minim.stop();
- super.stop();
- }
1