sc_code

s.boot;
s.meter;



// value osc_Receive
(
~value = OSCresponder(nil, 'PROC',{ arg time, responder, msg;
	if(msg[1] == 1) {
		~event3 = Synth.new("ball", ['freq',msg[2]*440,'vol',0.3]); //set freq
		postln(" ballCount : " + msg[1]);
	};
}).add )




// SynthDef



( SynthDef.new("ball",
		{ arg freq = 500, vol = 0.5;
			var sig;
			 
			sig = SinOsc.ar(freq)*EnvGen.ar(Env.perc(0.01,0.5),doneAction: 2);
			sig = sig * vol;
			sig = Pan2.ar(sig,0);
			
			Out.ar(0,sig);
		}).send(s)
		)



~value.remove
Advertisements