| 1 | |
| 2 | <refentry id="cpstuni"> |
| 3 | <indexterm id="IndexCpstuni"><primary>cpstuni</primary></indexterm> |
| 4 | <refentryinfo><title>Pitch Converters:Tuning Opcodes</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>cpstuni</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>cpstuni</refname> |
| 13 | <refpurpose> |
| 14 | Returns micro-tuning values at init-rate. |
| 15 | </refpurpose> |
| 16 | </refnamediv> |
| 17 | |
| 18 | <refsect1> |
| 19 | <title>Description</title> |
| 20 | <para> |
| 21 | Returns micro-tuning values at init-rate. |
| 22 | </para> |
| 23 | </refsect1> |
| 24 | |
| 25 | <refsect1> |
| 26 | <title>Syntax</title> |
| 27 | <synopsis>icps <command>cpstuni</command> index, ifn</synopsis> |
| 28 | </refsect1> |
| 29 | |
| 30 | <refsect1> |
| 31 | <title>Initialization</title> |
| 32 | <para> |
| 33 | <emphasis>icps</emphasis> -- Return value in cycles per second. |
| 34 | </para> |
| 35 | |
| 36 | <para> |
| 37 | <emphasis>index</emphasis> -- An integer number denoting an index of scale. |
| 38 | </para> |
| 39 | |
| 40 | <para> |
| 41 | <emphasis>ifn</emphasis> -- Function table containing the parameters (numgrades, interval, basefreq, basekeymidi) and the tuning ratios. |
| 42 | </para> |
| 43 | </refsect1> |
| 44 | |
| 45 | <refsect1> |
| 46 | <title>Performance</title> |
| 47 | <para> |
| 48 | These opcodes are similar to <link linkend="cpstmid"><citetitle>cpstmid</citetitle></link>, but work without necessity of MIDI. |
| 49 | </para> |
| 50 | |
| 51 | <para> |
| 52 | <emphasis>cpstuni</emphasis> works at init-rate. It allows fully customized micro-tuning scales. It requires a function table number containing the tuning ratios, and some other parameters stored in the function table itself. |
| 53 | </para> |
| 54 | |
| 55 | <para> |
| 56 | The <emphasis>index</emphasis> argument should be filled with integer numbers expressing the grade of given scale to be converted in cps. The function table <emphasis>ifn</emphasis> should be generated by <link linkend="GEN02"><citetitle>GEN02</citetitle></link> and the first four values stored in this function are parameters that express: |
| 57 | <itemizedlist> |
| 58 | <listitem><para>numgrades -- The number of grades of the micro-tuning scale.</para></listitem> |
| 59 | |
| 60 | <listitem><para>interval -- The frequency range covered before repeating the grade ratios, for example 2 for one octave, 1.5 for a fifth etcetera.</para></listitem> |
| 61 | |
| 62 | <listitem><para>basefreq -- The base frequency of the scale in cycles per second.</para></listitem> |
| 63 | |
| 64 | <listitem><para>basekey -- The integer index of the scale to which to assign basefreq unmodified.</para></listitem> |
| 65 | </itemizedlist> |
| 66 | </para> |
| 67 | |
| 68 | <para> |
| 69 | After these four values, the user can begin to insert the tuning ratios. For example, for a standard 12-grade scale with the base-frequency of 261 cps assigned to the key-number 60, the corresponding f-statement in the score to generate the table should be: |
| 70 | |
| 71 | <informalexample> |
| 72 | <programlisting> |
| 73 | <emphasis role="comment">; numgrades basefreq tuning-ratios (eq.temp) .......</emphasis> |
| 74 | <emphasis role="comment">; interval basekey</emphasis> |
| 75 | <emphasis role="stamnt">f</emphasis>1 0 64 -2 12 2 261 60 1 1.059463 1.12246 1.18920 ..etc...</programlisting> |
| 76 | </informalexample> |
| 77 | </para> |
| 78 | |
| 79 | <para> |
| 80 | Another example with a 24-grade scale with a base frequency of 440 assigned |
| 81 | to the key-number 48, and a repetition interval of 1.5: |
| 82 | |
| 83 | <informalexample> |
| 84 | <programlisting> |
| 85 | <emphasis role="comment">; numgrades basefreq tuning-ratios .......</emphasis> |
| 86 | <emphasis role="comment">; interval basekey</emphasis> |
| 87 | <emphasis role="stamnt">f</emphasis>1 0 64 -2 24 1.5 440 48 1 1.01 1.02 1.03 ..etc...</programlisting> |
| 88 | </informalexample> |
| 89 | </para> |
| 90 | </refsect1> |
| 91 | |
| 92 | <refsect1> |
| 93 | <title>Examples</title> |
| 94 | <para> |
| 95 | Here is an example of the cpstuni opcode. It uses the file <ulink url="examples/cpstuni.csd"><citetitle>cpstuni.csd</citetitle></ulink>. |
| 96 | |
| 97 | <example> |
| 98 | <title>Example of the cpstuni opcode.</title> |
| 99 | |
| 100 | |
| 101 | |
| 102 | <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> |
| 103 | <xi:include href="examples-xml/cpstuni.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 104 | </example> |
| 105 | |
| 106 | Its output should include lines like this: |
| 107 | <screen>instr 1: i1 = 440.110</screen> |
| 108 | </para> |
| 109 | </refsect1> |
| 110 | |
| 111 | <refsect1> |
| 112 | <title>See also</title> |
| 113 | <para><link linkend="PitchTuning"><citetitle>Pitch Converters: Tuning Opcodes</citetitle></link></para> |
| 114 | </refsect1> |
| 115 | |
| 116 | <refsect1> |
| 117 | <title>Credits</title> |
| 118 | <para>Written by &namegabriel;.</para> |
| 119 | <para>Example written by &namekevin;.</para> |
| 120 | </refsect1> |
| 121 | </refentry> |