SW curve calculator

Mark Davidson mark.davidson@mindspring.com
Thu, 28 Aug 2003 22:49:56 -0400


Bill Ballard wrote:
> At 7:38 PM -0400 8/28/03, Mark Davidson wrote:
> >3. If you want to smooth SWs but not put them on a standard curve, you can
> >enter them (as in the example SW values I gave) and then adjust your curve to
> >smooth them out.
> 
> I'm a little confused here. The "standard curve" you refer to, would 
> an example of that be one of Stanwood's standard curves?

Yes, that's what I meant (are there others?).  What I really should 
have said is you can overlay a smooth curve on your jagged curve 
while doing  adjustments.  You don't really "smooth" the jagged one.  
You just have a nice visual way of doing it.

> 
> What do you mean by "adjust your curve to smooth them out"? The only 
> way to adjust the curve (ie., alter it) is to change the goal points, 
> right? This is a visual process where one looks at the raw, jagged 
> data set and decides intuitively what values #1, 30, 59 and 88 would 
> need to either smooth that jagged line, or further 2.) insure that 
> the smoothed value was never 1.0g less than the original raw value. 
> (Let's be reasonable about how much one can carve off a hammer.) Once 
> the goal points are set, the curve they yield has to be smooth. Or is 
> what you're talking about smoothing is the original jagged data set?

I meant what you said.  You don't really smooth the jagged curve.  Just
create a smooth curve that is close enough to the jagged one to not keep
you awake at night.  Try setting up a column that gives abs(jagged-smooth).
Then minimize sum of this column by playing with goal points.

> 
> >Note that for "curvier" curves, the note 30 and 59 goals
> >may not match the result curve.  Endpoints will always be
> >exact matches.
> 
> You're correct. However, these must be different Bezier curves than 
> the ones I'm familiar with from the vector-based draw programs like 
> Adobe Illustrator and MacroMedia Freehand. Your "goal points" appear 
> to be their anchor points. The definition of their Bezier curve is 
> that it will pass through the anchor points. Also, regardless of the 
> approach which the curve on either side of the anchor point makes, 
> when each side hits the anchor point, their inclination (slope) is 
> identical.

I played some tricks - see below.

> 
> What, pray tell do you have hidden in cells J2 through J5?  <g> 
> (Gawd, I hate MS Excel. Why can't they manage to include the standard 
> file command "Revert to Saved"?)

Select columns on both sides, right click and "unhide" to see all the gory details.

OK. Here's the math:

First define "t" function.  This is just the note numbers mapped onto the range
0..1, so it's t(note) = (note-1)/87.

Normally Bezier functions give you (x,y) as a function of t.  I computed only the y
value and let x just be the note number.  Not strictly speaking a Bezier, but works
well enough for this purpose since x values are pretty evenly spaced.

If A, B, C, D are your 4 values, then A and D are anchors and 
B and C are controls.

y values are given by this ugly thing:

        y = (1-t)^3*A+(1-t)^2*t*B+(1-t)^2*t^2*C+t^3*D

That's really all you need to create a nice curve.  I went one step 
further and tried to find control values that gave the correct goal 
values for B and C (i.e. tried to make the curve go through B and C).  
The way I did this is to do several iterations (setup as repeating 
columns).  For each, I add onto B and C the error from the previous 
iteration.

So if the goal for B is 10 but the curve is at 9.7, then I use B=10.3 for 
the next try. About 4 or 5 times does a pretty good job for anything 
that's only modestly curved.  I set up the spreadsheet to only show 
the final column and not all the intermediate ones.

-Mark

"Math is hard!"    -Barbie

This PTG archive page provided courtesy of Moy Piano Service, LLC