Whats going on here?
Using \lin, \exp, \welsh, whatever curvature key inside a named control rate will fail the writing of definition to file. Integers for curvature is fine though.
TL;DR the better way to control envelope shapes is by sending the envelope as an array. There are examples in the help: Specifying an envelope for each new synth for one.
Why is that?
Each envelope segment is encoded as four values: target level, duration, shape number and curvature.
Note that this is not a single value for the shape.
All values in the server must be real numbers. If a curvature value can be any real number, and shape must also be a number, then you can’t tell the difference between 1.0 = curvature or 1.0 = exponential curve. It has to be two numbers.
myEnv.asArray automatically looks up the shape numbers for you (Env.shapeNumber) and produces the two values, so it will be much much simpler to follow the model of the link above.
You could write the Env into the synth and override the two values with your own control inputs, but this is a lot trickier (I tried it and got confused) – too much trouble.
Thanks everybody!
Using symbols like \lin, \exp, \sin, \wel is totally fine right. In Env.new. values arg. And I always tend to use -10 between and 10 for curve . But through a named control → I expected the curve arg in Env.perc could be set by a named control passing a symbol. Yaaa…
Aand on top of that I hit an error message only when using .writeDefFile on a SynthDef.
Ended up confusing myself indeed.
Also note that the curvature can be an array of values, one for each line segment:
Env.perc(0.01, 0.01, 1, 4).plot
// same as
Env.perc(0.01, 0.01, 1, [4, 4]).plot
// but you can also specify a different curvature for each segment
Env.perc(0.01, 0.01, 1, [-4, 2]).plot
// this is also true for 'custom' envelopes
Env([0, 0.5, 0.3, 1], [0.005, 0.005, 0.01], [-2, 1, 5]).plot
// same envelope with different curvatures
Env([0, 0.5, 0.3, 1], [0.005, 0.005, 0.01], [4, -5, -2]).plot