<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">IOhannes, you are right only in these
      cases:<br>
      <br>
      0 127 0 500<br>
      0 300 0 1<br>
      ...<br>
      <br>
      But, if I need:<br>
      <br>
      50 10 0 500<br>
      3000 -3000 0.5 0.6<br>
      ...<br>
      <br>
      I will need a "linear equation conversion". As I wrote in last
      mail, I was needing something like this, first in ActionScript...
      then in Python... but I never could did it. Now, I needed again in
      Pd... so, I made lin-eq-conv.pd with extrapolation and
      lin-eq-conv-clip.pd for clipped values. I made it as neat as I
      could, to see how it works. Using x0-x1 and y0-y1, it uses expr to
      get "a" and "b" at load. Then, it only computes "aX + b = Y".<br>
      <br>
      I attach the lin-eq-conv.pd, lin-eq-conv-clip.pd and
      lin-eq-conv-help.pd.<br>
      <br>
      Also, I have some issues using [autoscale]. I start giving values
      and it outputs only 1. Then, I start to down the input and, then,
      it shows the real output. Maybe it's about this version (0.43.4
      Pd-Extended 64bits).<br>
      <br>
      PD: translated to Python:<br>
      <br>
      <code>def lin_eq_conv(x, x0, x1, y0, y1):<br>
        &nbsp; &nbsp;a = (y0 - y1) / (x0 - x1)<br>
        &nbsp; &nbsp;b = (a * x0) + y0<br>
        &nbsp; &nbsp;return a * x + b</code><br>
      <br>
      <br>
      <br>
      <br>
      El 03/09/13 03:32, IOhannes zm&ouml;lnig escribi&oacute;:<br>
    </div>
    <blockquote cite="mid:5225827A.5090600@iem.at" type="cite">
      <pre wrap="">On 09/02/2013 06:17 PM, hghoyer wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">Hi,

in Max/MSP there is an object for simple scaling.

If you create in MAX these object with this arguments:

[scale 0 127 0 500] incomming messages from 0 to 127 are automatically
scaled from 0 to 500...
</pre>
      </blockquote>
      <pre wrap="">
honestly i'm of the firm conviction that you should learn how scaling
works: it really is only a matter of adding, multiplying, dividing,
subtracting - stuff you should heave learned in primary school.

as frank pointed out, this should do for you:

|
[/ 127]
|
[* 500]
|

if you find it too tedious to do the maths over and over again, you
might want to create an abstraction.


being able to solve trivial problems like this will surely empower you
to solve more complex problems :-)

gamsdr
IOhannes



</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
<a class="moz-txt-link-abbreviated" href="mailto:Pd-list@iem.at">Pd-list@iem.at</a> mailing list
UNSUBSCRIBE and account-management -&gt; <a class="moz-txt-link-freetext" href="http://lists.puredata.info/listinfo/pd-list">http://lists.puredata.info/listinfo/pd-list</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>