I have this not-very-good attempt at a bell-like synth with variable ‘inharmonicity’ in a control called \bell
(0-1):
SynthDef(\dynk, { | out=0, amp=0.1, pan=0, freq=440, attack=0.001, decay=1, bell=0, gate=1|
var sig, freqs, excitation, env, number=7;
freqs = freq * (1..number);
freqs = freqs * Array.geom(number,1,(1 + bell)); // stretches
freqs = freqs * (1 - bell); // rough pitch correction
excitation = {WhiteNoise.ar * 0.01}!2;
excitation = BPF.ar(excitation, freq * 2); // smoother
env = Env.asr(attackTime: attack, releaseTime: 0.001).kr(gate: gate);
excitation = excitation * env;
sig = DynKlank.ar(`[freqs, Array.geom(number,1,0.9), decay!number], excitation);
FreeSelf.kr(DetectSilence.ar(sig + Impulse.ar(0)).product); // see helpfile :)
Out.ar(out, Splay.ar(sig, spread: 0.6, center: pan) * amp )
}).add;
This works fine:
P(\a, \instrument, \dynk).play;
Ndef(\bell, {LFPar.kr(1/4).range(0.1,0.3)});
P(\a, \bell, Ndef (\bell));
But this throws an error:
Ndef(\freq, {LFPar.kr(1/4).range(200,500)});
P(\a, \freq, Ndef(\freq));
> WARNING: BinaryOpPlug: Cannot calculate this value. Use direct mapping only.
But this is fine:
P(\a, \freq, 200)
At a loss here as to what is wrong. Something to do with the way I am calculating the array of frequencies in the DynKlank?
Thanks!