[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] AudioIn triggering a Routine



hallo,

in SuperCollider 3 you have to distinguish between things that are on the Server side, for example Synths (connected UGens) and stuff on the Client side, for example a Routine. To communicate back from Server to Client, e.g. to control a Routine through a UGen such as AudioIn, you need to use the special UGen SendTrig which sends trigger messages back to the Client :

(
SynthDef( \pling, { arg freq = 440, mul = 0.1;
	var line;
	
	line = Line.ar( mul, 0, 0.1, doneAction: 2 );
	Out.ar( 0, Pan2.ar( SinOsc.ar( freq, mul: line )));
}).send( s );
)

(
r = Routine({
	rrand( 1, 4 ).do({ arg i;
		Synth( \pling, [ \freq,  rrand( 60, 80 ).midicps ]);
		0.1.wait;
	});
});
)

(
  {
  	var inp, trig;
  	
  	inp = AudioIn.ar( 1 );
//  	trig = Compander.ar( inp, inp, -6.dbamp, inf, 1, 0.01, 0.1 );
  	trig = Amplitude.kr( inp ) > -12.dbamp;
  	SendTrig.kr( trig );
  }.play;
 )

(
n = OSCresponderNode( s.addr, '/tr', { arg time, resp, msg;
	if( r.isPlaying, {
		"stop!".inform;
		r.stop;
	}, {
		"play!".inform;
		r.reset;
		r.play;
	});
}).add;
)

n.remove;

check the help file for SendTrig.

ciao , -sciss-


Am 14.05.2006 um 18:02 schrieb Johannes Quint:

with the 'gate'-parameter, i can control an EnvGen by an AudioIn- signal.
but can i start (and stop) a routine by an AudioIn-signal too?
thanks for help,
johannes quint