Audio Reactive visuals with Minim Library.

In an effort to learn how to make audio reactive visual work with processing, I have created 4 columns of rapidly moving shapes (inspired by Ryoji Ikeda). I have got the sketch looking as I want it, only that now I want it to react to audio data coming from Ableton (via sound flower, or the main built in output). I heard this was possible with the minim library? but I have no idea how it works. I would like to put black covers over the columns and have them disappear when a certain amplitude is hit for example. Any suggestions? or sources where I can learn about the minim library?

Code:

import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
import ddf.minim.signals.*;
import ddf.minim.spi.*;
import ddf.minim.ugens.*;

float GV_Y001 = 95;
float GV_Y002 = 95;
float GV_Y003 = 95;
float GV_Y004 = 95;

float GV_Y005 = 625;
float GV_Y006 = 625;
float GV_Y007 = 625;
float GV_Y008 = 625;

float GV_Y009 = 50;

float GV_SPD001 = 10;
float GV_SPD002 = 5;
float GV_SPD003 = 50;

float GV_VT = 625; 
float GV_VB = 95;

void setup () {
  size (1280, 720);
  smooth ();

}

void draw () {

  background (0);
  PTRN();

  // ERROR BAR

  stroke (0,0,0);
  fill (0,0,0);
  rect (0,625,1280,95);

}   

void PTRN () {

    for (int i = 0; i < 5; i = i + 1 ) {
    for (int j = 0; j < 5; j = j + 1 ) {

    // BARSET_001

  stroke (255);
  fill (255);

  rect (0, GV_Y001, 320, random (1, 50));
  GV_Y001 = GV_Y001 + GV_SPD001;
  if (GV_Y001 == GV_VT) { 
    GV_Y001 = random (GV_VT, GV_VB);
    if (GV_Y001 < 626) { 
      GV_Y001 = 95;
    }
  } 

  rect (320, GV_Y002, 320, random(1, 20));
  GV_Y002 = GV_Y002 + GV_SPD002;
  if (GV_Y002 == GV_VT) { 
    GV_Y002 = random(GV_VT, GV_VB);
    if (GV_Y002 < 626) { 
      GV_Y002 = 95;
    }
  } 

  rect (640, GV_Y003, 320, random(1, 60));
  GV_Y003 = GV_Y003 + GV_SPD001;
  if (GV_Y003 == GV_VT) { 
    GV_Y003 = random(GV_VT, GV_VB);
     if (GV_Y003 < 626) { 
      GV_Y003 = 95;
    }
  } 

  rect (960, GV_Y004, 320, random(1, 10));
  GV_Y004 = GV_Y004 + GV_SPD002;
  if (GV_Y004 == GV_VT) { 
    GV_Y004 = random(GV_VT, GV_VB);
     if (GV_Y004 < 626) { 
      GV_Y004 = 95;
    }
  }

  // BARSET_002 (Inverted)

    rect (0, GV_Y005, 320, random (1, 10));
  GV_Y005 = GV_Y005 - GV_SPD001;
  if (GV_Y005 == GV_VB) { 
    GV_Y005 = random (GV_VT, GV_VB);
    if (GV_Y005 < 94) { 
      GV_Y005 = 625;
    }
  } 

  rect (320, GV_Y006, 320, random(1, 70));
  GV_Y006 = GV_Y006 - GV_SPD002;
  if (GV_Y006 == GV_VB) { 
    GV_Y006 = random(GV_VT, GV_VB);
    if (GV_Y006 < 94) { 
      GV_Y002 = 625;
    }
  } 

  rect (640, GV_Y007, 320, random(1, 60));
  GV_Y007 = GV_Y007 - GV_SPD001;
  if (GV_Y007 == GV_VB) { 
    GV_Y007 = random(GV_VT, GV_VB);
     if (GV_Y007 < 94) { 
      GV_Y007 = 625;
    }
  } 

  rect (960, GV_Y008, 320, random(1, 100));
  GV_Y008 = GV_Y008 - GV_SPD002;
  if (GV_Y008 == GV_VB) { 
    GV_Y008 = random(GV_VT, GV_VB);
     if (GV_Y008 < 94) { 
      GV_Y008 = 625;
    }
  }

  }
 }

}
Sign In or Register to comment.