| 1 | |
| 2 | <refentry id="scale2"> |
| 3 | <indexterm id="IndexScale2"><primary>scale2</primary></indexterm> |
| 4 | <refentryinfo><title>Signal Generators:Linear and Exponential Generators</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>scale2</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>scale2</refname> |
| 11 | <refpurpose> |
| 12 | Arbitrary signal scaling with optional smoothing. |
| 13 | </refpurpose> |
| 14 | </refnamediv> |
| 15 | |
| 16 | <refsect1> |
| 17 | <title>Description</title> |
| 18 | <para> |
| 19 | Scales incoming value to user-definable range. Similar to scale object found in popular dataflow languages. |
| 20 | </para> |
| 21 | </refsect1> |
| 22 | |
| 23 | <refsect1> |
| 24 | <title>Syntax</title> |
| 25 | <synopsis>kscl <command>scale2</command> kinput, kmin, kmax[, kimin, kimax][ihtime]</synopsis> |
| 26 | </refsect1> |
| 27 | |
| 28 | <refsect1> |
| 29 | <title>Initialisation</title> |
| 30 | <para><emphasis>ihtime</emphasis> -- Optional; Half time value |
| 31 | for internal port filter for smoothing. Default is no smoothing. |
| 32 | </para> |
| 33 | </refsect1> |
| 34 | |
| 35 | <refsect1> |
| 36 | <title>Performance</title> |
| 37 | <para> |
| 38 | <emphasis>kin</emphasis> -- Input value. Can originate from any |
| 39 | k-rate source and should be in the range |
| 40 | <emphasis>kimin</emphasis> to <emphasis>kimax</emphasis>. If it |
| 41 | is larger than kimax it is treated as kimax, and if less than |
| 42 | kimin then it is treated as kimin. |
| 43 | </para> |
| 44 | <para> |
| 45 | <emphasis>kmin</emphasis> -- Minimum value of the resultant scale operation. |
| 46 | </para> |
| 47 | <para> |
| 48 | <emphasis>kmax</emphasis> -- Maximum value of the resultant scale operation. |
| 49 | </para> |
| 50 | <para> |
| 51 | <emphasis>kimin</emphasis> -- Optional; Minimum of the incoming |
| 52 | value range, defaulting to zero. |
| 53 | </para> |
| 54 | <para> |
| 55 | <emphasis>kimax</emphasis> -- Optional; Maximum of the incoming |
| 56 | value range, defaulting to one. |
| 57 | </para> |
| 58 | <para><warning>The argument order is minimum before maximum, which |
| 59 | differs from <command>scale</command> but it consistent with other opcodes that use a |
| 60 | range.</warning></para> |
| 61 | </refsect1> |
| 62 | |
| 63 | |
| 64 | <refsect1> |
| 65 | <title>Examples</title> |
| 66 | <para> |
| 67 | Here is an example of the scale2 opcode. It uses the file <ulink url="examples/scale2.csd"><citetitle>scale2.csd</citetitle></ulink>. |
| 68 | <example> |
| 69 | <title>Example of the scale2 opcode.</title> |
| 70 | <para>See the sections <link linkend="UsingRealTime"><citetitle>Real-time Audio</citetitle></link> and <link linkend="CommandFlags"><citetitle>Command Line Flags</citetitle></link> for more information on using command line flags.</para> |
| 71 | <xi:include href="examples-xml/scale2.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 72 | </example> |
| 73 | </para> |
| 74 | </refsect1> |
| 75 | |
| 76 | <refsect1> |
| 77 | <title>See also</title> |
| 78 | <para><link linkend="SiggenLineexp"><citetitle>Linear and Exponential Generators</citetitle></link></para> |
| 79 | </refsect1> |
| 80 | |
| 81 | <refsect1> |
| 82 | <title>Credits</title> |
| 83 | <para> |
| 84 | <simplelist> |
| 85 | <member>Author: &namejohn; after David Akbari</member> |
| 86 | <member>December</member> |
| 87 | <member>2020</member> |
| 88 | </simplelist> |
| 89 | </para> |
| 90 | </refsect1> |
| 91 | </refentry> |