[PD] range of numbers

Thomas Ouellet Fredericks iamonthebeach at hotmail.com
Fri Aug 20 19:57:00 CEST 2004


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 at tiscalinet.it>
To: <pd-list at 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 at iem.at mailing list
> UNSUBSCRIBE and account-management ->
http://iem.at/cgi-bin/mailman/listinfo/pd-list
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: range.pd
Type: application/octet-stream
Size: 804 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20040820/fe0f59b5/attachment.obj>


More information about the Pd-list mailing list