Issues with scaling an array in Penv


#1

Hi everyone, I’m getting an error message suddenly and I’m not really sure why.

I have this little pulsar synthesis patch that I’ve been using for a while now which is based on the code in the SC book. In order to scale my Penvs into values that I need for my synths parameters, I’ve always used the range message on my level arrays to get them into the range I’d like. All of the sudden, I’ve started getting the following error message. Does anyone have any ideas to why this would suddenly start behaving this way after years of it not throwing any errors? I tried reinstalling SC and am still have the same issue.

An example of my code is after the error message. Any help/advice/suggestions would be greatly appretiated.

ERROR: Message ‘range’ not understood.
RECEIVER:
Float 0.911316 00000000 3FED2981
ARGS:
Integer 10
Integer 80
CALL STACK:
DoesNotUnderstandError:reportError
arg this =
Nil:handleError
arg this = nil
arg error =
Thread:handleError
arg this =
arg error =
Object:throw
arg this =
Object:doesNotUnderstand
arg this = 0.91131639480591
arg selector = ‘range’
arg args = [*2]
< FunctionDef in Method Collection:collectAs >
arg elem = [*4]
arg i = 0
ArrayedCollection:do
arg this = [*10]
arg function =
var i = 0
Collection:collectAs
arg this = [*10]
arg function =
arg class =
var res = [*0]
< closed FunctionDef > (no arguments or variables)
Interpreter:interpretPrintCmdLine
arg this =
var res = nil
var func =
var code = “(
~sineHarmonicSig = Signal…”
var doc = nil
var ideClass =
Process:interpretPrintCmdLine
arg this =
^^ The preceding error dump is for ERROR: Message ‘range’ not understood.
RECEIVER: 0.91131639480591

(
// a pulsar synthdef
SynthDef(\pulsar1, {|out, wavebuf, envbuf, form=200, amp=0.2, pan|
var grDur = 1/form;
var pulsaret = Osc1.ar(wavebuf, grDur);
var env = Osc1.ar(envbuf, grDur);

	OffsetOut.ar(out, Pan2.ar(pulsaret * env, pan, amp));
}).add;

)
(
~sineHarmonicSig = Signal.sineFill(2048, 1/(1…10).scramble).putLast(0);
~sinHarm = Buffer.loadCollection(s, ~sineHarmonicSig).normalize;
~expoDecayEnv = Env.perc.discretize(2048).putLast(0).asSignal;
~expoDec = Buffer.loadCollection(s, ~expoDecayEnv, 1);
~rand = {rrand(0.0, 1.0)}.dup(rrand(3, 16));

~pulsaret = ~sineHarm;
~pulsarEnv = ~expoDec;
~minFreq= 10;
~maxFreq = 80;
~minForm = 80;
~maxForm = 1080;
~dur = 0.5;
~loop = inf;
~fund = [rrand(~minFreq, ~maxFreq), Pn(Penv(~rand.range(~minFreq, ~maxFreq), [~dur]), ~loop)].choose.postln;

//three voice pulsar train
3.do{|i|

Pbindef(("pulsar"++i).asSymbol,
	\instrument, \pulsar1,
	\wavebuf, ~pulsaret, \envbuf, ~pulsarEnv,
	\fund, ~fund,
	\form, Pn(Penv(~rand.range(~minForm, ~maxForm),[~dur]), ~loop),
	\amp, Pn(Penv(~rand, [~dur]), ~loop),
	\pan, Pn(Penv(~rand.range(-1, 1),[~dur]), ~loop),
	\dur, Pfunc({ |ev| abs(ev.fund.reciprocal) });

).play;

};
)