<?xml version="1.0" encoding="utf-8" standalone="yes"?>

<?xml-stylesheet href="./_c74_ref.xsl" type="text/xsl"?>

<!--This is an automatically generated file. DO NOT EDIT THIS FILE DIRECTLY. Rather, use the _ref.xml files found in the 'edits' folder.-->
<c74object name="scale" module="max" category="Math">
	<digest>
		Map values to an output range
	</digest>
	<description>
		The scale object maps an input range of float or integer values to an output range. The output range can be larger or smaller than the input range, can be inverted and can change numeric type. If specified, the mapping can also be exponential.
	</description>
	<!--METADATA-->
	<metadatalist>
		<metadata name="author">
			Cycling '74
		</metadata>
		<metadata name="tag">
			Max
		</metadata>
		<metadata name="tag">
			math
		</metadata>
		<metadata name="reference">
			TEXT_HERE
		</metadata>
		<metadata name="license">
			TEXT_HERE
		</metadata>
	</metadatalist>
	<!--INLETS-->
	<inletlist>
		<inlet id="0" type="INLET_TYPE">
			<digest>
				input value
			</digest>
			<description>
			</description>
		</inlet>
		<inlet id="1" type="INLET_TYPE">
			<digest>
				input range low
			</digest>
			<description>
				The low value of the expected input range
			</description>
		</inlet>
		<inlet id="2" type="INLET_TYPE">
			<digest>
				input range high
			</digest>
			<description>
				The high value of the expected input range
			</description>
		</inlet>
		<inlet id="3" type="INLET_TYPE">
			<digest>
				output range low
			</digest>
			<description>
				The low value of the output range
			</description>
		</inlet>
		<inlet id="4" type="INLET_TYPE">
			<digest>
				output range high
			</digest>
			<description>
				The high value of the output range
			</description>
		</inlet>
		<inlet id="5" type="INLET_TYPE">
			<digest>
				exponential base value
			</digest>
			<description>
				The exponential base value determines the curve used for mapping input values to output values.
			</description>
		</inlet>
	</inletlist>
	<!--OUTLETS-->
	<outletlist>
		<outlet id="0" type="OUTLET_TYPE">
			<digest>
				Output value
			</digest>
			<description>
			</description>
		</outlet>
	</outletlist>
	<!--ARGUMENTS-->
	<objarglist>
		<objarg name="input-low" optional="1" type="number">
			<digest>
				Set the low end of the input range
			</digest>
			<description>
				Sets the low end of the expected input range. Incoming values are not clipped to this range; rather, the input range is used to determine the value mapping formula.
			</description>
		</objarg>
		<objarg name="input-high" optional="1" type="number">
			<digest>
				Set the high end of the input range
			</digest>
			<description>
				Sets the high end of the expected input range. Incoming values are not clipped to this range; rather, the input range is used to determine the value mapping formula.
			</description>
		</objarg>
		<objarg name="output-low" optional="1" type="number">
			<digest>
				Set the low end of the output range
			</digest>
			<description>
				This sets the low end of the output range, and will be the lowest output value if the input value stays with its expected range.
			</description>
		</objarg>
		<objarg name="output-high" optional="1" type="number">
			<digest>
				Set the high end of the output range
			</digest>
			<description>
				This sets the high end of the output range, and will be the highest output value if the input value stays with its expected range.
			</description>
		</objarg>
		<objarg name="exponential" optional="1" type="float">
			<digest>
				Determine the curve of value mapping
			</digest>
			<description>
				This optional fifth argument specifies the nature of the scaling curve. This argument must be a floating-point number greater than 1., with larger values leading to steeper exponential curves.
				<br />
				<br />
				In
				<attr>
					classic
				</attr>
				mode a typical value for this argument is 1.06 and the number is converted according to the following expression:
				<br />
				(out_high-out_low &gt;= 0) ? (out_low + (out_high-out_low) * ( (out_high - out_low) * exp(-1*(in_high-in_low)*log(power)) * exp(x*log(power)) )) : (-1) * ( out_low + (out_high-out_low) * ( (out_high - out_low) * exp(-1*(in_high-in_low)*log(power)) * exp(x*log(power)) ) )
				<br />
				<br />
				In non-
				<attr>
					classic
				</attr>
				(modern) mode the value for the scaling curve must be higher than 0. and is converted according to the following expression:
				<br />
				<br />
				((x-in_low)/(in_high-in_low) == 0) ? out_low : (((x-in_low)/(in_high-in_low)) &gt; 0) ? (out_low + (out_high-out_low) * ((x-in_low)/(in_high-in_low))^exp) : ( out_low + (out_high-out_low) * -((((-x+in_low)/(in_high-in_low)))^(exp)))
				<br />
				<br />
				Note that prior to Max 6.0.4 the exponent was inverted. Thus, if you gave it an exponent of 2 the object behaved like it had an exponent of 0.5, and if you gave it an exponent of 0.5 it behaved like it had an exponent of 2. Patches from versions prior to 6.0.4 may require updating to work properly.
			</description>
		</objarg>
	</objarglist>
	<!--MESSAGES-->
	<methodlist>
		<method name="bang">
			<arglist />
			<digest>
				Perform the last scaling operation
			</digest>
			<description>
				Perform the scaling operation on the most recently received input value. If the range values have been changed, the scaling will be based on the new range.
			</description>
		</method>
		<method name="int">
			<arglist>
				<arg name="input" optional="0" type="int" />
			</arglist>
			<digest>
				Scale an integer value
			</digest>
			<description>
				The scaling function is performed on the incoming value. If any of the range types are floating point, the value is converted into a <m>float</m> for the calculation.
			</description>
		</method>
		<method name="float">
			<arglist>
				<arg name="input" optional="0" type="float" />
			</arglist>
			<digest>
				Scale a float value
			</digest>
			<description>
				In left inlet: The scaling function is performed on the incoming value. If the input range type is integer, the value is converted into an <m>int</m> for the calculation.
				<br />
				<br />
				In second inlet: Sets the low end of the input range.
				<br />
				<br />
				In third inlet: Sets the high end of the input range.
				<br />
				<br />
				In fourth inlet: Sets the low end of the output range.
				<br />
				<br />
				In fifth inlet: Sets the high end of the output range.
				<br />
				<br />
				In sixth inlet: Sets the scaling curve value as described in the object arguments section.
			</description>
		</method>
		<method name="list">
			<arglist>
				<arg name="input" optional="0" type="list" />
			</arglist>
			<digest>
				Scale a list of numbers
			</digest>
			<description>
				A list of numbers sent to the left inlet will trigger the output of a list with the results of scaling operation perforned on each item.
			</description>
		</method>
	</methodlist>
	<!--ATTRIBUTES-->
	<attributelist>
		<attribute name="classic" get="1" set="1" type="int" size="1">
			<digest>
				Backward compatibility mode
			</digest>
			<description>
				Classic mode uses exponential function that is backward compatible with old IRCAM patchers.
			</description>
			<attributelist>
				<attribute name="basic" get="1" set="1" type="int" size="1" value="1" />
				<attribute name="category" get="1" set="1" type="symbol" size="1" value="Value" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Classic Exponential Compatibility Mode" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="onoff" />
			</attributelist>
		</attribute>
	</attributelist>
	<!--EXAMPLE-->
	<examplelist>
		<example img="scale.png" caption="An example of how to scale an integer slider into a useful range of floating-point values" />
	</examplelist>
	<!--SEEALSO-->
	<seealsolist>
		<seealso name="expr" />
		<seealso name="linedrive" />
		<seealso name="zmap" />
		<seealso name="basicchapter11" module="max" type="tutorial" />
	</seealsolist>
	<misc name="Output">
		<entry name="int">
			<description>
				If only four arguments are provided and all four are of type <m>int</m>, scale will output scaled values as integers. Otherwise output is floating-point.
			</description>
		</entry>
		<entry name="float">
			<description>
				When scale receives a value in its leftmost inlet, that value is scaled to the indicated output range of values.
			</description>
		</entry>
	</misc>
</c74object>
