• fullscreen
  • Cicloide.pde
  • progetto_filtri.pde
  • float r;
    float t,d;
    int posX;
    int posY;
    float incremento;
    float x1,x2;
    float y1,y2;
    float x3,x4;
    float y3,y4;
    color c;
    
    public class cicloide{
        
      cicloide(float raggio,int posizioneX, int posizioneY, color colore){
        r = raggio;
        t= 0.0;
        d= 0.0;
        posX = posizioneX;
        posY = posizioneY;
        incremento = +0.05;
        c= colore;
      }
      
      void display(){
           for(int i = 0; i<=120*Math.PI; i++){
              
             stroke(c);
              x1=  posX-(r*(t-sin(t)));
              y1=  posY-(r*(1-cos(t)));
              t = t-incremento;
              x2=  posX-(r*(t-sin(t)));
              y2=  posY-(r*(1-cos(t)));
              line(x1, y1,x2,y2);
              
              stroke(c);
              x3=  posX+(r*(d-sin(d)));
              y3=  posY+(r*(1-cos(d)));
              d = d+incremento;
              x4=  posX+(r*(d-sin(d)));
              y4=  posY+(r*(1-cos(d)));
              line(x3, y3,x4,y4);
              
          }
      }
    }  
    
    import ddf.minim.*;
    import ddf.minim.signals.*;
    import ddf.minim.analysis.*;
    import ddf.minim.effects.*;
    
    
    Minim minim;
    AudioPlayer song;
    FFT fft;
    HighPassSP highpass;
    
    
    
    void setup(){
      size(600,500);
      
      minim = new Minim(this);
    
      song = minim.loadFile("Talking Heads Psycho Killer (HQ).mp3", 1024);
      song.loop();
      highpass = new HighPassSP(200,44100);
      fft = new FFT(song.bufferSize(), song.sampleRate());
      fft.logAverages(22,3);
      song.addEffect(highpass);
      
      noStroke();
    }
    
    
    void draw(){
      color c = color(mouseX,mouseY,0);
      rect(0,0,width,height);
      
      fill(0,170);
      fft.forward(song.mix);
      for (int i = 0; i < fft.avgSize(); i++)
      {
         cicloide ciclo = new cicloide(map(fft.getBand(i), 0, 100, 0, 120),0,250, c);
         ciclo.display();
         println(fft.getBand(i));
      }
      if(mouseY<=height/2){
        highpass.setFreq( map(mouseY, 0, height, 120, 10000));
      }
      if(mouseY>height/2){
        highpass.setFreq( map(mouseY, height, 0, 120, 10000));
      }
    }
    
    void stop(){
      
      song.close();
      minim.stop();
      super.stop();
    }
      
      
      
      
    
    
    

    code

    tweaks (0)

    about this sketch

    This sketch is running as Java applet, exported from Processing.

    license

    advertisement

    Giulia Tuveri

    progetto_filtro

    Add to Faves Me Likey@!
    You must login/register to add this sketch to your favorites.

    You need to login/register to comment.