I’m not sure whether I’ve understood correctly, but I would do something like this
(
var a=Array.fill(7, {|i| choose([0,1])}), m=[31,43,57,64,70,76,77].midicps;
var p=Pca1(a, 90, inf);
var x=p.asStream;
//mapping between 0-1 automata list and corresponding values
//return an array, when 1 then returns the corresponding value, otherwise returns 0
~interpret={|list, values| //
var out=Array.new(list.size);
list.do({|item, ind|
if (item==1,
{out.add(values[ind])},
{out.add(0)}
);
});
out;
};
Routine.new({
20.do({
var pitches=~interpret.value(x.next, m);
{Mix.new(SinOsc.ar(pitches, 0, 0.5)*EnvGen.ar(Env.perc(0.01,0.4), 1, 0.3, doneAction:2))}.play;
0.4.wait;
});
}).play;
);