This was my first guess at an answer which was wrong as SSC points out in the comments below:
I'm not in front of Kyma right now so I'll need to double check this later. When I tried this before I had to explicitly set all the values eg.
(0 to: pitchArray size) do: [:i| (pitchArray @< i) <~ 1].
There is an EventValue that gives you the amount of time since the Sound has been running. I can't remember it off the top of my head right now but I remember using that:
((!TimeThingICan'tRemember lt: 1) true: ((0 to: pitchArray size) do: [:i| (pitchArray @< i) <~ 1].) false: nil),
or something like that.
Here's a better answer that should work:
| pitchArray initialiseAllExpression |
pitchArray := EventVariable new size: 64.
"construct the expression that initialises all the values of the pitchArray"
initialiseAllExpression := (pitchArray @< 0) <+ 0.
initialiseAllExpression := (1 to: (64 - 1)) inject: initialiseAllExpression into: [:expr :i| (expr, ((pitchArray @< i) <+ 0))].
((1 turnOnAfter: 0 s for: 0.001 s) evaluate: initialiseAllExpression)
The reason why this works, if I remember right, is all down to the "," (the comma). The Sound's parameter field will only evaluate one Capytalk expression, but it can be a compound one. Compound Capytalk expressions are separated by commas. In the "inject:into:" expression, the key part is:
[:expr :i| (expr, ((pitchArray @< i) <+ 0))]
which means for each iteration of the loop, take the output of the last iteration (:expr) and construct
(expr, ((pitchArray @< i) <+ 0))
The "expr," is the magic bit that's building up a big compound Capytalk expression with the sub-expressions separated by commas. Like:
((pitchArray @ 0) <+ 0),
((pitchArray @ 1) <+ 0),
((pitchArray @ 2) <+ 0),
...
Ugh, my first guess was badly wrong in two ways. (silly me for making a guess while not sitting at Kyma, sorry)
First I used "do:".
If you evaluate this code (using Cmd-Y):
| pitchArray |
pitchArray := EventVariable new size: 10.
(0 to: pitchArray size) do: [:i| (pitchArray @< i) <~ 1].
you get "(0 to: 10)" because do: answers the receiver. Smalltalk will happily go round the loop 10 times at compile time, but will return (0 to: 10).
Ah... but what about collect:?
If you evaluate this....
| pitchArray |
pitchArray := EventVariable new size: 10.
(0 to: pitchArray size) collect: [:i| (pitchArray @< i) <~ 1].
you get
(((Var132 @< 0 ) <~ 1 ) ((Var132 @< 1 ) <~ 1 ) ((Var132 @< 2 ) <~ 1 ) ((Var132 @< 3 ) <~ 1 ) ((Var132 @< 4 ) <~ 1 ) ((Var132 @< 5 ) <~ 1 ) ((Var132 @< 6 ) <~ 1 ) ((Var132 @< 7 ) <~ 1 ) ((Var132 @< 8 ) <~ 1 ) ((Var132 @< 9 ) <~ 1 ) ((Var132 @< 10 ) <~ 1 ))
an array of Capytalk expressions NOT separated by commas. Oops. Which is why you need inject:into:.