Hello!!
I have a problem with Ess. Any idea about that? thanks!!
I have a problem with Ess. Any idea about that? thanks!!
- import processing.opengl.*;
import krister.Ess.*; //sound library
boolean nl1,nl2,nl3,nl4,nl5,nl6;
boolean rec;
float rotx = 0;
float roty = 0;
int num = 120;//Arithos Sformon se kathe Sforma
int free=0,colorL=255,megethos = 400,k = 0,j=100,i=200;
float x,y,z;
float r,th=0,step=.1,epi=200;
float m = 1,n1=-1,n2=0,n3=0;
float b=1,a=1;
int counter1=158,counter2=0;
//audio
//call audiofilters/channels
AudioChannel ac;
SineWave sine;
Envelope myEnvelope;
int envelopeLength = 1000;
void setup()
{
//size(screen.width,screen.height,OPENGL);//screen.height
size(400, 300,OPENGL);
background(0);
frameRate(30);
smooth();
rectMode(CENTER);
Ess.start(this);
}
void draw()
{
counter1++;
if (counter1 == 160) {
m=int(random(3,40));
n1=random(.5);
n2=random(6.);
n3=int(random(0,10));
epi=int(random(50,150));
step=random(.01,10);
colorL = 255;
colorL = colorL*int(random(0.4,1.99));
counter1=0;
}
translate(width/2,height/2);
stroke(colorL,5);
noFill();
beginShape();
for(int i=1; i < num; i++) {
r = epi*pow(((pow(abs(cos(m*th/4)/a),n2))+(pow(abs(sin(m*th/4)/b),n3))),(-1/n1));
th = th + step;
x = r*cos(th);
y = r*sin(th);
curveVertex(x,y);
curveVertex(x+random(free),y+random(free));
soundSynthesis(x+y);
}
endShape();
noCursor();
}
void soundSynthesis(float x) {
ac = new AudioChannel();
ac.initChannel(ac.frames(envelopeLength));
sine=new SineWave(x, 0.1);
sine.generate(ac, 0, ac.frames(envelopeLength));
//gain envelope
EPoint[] env=new EPoint[3];
env[0]=new EPoint(0,0);
env[1]=new EPoint(0.1,0.1);
env[2]=new EPoint(envelopeLength/1000,0);
myEnvelope=new Envelope(env);
myEnvelope.filter(ac);
ac.play();
}
1