# Smooth a graph as if placing a rope across the data…?

I'm not sure how to correctly phrase this question, in fact if I knew exactly what I needed to ask I could probably work it out myself, so please bear with me.

What I need to do is smooth out a line, but weight the smoothing so that the smoothed graph never goes below the sampled data. What it would look like is if you put a thick rope over the sample points so that at the pointy bits the smooth curve of the rope would be close to the data, and at the low points of the data the smooth rope would be hanging in space. Like the red line here (it's a bit wrong at the top right, but you get the idea):

This is for some motion graphics I'm doing. The samples are from a timed transcript of someone speaking. As they speak their words appear, and then float off, driven by an expression. If I track the timing of the words exactly it's very jerky, if I take an average of the value over a period of time, e.g. five seconds I get the smoothness I want, but it looks bad when the text lags behind the speaking, but not so much if the speech lags behind the words.

• +1 for a very interesting problem! I wonder if the convex hull would give you what you want? That would give you a piece-wise linear envelope, and there's probably some way you could get rid of the lower part of it. See en.wikipedia.org/wiki/Convex_hull_algorithms. Also, most numerical libraries would have numerical geometry algorithms in them, including the computation of convex hulls. – Adrian Keister Nov 28 '18 at 14:07
• Kinda disappointed that it's an interesting problem. I had hope that the answer would be 'oh that's just <mathematician's name> smoothing' – stib Nov 28 '18 at 23:53