Yes, that’s correct. Pshuf / Dshuf intentionally repeats the same ordering.
“Why? Wouldn’t you want a new ordering on each repeat?” – If it enforced a new ordering on every repeat, then it would be impossible to repeat the same ordering. So this design gives you a choice.
To get the new ordering, Pshuf / Dshuf should output one ordering only one time, and then repeat this externally. That is, there’s a difference between a Pshuf / Dshuf repeating infinitely, and infinitely repeating a one-shot Pshuf / Dshuf.
Pshuf([1, 2, 3], 3).asStream.all
-> [ 3, 2, 1, 3, 2, 1, 3, 2, 1 ]
Pn(Pshuf([1, 2, 3], 1), 3).asStream.all
-> [ 1, 3, 2, 2, 3, 1, 2, 1, 3 ]
s.boot;
(
a = {
var trig = Impulse.kr(4);
var source = Dshuf([1, 2, 3], 3);
var demand = Demand.kr(trig, 0, source);
demand.poll(trig);
FreeSelfWhenDone.kr(demand);
Silent.ar(1)
}.play;
)
UGen(OutputProxy): 3
UGen(OutputProxy): 2
UGen(OutputProxy): 1
UGen(OutputProxy): 3
UGen(OutputProxy): 2
UGen(OutputProxy): 1
UGen(OutputProxy): 3
UGen(OutputProxy): 2
UGen(OutputProxy): 1
UGen(OutputProxy): 1 // not sure why there's an extra
There’s no Dn() so we have to translate Pn(x, n)
as Dseq([x], n)
.
(
a = {
var trig = Impulse.kr(4);
var source = Dseq([Dshuf([1, 2, 3], 1)], 3);
var demand = Demand.kr(trig, 0, source);
demand.poll(trig);
FreeSelfWhenDone.kr(demand);
Silent.ar(1)
}.play;
)
UGen(OutputProxy): 2 // 213
UGen(OutputProxy): 1
UGen(OutputProxy): 3
UGen(OutputProxy): 3 // 312 -- changed ordering
UGen(OutputProxy): 1
UGen(OutputProxy): 2
UGen(OutputProxy): 2 // 213 -- changed again
UGen(OutputProxy): 1
UGen(OutputProxy): 3
UGen(OutputProxy): 3
hjh