First time here? Check out the FAQ!
x

How can I trigger ramp00s of random length with random spacing in between using capyTalk?

0 votes
327 views

At first that seemed like an easy task but I can't find a way to do it without using a feedback loop:

- every 100 ms decide on a certain probability to trigger a ramp00

- if the ramp00 is triggered don't retrigger it until it finished

- the random spacing should always be active (so also when the ramp length is fixed)

| trigger |

trigger := ( ((1 - (FeedbackLoopOutput L asLogicValue)) * ((100 ms random) gt: !Density)) + (1 ramp00: 20 ms)) seed: 0.1.

(trigger ramp00: (!CenterDuration s + (trigger nextRandom * !Deviation s))) seed: 0.1

The output of the constant with this expression feeds the corresponding FeedbackLoopInput. So here I am preventing the retriggering by checking if the ramp is still running. That works but I'm scratching my head how I could do that with CapyTalk only - any ideas? 

Thanks!

asked Aug 24, 2016 in Capytalk & Smalltalk by kymaguy (Virtuoso) (10,580 points)

1 Answer

0 votes
 
Best answer

Here's a starting point:

| dur |
dur := EventVariable new.
((1 triggerTimeToNext: (dur <~ (!Random * !Deviation + !CenterDuration)) s + (!Random abs * !InterSpacing) s) ramp00: dur s) seed: 0.42

answered Aug 24, 2016 by ssc (Savant) (126,620 points)
selected Aug 25, 2016 by kymaguy
Ah yes the advanced art of the tilde ~:)
brilliant! thanks!
...