First time here? Check out the FAQ!

Why does turnOnAfter change its duty cycle?

0 votes

I'm trying to delay a gate.

I have one gate that marks the beginning of a bar. I have another gate which I call "angle" that can vary when it occurs from the beginning to the end of the bar. A value of 0 would be the beginning of the bar. A value of 1 would be the end and a value of 0.5 would be in the middle.

I was using turnOnAfter: for: to create the angle gate from the bar gate.

I'm using a STGC to generate the angle gate and this is the expression in the value field:

!BarGate turnOnAfter: !Angle * ((!BPM / 4) bpm s) for: 0.1s

But as I increase !Angle the duration of the angle gate increases. I thought it would always be 0.1s. Why does it increase?

Also as the angle gate approaches the end of the bar it gets closer and closer to the next occurance of the bar gate. The subsequent triggering of the bar gate cuts short the duration of the angle gate that is triggering at the time. So it's not really acting like a delay line for a repeating gate. Is there a better way of doing this?

Here's a simple example showing this behaviour:

asked Aug 29 in Capytalk & Smalltalk by alan-jackson (Adept) (2,800 points)

2 Answers

+1 vote
In this case, you could use CapyTalkToSound to change your gating function into a signal. Then put that signal through a DelayWithFeedback to delay the onset but keep everything else about the signal the same.
answered Aug 29 by ssc (Savant) (57,590 points)
hello, i experienced the same thing as alan.
iam curious as well, why the duration of the gates gets longer when increasing the turnOnAfter: !Delay… thanks
0 votes

turnOnAfter:for: generates a new gate event that starts after the amount of time in the first argument and lasts for the duration you provide as the second argument. It idoes not delay the EventValue you provide as the receiver of the message; it generates a new gate. To delay an EventValue, use CapyTalkToSound to turn it into a signal, pass it through a DelayWithFeedback, and past the DelayWithFeedback into the parameter field where you were using that EventValue.

answered Aug 31 by ssc (Savant) (57,590 points)

If turnOnAfter:for: creates a gate that lasts for the duration of the second argument, why does it appear to change in duration when I give it a constant for the second argument?