Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

Re : Making dots bigger recognizing volume or pitch of the voice (mic)

$
0
0

Hello, Amnon.owed!

I have done until this far but can I please ask you more questions?

I want to use filter (posterize) in this codation to make this bubbles look more prettier, or I want to use gradation, but it doesn't work at all.

How can I make this more prettier using filter (posterize) or gradation?

Please give me an answer .Thank you. 

 

/**
 * Mirror 2 
 * by Daniel Shiffman. 
 *
 * Each pixel from the video source is drawn as a rectangle with size based on brightness.  
 */


import krister.Ess.*;

int bufferSize;
int steps;
float limitDiff;
int numAverages=1;
float myDamp=.1f;
float maxLimit,minLimit;

FFT myFFT;
AudioInput myInput;
int audioSensibility;
 
import processing.video.*;

// Size of each cell in the grid
int cellSize = 10;
// Number of columns and rows in our system
int cols, rows;
// Variable for capture device
Capture video;


void setup() {

  
  smooth();

  
  Ess.start(this);  
    bufferSize=512;
  myInput=new AudioInput(bufferSize);

  // set up our FFT
  myFFT=new FFT(bufferSize*2);
  myFFT.equalizer(true);

  // set up our FFT normalization/dampening
  minLimit=.049;
  maxLimit=.05;
  myFFT.limits(minLimit,maxLimit);
  myFFT.damp(myDamp);
  myFFT.averages(numAverages);

  // get the number of bins per average 
  steps=bufferSize/numAverages;

  // get the distance of travel between minimum and maximum limits
  limitDiff=maxLimit-minLimit;
    myInput.start();
   audioSensibility = 350;
  
  size(1024, 800, P3D);
  // Set up columns and rows
  cols = width/2 / cellSize;
  rows = height/2 / cellSize;
  colorMode(RGB, 255, 255, 255, 100);
  ellipseMode(CENTER);

  // Uses the default video input, see the reference if this causes an error
  video = new Capture(this, 640, 480);
  video.start();
 // frameRate(45); 

  filter(BLUR,10);
}


void draw() { 
  


  float percent=max(0,(myFFT.max-minLimit)/limitDiff);
 
 // rect(600,11,50,(int)(198*percent)); 

  if (video.available()) {
    video.read();
    video.loadPixels();
    
    background(0,0,0);
   //filter(BLUR,10);
    // Begin loop for columns
    for (int i = 0; i < cols;i++) {
      // Begin loop for rows
      for (int j = 0; j < rows;j++) {

        // Where are we, pixel-wise?
        int x = i*cellSize + cellSize/2;
        int y = j*cellSize + cellSize/2;
        int loc = (video.width - x - 1) + y*video.width; // Reversing x to mirror the image
        
        // Each rect is colored white with a size determined by brightness
        color c = video.pixels[loc];
        float sz = ((percent)*1000/ float(width)) * brightness(video.pixels[loc]) + 20.0;
        pushMatrix();
       translate(x , y , sz);
       
       println("percent : "+percent);
      //translate(x , y , sz+20);
        fill(c);
        ;
        noStroke();
     
        
        ellipse(0, 0, cellSize , cellSize);
        //ellipse(x + cellSize/2, y + cellSize/2,sz*brightness(c)/255, sz*brightness(c)/255);
           popMatrix();
           
      }
    }
  }
}
public void audioInputData(AudioInput theInput) {
  myFFT.getSpectrum(myInput);
}


Viewing all articles
Browse latest Browse all 1768

Trending Articles