k y m a • t w e a k y — the kyma collective || view the current website || February 2015 Archive

/ WebHome / Expressions / Share.ContinuousRotary

Search


Share Section


Sounds
Samples
Timelines
Tools
Microsounds

Home 
Topics 
More... 

All Sections


Products
Order
Company
Community
Share
Learn

Login / Register 
Change password
Forgot password?
%SESSION_IF_AUTHENTICATED% Site Map
%SESSION_ENDIF%

Symbolic Sound


Home
Kyma Forum
Eighth Nerve

TWiki Links


%SESSION_IF_AUTHENTICATED% TWiki Shorthand
TWiki Formatting FAQ
What is TWiki?
%SESSION_ENDIF% twiki.org
The idea of this example was to create an EventValue that could be incremented/decremented indefinitely by using a rotary control. The basic algorithm is:

If !Pos (the position of the rotary) has changed, diff is the difference between its old and new positions. Otherwise diff = 0. Add diff to val.

Here is the CapyTalk code:

| diff oldPos val |

"Declare EventVariables"
diff := EventVariable new initialValue: 0.
oldPos := EventVariable new readEveryMillisecond.
val := EventVariable new initialValue: 60.

((!Pos ne: oldPos)
   true: ((diff <+ (!Pos - oldPos)),

         "Kludge to ignore when the rotary wraps around and resets to 0"
             ((diff abs gt: 0.75) true: (diff <+ 0) false: nil),

             (oldPos <+ !Pos))
   false: (diff <+ 0)),

(val <~ (val + diff))

-- CarlaScaletti - 07 Jan 2004

Heureka! This piece of CapyTalk works really fine and solves a question, which has kept me busy for a long time. Thanks a lot for providing it.

-- EckardVossas - 19 Jan 2004

excuse my lack of knowledge.. but, where do i paste this code? just replace my hot parameters (ie: !LoopStart) with this entire bit? can i freely change the label of !Pos to reflect the name of the function?

-- TaylorDeupree - 21 Jan 2004

Taylor, please take a look at the example Sound for an example of how to use this code in the value field of a SoundToGlobalController.

-- CarlaScaletti - 31 Jan 2004

 
 
© 2003-2014 by the contributing authors. / You are TWikiGuest