[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-users] variable size array as an argument for Dseq



dear users,

is there a way to have a variable size list as an argument for Dseq? I know that the array size is set at the definition stage. I have an array of 6 values as a default argument and in some cases, I would like to set it to less than 6 values, e.g., 

this will play 6 consecutive notes
(
Ndef(\dseqTest, {
arg seq = #[1,2,3,4,5,6];
    var a, freq, trig;
    a = Dseq(seq, inf);
    trig = Impulse.kr(MouseX.kr(1, 40, 1));
    freq = Demand.kr(trig, 0, a) * 30 + 340;
    SinOsc.ar(freq) * 0.1

}).play;
)

an I would like to be able to switch to 2 notes only, 

Ndef(\dseqTest).set(\seq, [1,5]);  

but it only replaces the first two elements of the array and the rest remains as in the default. Do I have to redefine the Ndef each time the size changes, even if it is smaller than the default?

best

m