Hello everybody,
I’m studying the recursive_phrasing documentation in the jitlib tutorial and I need help.
In the Pdef(\sweep) above, the arguments freq and sustain have to be evaluated, cause they are functions.
The other arguments n and ratio are not functions so they don’t need to be evaluated (no need to do ratio.value).
My question is what is the difference between freq and ratio, why the first one is a function and the last a value ?
Same question with sustain why is this a function ?
In the examples:
(
s.boot;
SynthDef(\pgrain,
{ arg out = 0, freq=800, sustain=0.001, amp=0.5, pan = 0;
var window;
window = Env.sine(sustain, amp * AmpCompA.kr(freq));
Out.ar(out,
Pan2.ar(
SinOsc.ar(freq),
pan
) * EnvGen.ar(window, doneAction: Done.freeSelf)
)
}
).add;
Pdef(\sweep, { arg sustain=1, n=8, freq=440, ratio=0.1;
Pbind(
\instrument, \pgrain,
\dur, sustain.value / n,
\freq, Pseq((1..n)) * ratio + 1 * freq.value // freq is a function, has to be evaluated
)
});
Pbind(
\type, \phrase, // phrase event from global library
\instrument, \sweep,
\n, 15,
\degree, Pseq([0, 4, 6, 3], inf),
\sustain, Pseq([1.3, 0.2, 0.4],inf)
).play;
)
Other question:
Pdef(\sweep, { arg sustain=1, n=8, freq=440, ratio=0.1;
Pbind(
\instrument, \pgrain,
\dur, sustain.value / n,
\postSustain, sustain.value.postln,
\postN, n.postln,
\postFreq, freq.value.postln,
\freq, Pseq((1..n)) * ratio + 1 * freq.value // freq is a function, has to be evaluated
)
});
Pbind(
\type, \phrase,
\instrument, \sweep,
//\n, 15, // if I comment this, I can see n = 8 (the default value declared in Pdef(\sweep) for n is 8)
//\degree, Pseq([0, 4, 6, 3], inf), // if I comment this, I can see freq = 261.62 in the post window (the default value declared in Pdef(\sweep) for freq is 440, I don't understand why I see 261.62)
//\sustain, Pseq([1.3, 0.2, 0.4],inf) // if I comment this, I can see sustain = 0.8 in the post window (the default value declared in Pdef(\sweep) for sustain is 1, I don't understand why I see 0.8)
).play;
If someone can help with that, I’ll be gratefull
Thanks a lot