Hi, I would want to know if exist an object in pd (or externals) that changes the range of one stream of numbers. for example: I would want to convert a stream in the range from 0 (0.01 0.02 0.03 .. 0.99) to 1 (the x coords of a xv window) in a stream of numbers from 0 to 127.
I have not understood if the object clip (of which I do not have the help) make this, it not seem me.
Lazzaro
On Fri, Aug 20, 2004 at 06:23:48PM +0200, IOhannes m zmoelnig wrote:
Lazzaro N. Ciccolella wrote:
I would want to convert a stream in the range from 0 (0.01 0.02 0.03 .. 0.99) to 1 (the x coords of a xv window) in a stream of numbers from 0 to 127.
how about [* 127] ? maths can be awesome...
Thanks but (apologize if I have too much simplified the question) what succeeds if I must convert one portion of that range ? example I would want to convert the range 0.20 - 0.60 in the range 0 - 127
in other word:
0.20 must become 0 and 0.60 must become 127
(I am making a patch that transforms whichever thing inside a pidip_canvas in one slider 0-127)
I have already made the subpatch (with the maths object :)) that make this trasformation but the patch becomes more and more large and I asked if were a pd object that let me to save cpu.
Lazzaro
Hallo, Lazzaro N. Ciccolella hat gesagt: // Lazzaro N. Ciccolella wrote:
what succeeds if I must convert one portion of that range ? example I would want to convert the range 0.20 - 0.60 in the range 0 - 127
in other word:
0.20 must become 0 and 0.60 must become 127
(I am making a patch that transforms whichever thing inside a pidip_canvas in one slider 0-127)
I have already made the subpatch (with the maths object :)) that make this trasformation but the patch becomes more and more large and I asked if were a pd object that let me to save cpu.
It could be interesting to benchmark an abstraction solution agains maxlib.scale, but I doubt, that maxlib.scale would be that much faster.
Attached is an abstraction I sometimes use when I want to make sure, I don't need to rely on maxlib.scale (which also can clash with Gem.scale)
Frank Barknecht _ ______footils.org__
maths can be awesome...
I would want to convert the range 0.20 - 0.60 in the range 0 - 127
oh, oh, probably (sorry for being sarcastic, but) this can be done with maths too!
[- 0.2] | [* 317.5]
any other questions ?
mfg.as.dr IOhannes
PS: sure there are externals that can do this better. PPS: you can also use [.] (from zexy) to do the multiplication
On Fri, Aug 20, 2004 at 07:47:07PM +0200, IOhannes m zmoelnig wrote:
oh, oh, probably (sorry for being sarcastic, but) this can be done with maths too!
You are welcome (also because I am one great ass im mathematics !)
[- 0.2] | [* 317.5]
great
any other questions ?
yes,
it is wery wery fast (sure faster than a lib)
but how I can make it automaticaly ?
how calculates the two numbers ?
Lazzaro
On Friday 20 August 2004 18:18, Lazzaro N. Ciccolella wrote:
yes,
it is wery wery fast (sure faster than a lib) but how I can make it automaticaly ? how calculates the two numbers ?
many thanks
You want to map a range of 0.5 length f.i. starting at 0.1 to another range starting at 0 or any other number. You do that by
subtract the smallest number (so that is mapped to zero) 2) multiply by the desired-range/input-range (i.e.) biggest number - smallest number) 3)if necessary add the new lower bound.
so 0.1-0.5 mapped to 20-500 goes like so:
G
Hallo, vanDongen/Gilcher hat gesagt: // vanDongen/Gilcher wrote:
You want to map a range of 0.5 length f.i. starting at 0.1 to another range starting at 0 or any other number. You do that by
subtract the smallest number (so that is mapped to zero)
You need not necessarily use the smallest number, though. If you want to invert the input and for example map [127,10] to [20,40] it's possible as well like this (x is input):
x-127
although 10 and not 127 would be the smaller number, or more generally:
(x-il) * (il-ih)/(ol-oh) + ol
and in "expr" form for Pd:
[ expr ($f1-$f2) * ($f4-$f5) / ($f2-$f3) + $f4 ]
using input, from_low, from_hi, to_low, to_high as inlets.
Basically this all is an application of the "rule of three" from school.
Frank Barknecht _ ______footils.org__
This seems to be a very popular question...
#N canvas 435 305 484 374 12; #X obj 123 29 nbx 5 14 0 100 0 0 empty empty empty 0 -6 0 10 -262144 -1 -1 38 256; #X obj 123 52 / 100; #X floatatom 123 82 5 0 0 0 - - -; #X text 183 29 (0-100); #X text 172 83 (0-1); #X floatatom 123 334 5 0 0 0 - - -; #X floatatom 216 152 5 0 0 0 Minimum - -; #X obj 123 176 expr ($f1-$f2)/($f3-$f2); #X floatatom 353 152 5 0 0 0 Maximum - -; #X obj 123 212 clip 0 1; #X text 64 111 -------------------------; #X obj 307 81 loadbang; #X msg 294 111 0.2; #X msg 353 111 0.6; #X obj 123 276 * 127; #X text 172 273 New range; #X connect 0 0 1 0; #X connect 1 0 2 0; #X connect 2 0 7 0; #X connect 6 0 7 1; #X connect 7 0 9 0; #X connect 8 0 7 2; #X connect 9 0 14 0; #X connect 11 0 12 0; #X connect 11 0 13 0; #X connect 12 0 6 0; #X connect 13 0 8 0; #X connect 14 0 5 0;
----- Original Message ----- From: "Lazzaro N. Ciccolella" ciccolix@tiscalinet.it To: pd-list@iem.at Sent: Friday, August 20, 2004 12:55 PM Subject: Re: [PD] range of numbers
On Fri, Aug 20, 2004 at 06:23:48PM +0200, IOhannes m zmoelnig wrote:
Lazzaro N. Ciccolella wrote:
I would want to convert a stream in the range from 0 (0.01 0.02 0.03 .. 0.99) to 1 (the x coords of a xv window) in a stream of numbers from 0 to 127.
how about [* 127] ? maths can be awesome...
Thanks but (apologize if I have too much simplified the question) what succeeds if I must convert one portion of that range ? example I would want to convert the range 0.20 - 0.60 in the range 0 - 127
in other word:
0.20 must become 0 and 0.60 must become 127
(I am making a patch that transforms whichever thing inside a pidip_canvas in one slider 0-127)
I have already made the subpatch (with the maths object :)) that make this
trasformation
but the patch becomes more and more large and I asked if were a pd object that
let me to save cpu.
many thanks
Lazzaro
PD-list@iem.at mailing list UNSUBSCRIBE and account-management ->
On pe, 2004-08-20 at 19:15, Lazzaro N. Ciccolella wrote:
Hi, I would want to know if exist an object in pd (or externals) that changes the range of one stream of numbers. for example: I would want to convert a stream in the range from 0 (0.01 0.02 0.03 .. 0.99) to 1 (the x coords of a xv window) in a stream of numbers from 0 to 127.
At least "scale" by Olaf Matthes does this. I found it from pd-externals package from:
http://pure-data.sourceforge.net/
On Fri, Aug 20, 2004 at 07:34:23PM +0300, Sami Nybacka wrote:
At least "scale" by Olaf Matthes does this. I found it from pd-externals package from:
http://pure-data.sourceforge.net/
-- Sami Nybacka
Hi, many thanks it is exactly that one of which I have need.
Building the lib I had some errors regarding the net* stuff.
(for being able to use immediately the object that I need I am edited the makefile and the maxlib.c so I have now the scale and many other beautiful objects)
but if someone can help me I would want to compile all.
appended there are the errors.
Lazzaro
cc -DPD -DMAXLIB -DUNIX -O2 -funroll-loops -fomit-frame-pointer -Wall -W -Wshadow -Wno-unused -Wno-parentheses -Wno-switch -I/usr/include -I./include -c src/netclient.c
src/netclient.c:30:21: s_stuff.h: No such file or directory
src/netclient.c:32:19: m_imp.h: No such file or directory
src/netclient.c: In function netclient_tick': src/netclient.c:89: warning: implicit declaration of function
sys_addpollfn'
src/netclient.c:89: error: t_fdpollfn' undeclared (first use in this function) src/netclient.c:89: error: (Each undeclared identifier is reported only once src/netclient.c:89: error: for each function it appears in.) src/netclient.c:89: error: parse error before "netclient_rcv" src/netclient.c: In function
netclient_child_connect':
src/netclient.c:112: warning: implicit declaration of function sys_sockerror' src/netclient.c:133: warning: implicit declaration of function
sys_closesocket'
src/netclient.c: In function netclient_disconnect': src/netclient.c:162: warning: implicit declaration of function
sys_rmpollfn'
make: *** [maxlib.pd_linux] Error 1
Hallo, Lazzaro N. Ciccolella hat gesagt: // Lazzaro N. Ciccolella wrote:
On Fri, Aug 20, 2004 at 07:34:23PM +0300, Sami Nybacka wrote: (for being able to use immediately the object that I need I am edited the makefile and the maxlib.c so I have now the scale and many other beautiful objects)
but if someone can help me I would want to compile all.
appended there are the errors.
I would recommend you go to the externals/build/YOU_OS directory, and build the externals as single externals there.
Frank Barknecht _ ______footils.org__
Hallo, Frank Barknecht hat gesagt: // Frank Barknecht wrote:
I would recommend you go to the externals/build/YOU_OS directory, and build the externals as single externals there.
... that is, if you used the CVS checkout.
Frank Barknecht _ ______footils.org__
Lazzaro N. Ciccolella wrote:
On Fri, Aug 20, 2004 at 07:34:23PM +0300, Sami Nybacka wrote:
At least "scale" by Olaf Matthes does this. I found it from pd-externals package from:
http://pure-data.sourceforge.net/
-- Sami Nybacka
Hi, many thanks it is exactly that one of which I have need.
Building the lib I had some errors regarding the net* stuff.
The maxlib website states: "To compile with Pd 0.37 define "PD_0_37" in the makefile."
Olaf