Basic Programming question! keeping
in
Contributed Library Questions
•
1 year ago
Greeting all! I'm a processing newbie so please go easy.
I've been doing a project with the super collider library to learn some processing.
For a basic test of concept I've having rectangles spawn on click, but I'm stumped
as to how they should "stay". I imagine I insert a "delay" command somewhere,
though I would prefer it if there was just a static maximum number of rectangles
available.
Here's my code so far:
// ojective 1: make new synthes and things per click.
import supercollider.*;
import oscP5.*;
import netP5.*;
Synth synth;
void setup ()
{
size(800, 800);
// uses default sc server at 127.0.0.1:57110
// does NOT create synth!
synth = new Synth("sine");
// set initial arguments
synth.set("amp", 0.5);
synth.set("freq", 80);
}
void draw ()
{
background(0);
}
void mousePressed() {
float r = random ( 0, 800);
float s = random ( 0, 800);
float t = random ( 0, 800);
float u = random ( 0, 800);
float v = random ( 0, 10000);
rect(r,s ,t , u);
synth.create();
synth.set("freq", 40 + v);
}
at least it makes noise!
I've been doing a project with the super collider library to learn some processing.
For a basic test of concept I've having rectangles spawn on click, but I'm stumped
as to how they should "stay". I imagine I insert a "delay" command somewhere,
though I would prefer it if there was just a static maximum number of rectangles
available.
Here's my code so far:
// ojective 1: make new synthes and things per click.
import supercollider.*;
import oscP5.*;
import netP5.*;
Synth synth;
void setup ()
{
size(800, 800);
// uses default sc server at 127.0.0.1:57110
// does NOT create synth!
synth = new Synth("sine");
// set initial arguments
synth.set("amp", 0.5);
synth.set("freq", 80);
}
void draw ()
{
background(0);
}
void mousePressed() {
float r = random ( 0, 800);
float s = random ( 0, 800);
float t = random ( 0, 800);
float u = random ( 0, 800);
float v = random ( 0, 10000);
rect(r,s ,t , u);
synth.create();
synth.set("freq", 40 + v);
}
at least it makes noise!
1