Thank you very much!!
Someday I really want to help you if there is any chance kk
With your adapted code, I made this
- applying the First code to pixels on the (P)Image-
It is...
- import ddf.minim.*;
- import ddf.minim.analysis.*;
- int numBalloons = 160*120;
- Balloon[] balloons = new Balloon[numBalloons];
- Minim minim;
- AudioInput voice;
- FFT fft;
- float dampedVolume;
- float damping = 0.1;
- float filtering = 100;
- PImage pic2;
- void setup() {
- size(640, 480);
- smooth();
- minim = new Minim(this);
- voice = minim.getLineIn(Minim.STEREO, 2048);
- fft = new FFT(voice.bufferSize(), voice.sampleRate());
- for (int i=0; i<numBalloons; i++) {
- balloons[i] = new Balloon( i , i );
- }
- pic2 = loadImage("pic2.JPG");
- }
- void draw() {
- background(255);
- analyseSound(); // done once, end result = new dampedVolume value
- for (int i=0; i<balloons.length; i++) {
- balloons[i].display();
- }
- }
- void analyseSound() {
- fft.forward(voice.mix);
- float volume = 0;
- for (int i=0; i<filtering; i++) {
- volume += fft.getBand(i);
- }
- volume *= 0.25;
- dampedVolume = dampedVolume + (volume - dampedVolume)*damping;
- }
- void stop() {
- voice.close();
- minim.stop();
- super.stop();
- }
- class Balloon {
- float x, y;
- color c;
- float scaler;
- Balloon(float x, float y) {
- this.x = x;
- this.y = y;
- scaler = random(0.5, 2);
- }
- void display() {
- noStroke();
- for (int x=1; x<160; x++) {
- for (int y=1; y<120; y++) {
- noStroke();
- int imageColor = pic2.width*y+x;
- fill(pic2.pixels[imageColor],30);
- ellipse(x*4, y*4, dampedVolume*scaler, dampedVolume*scaler);
- }
- }
- }
- }
from your adapted code, I just changed and added some things to
match the color and to array to be shown as picture.
however, It doesn't work too.. -d-
please would you help me for last chance...;;?