There is a way to make a sequencer that sequences over an array of values. You can supply any array through the namedcontrol, as long as its smaller than the intial size of the array, which is in this case 20. If you supply a array smaller than size 20, you have to use the \size.kr() named control accordingly. The point of this is that i can set it to different arrays of different sizes while its playing. This method is taken from here https://scsynth.org/t/problems-with-variable-literal-array-and-namedcontrol/941/3
(
x = {
var freq, trig;
trig = Impulse.kr(1);
freq = Demand.kr(trig, 0, Dseq(Dser(\pattern.kr(100!20), \size.kr(1)), inf));
SinOsc.ar(freq) * EnvGen.kr(Env.perc(), trig);
}.play;
)
(
var pattern1 = [100, 200, 300];
x.set(\pattern, pattern1);
x.set(\size, pattern1.size);
)
Now comes my question.
I want to have this exactly, but with Dseq replaced with Drand. However when i do that it just plays the array of values as a sequence. Why does this not work? Is there a way around this?
(
x = {
var freq, trig;
trig = Impulse.kr(1);
// here Drand is used instead of Dseq
freq = Demand.kr(trig, 0, Drand(Dser(\pattern.kr(100!20), \size.kr(1)), inf));
SinOsc.ar(freq) * EnvGen.kr(Env.perc(), trig);
}.play;
)
(
var pattern1 = [100, 200, 300];
x.set(\pattern, pattern1);
x.set(\size, pattern1.size);
)
I want the functionality of the first method (with Dseq), but it should play the given array of values in a random order.