Day 16

Posted: September 17th, 2010 | Author: | Filed under: Uncategorized | No Comments »
Today I almost forgot to do my piece. I have been watching a lot of Alva Noto so today is my stab at a classic bass drum gesture. A black screen with a mouse click that fires a bass drum sample and flashes a white screen that fades. I didn’t think an image of a white or black screen was worth a screenshot, so enjoy the code.

import javax.media.opengl.*;
import processing.opengl.*;
import ddf.minim.*;
import ddf.minim.ugens.*;

Minim minim;
AudioOutput out;
Oscil o;
Damp env;

float a;

void setup()
{
  size(720,480,OPENGL);
  hint(ENABLE_OPENGL_4X_SMOOTH);  

  minim = new Minim(this);
  out = minim.getLineOut(Minim.STEREO);
  env = new Damp();
  o = new Oscil(50,1.0, Waves.SINE);
  o.patch(env).patch(out);

  fill(0);
  noStroke();
  rect(0,0,width,height);
}

void draw()
{
  noStroke();
  fill(0,6);
  rect(0,0,width,height);
}

void mouseClicked()
{

   fill(255);
   rect(0,0,width,height);
   o.setPhase(0);
   env.activate();
}


Leave a Reply