Login
Register
First time here? Check out the
FAQ
!
x
Kyma Q&A
All Activity
Questions
Unanswered
Tags
Users
Ask a Question
FAQ
kyma: sound design inspiration
Tap into the collective expertise of the Kyma community!
All categories
Using Kyma
(458)
Sound Design
(146)
Capytalk & Smalltalk
(299)
Controllers, OSC & MIDI
(208)
Hardware & Interfaces
(150)
General
(117)
Most popular tags
vcs
multigrid
osc
midi
capytalk
smalltalk
timeline
interface
kyma7
tool
kyma
wacom
kyma-control
arrays
script
bpm
delay
memorywriter
sample
Community
Recent Activity
Insights Magazine
Video Tutorials
Community Library
Kyma 7 Forum
Questions & Answers
Kyma Symposium
Kyma Users Sound & Video
1,378
questions
1,497
answers
3,340
comments
265
users
What would be the most elegant way to countTriggersMod 'forwards-backwards'
0
votes
569
views
I'd like to countTriggers up to a mod value, then count in reverse back to zero (or perhaps another integer) and then the counting flips direction again...
What would be a really neat way to do that in Capytalk?
counting
sequencer
modulo
asked
Apr 27, 2018
in
Capytalk & Smalltalk
by
cristian-vogel
(Master)
(
8,460
points)
Please
log in
or
register
to add a comment.
Please
log in
or
register
to answer this question.
1 Answer
+1
vote
Best answer
((((1 bpm: !BPM) nextIndex + !Beats) mod: (!Beats * 2)) - !Beats) abs
answered
Apr 27, 2018
by
ssc
(Savant)
(
128,320
points)
selected
Apr 28, 2018
by
cristian-vogel
That is very elegant! Thankyou.
One of the things I love about programming in Capytalk, an event driven language, is how the optimal solution to something does not usually involve 'Conditionals' as in other programming languages... such as If this condition is true then do this... Its encourages a more holistic form of thinking, less concerned with forcing behaviours and more about understanding the nature of fundamental processes, like 'different ways to count numbers' in this case.
I was just trying to implement this idea.... does nextIndexReset: understand the reverse: message like nextIndexMod: ?
I found this works for me...
| index clock |
clock := (1 bpm: !bpm).
index :=
(
(
(
((clock nextIndexMod: (!beats * 2) reverse: !reverse reset: !reset ) + !beats )
) mod: (!beats * 2)
) - !beats
)
abs.
index
Please
log in
or
register
to add a comment.
...