We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, I don't know how to change the frequency of a given Oscil. Can anybody help me guess how? Thanx. The code:
import ddf.minim.*;
import ddf.minim.signals.*;
import ddf.minim.ugens.*;
Minim minim;
AudioOutput out;
Oscil myOscil;
void setup()
{
size(300, 300);
minim = new Minim(this);
out = minim.getLineOut(Minim.STEREO, 512);
myOscil = new Oscil( 220, 0.3, Waves.SINE );
myOscil.patch(out);
}
void draw()
{
background(0);
}
void keyPressed()
{
switch(key) {
case '1': myOscil.setFreq(+10); break;
case '2': myOscil.setFreq(-10);; break;
}
}
void stop()
{
out.close();
minim.stop();
super.stop();
}
Answers
Excuse me, I didn´t explain that what I wanted was to increase and decrease the frequency of the wave by pressing the key 1 and the key 2. Thanx.