A nice and simple way to do do that kind of smoothing on a 0...1 number is:
3 x^2 - 2x^3 (i.e. 3 * x * x - 2 * x * x * x)
The idea is that you want a cubic curve (a * x^3 + b * x^2 + c * x + d = 0)
that satisfies:
- input: 0 gives output: 0
- input: 1 gives output: 1
- 1st derivative at 0 is 0
- 1st derivative at 1 is also 0
1st derivative is basically the slope of the curve, i.e. the rate it changes
at. So you want the tangent (i.e. slope) to approach 0 (i.e. be flat) as input
approaches 0 or 1
Given these 4 constraints, you need to solve for a, b, c and d. Of course you
don't actually have to, the solution is at the top of the email :)
Memo.
29 Ironworks. Dace Rd. London E3 2NX, UK
mob : +44 (0) 7958 783 832
tel : +44 (0) 20 8123 9986
fax : +44 (0) 20 8986 5496
work: www.msavisuals.com
play: www.memo.tv
On 19 Mar 2010, at 20:56, Dan Winckler wrote:
> Thanks, vade! And thank you again, Chris! This is very educational.
>
> Just to clarify, I'm not rushing to push out a new version now, right before
> the show -- the exponential scaling will have to do and there's plenty of
> controls for Wiley to play with. ;)
>
> cheers,
> dan
>
>
> On Mar 19, 2010, at 4:41 PM, Christopher Wright wrote:
>
>>> Chris Wright also threw in the sigmoid function
>>> (http://en.wikipedia.org/wiki/Sigmoid_function) -- thank you, Chris(x2).
>>> The difficulty is in fitting the curve to the desired range -- any tips,
>>> mathemagicians?
>>
>> Going with the sigmoid, you have an equation like this:
>>
>> y = 1 / (1 + e^-x)
>>
>> We can generalize this a bit more, and turn it into this:
>>
>> y = r / (1 + e^(-(x - o) * s))
>>
>> Where r is the "range" (0 to r), s is the "scale" (or "sharpness"?) (higher
>> numbers make the change from 0 to r occur more rapidly, default is 1), and o
>> is the "offset", where the transition takes place (normally 0).
>>
>> Varying r, s, and o will give you a sigmoid mapped however you'd like. (and
>> varying e will make you impossibly powerful ;)
>>
>> The other equations (sin being another good easy one) have similar
>> scale/offset changes to tweak them as necessary.
>>
>> (disclaimer: i'm not a real mathemagician, and was also educated by the US
>> education system ;)
>>
>> Chris
>
>
>
> On Mar 19, 2010, at 4:46 PM, vade wrote:
>
>> Dan, you can get close with a ease-in-ease-out function, aka easy-ease in AE.
>>
>> Check out : http://abstrakt.vade.info/?p=132 the javascript in the Max/MSP
>> patch potentially be of help, while it has some extra junk for Max/MSP, the
>> basic math is in there, implemented in a similar way as to what you want.
>>
>>
>> On Mar 19, 2010, at 4:42 PM, Dan Winckler wrote:
>>
>>> Thanks, Troy! I don't need to draw the curve, actually -- I'm just using
>>> it to scale incoming data. Specifically, I'm taking an incoming float
>>> number between 0. and 1.0 that is a linear scaling of pitch and reshaping
>>> it.
>>>
>>> If you're curious, yes, this is related to my previous post about
>>> pitch-tracking. Specifically, I'm doing the pitch-tracking in Max/MSP with
>>> the fiddle~ object and sending the resulting pitch and amplitude, scaled,
>>> to a QC comp that uses the pitch to control the hue of a gradient.
>>>
>>> Even more specifically, it's something I put together for Wiley Wiggins,
>>> who is doing visuals with The Octopus Project in Hexadecagon, which is a
>>> free show this evening in Austin, TX. "Music for eight-channel sound and
>>> eight-channel video performed live in the round. Awesome!"
>>> http://www.theoctopusproject.com/hxdx.html Wish I could be there but,
>>> alas, I'm in NYC.
>>>
>>> cheers,
>>> dan
>>>
>>>
>>>
>>> On Mar 19, 2010, at 4:27 PM, Troy Koelling wrote:
>>>
>>>> If those circles are control points, I'd probably guess this is a cubic
>>>> spline. CoreGraphics has the ability to draw that if you need to.
>>>>
>>>> This is a pretty good rundown:
>>>> http://cocoawithlove.com/2008/07/coregraphics-curves-and-lines-sample.html
>>>>
>>>> On Mar 19, 2010, at 1:15 PM, Chris Wood wrote:
>>>>
>>>>> See also gaussian curve/bell curve/s-curve... Although of course that was
>>>>> a straight spline curve in the first pic. Splines will give you what you
>>>>> want, but maybe not in the most simple way.
>>>>>
>>>>> Chris
>>>>>
>>>>>
>>>>> On 19 Mar 2010, at 19:52, Dan Winckler wrote:
>>>>>
>>>>>> Thanks, Tom and Jon! I remembered Grapher earlier today and it was a
>>>>>> big help, even though polynomial curves are not among its examples (sure
>>>>>> beats my old TI-82). Now to tweak the numbers until they give me the
>>>>>> shape I need. Additional help still welcome if offered. :)
>>>>>>
>>>>>> best,
>>>>>> dan
>>>>>>
>>>>>>
>>>>>>
>>>>>> <Screen shot 2010-03-19 at 3.49.57 PM.png>
>>>>>>
>>>>>>
>>>>>> On Mar 19, 2010, at 3:40 PM, Jon Pugh wrote:
>>>>>>
>>>>>>> At 3:14 PM -0400 3/19/10, Dan Winckler wrote:
>>>>>>>> What do you call a curve like the one in the attached image? Rather,
>>>>>>>> what's the mathematical term for the equation that produces such a
>>>>>>>> double curve. I am trying to scale an incoming float number (0.0
>>>>>>>> 1.0) so that it changes more quickly in the middle of the range (~0.2
>>>>>>>> - 0.8) than at the top and bottom (~ 0.0 - 0.2, 0.8 - 1.0). Right now
>>>>>>>> I've got exponential scaling, which works for the bottom of the range
>>>>>>>> but not the top.
>>>>>>>
>>>>>>> This is a curve produced by a polynomial equation. I recommend opening
>>>>>>> the application Grapher, which came with your Mac, and entering this
>>>>>>> equation: x = y^3+y^2+y
>>>>>>>
>>>>>>> This will give you a curve approximating the one you've drawn. Then
>>>>>>> you can play with adding numbers before the various terms (i.e. 3y^3,
>>>>>>> etc) to change the shape of the curve.
>>>>>>>
>>>>>>> Good luck.
>>>>>>>
>>>>>>> Jon
>>>>>>> _______________________________________________
>>>>>>> Do not post admin requests to the list. They will be ignored.
>>>>>>> Quartzcomposer-dev mailing list
>>>>>>> ([email protected])
>>>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>>> http://lists.apple.com/mailman/options/quartzcomposer-dev/dan%40danwinckler.com
>>>>>>>
>>>>>>> This email sent to [email protected]
>>>>>>
>>>>>> _______________________________________________
>>>>>> Do not post admin requests to the list. They will be ignored.
>>>>>> Quartzcomposer-dev mailing list ([email protected])
>>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>> http://lists.apple.com/mailman/options/quartzcomposer-dev/psonice%40gmail.com
>>>>>>
>>>>>> This email sent to [email protected]
>>>>>
>>>>> _______________________________________________
>>>>> Do not post admin requests to the list. They will be ignored.
>>>>> Quartzcomposer-dev mailing list ([email protected])
>>>>> Help/Unsubscribe/Update your Subscription:
>>>>> http://lists.apple.com/mailman/options/quartzcomposer-dev/tkoelling%40apple.com
>>>>>
>>>>> This email sent to [email protected]
>>>>
>>>
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Quartzcomposer-dev mailing list ([email protected])
>>> Help/Unsubscribe/Update your Subscription:
>>> http://lists.apple.com/mailman/options/quartzcomposer-dev/doktorp%40mac.com
>>>
>>> This email sent to [email protected]
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Quartzcomposer-dev mailing list ([email protected])
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/quartzcomposer-dev/dan%40danwinckler.com
>>
>> This email sent to [email protected]
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Quartzcomposer-dev mailing list ([email protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/quartzcomposer-dev/memo%40memo.tv
>
> This email sent to [email protected]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com
This email sent to [email protected]