Logarithmic scaling from input range

fraction's icon

hi everyone,

I am in the middle of a math problem. I assume that could be resolved by applying logarithmic scaling, but that's beyond my max knowledge,

Let say you have an input range of data from -50 to 50 sent in osc from a horizontal slider (0 in the middle). I want to scale the output, in order to still have a range from -50 to 50, but with a scale of data more precise as you get closer to 0 (from either ways, negative, or positive)

thanks for the help!
eric

brendan mccloskey's icon

Hi
I'm AFK at the moment, but search here for "tweening" or "easing functions". Essentially all you need to do is scale your input to between 0.0 and 1.0, then apply your curve using a power, either > or < 1.0 then scale back up to your desired output range.

Brendan

brendan mccloskey's icon
Max Patch
Copy patch and select New From Clipboard in Max.

and, here, for more comprehensive practical detail (from Gregory Taylor, mwah!)

brendan mccloskey's icon
Max Patch
Copy patch and select New From Clipboard in Max.

This depicts it a little better:

(from that other thread, but look at Gregory's equations too)

fraction's icon

thx brendan,

..apparently, there's something i was looking for, the so called 'split range'

will dig that! thx!

Max Patch
Copy patch and select New From Clipboard in Max.

fraction's icon

thx again brendan, but i tried your two patches, but i can't get the average data correctly. I mean, for instance on a scale -50 to 50, if i have 0 in input, i must found back this on output. Only datas around the 0 are progressively scaled . ..and i don't get that with this patches,...

any suggestion?

brendan mccloskey's icon

Hi
Are you asking for linear input/output between -50 and -10 (for example), then greater resolution (a curve) between -10 and 0?

Wetterberg's icon
Max Patch
Copy patch and select New From Clipboard in Max.

are you looking for something like this?

sorry for the hacky patch, you get the idea.

fraction's icon

yes that was that! :)

thx a lot!