Dear all a y'all,
I have a list of 25 numbers between 800-19000 that I'm calling randomly'ish.
I want to add some constraints to those numbers: so for example, I have the number 6569 and by the use of either simple x2 multiplication or dividing I want to shoehorn it into the ranges of 11000-18000 but also 400-800 at the same time.
THe ranges are set but the numbers aren't. So say sometimes the range 2400-4700 may get a number that is less than the range like 912 and sometimes it will get a number over the range like 13264, so I need a way of Pd recognising whether the number requires multiplication or dividing.
How can I do this?
Bests,
Jbz
Hey IOhannes,
Yeah I thought about moses but doesn't moses always start at 0? Ideally I would like something with a range between 2 settable limits.
Cheers,
Jbz
2009/8/1 IOhannes m zmölnig zmoelnig@iem.at
J bz wrote:
How can I do this?
look at [moses]
fgmasdr IOhannes
J bz wrote:
Hey IOhannes,
Yeah I thought about moses but doesn't moses always start at 0?
no, why do you think so? (unless you mean, by "starting" what is the default behaviour when you don't specify an argument and/or don't reset the limit)
even if it did, you could always translform the numbers into the range you want them to be with simple linear transformation as learned in high-school (y=kx*d)
anyhow::
[moses 10] will divide at 10, whereas the following will divide at -5:
[loadbang]
|
[-5(
|
[moses 20]
fmasd IOhannes
Hi IOhannes,
Your right, of course.
Guess I needed that conceptual shift, not just relying on objects/abstractions to do the work for me.
Cheers,
Jbz
2009/8/1 IOhannes m zmölnig zmoelnig@iem.at
J bz wrote:
Hey IOhannes,
Yeah I thought about moses but doesn't moses always start at 0?
no, why do you think so? (unless you mean, by "starting" what is the default behaviour when you don't specify an argument and/or don't reset the limit)
even if it did, you could always translform the numbers into the range you want them to be with simple linear transformation as learned in high-school (y=kx*d)
anyhow::
[moses 10] will divide at 10, whereas the following will divide at -5:
[loadbang] | [-5( |
[moses 20]
fmasd IOhannes
Hi JBeez,
We could interpret this in two ways. A hard constraint is applied by using [moses] [max], [min] or [clip] so that numbers outside the desired bounds are simply discarded, or clamped to the boundry. Look that one up in the help files if it's what you want.
On the other hand, I think you really mean to rescale the numbers so that all of them fit between your new bounds.
Changing a range requires a linear scale function. There is one called [scale].
But, instead of just using a ready made abstraction maybe it's a good idea to understand the simple principle of changing the slope and origin of a line.
If your original bounds are 800 and 19000 then the magnitude of the range, the interval, is 19000 - 800 = 18200
The origin of the interval is 800, which is the lowest number you can have.
The first thing to do is 'reset the origin' so that all your numbers have a lowest value starting at zero, so to do that subtract 800.
Then scale the line to cover the magnitude of your new interval, which is 800 - 400 = 400
To map 18200 to 400 divide them to get 400/18200 = 0.021987
Now scale the numbers by that factor
Finally add the bottom offset, your new origin, by adding the lowest value of the new range which is 400
So the complete scale function is now
((x - 800) * 0.021987) + 400
(see attached patch)
a.
On Sat, 1 Aug 2009 15:32:06 +0100 J bz jbeezez@googlemail.com wrote:
Dear all a y'all,
I have a list of 25 numbers between 800-19000 that I'm calling randomly'ish.
I want to add some constraints to those numbers: so for example, I have the number 6569 and by the use of either simple x2 multiplication or dividing I want to shoehorn it into the ranges of 11000-18000 but also 400-800 at the same time.
THe ranges are set but the numbers aren't. So say sometimes the range 2400-4700 may get a number that is less than the range like 912 and sometimes it will get a number over the range like 13264, so I need a way of Pd recognising whether the number requires multiplication or dividing.
How can I do this?
Bests,
Jbz
Very nice.
Cheers Andy,
Jbz
On Sat, Aug 1, 2009 at 5:43 PM, Andy Farnell padawan12@obiwannabe.co.ukwrote:
Hi JBeez,
We could interpret this in two ways. A hard constraint is applied by using [moses] [max], [min] or [clip] so that numbers outside the desired bounds are simply discarded, or clamped to the boundry. Look that one up in the help files if it's what you want.
On the other hand, I think you really mean to rescale the numbers so that all of them fit between your new bounds.
Changing a range requires a linear scale function. There is one called [scale].
But, instead of just using a ready made abstraction maybe it's a good idea to understand the simple principle of changing the slope and origin of a line.
If your original bounds are 800 and 19000 then the magnitude of the range, the interval, is 19000 - 800 = 18200
The origin of the interval is 800, which is the lowest number you can have.
The first thing to do is 'reset the origin' so that all your numbers have a lowest value starting at zero, so to do that subtract 800.
Then scale the line to cover the magnitude of your new interval, which is 800 - 400 = 400
To map 18200 to 400 divide them to get 400/18200 = 0.021987
Now scale the numbers by that factor
Finally add the bottom offset, your new origin, by adding the lowest value of the new range which is 400
So the complete scale function is now
((x - 800) * 0.021987) + 400
(see attached patch)
a.
On Sat, 1 Aug 2009 15:32:06 +0100 J bz jbeezez@googlemail.com wrote:
Dear all a y'all,
I have a list of 25 numbers between 800-19000 that I'm calling
randomly'ish.
I want to add some constraints to those numbers: so for example, I have the number 6569 and by the use of either simple x2 multiplication or dividing I want to shoehorn it into the ranges of 11000-18000 but also 400-800 at the same time.
THe ranges are set but the numbers aren't. So say sometimes the range 2400-4700 may get a number that is less than the range like 912 and sometimes it will get a number over the range like 13264, so I need a way
of
Pd recognising whether the number requires multiplication or dividing.
How can I do this?
Bests,
Jbz
-- Use the source
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list