Set DynKlank args with set type pattern or Pmono

Hi there,

I’ve been struggling for a while now to get to sequent fx, for some reason I’m bumping into walls.

I read “Pattern Guide 08: Event Types and Parameters” and a couple of threads here in the forum on sending triggers/values to a Synth with Patterns. I tried different options, e.g. with Routines, but there syncing between the source’s and the fx’s pattern seemed very unprecise, so that’s why I thought patterns would be the solution.

I followed the instructions under “node controls” in the aformentioned tutorial in the Help browser, but didn’t get the result I wanted :expressionless:

Here below is my take on it, where I wanted to change all four 6kHz freqs of the DynKlank randomly with a Pseq, so it makes chords. Instead this below results to me in the original four 6kHz freqs + only one frequency sequencing:

(
s.bind{
	~bA.free;
	s.newBusAllocators;
	s.sync;
	~bA = Bus.audio(s,1);
	~bA.postln
};
SynthDef(\src,{
	x = WhiteNoise.ar;
	x = x * Env.asr(0.01,1,0.01,-4).kr(2,\gate.kr(1));
	Out.ar(~bA,x*(-39).dbamp);
}).add;
SynthDef(\dk,{
	x = In.ar(~bA,1);
	x = LPF.ar(x,6e3);
	x = DynKlank.ar(`[\freq.kr(6e3!4).poll,nil,1!4],x);
	x = Pan2.ar(x);
	x = LeakDC.ar(x);
	Out.ar(0,x*(-39).dbamp);
}).add;
)
(
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).trace,
	\dur, 0.5
).play(quant:1);
)
(
{
	Pdef(\pd).remove;
	1.wait;
	p.stop;
	~dk.free;
}.fork;
)

I tried the same with Pmono, with better results, because at least I hear all four frequencies sequencing, but the 4 * 6kHz is still stuck in there somehow. What am I missing here?

Thanks,
cd

If you are passing an array to an arrayed control, it has to be double wrapped. (This is explained in other threads here; short on time this morning, for further questions, try searching the forum for “arrayed args” or such.)

// with this, each event gets a 4-item array
// the 4 items will be distributed across multiple 'set' messages
\degree, Pseq({{rrand(0,7)}!4}!4,inf).trace

// with this, each event gets a 4-item array *inside an array*
// the 4-item array will go to one synth
\degree, Pseq({{rrand(0,7)}!4}!4,inf).collect(_.asArray).trace

hjh

1 Like

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?

:thinking:

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

Oh you’re right, my suggestion was wrong.

Daniel’s is correct.

“Short on time” in this case also meant “careless” :flushed:

hjh

1 Like

Thanks hjh for confirming!

I think I also made a mistake here:

y and z give the same results, x doesn’t. That was the whole point :slight_smile: