I’ve been looking in the help docs and books, but I can’t seem to figure out how to get random numbers of a scale within a SynthDef,
Specifically something like this:
Scale.yu.degreeToFreq(IRand(0,12),2640,0);
I keep getting error: ERROR: Primitive ‘_BasicWrapAt’ failed.
Full code:
(
SynthDef(\hh, {
arg out=0, gate=1;
var sig, o1, o2, png, penv, henv, tail, env, n0, penv2, scale, rand;
rand = Rand(0,12);
scale = Scale.phrygian.degreeToFreq(rand,2640,0);
penv = EnvGen.ar(Env.perc(0.001,0.15).range(1000,20000));
penv2 = EnvGen.ar(Env.perc(0.001,0.35));
henv = EnvGen.ar(Env.new([2640,4000,2640],[0.2,0.4]));
env = EnvGen.ar(Env.perc(0.001,0.45),gate,doneAction:2);
n0 = BrownNoise.ar(1);
o1 = Pulse.ar(scale/10,0.7)!4;
o2 = Pulse.ar(Rand(2490,3491)+o1,0.5)!4*o1*0.5;
o2 = Pulse.ar(scale+o1,0.5)!4*o1*0.5;
png = BPF.ar(o2, 1000+penv, 1)*penv2*1;
tail = BPF.ar(o2+n0,henv,0.2)*penv2!2;
sig = HPF.ar(o2+png*0.6+tail, 2000);
Out.ar(out, sig*env );
}).add;
)