trigger sound just once not every frame
in
Contributed Library Questions
•
1 year ago
hi, here is simple visual sequence loop (below)
this triggers sound in SuperCollider: osc.send("/oo", new Object[] {"test","set", "t_trig",1}, sc);
problem: i need to trigger this sound just once, but right now it is triggered on every frame while if(m<2000)
i tried
if(m==2000){osc.send("/oo", new Object[] {"test","set", "t_trig",1}, sc);}
and it should work but seems it is too fast and results is inconsistent
any ideas how to achieve that in different way? i sort of need noLoop within loop
// code fragment
void draw(){
background(0);
fill(255);
noStroke();
int m = millis() - startTime;
}
if(m<2000){
rect(width/2,height/2,width,height);
osc.send("/oo", new Object[] {"test","set", "t_trig",1}, sc); // triggering sound
} else if (m<3000){
rect(width/2,height/2,width*0.5,height*0.5);
}
else if(m<5000){
startTime=millis();
}
}
this triggers sound in SuperCollider: osc.send("/oo", new Object[] {"test","set", "t_trig",1}, sc);
problem: i need to trigger this sound just once, but right now it is triggered on every frame while if(m<2000)
i tried
if(m==2000){osc.send("/oo", new Object[] {"test","set", "t_trig",1}, sc);}
and it should work but seems it is too fast and results is inconsistent
any ideas how to achieve that in different way? i sort of need noLoop within loop
// code fragment
void draw(){
background(0);
fill(255);
noStroke();
int m = millis() - startTime;
}
if(m<2000){
rect(width/2,height/2,width,height);
osc.send("/oo", new Object[] {"test","set", "t_trig",1}, sc); // triggering sound
} else if (m<3000){
rect(width/2,height/2,width*0.5,height*0.5);
}
else if(m<5000){
startTime=millis();
}
}
1