how to animate bezier curve

Hi, I’m trying to build a simple example that reads data from a txt file and visualizes as an animated the curve like poorman’s oscillscope:
As there is always noisy data point in the txt file, what are ways to draw smooth curve? maybe animated bezier curve? or is there a simpler way to do it? thanks.

One place to start might be with using an ofPath, adding bezier points, and then calling simplify() on that line before you draw it. Depending on what else you’re doing, something like fitLine might help too.

Thanks Joshua, I had the following but when i called simplify, it crashed:

in update
testLine.curveTo(x, y[1]);

in draw

without calling simplify function, it still doesn’t look smooth. any suggestion?

I’m looking at a couple of other examples:
cur.getSmoothed(8) in CV example
polyline has similar methods, too

still no luck in animating the smooth curve?!