how does ( -1 ) function as a fifth argument in the [scale] operator?

Leonard Zajdek's icon

Leonard Zajdek

6月 27 2024 | 7:20 午後

Hi - i am relatively new to Max8 / MSP / gen~ and generally its coming along fine but there is this thing bugging me - itsa question concerning the [ scale 1 0 0 1 -1 ] operator within the abstraction go.unit.trapezoid.gendsp

on page 68 of the amazing book "Generating Sound & Organizing Time" -

by what calculation does the fifth argument (-1) in [scale 1 0 0 1 -1 ] accomplish its task here?

i understand the function of the [scale] operator - and i am familiar with the maths and graphs of exponential curves - it is just i cannot grasp how this (-1) affects the offset [phasor] slope the way it does when it enters the following [ * ] operator .

will be grateful for a kind explanation -

leonard zajdek

Graham Wakefield's icon

Graham Wakefield

6月 28 2024 | 4:43 午後

Short answer: a power of n^-1 is the same as 1/n.

Full answer:

The [scale] arguments are [scale A B X Y P], where the fifth argument "P" is a power scale. First, the input in the range of A to B is normalized to a range of 0 to 1. Then this normalized number is raised to the power P. Then the result of this is scaled to the range X to Y. That is, for input n, the output is:

(( (n - A)/(B - A) )^P)*(Y - X) + X

So for [scale 1 0 0 1 -1] we end up with:

(( (n - 1)/(0 - 1) )^-1)*(1 - 0) + 0

= (( (n - 1)/(-1) )^-1)

= (1 - n)^-1

= 1/(1 - n)

Leonard Zajdek's icon

Leonard Zajdek

6月 28 2024 | 5:31 午後

Thanks for that Graham -

and for the longer explanation - they're the kind i like - i'm at peace now - - i had been sticking all kinds of values in there as well trying to figure out the connection - thanks again