Counter and playback

Hello. Faced such a problem with program oopsy patch for Daisy Patch. My task is to make a looper with playing the sample in different directions: if the knob is fully clockwise, the sample plays forward, when I turn the knob to the middle, the sample slows down and stops in the central position of the knob. Counter-clockwise it plays in the opposite direction and plays with speed according to the position of the knob (similar like Morphagene).

To do this, I use the ‘counter’, which counts down 2 seconds per loop (0-95999 for 48000khz patch). To control the speed and direction of the counter, I use its first input (1 full speed, 0 stop, -1 full speed reverse). In order for the counter to work within the given size, I use the ‘wrap’ operator, where I set the same size as for the counter.
And for some time everything works fine, but after a certain time, playback in the opposite direction starts to be glitch, works incorrectly and generally falls silent. Forward play still works fine.
It feels like there is a stack overflow or something like that. Tell me, how can I properly implement the loop control function so that everything works stably? I thought about using a ‘phasor’, but I heard that it’s not the best way either… Although, at first glance, it’s more convenient to work with than with a counter.

It would be useful if you posted your code.

Hello!!

It sounds like using [phasor] and [sample] operators might be what you’re looking for.

There’s a new gen~ book that came out recently that goes into detail about using those two operators in combination. I recommend this book a lot by the way!!

What’s good about using those two operators together is that you don’t need to worry about the size of the buffer. The input that [sample] expects is 0.0 - 1.0 (from [phasor] for example) and it is a relative position. 0.0 is start of the buffer and 1.0 and end of the buffer.

Here’s a simplified version of a patcher that’s in the book (I hope the authors don’t mind sharing one of the examples. Again, I highly recommend the book!! There is also an official tutorial about this topic on Cycling 74).

Changing the frequency from -1 to +1 hz in this patcher gives it that sound of pitch speed change like in Morphagene as you mentioned.

1 Like

OOPS - I forgot this is in the Oopsy section…