While I was looking at the \filter NodeProxy role code for another reason, I noticed an issue in the code that can lead to the following difference in behaviors: an uninitialized NodeProxy can only have a filter that doesn’t use NamedControls, e.g.
Ndef.clear
Ndef(\prb)[1] = \filter -> { arg in, mfreq = 2; in * SinOsc.ar(mfreq) }
// ok
Ndef.clear
Ndef(\prb)[1] = \filter -> { arg in; in * SinOsc.ar(\mfreq.kr(2)) }
// ERR
This is caused by \filter calling the function on the right-hand side of the association seemingly while no SynthDef is being built when the NodeProxy is not initialized.
if(proxy.isNeutral) {
ugen = func.value(Silent.ar);
Basically, if func there tries to emit a NamedControl, that causes the same error, as shown below:
{ arg in; in * SinOsc.ar(\mfreq.kr(2)) }.(Silence.ar) // err
// whereas
{ arg in, mfreq = 2; in * SinOsc.ar(mfreq) }.(Silence.ar) // binop ugen
I’m not sure how to fix this problem other than saying “don’t do that”, for now
LFSaw
September 30, 2025, 4:02pm
2
I stumbled over this, too and made an issue…
opened 04:14PM - 30 Sep 25 UTC
bug
comp: JITlib
## Environment
* SuperCollider version: 3.15.0
* Operating system: OSX
## Step… s to reproduce
Ndef.clear
Ndef(\prb, \filter -> { arg in; in * SinOsc.ar(\mfreq.kr(2)) })
## Expected vs. actual behavior
should behave like this
```sc
Ndef.clear
Ndef(\prb, \filter -> { arg in, mfreq = 2; in * SinOsc.ar(mfreq) })
```
i.e. it should prime the proxy as audio and assign the function.
Instead it throws an error:
```txt
-> Ndef
ERROR: Message 'addKr' not understood.
RECEIVER:
nil
ARGS:
Symbol 'mfreq'
Integer 2
KEYWORD ARGUMENTS:
CALL STACK:
DoesNotUnderstandError:reportError
arg this = <instance of DoesNotUnderstandError>
Nil:handleError
arg this = nil
arg error = <instance of DoesNotUnderstandError>
Thread:handleError
arg this = <instance of Thread>
arg error = <instance of DoesNotUnderstandError>
Object:throw
arg this = <instance of DoesNotUnderstandError>
Object:doesNotUnderstand
arg this = nil
arg selector = 'addKr'
arg args = [*2]
arg kwargs = [*0]
NamedControl:init
arg this = <instance of NamedControl>
var prefix = nil
var str = "mfreq"
Meta_NamedControl:new
arg this = <instance of Meta_NamedControl>
arg name = 'mfreq'
arg values = [*1]
arg rate = 'control'
arg lags = nil
arg fixedLag = false
arg spec = nil
var res = nil
< closed FunctionDef >
arg in = <instance of OutputProxy>
< closed FunctionDef >
arg func = <instance of Function>
arg proxy = <instance of Ndef>
arg channelOffset = 0
arg index = 0
var ok = nil
var ugen = nil
Association:buildForProxy
arg this = <instance of Association>
arg proxy = <instance of Ndef>
arg channelOffset = 0
arg index = 0
SynthDefControl:build
arg this = <instance of SynthDefControl>
arg proxy = <instance of Ndef>
arg orderIndex = 0
var ok = nil
var rate = nil
var numChannels = nil
var outerDefControl = <instance of SynthDefControl>
var outerBuildProxy = <instance of Ndef>
var controlNames = nil
NodeProxy:put
arg this = <instance of Ndef>
arg index = nil
arg obj = <instance of Association>
arg channelOffset = 0
arg extraArgs = nil
arg now = true
var container = <instance of SynthDefControl>
var bundle = <instance of MixedBundle>
var oldBus = nil
NodeProxy:source_
arg this = <instance of Ndef>
arg obj = <instance of Association>
Meta_Ndef:new
arg this = <instance of Meta_Ndef>
arg key = 'prb'
arg object = <instance of Association>
var res = <instance of Ndef>
var server = <instance of Server>
var dict = <instance of ProxySpace>
Interpreter:interpretPrintCmdLine
arg this = <instance of Interpreter>
var res = nil
var func = <instance of Function>
var code = "Ndef(\prb, \filter -> { arg ..."
var doc = nil
var ideClass = <instance of Meta_ScIDE>
Process:interpretPrintCmdLine
arg this = <instance of Main>
^^ ERROR: Message 'addKr' not understood.
RECEIVER: nil
Message with a similar name understood by the receiver:
add
Objects which respond to the selector 'addKr' derive from:
SynthDef
```
This came up on [scsynth](https://scsynth.org/t/error-with-namedcontrol-in-uninitialized-nodeproxy-filter/4992/2) about 4 years ago and I stumbled across it the other day, too.