Example from doc returns error

I was reading about the NamedControls here NamedControl | SuperCollider 3.12.2 Help.
In the section Comparison with direct use of Controls the first example throws me with the error: NamedControl: cannot have more than one set of fixed lag values in the same control., according to the description however this example should work:

(
a = {
    var x, y;
    x = NamedControl.kr(\freq, 440, 3.5);
    y = NamedControl.kr(\freq, 440, 1);
    SinOsc.ar([x, y] * [2, 1.2]) * 0.1
}.play;
)

since it’s a named control, and should allow reusing the same name: “NamedControl allows to reuse existing control names.”. Why am I getting the error? Has things change?

It’s requesting that the same argument name have two different lag values.

So what should it do? If it lags by 1, it’s wrong because the code also asked for 3.5. If it lags by 3.5, then this is wrong because it ignores the 1.

That is, it’s a typo in the help file. We definitely shouldn’t be recommending this to users.

hjh

In my help docs (sc 3.13.0) the example looks like this:

(
a = {
    var x, y;
    x = NamedControl.kr(\freq, 440).lag(3.5);
    y = NamedControl.kr(\freq, 440).lag(1);
    SinOsc.ar([x, y] * [2, 1.2]) * 0.1
}.play;
)

…and works as described - I guess the typo has already been resolved?

1 Like

Ok, in my sc doc (3.13) it’s also correct, I was searching the online https://doc.sccode.org/ which is 3.12.