| 1 | |
| 2 | <refentry id="cpstmid"> |
| 3 | <indexterm id="IndexCpstmid"><primary>cpstmid</primary></indexterm> |
| 4 | <refentryinfo><title>Real-time MIDI:Converters</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>cpstmid</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>cpstmid</refname> |
| 13 | |
| 14 | <refpurpose> |
| 15 | Get a MIDI note number (allows customized micro-tuning scales). |
| 16 | </refpurpose> |
| 17 | </refnamediv> |
| 18 | |
| 19 | <refsect1> |
| 20 | <title>Description</title> |
| 21 | <para> |
| 22 | This unit is similar to <link linkend="cpsmidi"><citetitle>cpsmidi</citetitle></link>, but allows fully customized micro-tuning scales. |
| 23 | </para> |
| 24 | </refsect1> |
| 25 | |
| 26 | <refsect1> |
| 27 | <title>Syntax</title> |
| 28 | <synopsis>icps <command>cpstmid</command> ifn</synopsis> |
| 29 | </refsect1> |
| 30 | |
| 31 | <refsect1> |
| 32 | <title>Initialization</title> |
| 33 | <para> |
| 34 | <emphasis>ifn</emphasis> -- function table containing the parameters (<emphasis>numgrades</emphasis>, <emphasis>interval</emphasis>, <emphasis>basefreq</emphasis>, <emphasis>basekeymidi</emphasis>) and the tuning ratios. |
| 35 | </para> |
| 36 | </refsect1> |
| 37 | |
| 38 | <refsect1> |
| 39 | <title>Performance</title> |
| 40 | <para> |
| 41 | Init-rate only |
| 42 | </para> |
| 43 | |
| 44 | <para> |
| 45 | <emphasis>cpsmid</emphasis> requires five parameters, the first, <emphasis>ifn</emphasis>, is the function table number of the tuning ratios, and the other parameters must be stored in the function table itself. The function table <emphasis>ifn</emphasis> should be generated by <link linkend="GEN02"><citetitle>GEN02</citetitle></link>, with normalization inhibited. The first four values stored in this function are: |
| 46 | <orderedlist> |
| 47 | <listitem><para><emphasis>numgrades</emphasis> -- the number of grades of the micro-tuning scale</para></listitem> |
| 48 | <listitem><para><emphasis>interval</emphasis> -- the frequency range covered before repeating the grade ratios, for example 2 for one octave, 1.5 for a fifth etc.</para></listitem> |
| 49 | <listitem><para><emphasis>basefreq</emphasis> -- the base frequency of the scale in Hz</para></listitem> |
| 50 | <listitem><para><emphasis>basekeymidi</emphasis> -- the MIDI note number to which <emphasis>basefreq</emphasis> is assigned unmodified</para></listitem> |
| 51 | </orderedlist> |
| 52 | </para> |
| 53 | |
| 54 | <para> |
| 55 | After these four values, the user can begin to insert the tuning ratios. For example, for a standard 12 note scale with the base frequency of 261 Hz assigned to the key number 60, the corresponding f-statement in the score to generate the table should be: |
| 56 | <literallayout> |
| 57 | ; numgrades interval basefreq basekeymidi tuning ratios (equal temp) |
| 58 | f1 0 64 -2 12 2 261 60 1 1.059463094359 1.122462048309 1.189207115003 ..etc... |
| 59 | </literallayout> |
| 60 | </para> |
| 61 | |
| 62 | <para> |
| 63 | Another example with a 24 note scale with a base frequency of 440 assigned to the key number 48, and a repetition interval of 1.5: |
| 64 | <literallayout> |
| 65 | ; numgrades interval basefreq basekeymidi tuning-ratios (equal temp) |
| 66 | f1 0 64 -2 24 1.5 440 48 1 1.01 1.02 1.03 ..etc... |
| 67 | </literallayout> |
| 68 | </para> |
| 69 | </refsect1> |
| 70 | |
| 71 | <refsect1> |
| 72 | <title>Examples</title> |
| 73 | <para> |
| 74 | Here is an example of the cpstmid opcode. It uses the file <ulink url="examples/cpstmid.csd"><citetitle>cpstmid.csd</citetitle></ulink>. |
| 75 | |
| 76 | <example> |
| 77 | <title>Example of the cpstmid opcode.</title> |
| 78 | |
| 79 | |
| 80 | |
| 81 | <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> |
| 82 | <xi:include href="examples-xml/cpstmid.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 83 | </example> |
| 84 | </para> |
| 85 | </refsect1> |
| 86 | |
| 87 | <refsect1> |
| 88 | <title>See also</title> |
| 89 | <para><link linkend="MidiConvert"><citetitle>Midi Converters</citetitle></link></para> |
| 90 | </refsect1> |
| 91 | |
| 92 | <refsect1> |
| 93 | <title>Credits</title> |
| 94 | <para> |
| 95 | <simplelist> |
| 96 | <member>Author: &namegabriel;</member> |
| 97 | <member>Italy</member> |
| 98 | <member>1998</member> |
| 99 | </simplelist> |
| 100 | </para> |
| 101 | |
| 102 | <para>New in Csound version 3.492</para> |
| 103 | </refsect1> |
| 104 | </refentry> |