Kyma Forum
  Kyma Support
  threshold for changes for hasChangedInLast?

Post New Topic  Post A Reply
profile | register | preferences | faq | search

next newest topic | next oldest topic
Author Topic:   threshold for changes for hasChangedInLast?
Phi Curtis
Member
posted 01 September 2008 12:42         Edit/Delete Message   Reply w/Quote
Hi,

I have this code:

| penXSwarmController |

penXSwarmController := !PenX swarmFollowFromPosition: 0 velocity: !PenY acceleration: ((!PenTiltY * 0.5 + 0.5) clipTo01) friction: (((!PenTiltX * 0.5 + 0.5)clipTo01) * 0.95 + 0.05).

(penXSwarmController hasChangedInLast: 0.1 s)

You can see that I am using a swarmFollowFromPosition expression on !PenX, and I am detecting when the resulting movement has stopped. However, I find that when the friction in the expression is low (ie when !PenTiltX is low) a large amount of time is spent waiting for extremely small changes in the value of the penXSwarmController expression to die away. I would like the hasChangedInLast expression to disregard very small changes (say +/- 0.05), so that it doesn't take so long for the expression to become 0.

Any ideas of simple ways to do this?

thanks,
Phil

[This message has been edited by Phi Curtis (edited 01 September 2008).]

IP: Logged

SSC
Administrator
posted 01 September 2008 16:09         Edit/Delete Message   Reply w/Quote
I wonder whether sameForLast:tolerance: might work in this situation? For example

penXSwarmController sameForLast: 1 tolerance: 0.5

For small changes in the measured value, this will be true. However, if the value jumps 0.5 between updates, the expression becomes false (0). You make tolerance into a fader to experiment and find the right tolerance value.

IP: Logged

Phi Curtis
Member
posted 01 September 2008 17:43         Edit/Delete Message   Reply w/Quote
Hi SSC,

Thanks - this seems to be in the right direction, but it seems to work almost opposite of what I'm looking for. If I set the tolerance very low (like at 0.001), it seems to toggle when the changes in the swarm expression are large.

What I was doing to test it was using this code in a SoundToGlobalController with the "silent" parameter unchecked (so I can listen for fast triggers):

code:

| penXSwarmController |
penXSwarmController := !PenX swarmFollowFromPosition: 0 velocity: !PenY acceleration: ((!PenTiltY * 0.5 + 0.5) clipTo01) friction: (((!PenTiltX * 0.5 + 0.5)clipTo01) * 0.95 + 0.05).

penXSwarmController sameForLast: 1 tolerance: 0.001



IP: Logged

All times are CT (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply

Contact Us | Symbolic Sound Home

This forum is provided solely for the support and edification of the customers of Symbolic Sound Corporation.


Ultimate Bulletin Board 5.45c