Kyma Forum
  Kyma Support
  smoothing a new pen controller value

Post New Topic  Post A Reply
profile | register | preferences | faq | search

next newest topic | next oldest topic
Author Topic:   smoothing a new pen controller value
Phi Curtis
Member
posted 15 October 2006 17:20         Edit/Delete Message   Reply w/Quote
Hi,

I'm using this expression to smooth the first jump that happens to a pen controller such as !PenX when putting the pen down in a new place:

!PenX smooth: (( 1 - (!PenDown ramp: 0.05 s) rounded * !Smooth * 3) vmax: 0.01) s

I want the initial jump to be smoothed, but shortly thereafter, if the pen remains down, I want !PenX to be accurately tracked (not smoothed). So what I'm attempting to do is start every new !PenDown with an initial large smoothing value and then jump thereafter to a small value (0.01 s).

The expression above mostly works, but it frequently has jumps. In fact, if you paste it into a soundToGlobal controller and compile it, the first !PenDown consistantly causes a jump. Or at least it does for me. I'm having a hard time figuring out where it's breaking down, or coming up with an alternative approach.

I'm sure if I kept at it I could come up with something else, but I'm hoping to learn something if I can figure out why this way isn't working...

thanks,
Phil

IP: Logged

photonal
Member
posted 16 October 2006 07:10         Edit/Delete Message   Reply w/Quote
hi phil,

I don't have a pen controller but ideas which come to mind would be to have a variable (PenCoord) which holds the current value of !PenX and then testing for the difference between !PenX and PenCoord.

Using the difference you could then smooth by an amount according to a threshold. e.g. If difference > 0.5 then Smooth = 0.05 else Smooth = 0.01

andrew


IP: Logged

SSC
Administrator
posted 16 October 2006 09:59         Edit/Delete Message   Reply w/Quote
I wonder if PenX is changing even before PenDown. The tablet can track PenX and PenY even when you are above the tablet (but in close proximity), whereas PenDown occurs only when the pen is touching the tablet.

Maybe you could try a trackAndHold on the PenX so you don't track it unless the pen is down,
!PenDown trackAndHold: !PenX

IP: Logged

Phi Curtis
Member
posted 16 October 2006 19:46         Edit/Delete Message   Reply w/Quote
Thanks Andrew and SSC,

I do think there is something strange going on between !PenDown and !PenX in terms of !PenX maybe moving a little ahead of !PenDown, but the trackAndHold here doesn't seem to help.

I tried a few variations on Andrew's idea, as best as I could implement it (mostly comparing !PenX with a delayed version of !PenX). I got some things that were close, but didn't find anything that worked any better than what I had.

So far, the best solution I have found is pretty much my original formula, with the ramp time raised a little and minimum smoothing time at 0.05 s - it seems to jump less frequently.

So:

!PenX smooth: ( 1 - (!PenDown ramp: 0.1 s) * !Smooth vmax: 0.05) s

It's not exactly what I was looking for - I want something that tracks absolutely perfectly after an initial smooth fade to the first new value. Here there's still some smoothing because I've set the minimum smoothing time to 0.05 s instead of 0.01 s. Anyway, it's pretty close - it just feels a little sluggish, like there's some resistance to it. Not necessarily a bad thing - at least now it doesn't jump.

thanks,
Phil

[This message has been edited by Phi Curtis (edited 16 October 2006).]

IP: Logged

SSC
Administrator
posted 17 October 2006 13:11         Edit/Delete Message   Reply w/Quote
In Dec 04/Pen Examples.kym, there is an example called Test all pen controls. When you run that, do you see anything strange going on with respect to PenX values?

IP: Logged

Phi Curtis
Member
posted 18 October 2006 21:36         Edit/Delete Message   Reply w/Quote
No, I don't have any problems with the pen examples sound - If there is a problem with !PenX coming before !Pendown it would be too fast to see, and I don't think I've heard a problem either. I'm only saying that it seems like there may be a problem because the first formula I gave,

!PenX smooth: (( 1 - (!PenDown ramp: 0.05 s) rounded * !Smooth * 3) vmax: 0.01) s

has jumps fairly frequently when I paste it into a global controller. The way I understand it, it should be smoothed every !PenDown. However, increasing the smallest time value (say, from 0.01 s to 0.05 s) that the smoothing happens in seems to eliminate the problem, or mostly eliminate it.

Of course, the cause of the problem may lie elsewhere.

best,
Phil

IP: Logged

All times are CT (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply

Contact Us | Symbolic Sound Home

This forum is provided solely for the support and edification of the customers of Symbolic Sound Corporation.


Ultimate Bulletin Board 5.45c