Error message when setting buffer in an Ndef

I’m using a granular patch with an Ndef (most of the code is from Reflectives videos) and playing with controlling the parameters with external LFOs via extra Ndefs. So far, so good. But when I try to change the buffer with Ndef(\gran_fx).set(\buf, ~git[3]), it gets me into trouble - I get the following error message, and after that, nothing seems to work. Maybe someone could explain what’s going on? Code is below the error message.

ERROR: Message 'rate' not understood.
Perhaps you misspelled 'rank', or meant to call 'rate' on another receiver?
RECEIVER:
Instance of Buffer {    (0x6c20d18, gc=FC, fmt=00, flg=00, set=03)
  instance variables [8]
    server : instance of Server (0x1b15b48, size=30, set=5)
    bufnum : Integer 3
    numFrames : Integer 21520356
    numChannels : Integer 1
    sampleRate : Float 44100.000000   00000000 40E58880
    path : "/home/jordan/Documents/music-work/LBD/aug_21..."
    startFrame : Integer 0
    doOnInfo : nil
}
ARGS:
PATH: /home/jordan/Documents/music-work/LBD/aug_21/gran_fx.scd

PROTECTED CALL STACK:
	Meta_MethodError:new	0x2753780
		arg this = DoesNotUnderstandError
		arg what = nil
		arg receiver = Buffer(3, 21520356, 1, 44100.0, /home/jordan/Documents/music-work/LBD/aug_21/samples/git_recordings-004.wav)
	Meta_DoesNotUnderstandError:new	0x2755ac0
		arg this = DoesNotUnderstandError
		arg receiver = Buffer(3, 21520356, 1, 44100.0, /home/jordan/Documents/music-work/LBD/aug_21/samples/git_recordings-004.wav)
		arg selector = rate
		arg args = [  ]
	Object:doesNotUnderstand	0x21bd7c0
		arg this = Buffer(3, 21520356, 1, 44100.0, /home/jordan/Documents/music-work/LBD/aug_21/samples/git_recordings-004.wav)
		arg selector = rate
		arg args = nil
	a FunctionDef	0x3660680
		sourceCode = "<an open Function>"
		arg key = buf
		arg value = Buffer(3, 21520356, 1, 44100.0, /home/jordan/Documents/music-work/LBD/aug_21/samples/git_recordings-004.wav)
		var rate = nil
	Dictionary:keysValuesArrayDo	0x364a880
		arg this = ProxyNodeMap[ (amp -> 1), (rate -> 0.79700189828873), (i_out -> 4), (out -> 4), (posRateMF -> c0), 
  (posRateMD -> c1), (buf -> Buffer(3, 21520356, 1, 44100.0, /home/jordan/Documents/music-work/LBD/aug_21/samples/git_recordings-004.wav)), (tFreqMF -> c2), (tFreqMD -> c3), (fadeTime -> 0.02), 
  (posRate -> c4) ]
		arg argArray = [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, amp, 1, nil, nil, rate, 0.79700189828873, nil, nil, nil, nil, nil, nil, nil, nil, i_out, 4, nil, nil, nil, nil, out, 4, posRateMF, c0, posRateMD, c1, buf, Buffer(3, 21520356, 1, 44100.0, /home/jordan/Documents/music-work/LBD/aug_21/samples/git_recordings-004.wav), tFreqMF, c2, tFreqMD, c3, fadeTime, 0.02, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, posRate, c4, nil, nil, nil, nil ]
		arg function = a Function
		var i = 38
		var j = 7
		var key = nil
		var val = nil
		var arraySize = nil
	Dictionary:keysValuesDo	0x363d640
		arg this = ProxyNodeMap[ (amp -> 1), (rate -> 0.79700189828873), (i_out -> 4), (out -> 4), (posRateMF -> c0), 
  (posRateMD -> c1), (buf -> Buffer(3, 21520356, 1, 44100.0, /home/jordan/Documents/music-work/LBD/aug_21/samples/git_recordings-004.wav)), (tFreqMF -> c2), (tFreqMD -> c3), (fadeTime -> 0.02), 
  (posRate -> c4) ]
		arg function = a Function
	ProxyNodeMap:controlNames	0x3660200
		arg this = ProxyNodeMap[ (amp -> 1), (rate -> 0.79700189828873), (i_out -> 4), (out -> 4), (posRateMF -> c0), 
  (posRateMD -> c1), (buf -> Buffer(3, 21520356, 1, 44100.0, /home/jordan/Documents/music-work/LBD/aug_21/samples/git_recordings-004.wav)), (tFreqMF -> c2), (tFreqMD -> c3), (fadeTime -> 0.02), 
  (posRate -> c4) ]
		var res = [ ControlName  P nil amp control 1, ControlName  P nil rate control 0.79700189828873, ControlName  P nil i_out control 4, ControlName  P nil out control 4, ControlName  P nil posRateMF control c0, ControlName  P nil posRateMD control c1 ]
	NodeProxy:addNodeMapControlNames	0x2a545c0
		arg this = Ndef('gran_fx')
		arg objCtlNames = [ ControlName  P 0 buf control 0, ControlName  P 1 tFreq control 20, ControlName  P 2 posRate control 1, ControlName  P 3 rate control 1, ControlName  P 4 tFreqMF control 0, ControlName  P 5 tFreqMD control 0, ControlName  P 6 posRateMF control 0, ControlName  P 7 posRateMD control 0, ControlName  P 8 rateMF control 0, ControlName  P 9 rateMD control 0, ControlName  P 10 startPos control 0, ControlName  P 11 overlap control 2, ControlName  P 12 amp control 1 ]
		arg except = [ out, i_out, gate, fadeTime ]
	a FunctionDef	0x3b65740
		sourceCode = "<an open Function>"
	a FunctionDef	0x36657c0
		sourceCode = "<an open Function>"
	Function:prTry	0x29e9680
		arg this = a Function
		var result = nil
		var thread = a Routine
		var next = nil
		var wasInProtectedFunc = false
	
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>
	Thread:handleError
		arg this = <instance of Routine>
		arg error = <instance of DoesNotUnderstandError>
	Object:throw
		arg this = <instance of DoesNotUnderstandError>
	Function:protect
		arg this = <instance of Function>
		arg handler = <instance of Function>
		var result = <instance of DoesNotUnderstandError>
	Environment:use
		arg this = <instance of Event>
		arg function = <instance of Function>
		var result = nil
		var saveEnvir = <instance of Environment>
	Event:play
		arg this = <instance of Event>
	Event:playAndDelta
		arg this = <instance of Event>
		arg cleanup = <instance of EventStreamCleanup>
		arg mute = false
	EventStreamPlayer:prNext
		arg this = <instance of EventStreamPlayer>
		arg inTime = 289.494147082
		var nextTime = nil
		var outEvent = <instance of Event>
	< FunctionDef in Method EventStreamPlayer:init >
		arg inTime = 289.494147082
	Routine:prStart
		arg this = <instance of Routine>
		arg inval = 279.494147082
