First time here? Check out the FAQ!
x

Capytalk sync problem in algorithmic controls in Multigrid

0 votes
510 views

Hello.

I'm trying the control the track selection in the multigrid using capytalk.

in the selection field I've got: 

((((0.2 s random abs) seed: 0.2) * 6) rounded)     "I've got 6 Sounds on the track"

in the trigger field I've got:     

(((((0.2 s random abs) seed: 0.2) * 6) rounded) hasChangedInLast: 11 ms)

This gives me a trigger everytime the selection value has changed but when the selection value is the same I still get a trigger and the next change is ignored. 

When I scope it it looks like it's all working except the triggers are behind by one period:

In the test scope Sound; If I paste the selection expression into the trigger expression: 

( [selection expression] L) hasChangedInLast: 11 ms    then the triggers line up with the changes. 

But in the algorithmic control of the multigrid I can't paste the selection expression Sound into the trigger expression.

I'm looking to control the period of the random selection with a !HotValue and for the period to be quite long so it's important that the selection and triggers line up.

So how do I line the triggers up so the selection reflects the Sound that's playing?

thanks, Andreas

(here's a test setup to illustrate: capytalk sync problem.kym)

asked May 16, 2020 in Capytalk & Smalltalk by andreas-frostholm (Practitioner) (390 points)
Because the triggers are one period behind, it looks like one of the two "(0.2 s random...)" expressions is answering a random number one behind in the sequence.

I thought one possible way round that issue might be to use a single SoundToGlobalController with the random sequence expression in it and reference that STGC in both the Selection and Trigger expressions. But where would you put that STGC?

1 Answer

0 votes

Here's an example Multigrid where the selection expression is:

(((!tc s tick nextRandom abs) seededWith: 0.2) * 3) ceiling

and the trigger expression is:

(((!tc s tick nextRandom abs) seededWith: 0.2) * 3) ceiling hasChangedInLast: 11 ms

The track's gear menu was used to make !Tc a shared control, and each Sound in the track is triggered by !IsActive.

answered May 17, 2020 by ssc (Savant) (126,620 points)
Thanks for bringing to our attention a discrepancy in hasChangedInLast: (in one of three branches it was not updating the receiver's state which, in your example meant that time was not advancing in the random number generator). This has been fixed in the next update (which will be uploaded shortly).

By using nextRandom instead, the time-updating occurs in !Tc tick so it will not be affected by the hasChangedInLast: problem (now fixed, in any case).
That's very interesting. Could you please describe when and where the error occurred in hasChangedInLast: in Multigrids? I use the expression to generate excellent triggers that reset capytalk expressions very well, like countTriggersReset:

Unfortunately I cannot update to the current version of Kyma 7+, because my multigrid only works in an older version of Kyma7+.
Why works your MultiGrid only in an older version of Kyma7+?
...