# [sdiy] Bezier? B-Spline?

Tom Wiltshire tom at electricdruid.net
Sun Mar 8 14:12:39 CET 2015

```I've done similar things using quadratic interpolation. That makes it sound all mathy.

I've been trying to write this email several times, and each time got tangled up, so please bear with me.

All I really wanted to say is that the first differential is just the slope of a straight line graph y=mx+c is the amount that one point changes from the last. E.g. it's the increment you'd add on if you were generating the points sequentially.
The second differential is the rate of change of that slope. This time, that's the increment that you'd add to the slope whilst sequentially generating points.

If you know the starting slope and the ending slope, you know how many samples there are between them, so you can work out the rate-of-change-of-slope, the second differential. Then you can do something like this:

current_value = v1;				// Set up initial value

loop:

current_value += current_slope;		// Add slope (1st diff)  to current value
current_m += delta_slope;				// Add change-of-slope(2nd diff)  to slope

Repeat the loop until you reach the end of the segment. If you've got it right, you should finish up at the end point you intended!

On 7 Mar 2015, at 19:23, Tim Ressel <timr at circuitabbey.com> wrote:

> Hi,
>
> I have an application where I need to take segments of a multi-segment envelope generator and make them smoothed curves. Each segment is comprised of N samples. I want the smoothed curve to go through the end points of the segments. I was hoping a clever math dude can show me how to do this.
>
> Thanks!
>
> Tim Ressel
> Circuit Abbey
> 503-750-9331
> timr at circuitabbey.com
> _______________________________________________
> Synth-diy mailing list
> Synth-diy at synth-diy.org
> http://synth-diy.org/mailman/listinfo/synth-diy

```