Loading...
Logo
Processing Forum
t.boet's Profile
2 Posts
0 Responses
0 Followers

Activity Trend

Last 30 days

Loading Chart...

Show:
Private Message
    How can I rotate this audiovisualizer from left to right, instead from the bottom to the middle?

    class Timer {
    int savedTime; // When Timer started
    int totalTime; // How long Timer should last

      Timer(int tempTotalTime) {
      totalTime = tempTotalTime;
    }

    // Starting the timer
    void start() {
    // When the timer starts it stores the current time in milliseconds.
    savedTime = millis(); 
    }

    // The function isFinished() returns true if 5,000 ms have passed. 
    // The work of the timer is farmed out to this method.
    boolean isFinished() { 
    // Check how much time has passed
      int passedTime = millis()- savedTime;
      if (passedTime > totalTime) {
      return true;
      } 
      else {
      return false;
      }
     }
    }
    Timer timer;
    import ddf.minim.analysis.*;
    import ddf.minim.*;
    Minim minim;
    AudioInput in;
    FFT fft;
    int w;
    PImage fade;
    int hVal;
    float rWidth, rHeight;




    boolean b = false;
    void setup() {


    background(#FFFFFF);
    timer = new Timer(300);
    timer.start();
    size(1280, 720, P3D);


    minim = new Minim(this);
    in = minim.getLineIn(Minim.STEREO, 512);
    fft = new FFT(in.bufferSize(), in.sampleRate());
    fft.logAverages(5000, 50);
    stroke(255);
    w = width/fft.avgSize();
    strokeWeight(w);


    fade = get(0, 0, width, height);

    rWidth = width * 0.99;
    rHeight = height * 0.99;
    hVal = 0;
    }




    void draw() {
     
      
    if (timer.isFinished()) {
    b = true;
    timer.start();
    }
    if(b==true){

    tint(255, 255, 255, 255 );
    image(fade, (width - rWidth) /2, (height - rHeight) /4, rWidth, rHeight);
    noTint();



    fft.forward(in.mix);


    colorMode(HSB);
    stroke(hVal, 255, 255);
    colorMode(RGB);





    for(int i = 0; i < fft.avgSize(); i++){
    line((i * w) + (w / 2), height, (i * w) + (w /2), height - fft.getAvg(i) * 4); 
    }

    fade = get(0, 0, width, height);

     pushMatrix();
    rotate(radians(-45));
    popMatrix(); 
    translate(0, 0);

    for(int i = 0; i < fft.avgSize(); i++){
    line((i * w) + (w / 2), height, (i * w) + (w /2), height - fft.getAvg(i) * 4); 
    }



    hVal += 2;
    if( hVal > 255)
    {
    hVal = 0;
    }
    }
    }

    Hi,

    I was hoping someone could help me. I have made an audio visualizer but I want to add a text that displays 5 seconds before the audio visualizer starts.I want to show the text, when the text disapear the user can speak and the see that the audio visualizer react to their voices. This I want to do with 5 lines of text. So 5 seconds of text is displayed then the audio visualizer reacts to the users voice for about 15 seconds, then another line of text pops up en so on.

    I hope you guys can help me.

    Here is the code for the visualizer:

    import ddf.minim.analysis.*;
    import ddf.minim.*;

    Minim minim;
    AudioInput in;
    FFT fft;
    int w;
    PImage fade;

    int hVal;

    float rWidth, rHeight;


    void setup()
    {
     size(1280, 720, P3D);
     minim = new Minim(this);
     in = minim.getLineIn(Minim.STEREO, 512);
     fft = new FFT(in.bufferSize(), in.sampleRate());
     fft.logAverages(5000, 50);

     stroke(255);
     w = width/fft.avgSize();
     strokeWeight(w);
     

     
     background(0);
     fade = get(0, 0, width, height);
     
     rWidth = width * 0.99;
     rHeight = height * 0.99;
     hVal = 0;

    }

    void draw()

      background(0);
      tint(255, 255, 255, 254 );
      image(fade, (width - rWidth) /2, (height - rHeight) /4, rWidth, rHeight);
      noTint();
      
      fft.forward(in.mix);
      
      
      colorMode(HSB);
      stroke(hVal, 255, 255);
      colorMode(RGB);
      
        
      
      for(int i = 0; i < fft.avgSize(); i++){
        line((i * w) + (w / 2), height, (i * w) + (w /2), height - fft.getAvg(i) * 4); 
       }
       
      fade = get(0, 0, width, height);
      
       
        for(int i = 0; i < fft.avgSize(); i++){
        line((i * w) + (w / 2), height, (i * w) + (w /2), height - fft.getAvg(i) * 4); 
       }
      
      
      hVal += 2;
      if( hVal > 255)
      {
        hVal = 0;
      }


    }