Hi, I’m encountering an issue when using NamedControl. The array doesn’t seem to contain all the expected items, and I’m not sure why.
Here is the code I’m working with:
~degree = [0, 2, 4, 5, 7, 9, 11];
Ndef(\m02, {
var degree = \degree.kr(~degree);
var buffer = Buffer.alloc(s, degree.size, 1, { |b| b.setnMsg(0, degree) });
var freq = DegreeToKey.kr(
buffer.bufnum,
in: Line.kr(0, 12),
octave: 12,
mul: 1,
add: 48
);
SinOsc.ar((freq).midicps, mul: 0.1);
}).play;
In the above code, when I use NamedControl to define degree, the array doesn’t seem to hold all the items correctly. However, when I use a global reference (~degree) in a similar setup, everything works as expected:
~degree = [0, 2, 4, 5, 7, 9, 11];
Ndef(\m02, {
var degree = \degree.kr(~degree);
var buffer = Buffer.alloc(s, degree.size, 1, { |b| b.setnMsg(0, ~degree) });
var freq = DegreeToKey.kr(
buffer.bufnum,
in: Line.kr(0, 12),
octave: 12,
mul: 1,
add: 48
);
SinOsc.ar((freq).midicps, mul: 0.1);
}).play;
Can someone explain why this is happening? I’m not sure why the degree array isn’t being populated correctly in the first example.
Thanks in advance for your help!