Response of SC server/ How can I make multiple synths?
in
Contributed Library Questions
•
4 months ago
Hi, I am writing a small program using Arduino, Processing and SC. The idea is that an accelerometer will be placed in a watering can and when tipped the screen will display raindrops. When the raindrops hit the bottom of the screen(y height) they will make a sound. Ideally I would like each raindrop to have an individual sound. I am from a Max msp background and if it was max I would say that I would like each raindrop to be a separate groove object so that the raindrops can begin to make chords and melodies.
Currently the SC server cannot process the information fast enough so there are large gaps between sound. Could anyone help me out with this? I would prefer it if you could guide me to a solution rather than just giving me the code, otherwise I will never learn!
Apologies about the long post here is my code currently.
Currently the SC server cannot process the information fast enough so there are large gaps between sound. Could anyone help me out with this? I would prefer it if you could guide me to a solution rather than just giving me the code, otherwise I will never learn!
Apologies about the long post here is my code currently.
- import supercollider.*;
import oscP5.*;
Rain r1;
Synth synth;
ArrayList<Rain> drops;
void setup() {
size(600, 600);
drops = new ArrayList<Rain>();
drops.add(new Rain());
synth = new Synth("sine"); //Should I be creating an array of synths?
synth.set("freq", 80);
synth.set("amp", 0.0);
synth.create();
}
void draw() {
background(255);
fill(255, 80);
rect(0, 0, 600, 600);
for (int i = drops.size()-1;i >=0; i--) {
Rain rain = drops.get(i);
rain.fall();
}
}
void mousePressed() {
drops.add(new Rain()); //This is where I will add the arduino
}
void exit() {
synth.free();
super.exit();
}
class Rain {
float r = random(600);
float y = random(-height);
void fall() {
y = y + 7;
fill(0, 10, 200, 180);
ellipse(r, y, 10, 10);
if (y>height) {
r = random(600);
y = random(-200);
synth.set("freq", r);
synth.set("amp", 0.5);
}
else if (y >height - height/2){
synth.set("amp", 0);
} //This is probably a really stupid way to try and get the synth to // make a short noise
}
}
}
1