Forums > MaxMSP

Percentage total amongst multiple numbers

May 11, 2012 | 2:04 pm

Hello

I’m currently working on a patch in which the user should be able to set himself the probabilities of certain events, to do this, I arranged some number boxes in which a total 100% is divided equally, what I want to do is substract numbers from the rest of the boxes whenever you increase the number in one of them, so they always sum up 100. Any ideas on how to accomplish this?

Example in case I didnt make myself clear:

[25] [25] [25] [25] = total 100%

If I added 3 to the first number box it should ideally do this:

[28] [24] [24] [24] = total 100%

Of course theres a lot of interrogants, as in which order should he substract or if it is possible to do with floats (this would be even better)

Thanks a lot in advance.



Ch
May 11, 2012 | 2:47 pm

You could maybe approach it this way :

– Pasted Max Patch, click to expand. –

May 12, 2012 | 9:03 am

this reminds me on my various approaches to do the same for a variable
number of gain regulators, where i needed to have a variable sum in addition.

try to realize it with "set" messages only at first, then you will see at which points
you need to have a pvar or something like that, where the state of the parameters
is copied in order to accumulate.

-110


Viewing 3 posts - 1 through 3 (of 3 total)