Thanks for your quick response and the search keyword suggestions, a.o. because it took me to dkmayer’s post in this thread that seems to have solved this issue.
Inside .collect()
instead of _.asArray
he put [_]
which I think is the same if he wrote _.bubble
. “Bubbling” can be found at the J concepts in SC Help file.
I tested all three options:
(
x = Pseq({{rrand(0,7)}!4}!4,inf).collect(_.asArray).asStream;
y = Pseq({{rrand(0,7)}!4}!4,inf).collect([_]).asStream;
z = Pseq({{rrand(0,7)}!4}!4,inf).collect(_.bubble).asStream;
)
[x,y,z].do{|i| i.next.postln};
To my understanding all three gives the same results.
Couldn’t it be that if I write _.asArray
then I’m trying to convert something that’s already an array into an array?
And if I write instead [_]
or _.bubble
then will it only wrap the array into another one?
So here’s my modified example:
(
Pdef(\pd,
Pbind(
\instrument, \src,
\dur, Pdefn(\dur, 0.5),
\legato, Pdefn(\leg, 0.03),
\addAction, \addToHead,
)).play(quant:1);
~dk = Synth.tail(s,\dk);
p = Pbind(
\type, \set,
\id, ~dk,
\args, #[\freq],
\scale, Scale.minor,
\degree, Pseq({{rrand(0,7)}!4}!4,inf).collect([_])trace,
\dur, 0.5
).play(quant:1);
)
(
{
Pdef(\pd).remove;
p.stop;
1.wait;
~dk.free;
}.fork;
)
Greetings,
cd