Discussion:
Node:release behaving differently with Synth and Group?
thor
2014-10-15 17:10:39 UTC
Permalink
Hi List

I'm expecting Synth and Group to behave similarly here, but on release of the Group, it's not removed from the server:

s.boot
s.plotTree

x = Synth("default", [\freq, rrand(400, 600)]);
x.release

g = Group.new;
Synth("default", [\freq, rrand(400, 600)], target:g);
Synth("default", [\freq, rrand(400, 600)], target:g);
Synth("default", [\freq, rrand(400, 600)], target:g);

g.release;

I need the release for the group as I want the envelope fadeout.

Any suggestions? I prefer not to hack around as I'm creating hundreds of groups with lots of synths, so deferring the .free of the group is not really an appealing option.


Thor




_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Scott Wilson
2014-10-15 18:38:09 UTC
Permalink
Isn't there a doneAction for that?
Post by thor
Hi List
s.boot
s.plotTree
x = Synth("default", [\freq, rrand(400, 600)]);
x.release
g = Group.new;
Synth("default", [\freq, rrand(400, 600)], target:g);
Synth("default", [\freq, rrand(400, 600)], target:g);
Synth("default", [\freq, rrand(400, 600)], target:g);
g.release;
I need the release for the group as I want the envelope fadeout.
Any suggestions? I prefer not to hack around as I'm creating hundreds of groups with lots of synths, so deferring the .free of the group is not really an appealing option.
Thor
_______________________________________________
sc-users mailing list
info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
thor
2014-10-15 19:20:36 UTC
Permalink
Post by Scott Wilson
Isn't there a doneAction for that?
Not that I can see:

g = Group.new;
x = Synth("default", [\freq, rrand(400, 600)], target:g, doneAction:14);
Synth("default", [\freq, rrand(400, 600)], target:g, doneAction:14);
Synth("default", [\freq, rrand(400, 600)], target:g, doneAction:14);

x.release // doneAction 14 is supposed to free the enclosing group and all the nodes within it - doesn't do that
g.release; // not working either
Post by Scott Wilson
Post by thor
Hi List
s.boot
s.plotTree
x = Synth("default", [\freq, rrand(400, 600)]);
x.release
g = Group.new;
Synth("default", [\freq, rrand(400, 600)], target:g);
Synth("default", [\freq, rrand(400, 600)], target:g);
Synth("default", [\freq, rrand(400, 600)], target:g);
g.release;
I need the release for the group as I want the envelope fadeout.
Any suggestions? I prefer not to hack around as I'm creating hundreds of groups with lots of synths, so deferring the .free of the group is not really an appealing option.
Thor
_______________________________________________
sc-users mailing list
info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
_______________________________________________
sc-users mailing list
info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Dan Zink
2014-10-15 20:04:35 UTC
Permalink
That's not how doneAction works; 14 is the number you want, but you need to
call it from a UGen. Check the manual for the following UGens, hopefully
one will do what you need:

PlayBuf
RecordBuf
EnvGen
Line
XLine
Linen
LFGauss
DemandEnvGen
DetectSilence
PlayBuf
Duty
TDuty

Once they end, they will run the doneAction.
Post by thor
Post by Scott Wilson
Isn't there a doneAction for that?
g = Group.new;
x = Synth("default", [\freq, rrand(400, 600)], target:g, doneAction:14);
Synth("default", [\freq, rrand(400, 600)], target:g, doneAction:14);
Synth("default", [\freq, rrand(400, 600)], target:g, doneAction:14);
x.release // doneAction 14 is supposed to free the enclosing group and all
the nodes within it - doesn't do that
g.release; // not working either
Post by Scott Wilson
Post by thor
Hi List
I'm expecting Synth and Group to behave similarly here, but on release
s.boot
s.plotTree
x = Synth("default", [\freq, rrand(400, 600)]);
x.release
g = Group.new;
Synth("default", [\freq, rrand(400, 600)], target:g);
Synth("default", [\freq, rrand(400, 600)], target:g);
Synth("default", [\freq, rrand(400, 600)], target:g);
g.release;
I need the release for the group as I want the envelope fadeout.
Any suggestions? I prefer not to hack around as I'm creating hundreds
of groups with lots of synths, so deferring the .free of the group is not
really an appealing option.
Post by Scott Wilson
Post by thor
Thor
_______________________________________________
sc-users mailing list
http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
Post by Scott Wilson
Post by thor
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
_______________________________________________
sc-users mailing list
http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
Post by Scott Wilson
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
_______________________________________________
sc-users mailing list
http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Scott Wilson
2014-10-15 20:13:55 UTC
Permalink
Post by thor
Post by Scott Wilson
Isn't there a doneAction for that?
g = Group.new;
x = Synth("default", [\freq, rrand(400, 600)], target:g, doneAction:14);
Synth("default", [\freq, rrand(400, 600)], target:g, doneAction:14);
Synth("default", [\freq, rrand(400, 600)], target:g, doneAction:14);
x.release // doneAction 14 is supposed to free the enclosing group and all the nodes within it - doesn't do that
g.release; // not working either
There’s no doneAction arg in the default def. This works:

SynthDef(\test, {arg freq = 440, gate = 1;
Out.ar(0, SinOsc.ar(freq, 0, 0.1) * EnvGen.kr(Env.cutoff, gate, doneAction:14))
}).add;

g = Group.new;
x = Synth("test", [\freq, rrand(400, 600)], target:g, doneAction:14);
Synth("test", [\freq, rrand(400, 600)], target:g, doneAction:14);
Synth("test", [\freq, rrand(400, 600)], target:g, doneAction:14);

g.release;

S.
thor
2014-10-15 20:45:20 UTC
Permalink
I'm too tired today. Of course doneActions don't work as a synth argument.

