| 1 |
|
| 2 |
<refentry id="vmap"> |
| 3 |
<indexterm id="IndexVmap"><primary>vmap</primary></indexterm> |
| 4 |
<refentryinfo><title>Vectorial:Vectorial operations</title></refentryinfo> |
| 5 |
<refmeta> |
| 6 |
<refentrytitle>vmap</refentrytitle> |
| 7 |
</refmeta> |
| 8 |
|
| 9 |
<refnamediv> |
| 10 |
<refname>vmap</refname> |
| 11 |
<refpurpose> |
| 12 |
Maps elements from a vector according to indexes contained in another vector. |
| 13 |
</refpurpose> |
| 14 |
</refnamediv> |
| 15 |
|
| 16 |
<refsect1> |
| 17 |
<title>Description</title> |
| 18 |
<para> |
| 19 |
Maps elements from a vector onto another according to the indexes of a this vector. |
| 20 |
</para> |
| 21 |
</refsect1> |
| 22 |
|
| 23 |
<refsect1> |
| 24 |
<title>Syntax</title> |
| 25 |
<synopsis><command>vmap</command> ifn1, ifn2, ielements [,idstoffset, isrcoffset]</synopsis> |
| 26 |
</refsect1> |
| 27 |
|
| 28 |
<refsect1> |
| 29 |
<title>Initialization</title> |
| 30 |
<para> |
| 31 |
<emphasis>ifn1</emphasis> - number of the table where the vectorial signal will be copied, and which contains the mapping vector |
| 32 |
</para> |
| 33 |
<para> |
| 34 |
<emphasis>ifn2</emphasis> - number of the table hosting the vectorial signal to be copied |
| 35 |
</para> |
| 36 |
<para> |
| 37 |
<emphasis>ielements</emphasis> - number of elements to process |
| 38 |
</para> |
| 39 |
<para> |
| 40 |
<emphasis>idstoffset</emphasis> - index offset for destination table (<emphasis>ifn1</emphasis>) |
| 41 |
</para> |
| 42 |
<para> |
| 43 |
<emphasis>isrcoffset</emphasis> - index offset for source table (<emphasis>ifn2</emphasis>) |
| 44 |
</para> |
| 45 |
</refsect1> |
| 46 |
|
| 47 |
<refsect1> |
| 48 |
<title>Performance</title> |
| 49 |
<para> |
| 50 |
<emphasis>vmap</emphasis> maps elements of <emphasis>ifn2</emphasis> according to the values of table <emphasis>ifn1</emphasis>. Elements of <emphasis>ifn1</emphasis> are treated as indexes of table <emphasis>ifn2</emphasis>, so element values of <emphasis>ifn1</emphasis> must not exceed the length of <emphasis>ifn2</emphasis> table otherwise a Csound will report an error. Elements of <emphasis>ifn1</emphasis> are treated as integers, so any fractional part will be truncated. There is no interpolation performed on this operation. |
| 51 |
</para> |
| 52 |
<para>In practice, what happens is that the elements of <emphasis>ifn1</emphasis> are used as indexes to <emphasis>ifn2</emphasis>, and then are replaced by the corresponding elements from <emphasis>ifn2</emphasis>. <emphasis>ifn1</emphasis> must be different from <emphasis>ifn2</emphasis>, otherwise the results are unpredictable. Csound will produce an init error if they are not. |
| 53 |
</para> |
| 54 |
<para> |
| 55 |
All these operators (<link linkend="vaddv"><citetitle>vaddv</citetitle></link>, <link linkend="vsubv"><citetitle>vsubv</citetitle></link>, <link linkend="vmultv"><citetitle>vmultv</citetitle></link>, <link linkend="vdivv"><citetitle>vdivv</citetitle></link>, <link linkend="vpowv"><citetitle>vpowv</citetitle></link>, <link linkend="vexpv"><citetitle>vexpv</citetitle></link>, <link linkend="vcopy"><citetitle>vcopy</citetitle></link> and <link linkend="vmap"><citetitle>vmap</citetitle></link>) are designed to be used together with other opcodes that operate with vectorial signals such as, <link linkend="vcella"><citetitle>vcella</citetitle></link>, <link linkend="adsynt"><citetitle>adsynt</citetitle></link>, <link linkend="adsynt2"><citetitle>adsynt2</citetitle></link>, etc. |
| 56 |
</para> |
| 57 |
|
| 58 |
</refsect1> |
| 59 |
|
| 60 |
<refsect1> |
| 61 |
<title>Examples</title> |
| 62 |
<para> |
| 63 |
Here is an example of the vmap opcode. It uses the file <ulink url="examples/vmap.csd"><citetitle>vmap.csd</citetitle></ulink>. |
| 64 |
<example> |
| 65 |
<title>Example of the vmap opcode.</title> |
| 66 |
<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> |
| 67 |
<xi:include href="examples-xml/vmap.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 68 |
</example> |
| 69 |
</para> |
| 70 |
</refsect1> |
| 71 |
|
| 72 |
<refsect1> |
| 73 |
<title>See also</title> |
| 74 |
<para><link linkend="vectorialvectorial"><citetitle>Operations Between two Vectorial Signals</citetitle></link></para> |
| 75 |
</refsect1> |
| 76 |
|
| 77 |
<refsect1> |
| 78 |
<title>Credits</title> |
| 79 |
<para>Written by Gabriel Maldonado.</para> |
| 80 |
<para>New in Csound 5 (Previously available only on CsoundAV)</para> |
| 81 |
</refsect1> |
| 82 |
</refentry> |