<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>=</title> <link rel="stylesheet" type="text/css" href="csound.css" /> <meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /> <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" /> <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" /> <link rel="prev" href="divides.html" title="/" /> <link rel="next" href="equals.html" title="==" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">=</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="divides.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="equals.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry" title="="> <a id="assign"></a> <div class="titlepage"></div> <a id="IndexAssign" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">=</span> </h2> <p>= — Performs a simple assignment. </p> </div> <div class="refsect1" title="Syntax"> <a id="idp12842968"></a> <h2>Syntax</h2> <pre class="synopsis">ares <span class="command"><strong>=</strong></span> xarg</pre> <pre class="synopsis">ires <span class="command"><strong>=</strong></span> iarg</pre> <pre class="synopsis">kres <span class="command"><strong>=</strong></span> karg</pre> <pre class="synopsis">ires, ... <span class="command"><strong>=</strong></span> iarg, ...</pre> <pre class="synopsis">kres, ... <span class="command"><strong>=</strong></span> karg, ...</pre> <pre class="synopsis">table [ kval] <span class="command"><strong>=</strong></span> karg</pre> </div> <div class="refsect1" title="Description"> <a id="idp12894952"></a> <h2>Description</h2> <p> Performs a simple assignment. </p> </div> <div class="refsect1" title="Initialization"> <a id="idp12895656"></a> <h2>Initialization</h2> <p> <span class="emphasis"><em>=</em></span> (simple assignment) - Put the value of the expression <span class="emphasis"><em>iarg</em></span> (<span class="emphasis"><em>karg, xarg</em></span>) into the named result. This provides a means of saving an evaluated result for later use. </p> <p> From version 5.13 onwards the i- and k-rate versions of assignment can take a number of outputs, and an equal or less number of inputs. If there are less the last value is repeated as necessary. </p> <p> From version 5.14 values can be assigned to elements of a vector with the square bracket form. </p> </div> <div class="refsect1" title="Examples"> <a id="idp12898096"></a> <h2>Examples</h2> <p> Here is an example of the assign opcode. It uses the file <a class="ulink" href="examples/assign.csd" target="_top"><em class="citetitle">assign.csd</em></a>. </p> <div class="example"> <a id="idp12899072"></a> <p class="title"> <strong>Example 27. Example of the assign opcode.</strong> </p> <div class="example-contents"> <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p> <pre class="programlisting"> <span class="csdtag"><CsoundSynthesizer></span> <span class="csdtag"><CsOptions></span> <span class="comment">; Select audio/midi flags here according to platform</span> -odac <span class="comment">;;;RT audio out</span> <span class="comment">;-iadc ;;;uncomment -iadc if RT audio input is needed too</span> <span class="comment">; For Non-realtime ouput leave only the line below:</span> <span class="comment">; -o assign.wav -W ;;; for file output any platform</span> <span class="csdtag"></CsOptions></span> <span class="csdtag"><CsInstruments></span> <span class="ohdr">sr</span> <span class="op">=</span> 44100 <span class="ohdr">ksmps</span> <span class="op">=</span> 32 <span class="ohdr">nchnls</span> <span class="op">=</span> 2 <span class="oblock">instr</span> 1 <span class="comment">; Assign a value to the variable i1.</span> i1 <span class="op">=</span> 1234 <span class="comment">; Print the value of the i1 variable.</span> <span class="opc">print</span> i1 <span class="oblock">endin</span> <span class="csdtag"></CsInstruments></span> <span class="csdtag"><CsScore></span> <span class="comment">; Play Instrument #1 for one second.</span> <span class="stamnt">i</span> 1 0 1 <span class="stamnt">e</span> <span class="csdtag"></CsScore></span> <span class="csdtag"></CsoundSynthesizer></span> </pre> </div> </div> <p><br class="example-break" /> Its output should include a line like this: </p> <pre class="screen"> instr 1: i1 = 1234.000</pre> <p> </p> </div> <div class="refsect1" title="See Also"> <a id="idp12901736"></a> <h2>See Also</h2> <p> <a class="link" href="divz.html" title="divz"><em class="citetitle">divz</em></a>, <a class="link" href="init.html" title="init"><em class="citetitle">init</em></a>, <a class="link" href="passign.html" title="passign"><em class="citetitle">passign</em></a>, <a class="link" href="tival.html" title="tival"><em class="citetitle">tival</em></a> </p> </div> <div class="refsect1" title="Credits"> <a id="idp12904272"></a> <h2>Credits</h2> <p>Example written by Kevin Conder.</p> <p> The extension to multiple values is by </p> <table border="0" summary="Simple list" class="simplelist"> <tr> <td>Author: John ffitch</td> </tr> <tr> <td>University of Bath, and Codemist Ltd.</td> </tr> <tr> <td>Bath, UK</td> </tr> <tr> <td>February 2010</td> </tr> </table> <p> </p> <p>New in version 5.13</p> <p> </p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="divides.html">Prev</a> </td> <td width="20%" align="center"> <a accesskey="u" href="OpcodesTop.html">Up</a> </td> <td width="40%" align="right"> <a accesskey="n" href="equals.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">/ </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> ==</td> </tr> </table> </div> </body> </html>