Omitting arguments from scope of NdefPreset

Hello everyone! I’m currently using NdefPreset in a patch and I was wondering if there was a way to omit certain arguments from its scope? Currently, the NdefPreset is keeping track of every argument in my Ndef.

I know when instantiating a new NdefPreset, there is an argument namesToStore, but it’s unclear how to use that argument. For example, I thought maybe giving it an array of symbols would work, but it didn’t. As you can see, I’m not fully clear on how to use this Object. Does anyone have any advice?

I got a reply from Alberto de Campo on the mailing list.

// a very simple Ndef
Ndef(\a, { |amp=0.25, lofreq=20, ffreq = 2500, phase = 0.5|
        RLPF.ar(Impulse.ar(lofreq, [0, phase], amp), ffreq, 0.3);
}).play;

// add specs for its special params (amp and lofreq have known specs)
Ndef(\a).addSpec(\ffreq, \freq);
Ndef(\a).addSpec(\phase, [0,1]);

// make an NdefPreset from it, with namesToStore arg that leaves out \amp: 
NdefPreset(Ndef(\a), [\lofreq, \ffreq, \phase]);

// test rand and store/set from gui:
NdefPresetGui(NdefPreset(\a), 5);

// -> [\lofreq, \ffreq, \phase] are stored, \amp is not

In my code, I was trying to use a mix of backslash preceded symbol names and quotation style symbol names. This is why my array in the namesToStore argument did not work.

1 Like

Note that symbol noted \phase or ‘phase’ produce exactly the same result. Maybe you were using “phase” which is a string and not a symbol

Thanks for the clarification. I thought that was the case, and it’s likely I was using double quotations and not single.