^^ ERROR: Message 'rate' not understood.
Perhaps you misspelled 'rank', or meant to call 'rate' on another receiver?
RECEIVER: Buffer(3, 21520356, 1, 44100.0, /home/jordan/Documents/music-work/LBD/aug_21/samples/git_recordings-004.wav)
s.boot;


(
~git = Array.new;
~folder = PathName.new("/home/jordan/Documents/music-work/LBD/aug_21/samples");


~folder.entries.do {
        |path|
        ~git = ~git.add(Buffer.read(s, path.fullPath) );
};
)




(
Ndef(\gran_fx, {
        |buf = 0, tFreq = 20, posRate = 1, rate = 1|
        var phasor, t, sig;
        var bufFrames = BufFrames.kr(buf);
        
        var tFreqMod = { SinOsc.ar(\tFreqMF.kr(0), Rand(0.0, 2pi)) * \tFreqMD.kr(0) };
        var rateMod = { SinOsc.ar(\rateMF.kr(0), Rand(0.0, 2pi)) * \rateMD.kr(0) };
        var posRateMod = { SinOsc.ar(\posRateMF.kr(0), Rand(0.0, 2pi)) * \posRateMD.kr(0) };

        tFreq = tFreq + tFreqMod.dup;
        posRate = posRate + posRateMod.dup;
        rate = rate + rateMod.dup;

        t = Impulse.ar(tFreq.lag(0.05));

        phasor = Phasor.ar(
            trig: 0.0,
            rate: posRate * BufRateScale.kr(buf),
            start: \startPos.kr(0),
            end: bufFrames,
            resetPos: \startPos.kr(0) * bufFrames
        );

        sig = GrainBuf.ar(
            numChannels: 1,
            trigger: t,
            dur: tFreq.reciprocal * \overlap.kr(2),
            sndbuf: buf,
            rate: rate,
            pos: phasor / bufFrames,
            interp: 2,
            pan: 0,
            envbufnum: -1,
            maxGrains: 512
        );

        sig = sig * \amp.kr(1);

  //      Out.ar(\out.kr(0), sig);


});
)




