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

[sc-dev] crossfading groups, noid for groups



Hi,

 It occurs to me that Group's could be used directly to
provide crossfading similar to Julian's NodeProxy. Basically,
you fade out the group rather than individual members.

 This involves overloading bus assignment with group membership, but this
is already being done in a number of classes.  (I.e., a group has a
private bus its members output to and a public bus where the accumulated
output is written by a separate synth immediately after the group.)

 If this seems like a good idea, then the  message "noid" could be
extended to groups.  It would change the id's of all of its children.
Then on the client side, replacement nodes could be generated without
allocating new ID's.

  Here is a crude example:

SynthDef("fadeIn", { arg i_busOut=0, i_busIn=16, i_dur = 5;
	Out.ar(i_busOut, Line.kr(0, 1, i_dur) * In.ar(i_busIn, 2))
}).writeDefFile;

SynthDef("fadeOut", { arg i_busOut=0, i_busIn=16, i_dur = 5, i_doneAction
= 3; var out;
out = K2A.ar(0);
Out.ar(i_busOut, Line.kr(1, 0, i_dur, doneAction: 3) * In.ar(i_busIn, 2));
ReplaceOut.ar(i_busIn, [out,out]);
	// clear busIn for duplicate group that is fading in
}).writeDefFile;

s.boot;
r = RootNode(s);
b = Bus.audio(s, 2);

g = Group.basicNew(s);
t = Synth.basicNew("fadeIn", s);
s.sendBundle(nil, g.addToTailMsg(r), t.addAfterMsg(g,[\i_busIn,b.index])
);

x = Patch({arg f= 400, a = -20; SinOsc.ar(f,0,a.dbamp) });
x.play(g,0,b);
// x.args.at(0).activeValue_(1000).changed;
// x.synth.set(\f,1000);

u = Synth.basicNew("fadeOut", s);
h = Group.basicNew(s);
v = Synth.basicNew("fadeIn",h.server);

s.sendBundle(nil,
	[\n_set,x.synth.nodeID, \f,1000],
	t.freeMsg,
	u.addAfterMsg(g,[\i_busIn,b.index]),
	h.addAfterMsg(u,[\i_busIn,b.index]),
	v.addAfterMsg(h,[\i_busIn,b.index])

);

x.synth = nil;
// x.args.at(0).activeValue_(1000).changed;
x.play(h,0.1,b,400);