[sdiy] Bezier? B-Spline?
Tom Wiltshire
tom at electricdruid.net
Mon Mar 9 00:51:00 CET 2015
Hi Tim,
There's still stuff I'm forgetting about how I made this work. I've been digging through some old code, and the midpoints of each section are important.
I think I maybe did a quadratic interp from the *midpoint* of each segment to the *midpoint* of the next. I was working on this in 2008, so it's all a bit out of mind. We know the position at the midpoints, and we know both the position and the required slope at the changeover points. That should be enough to get the curve.
I also see that the second differential is calculated by looking at the two slopes and *one less than* the number of samples. Since the number of changes is one less than the number of samples, clearly (clear as mud, m'lud?). 2 to 4 is three numbers, but only two increments.
That's not complicated, but I'd arranged things so each segment was a power-of-two number of samples so I could do division with downshifts, and that screwed up my clever plan.
I hope these ideas help you move along. Sorry to be so incomplete, but I hope it gives you enough to make some progress.
Regards,
Tom
On 8 Mar 2015, at 21:15, Tim Ressel <timr at circuitabbey.com> wrote:
> Hi Tom,
>
> If I'm reading you right, that is kinda what I want to try. There is a lot of math to deal with, but I think it will work
>
>
> Tim Ressel
> Circuit Abbey
> 503-750-9331
> timr at circuitabbey.com
>
>
> From: Tom Wiltshire <tom at electricdruid.net>
> To: Tim Ressel <timr at circuitabbey.com>
> Cc: Synth-diy Diy <synth-diy at dropmix.xs4all.nl>
> Sent: Sunday, March 8, 2015 6:12 AM
> Subject: Re: [sdiy] Bezier? B-Spline?
>
> 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 dropmix.xs4all.nl
> > http://dropmix.xs4all.nl/mailman/listinfo/synth-diy
>
>
More information about the Synth-diy
mailing list