I’m having a problem with my signal conditioning: a resistive touchscreen is sending X/Y location data via Arduino to Max. The circuit and Arduino code is optimized, with one minor/major snag – tiny variations in fingertip contact pressure create radical leaps in that data. In order to get ‘smooth’ predictable values into Max one must maintain continuous pressure, and contact/release must be instantaneous; anything else and my X/Y [pictslider] leaps about all over the shop.
I have been successful in optimizing the hardware and code (through the Max, Arduino and Instructables forums), but the jittery characteristic of this type of touchscreen remains. My question is this: I know what my pseudo code is, which objects are best suited to realise a non-temporal "jitta-killa"? There are numerous solutions using [line], [if], [gate] etc on the forum but most introduce unwanted latency (however small):
"if the value makes a sudden large leap DOWN, ignore that large leap and retain the value before that leap, regardless of number-stream direction".
This is only really vital when values are continuously scrolling (ie during continued contact).
I’m halfway there with this algorithm:
[number] -> [t i i] ->-> (L, R)[>] -> [sel 1 0], which gives me number-stream direction……..
This feels a little poorly-explained,
Ahoy, can you define the threshold above which you would call a leap large?
there is a "look before you leap" in the cnmat collection. from the helpfile:
Look Before You Leap:" Echo an input stream of numbers to the output, but "don’t believe" large jumps unless the input stays at that value for a while.
does that help?
this is tricky, as the interface will be used in two ways: drag single finger ‘continuously’ or touch discretely (single finger too); this last will create large leaps that are intended. Discrete touches create almost instantaneous jumps to the required/intended value; with dragging/scrolling, however, variations in finger pressure create the sudden (but not instantaneous) leaps to a much lower value. Imagine drag-clicking and discrete clicking; this is the functionality i’m intending. The touchscreen is not pressure sensitive, it’s just doing simple X/Y polling – it’s the minute changes in fingertip touch area that create this anomaly.
I will definitely check the cnmat library and get back here with the results
A patch that resides in my ‘Max utilities’ folder contains many jitter/noise solutions, several of which I think are yours. I’ll look at the various solutions in the thread you mention.
My own attempts all produce some degree of latency (even those involving just [zl] objects, or audio rate filtering) – I guess because they are ON all the time (thereby inducing latency), I’m looking for something that responds only if certain conditions are met, for example:
if the number stream is smooth and without large leaps, let it go, if a large leap occurs ignore it; if the number stream is static and a leap occurs don’t ignore it…..
feature request pseudo-code compiler object for Max?
For those following:
[zl stream 5] -> [zl median] appears to be the best solution thus far; but only for a continuous (scrolling) number stream – if the number stream consists of discrete values (via discrete touches), for example (X=45, Y=45) then (X=126, Y=5), [zl stream] can’t do its job. I tried inserting a pack/line combo, but that has the inverse effect. Discrete values get through, but jitter returns?!?
cnmat’s [lbyl] works quite well too, but exhibits similar functionality when discrete values arrive……
here’s an annotated patch:
----------begin_max5_patcher---------- 919.3oc2X97aaBCEG+bpz9e3ItrKsUXCDHamlztrKa6v1zlpplb.2DuB1QXy ZSm1+6y7f7i1RZPoPXaWpadXa9993meOi+0KNYjyT0sbsC7J3BXzneYsLBsU ZYzJCibxX2FmxzXGchUYYbow4z5GZ32ZvGjwVNkCERIOlq0r7kq6hrHSHS4F bBHqrdkRZjrLNN3uvySXR11CQUXVMF2UlEIXuUS+wYATmsmIs3NblHjyW26E LS7bgb12y4wlJubrmm84fmK1PnXC08bW3RbP+9EmT1ZaN84SjO74O8wO+odF CtGDFBBKc7fPz+CF2mT3cuu2gf+jCBB909MsyffUpS44cmyRavY8BW24pdZV tfW4QNhxE.vYJSNyAt7PXRTDhg.ejItcAS32Xk8iiKRERdyjxqiHEcCoVjy0 1nSlQnja4tSbwUcOJ5tt0+YC4dDfKo6gQ1vwjpLOAkM9i6QxtfEeMH.hay3k d.3kzDdmre7h9LcRTaw6yAszvIkM0+3e1fVemdH5KHrJP2M5+lnOOmNNLplQ zHZ2EFcDpGPo8Z8fprV9AcV8fEhXiNUjrKtr1GyEyla9IKsnRntt6gIF0hl5 81nxceYrB8PG0KpsYrpIbYyldkxuZKgGrx7TkwnxZ3A6NXz2qNLDKPQJM1Ca YuKEzlbNKCB5tMsMEqRB12BPzD+pMgjiVE4H7sD50i4Ds.NimHXxdFug6Gu0 e+y3iEd8qNvyX+9EuGo3Wu9r37+QAhjdjScYD0N+p03TQ70mkjylMyJBfklp tQCl4b3h6RuDrNoUVVCJHQUZVjC+PMEhU4k5McIbFjHzw4bCGv4RCBIN9ud1 2.s8PRbfISd7Lxx4mBXouzkmBYBcJO40vb0M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