First time here? Check out the FAQ!

Freezing a KeyPitch with trackAndHold

0 votes
Why does a Capytalk expression like "(!Freeze - 1) trackAndHold: !KeyNumber nn" inside a Frequency Parameter Field not work as expected? What I'm doing wrong?

I want to control the frequency of a sound with a keyboard and to freeze from time to time the currenty played frequency by pushing a button, and using the keyboard during this time for controlling other parameters without affecting the frequency (and continue playing with variable frequency after releasing the button again).
asked Dec 29, 2019 in Capytalk & Smalltalk by explodingtickets (Adept) (1,230 points)

1 Answer

+1 vote
Best answer
I think this will work if you do the difference in the opposite direction:

(1 - !Freeze trackAndHold: !KeyNumber) nn

It also works with a logical NOT,

(!Freeze not trackAndHold: !KeyNumber) nn

(This freezes on the last pitch but does not affect !KeyDowns)
answered Dec 29, 2019 by ssc (Savant) (107,900 points)
selected Dec 30, 2019 by explodingtickets
For me "(!Freeze not trackAndHold: !KeyNumber) nn" is the best and most interesting solution. And of course toggle elements like these must be "(1 - !HotValue)" ... I've used this thousands of times ... don't know where my head was ...