Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import ddf.minim.*;
- import ddf.minim.analysis.*;
- import ddf.minim.effects.*;
- import ddf.minim.signals.*;
- import ddf.minim.spi.*;
- import ddf.minim.ugens.*;
- Minim minim;
- AudioPlayer song;
- BeatDetect beat;
- BeatListener bl;
- float kickSize, snareSize, hatSize;
- int counter = 0;
- class BeatListener implements AudioListener
- {
- private BeatDetect beat;
- private AudioPlayer source;
- BeatListener(BeatDetect beat, AudioPlayer source)
- {
- this.source = source;
- this.source.addListener(this);
- this.beat = beat;
- }
- void samples(float[] samps)
- {
- beat.detect(source.mix);
- }
- void samples(float[] sampsL, float[] sampsR)
- {
- beat.detect(source.mix);
- }
- }
- float detail = 0.6; // amount of detail in the noise (0-1)
- float increment = 0.002; // how quickly to move through noise (0-1)
- float yIncrement = 0.5; // how much to change b/w individual waves (0-1)
- float timeIncrement = 0.01; // speed of change over time (0-1)
- float timeOffset = 0; // incremented each frame to shift the nois
- //int rndOpac = int(random(0, 100));
- int rndOpac = 100;
- color[] colors = {
- color(3, 23, 39, rndOpac),
- color(18, 104, 114, rndOpac),
- color(11, 135, 125, rndOpac),
- color(24, 194, 156, rndOpac),
- color(136, 249, 212, rndOpac),
- color(123, 42, 59, rndOpac),
- color(229, 118, 97, rndOpac),
- color(248, 197, 140, rndOpac),
- color(248, 231, 162, rndOpac),
- color(134, 221, 178, rndOpac),
- color(229, 70, 97, rndOpac),
- color(255, 166, 68, rndOpac),
- color(153, 138, 47, rndOpac),
- color(44, 89, 79, rndOpac),
- color(0, 45, 64, rndOpac),
- color(44, 62, 80, rndOpac),
- color(252, 67, 73, rndOpac),
- color(215, 218, 219, rndOpac),
- color(109, 188, 219, rndOpac),
- color(255, 255, 255, rndOpac),
- color(46, 17, 45, rndOpac),
- color(29, 0, 50, rndOpac)
- };
- void setup() {
- size(800, 800);
- noStroke();
- minim = new Minim(this);
- song = minim.loadFile("Omnivore.mp3", 1024);
- song.play();
- beat = new BeatDetect(song.bufferSize(), song.sampleRate());
- beat.setSensitivity(300);
- kickSize = snareSize = hatSize = 16;
- bl = new BeatListener(beat, song);
- }
- void bubblyshit() {
- background(255);
- //Draw Circles Moving Left
- for (int i=0; i<100; i++) {
- fill (0);
- int randRadius = int(random(0, 15));
- float xpoints = random(0, width);
- float ypoints = random(0, height);
- noStroke();
- ellipse(random(width), random(height), randRadius, randRadius);
- }
- //Draw Circles Moving Right
- for (int i=0; i<100; i++) {
- fill (255, 34, 20);
- int randRadius = int(random(0, 15));
- float xpoints = random(0, width);
- float ypoints = random(0, height);
- noStroke();
- ellipse(random(width), random(height), randRadius, randRadius);
- }
- }
- void bubblyshit0() {
- background(255);
- //Draw Circles Moving Left
- for (int i=0; i<100; i++) {
- fill (0, 0, 255);
- int randRadius = int(random(0, 15));
- float xpoints = random(0, width);
- float ypoints = random(0, height);
- noStroke();
- ellipse(random(width), random(height), randRadius, randRadius);
- }
- //Draw Circles Moving Right
- for (int i=0; i<100; i++) {
- fill (0, 0, 255);
- int randRadius = int(random(0, 15));
- float xpoints = random(0, width);
- float ypoints = random(0, height);
- noStroke();
- ellipse(random(width), random(height), randRadius, randRadius);
- }
- }
- void bubblyshit1() {
- background(255);
- //Draw Circles Moving Left
- for (int i=0; i<100; i++) {
- fill (0,255, 0);
- int randRadius = int(random(0, 15));
- float xpoints = random(0, width);
- float ypoints = random(0, height);
- noStroke();
- ellipse(random(width), random(height), randRadius, randRadius);
- }
- //Draw Circles Moving Right
- for (int i=0; i<100; i++) {
- fill (0, 255, 0);
- int randRadius = int(random(0, 15));
- float xpoints = random(0, width);
- float ypoints = random(0, height);
- noStroke();
- ellipse(random(width), random(height), randRadius, randRadius);
- }
- }
- void draw() {
- if ( beat.isKick() ) counter = (counter +1)%3;
- System.out.println(counter);
- //%int = #of sketches
- switch (counter){
- case 0: bubblyshit();
- case 1: bubblyshit0();
- case 2: bubblyshit1();
- }
- delay(3000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement