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

Re: [sc-users] Re: Basic SendTrig->OSCresponder



Great, thanks, exactly what I was looking for!

Just wondering why it's not responding exactly as I expect. Here's a simplified example with two triggers and two corresponding responders (at least that's the intention):



Server.default = s = Server.internal;
s.boot;

(
SynthDef("trigger1", {arg trigID=1;
	var trig;
	trig = Impulse.ar(2);
	SendTrig.ar(
		trig,
		trigID
	);
}).send(s);
)


(
SynthDef("trigger2", {arg trigID=2;
	var trig;
	trig = Impulse.ar(5);
	SendTrig.ar(
		trig,
		trigID
	);
}).send(s);
)


(
SynthDef("synth1", {
	var synth, env;

	synth = SinOsc.ar(1000, mul: [0.9, 0]);
	env = EnvGen.kr(Env.perc(0, 0.5), doneAction: 2);

	Out.ar(0, synth * env);
}).send(s);
)


(
SynthDef("synth2", {
	var synth, env;

	synth = BrownNoise.ar(mul: [0, 0.9]);
	env = EnvGen.kr(Env.perc(0, 0.5), doneAction: 2);

	Out.ar(0, synth * env);
}).send(s);
)


(
~osc1=OSCpathResponder(s.addr, ['/tr', nil, 1], {
	Synth("synth1")
}).add;
)


(
~osc2=OSCpathResponder(s.addr, ['/tr', nil, 2], {
	Synth("synth2")
}).add;
)


//why do both OSCpathResponders respond to "trigger2":
y=Synth("trigger2");
y.free;

//and why does only ~osc1 respond to "trigger1" (which is what i hoped for), but louder (which is not what i hoped for):
x=Synth("trigger1");
x.free;



I was hoping for ~osc1 to respond to "trigger1" and ~osc2 to respond to "trigger2". No more, no less. Not so, it seems.

(I guess I should manage my synth nodes a little better, but that's the next problem.)



cheers,
m

Den 1/3-2006, kl. 10.41, skrev Item State:

hi,

have a look at the OSCpathResponder help file, there
is an example that shows how to do it! the path
responder in addition to a normal OSCresponderNode
will not just filter /tr messages but also any number
of arguments, so you can use two path responders, one
responding to the ID of your first SendTrig object,
the other responding to the other ID. the ID in
SendTrig is used to distinguish the SendTrig objects,
the value is something you can associate with any
parameter you wish to transmit (or set it to zero if
you don't want to use it).

best, -sciss-

--- sc-users-request@xxxxxxxxxxxxxxx wrote:
Message: 2
Date: Wed, 1 Mar 2006 00:45:15 +0100
From: Martin Vognsen <Bush@xxxxxxxxx>
Subject: [sc-users] Basic SendTrig->OSCresponder
question
[...]
I'm hacking up a simple patch to trigger samples via
OSCresponder,
using AudioIn as input to SendTrig. I think I need
to do it this way,
as I want an element of randomness (same input ->
different output).
This works fine, but what I'm not getting is this:
How do I (meaning
different OSCresponders) receive messages from
different SendTrigs,
let's say I have multi-channel triggers? I can't
figure out how to use
the ID argument in SendTrig. Any pointers? Seems
like it should be
basic, but I missed it somehow.



		
____________________________________________________
Do you Yahoo!?
The New Yahoo! Movies: Check out the Latest Trailers, Premiere Photos and full Actor Database.
http://au.movies.yahoo.com
_______________________________________________
sc-users mailing list
sc-users@xxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-users