Ndef(\gran_fx).fadeTime = 2;
Ndef(\gran_fx).play;
Ndef(\gran_fx).set(\buf, ~git[1])

Ndef(\gran_fx)[1] = \xset -> Pbind(\buf, ~git[3], \dur, Pwhite(10, 60), \posRateMF, Pwhite(0.1, 10), \posRateMD, Pwhite(1, 10), \amp, 1, \rate, Pwhite(0.5, 2));


// with LFOs
Ndef(\gran_fx)[1] = \xset -> Pbind(\dur, 10, \posRate, Ndef(\lfo4).asMap, \posRateMF, Ndef(\lfo0).asMap, \posRateMD, Ndef(\lfo1).asMap, \amp, 1, \tFreqMF, Ndef(\lfo2).asMap, \tFreqMD, Ndef(\lfo3).asMap);
(
// posRateMF + MD

Ndef(\lfo0, { SinOsc.kr(0.011).linlin(-1, 1, 0.1, 10) });

Ndef(\lfo1, { SinOsc.kr(0.01).linlin(-1, 1, 1, 10) });

// tFreqMF + MD

Ndef(\lfo2, { SinOsc.kr(0.02).linlin(-1, 1, 0.001, 1) });
Ndef(\lfo3, { SinOsc.kr(0.021).linlin(-1, 1, 0.001, 1) });


Ndef(\gran_fx).xset(\tFreqMF, 0.01, \tFreqMD, 0.01);
// pos rate

Ndef(\lfo4, { SinOsc.kr(0.001).linlin(-1, 1, 1, 5) });

)

Thanks,
Jordan

This might not help much, but I am not getting an error when doing this on my computer.

This guy had a similar error and reinstalled to resolve:

Class Implementation Error Message - scsynth

EDIT: Just adding after @jamshark70 , yes I do have crucial-lib

It’s a bug.

I think it’s a side effect of class library: do not convert values before checking the rate · supercollider/supercollider@a0a4b4c · GitHub, which deleted a call to asControlInput. This call supported Buffers here, but broke bus mapping. Fixing the bus mapping bug broke buffers as controls.

Probably Object should implement rate (@julian what do you think?) – the crucial-library quark has this, but the main library does not. So if you have crucial-library installed, you don’t see the error.

hjh

1 Like

yes, maybe object should return nil for rate.

I’d have thought \scalar.

hjh

Ok, that is another possibility. It will hide some bugs, however.

I guess the best, then, would be to review classes case-by-case. For instance, we expect set to accept simple numbers, buses (already implement rate I think), buffers (don’t implement it yet), symbols/strings for bus mapping (maybe check first character for rate), NodeProxies (already implement it)… anything else?

Is there a spec for what is allowed to pass as a value to set? If there’s a spec, then it’s easy: implement those and document that there aren’t any promises for other objects. If there’s no spec, then the process is always reacting passively to users’ discovery of bugs.

hjh

anything that returns something reasonable for asControlInput