Hi,
I think I found a bug in maxlib/scale. Unless the order of the parameters
is aligned - smaller value as smaller input/output and bigger value for
input/output -, the external doesn't work properly. Is this normal or
desired? I always thought that the parameter order would be
interchangeable without problems.
Here's a patch to illustrate it:
João Pais
On Fri, 2010-04-23 at 13:12 +0300, João Pais wrote:
Hi,
I think I found a bug in maxlib/scale. Unless the order of the parameters
is aligned - smaller value as smaller input/output and bigger value for
input/output -, the external doesn't work properly. Is this normal or
desired? I always thought that the parameter order would be
interchangeable without problems.Here's a patch to illustrate it:
Indeed, very wrong.
Unfortunately, from what I know maxlib is not maintained anymore by its original author (probably it can be considered 'community-maintained'). And since this can be nicely written as an abstraction, I'd say that the buggy external version should be avoided.
Roman
is the formula somewhere? I found a parcial one by frank, but didn't
really work. and now I'm too busy to be chasing this.
On Fri, 2010-04-23 at 13:12 +0300, João Pais wrote:
Hi,
I think I found a bug in maxlib/scale. Unless the order of the
parameters is aligned - smaller value as smaller input/output and bigger value for input/output -, the external doesn't work properly. Is this normal or desired? I always thought that the parameter order would be interchangeable without problems.Here's a patch to illustrate it:
Indeed, very wrong.
Unfortunately, from what I know maxlib is not maintained anymore by its original author (probably it can be considered 'community-maintained'). And since this can be nicely written as an abstraction, I'd say that the buggy external version should be avoided.
Roman
On Fri, 2010-04-23 at 13:36 +0300, João Pais wrote:
is the formula somewhere? I found a parcial one by frank, but didn't
really work. and now I'm too busy to be chasing this.
I don't know "the" formula, but I did it by putting two "Dreisätze" (rules of three?) in a row: The first scales the input to 0-1, the second scales 0-1 to the output range. If written out as a formula, this could probably even made shorter, I don't know.
Check the attached scale_abs.pd (It lacks the log/lin switch feature, though).
Roman
P.S.: [maxlib/scale] seems to apply correct formulas, but the initialization seems to be buggy. After manually setting the ranges, it outputs correct values.
On Fri, 2010-04-23 at 13:12 +0300, João Pais wrote:
Hi,
I think I found a bug in maxlib/scale. Unless the order of the
parameters is aligned - smaller value as smaller input/output and bigger value for input/output -, the external doesn't work properly. Is this normal or desired? I always thought that the parameter order would be interchangeable without problems.Here's a patch to illustrate it:
Indeed, very wrong.
Unfortunately, from what I know maxlib is not maintained anymore by its original author (probably it can be considered 'community-maintained'). And since this can be nicely written as an abstraction, I'd say that the buggy external version should be avoided.
Roman
On Fri, 23 Apr 2010, Roman Haefeli wrote:
I don't know "the" formula, but I did it by putting two "Dreisätze" (rules of three?) in a row: The first scales the input to 0-1, the second scales 0-1 to the output range. If written out as a formula, this could probably even made shorter, I don't know. Check the attached scale_abs.pd
That's quite exactly how I shown my students how to change the range of values, except we didn't have to do the stuff on the right because we were not trying to make an abstraction with it.
I mean, the [-] [/] [*] [+] sequence is exactly the same.
It's possible to make the left inlet run faster by condensing the formula to just a [*] and a [+], but then the right inlets become more complicated and slower. It's a possible tradeoff if you have to make the left inlet real fast, but I haven't taught that, and I didn't try to make an abstraction with it.
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801
Hallo, João Pais hat gesagt: // João Pais wrote:
is the formula somewhere? I found a parcial one by frank, but didn't
really work. and now I'm too busy to be chasing this.
It's called [m_scale] in the rj library and is pure Pd vanilla there. The plain linear interpolation is simple, the pow and dB formulas are a bit trickier (I took the dB one from a patch by Georg Holzmann), but basically what you do is map the input to replace left and right limit with with 0 and 1, then do the mapping either linear, pow or dB, then scale up again to the original limits.
The formula also is in the maxlib/scale source code in a more readable format.
Frank