[PD] add or subtract value every N ms?
padawan12 at obiwannabe.co.uk
Fri Jul 27 13:43:40 CEST 2007
But this is better :) If the limiter is on the output then the counter continues
beyond the 0-127 range and goes out of bounds. Putting [clip] (same as min and
max together) inside the counter locks the value in range.
What's the best solution to prevent overshoot? I did solve this once before
but it used spigots and was ugly imo.
On Fri, 27 Jul 2007 12:28:00 +0100
Andy Farnell <padawan12 at obiwannabe.co.uk> wrote:
> A counter driven by a metro with a period N ms has its increment value
> set to -1, 0 or 1 by messages. Don't forget you need the 0 to halt it.
> Limits are set by min and max.
> This implementatiion has a small bug. When you change direction the last
> value stored in the float is flushed through so it overshoots by 1 in either
> direction. But it's simple to understand.
> On Thu, 26 Jul 2007 23:45:20 +0100
> PROTMAN <protman.makes.music at gmail.com> wrote:
> > Using a joystick pad to send a +1 or -1; when the value changes to +1, I
> > want to increment a value every N ms, and when it is -1, I want it to
> > subtract from the value every N ms.
> > This will, in effect, cause the value to slide, at speed of N, between 0
> > and 127. I would also need to have these values limited so they do not slide
> > lower than zero or above 127.
> > any hints on how to implement this?
> > thanks!!
> > jjh
> > --
> > joe j hahn
> > joehahn at gmail.com
> > 773.818.2762 cell
> > "All is fair in lunch and robot wars." ~___ _____
> Use the source
Use the source
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 746 bytes
Desc: not available
More information about the Pd-list