Thanks guys for getting my head straight!
Thor
Post by Scott Wilson
Post by thor
Post by Scott Wilson
Isn't there a doneAction for that?
g = Group.new;
x = Synth("default", [\freq, rrand(400, 600)], target:g, doneAction:14);
Synth("default", [\freq, rrand(400, 600)], target:g, doneAction:14);
Synth("default", [\freq, rrand(400, 600)], target:g, doneAction:14);
x.release // doneAction 14 is supposed to free the enclosing group and all the nodes within it - doesn't do that
g.release; // not working either
SynthDef(\test, {arg freq = 440, gate = 1;
Out.ar(0, SinOsc.ar(freq, 0, 0.1) * EnvGen.kr(Env.cutoff, gate, doneAction:14))
}).add;
g = Group.new;
x = Synth("test", [\freq, rrand(400, 600)], target:g, doneAction:14);
Synth("test", [\freq, rrand(400, 600)], target:g, doneAction:14);
Synth("test", [\freq, rrand(400, 600)], target:g, doneAction:14);
g.release;
S.
Stephan Wittwer
2014-10-15 21:13:32 UTC
Permalink
Post by thor
I'm too tired today. Of course doneActions don't work as a synth argument.
Actually they do work.

Good night,
Stephan
Post by thor
Thanks guys for getting my head straight!
Thor
Stephan Wittwer
2014-10-15 22:18:13 UTC
Permalink
Post by Stephan Wittwer
Post by thor
I'm too tired today. Of course doneActions don't work as a synth argument.
Actually they do work.
But it's late here too ...

(
SynthDef("hasFreq", { | freq = 440, amp = 0.1, out = 0 |
var snd = SinOscFB.ar(freq, LFNoise0.kr(0.5, 300, 400), amp);
Out.ar(out, snd);
}).add;
SynthDef("hasGateAndDoneAction", {
| gate = 1, amp = 0.1, doneAction = 0, out = 1 |
var freq = LFNoise1.kr(0.5, 300, 400),
eg = Linen.kr(gate, doneAction: doneAction),
snd = SinOscFB.ar(freq, LFNoise0.kr(0.5, 300, 400), amp);
Out.ar(out, snd * eg);
}).add;
)

s.boot;

(
s.bind {
g = Group(s);
a = Synth("hasFreq", target: g);
b = Synth("hasGateAndDoneAction", target: g);
}
)

// whoever understands "freq" will respond
g.set("freq", 400);
g.set("freq", 330);
// release means setting gate to zero
g.release;
g.set("gate", 1);
g.set("doneAction", 14);
g.release(1.234);
Stephan Wittwer
2014-10-15 22:50:44 UTC
Permalink
Post by Stephan Wittwer
But it's late here too ...
Absurd values to SinOscFB feedback
thor
2014-10-16 10:58:26 UTC
Permalink
That's it. Thanks Stefan

Since I have a tons of Groups where hundreds of synths are created and killed over time, I can't hardcode doneAction: 14 in the SynthDefs. But passing it as an argument when I want to kill the group is the solution.

s.boot
s.plotTree

SynthDef("aa", { | freq = 440, amp = 0.1, out = 0, doneAction=2, gate=1 |
var snd = SinOsc.ar(freq, 0, amp*Linen.kr(gate, doneAction: doneAction));
Out.ar(out, snd);
}).add;

g = Group.new;
Synth("aa", [\freq, rrand(400, 600)], target:g);
Synth("aa", [\freq, rrand(400, 600)], target:g);
Synth("aa", [\freq, rrand(400, 600)], target:g);
Synth("aa", [\freq, rrand(400, 600)], target:g);

g.set(\doneAction, 14) // the trick!
g.release;
Post by thor
I'm too tired today. Of course doneActions don't work as a synth argument.
Actually they do work.
But it's late here too ...
(
SynthDef("hasFreq", { | freq = 440, amp = 0.1, out = 0 |
var snd = SinOscFB.ar(freq, LFNoise0.kr(0.5, 300, 400), amp);
Out.ar(out, snd);
}).add;
SynthDef("hasGateAndDoneAction", {
| gate = 1, amp = 0.1, doneAction = 0, out = 1 |
var freq = LFNoise1.kr(0.5, 300, 400),
eg = Linen.kr(gate, doneAction: doneAction),
snd = SinOscFB.ar(freq, LFNoise0.kr(0.5, 300, 400), amp);
Out.ar(out, snd * eg);
}).add;
)
s.boot;
(
s.bind {
g = Group(s);
a = Synth("hasFreq", target: g);
b = Synth("hasGateAndDoneAction", target: g);
}
)
// whoever understands "freq" will respond
g.set("freq", 400);
g.set("freq", 330);
// release means setting gate to zero
g.release;
g.set("gate", 1);
g.set("doneAction", 14);
g.release(1.234);
Stephan Wittwer
2014-10-15 20:07:25 UTC
Permalink
Post by thor
Hi List
I'm expecting Synth and Group to behave similarly here, but on release of
Why should it, and when?

(maybe when the last synth inside ended? But then this synth(s) should free
the group)

Some synths inside the group might react to 'release' in a certain way,
some not all.
Post by thor
s.boot
s.plotTree
x = Synth("default", [\freq, rrand(400, 600)]);
x.release
g = Group.new;
Synth("default", [\freq, rrand(400, 600)], target:g);
Synth("default", [\freq, rrand(400, 600)], target:g);
Synth("default", [\freq, rrand(400, 600)], target:g);
g.release;
I need the release for the group as I want the envelope fadeout.
Any suggestions? I prefer not to hack around as I'm creating hundreds of
groups with lots of synths, so deferring the .free of the group is not
really an appealing option.
Thor
Loading...