| 1 | |
| 2 | <refentry id="ptablei"> |
| 3 | <indexterm id="IndexPtablei"><primary>ptablei</primary></indexterm> |
| 4 | <refentryinfo><title>Signal Generators:Table Access</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>ptablei</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>ptablei</refname> |
| 11 | <refpurpose> |
| 12 | Accesses table values by direct indexing with linear interpolation. |
| 13 | </refpurpose> |
| 14 | </refnamediv> |
| 15 | |
| 16 | <refsect1> |
| 17 | <title>Description</title> |
| 18 | <para> |
| 19 | Accesses table values by direct indexing with linear interpolation. |
| 20 | </para> |
| 21 | </refsect1> |
| 22 | |
| 23 | <refsect1> |
| 24 | <title>Syntax</title> |
| 25 | <synopsis>ares <command>ptablei</command> andx, ifn [, ixmode] [, ixoff] [, iwrap]</synopsis> |
| 26 | |
| 27 | <synopsis>ires <command>ptablei</command> indx, ifn [, ixmode] [, ixoff] [, iwrap]</synopsis> |
| 28 | |
| 29 | <synopsis>kres <command>ptablei</command> kndx, ifn [, ixmode] [, ixoff] [, iwrap]</synopsis> |
| 30 | </refsect1> |
| 31 | |
| 32 | <refsect1> |
| 33 | <title>Initialization</title> |
| 34 | <para> |
| 35 | <emphasis>ifn</emphasis> -- function table number. The table |
| 36 | need not be a power of 2 long. |
| 37 | </para> |
| 38 | |
| 39 | <para> |
| 40 | <emphasis>ixmode</emphasis> (optional) -- index data mode. The default value is 0. |
| 41 | <itemizedlist> |
| 42 | <listitem><para>0 = raw index</para></listitem> |
| 43 | <listitem><para>1 = normalized (0 to 1)</para></listitem> |
| 44 | </itemizedlist> |
| 45 | </para> |
| 46 | |
| 47 | <para> |
| 48 | <emphasis>ixoff</emphasis> (optional) -- amount by which index is to be offset. For a table with origin at center, use tablesize/2 (raw) or .5 (normalized). The default value is 0. |
| 49 | </para> |
| 50 | |
| 51 | <para> |
| 52 | <emphasis>iwrap</emphasis> (optional) -- wraparound index flag. The default value is 0. |
| 53 | <itemizedlist> |
| 54 | <listitem> |
| 55 | <para>0 = nowrap (index < 0 treated as index=0; index > tablesize sticks at index=size)</para> |
| 56 | </listitem> |
| 57 | |
| 58 | <listitem> |
| 59 | <para>1 = wraparound.</para> |
| 60 | </listitem> |
| 61 | </itemizedlist> |
| 62 | </para> |
| 63 | </refsect1> |
| 64 | |
| 65 | <refsect1> |
| 66 | <title>Performance</title> |
| 67 | <para> |
| 68 | <emphasis>ptablei</emphasis> is a interpolating unit in which |
| 69 | the fractional part of index is used to interpolate between |
| 70 | adjacent table entries. The smoothness gained by interpolation |
| 71 | is at some small cost in execution time (see also <link |
| 72 | linkend="oscili"><citetitle>oscili</citetitle></link>, etc.), |
| 73 | but the interpolating and non-interpolating units are otherwise |
| 74 | interchangeable. |
| 75 | </para> |
| 76 | </refsect1> |
| 77 | |
| 78 | <refsect1> |
| 79 | <title>Examples</title> |
| 80 | <para> |
| 81 | Here is an example of the ptablei opcode. It uses the file <ulink url="examples/ptablei.csd"><citetitle>ptablei.csd</citetitle></ulink>. |
| 82 | <example> |
| 83 | <title>Example of the ptablei opcode.</title> |
| 84 | <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> |
| 85 | <xi:include href="examples-xml/ptablei.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 86 | </example> |
| 87 | </para> |
| 88 | </refsect1> |
| 89 | |
| 90 | <refsect1> |
| 91 | <title>See Also</title> |
| 92 | <para> |
| 93 | <link linkend="table"><citetitle>table</citetitle></link>, |
| 94 | <link linkend="tablei"><citetitle>tablei</citetitle></link>, |
| 95 | <link linkend="table3"><citetitle>table3</citetitle></link>, |
| 96 | <link linkend="ptable"><citetitle>ptable</citetitle></link>, |
| 97 | <link linkend="ptable3"><citetitle>ptable3</citetitle></link>, |
| 98 | <link linkend="oscil1"><citetitle>oscil1</citetitle></link>, |
| 99 | <link linkend="oscil1i"><citetitle>oscil1i</citetitle></link>, |
| 100 | <link linkend="osciln"><citetitle>osciln</citetitle></link> |
| 101 | </para> |
| 102 | <para> More information on this opcode: <ulink url="http://www.csoundjournal.com/issue12/genInstruments.html"><citetitle>http://www.csoundjournal.com/issue12/genInstruments.html</citetitle></ulink> , written by Jacob Joaquin </para> |
| 103 | </refsect1> |
| 104 | <refsect1> |
| 105 | <title>Credits</title> |
| 106 | <para> |
| 107 | <simplelist> |
| 108 | <member>Author: &namejohn;</member> |
| 109 | <member>Jan 2012</member> |
| 110 | </simplelist> |
| 111 | </para> |
| 112 | |
| 113 | <para>New in Csound version 5.16</para> |
| 114 | </refsect1> |
| 115 | </refentry> |