First time here? Check out the FAQ!
x

How do you use a Midi jog wheel to scrub through a sample?

+2 votes
1,074 views
I've got a midi jog wheel that sends a cc:06 value when it moves. If the wheel is moved forwards it sends repeated values of 1 (or higher if you're moving quickly). If it's moving backwards it sends repeated values of 127 (or 126 etc if you're moving quickly).

It doesn't send a value of 0 in between these "ticks".

If I map the controller to a VCS fader then use hasChangedInLast: 0.001s and increment my sample's index, then I miss loads of events because the VCS fader isn't changing, it keeps receiving a value of 1 every so often.

I can't integrate or keep adding the 1 value either. It sends these ticks as you move. If you stop moving it stops sending ticks but the VCS controller will still be at 1. It never sends a 0.

So how do I receive every CC message and act upon it?
asked Nov 23, 2019 in Using Kyma by alan-jackson (Virtuoso) (15,840 points)

1 Answer

+1 vote
 
Best answer

Since the controller is not sending a proper trigger, but just a message whenever it moves, you can't use any of the normal trigger-related Capytalk messages.

The evaluation of a Capytalk expression is triggered whenever any of the values in the expression is received. This means that you could use an EventVariable to accumulate the value each time the message is received by the Paca(rana):

| sum value signedValue |

sum := EventVariable new.

value := (!cc06 * 127) rounded.

signedValue := (value gt: 63) true: 128 - value false: value).

sum <~ (sum + signedValue)

This expression cannot be used with any other Capytalk that might also trigger the evaluation (for example, another Event Value or a time-dependent Capytalk message) because then expression evaluation could be triggered by something other than !cc06, causing the value to be accumulated even though the !cc06 message was not sent.

This will work best if you use a SoundToGlobalController to send the accumulated value to your other Sounds.

answered Nov 24, 2019 by ssc (Savant) (128,080 points)
selected Nov 27, 2019 by alan-jackson
Fabulous!

You said, "... message is received..." and suddenly the event driven nature of when Capytalk expressions get evaluated makes sense to me.

I have a related question with the same controller... I'll ask it as another question.
Hi,

could you please post a sound example of code ssc posted .
I can not recreate it .
...