[PD] weighted average (or ?)

João Pais jmmmpais at googlemail.com
Wed Jun 16 13:25:09 CEST 2010


I was going to program something, but wanted to see if someone hasn't done
it before. I needed a "weighted average" (probably the name is incorrect, I
just made it up), that is: considering an x number of sliders going from 0
to 1, the sum of all sliders would be always 1. In case I drag one slider up
or down, the difference in value to the total (1) would be distributed
through the other sliders that aren't active.
That itself isn't that hard to do, but then harder would be to consider the
previous state when the next change happens. So that a slider that is
already higher than the others by the next change would "retain" the average

I'll give an example for clarity:
- 4 sliders, initial state is each at 0,25 (4x0,25 = 1)
- I move slider #2 to 0,4, leaving a remainer of 0,6 to be distributed by
the other sliders. Sliders #1, #3 and #4 would then go down to 0,2 each.
- now slider #2 is higher than the others. But if I move #4 to 0,4, it
shouldn't happen that #1-3 move to 0,2. instead, the higher countour of #2
should be taken into account. The end result would be something like #4 =
0,4, #2 > 0,2, and #1 & #3 < 0,2.
- if I continued moving the sliders around, a similar behaviour would
- as a bonus, it would be possible to lock a slider into the present value,
only the others move.

Is there any external/patch for this, or any statistic formula / website I
should look at for this?



Friedenstr. 58
10249 Berlin Deutschland
Tel +49 30 42020091 | Mob +49 162 6843570
jmmmpais at googlemail.com | skype: jmmmpjmmmp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20100616/e172d1f1/attachment.htm>

More information about the Pd-list mailing list