Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-release > by-pkgid > 5fcfcb7517038d1f44ab4e478e6e61fa > files > 3090

csound-doc-6.10.0-1.mga7.noarch.rpm

<?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>urd</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <link rel="stylesheet" type="text/css" href="syntax-highlighting.css" />
    <meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" />
    <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="urandom.html" title="urandom" />
    <link rel="next" href="vactrol.html" title="vactrol" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">urd</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="urandom.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="vactrol.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="urd"></a>
      <div class="titlepage"></div>
      <a id="IndexUrd" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">urd</span>
        </h2>
        <p>urd — 
      A discrete user-defined-distribution random generator that can be used as a function.
          </p>
      </div>
      <div class="refsect1">
        <a id="idm281472876705192"></a>
        <h2>Description</h2>
        <p>
      A discrete user-defined-distribution random generator that can be used as a function.
    </p>
      </div>
      <div class="refsect1">
        <a id="idm281472876703896"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">aout = <span class="command"><strong>urd</strong></span>(ktableNum)</pre>
        <pre class="synopsis">iout = <span class="command"><strong>urd</strong></span>(itableNum)</pre>
        <pre class="synopsis">kout = <span class="command"><strong>urd</strong></span>(ktableNum)</pre>
      </div>
      <div class="refsect1">
        <a id="idm281472876632136"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>itableNum</em></span> -- number of table containing the random-distribution function.  Such table is generated by the user. See <a class="link" href="GEN40.html" title="GEN40">GEN40</a>, <a class="link" href="GEN41.html" title="GEN41">GEN41</a>, and <a class="link" href="GEN42.html" title="GEN42">GEN42</a>. The table length does not need to be a power of 2
    </p>
      </div>
      <div class="refsect1">
        <a id="idm281472876627976"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>ktableNum</em></span> -- number of table containing the random-distribution function.  Such table is generated by the user. See <a class="link" href="GEN40.html" title="GEN40">GEN40</a>, <a class="link" href="GEN41.html" title="GEN41">GEN41</a>, and <a class="link" href="GEN42.html" title="GEN42">GEN42</a>. The table length does not need to be a power of 2
    </p>
        <p>
      <span class="emphasis"><em>urd</em></span> is the same opcode as <a class="link" href="duserrnd.html" title="duserrnd"><em class="citetitle">duserrnd</em></a>, but can be used in function fashion. 
    </p>
        <p>
      For a tutorial about random distribution histograms and functions see:

      </p>
        <div class="itemizedlist">
          <ul class="itemizedlist" style="list-style-type: disc; ">
            <li class="listitem">
              <p>
            D. Lorrain. "A panoply of stochastic cannons". In C. Roads, ed. 1989. Music machine. Cambridge, Massachusetts: MIT press, pp. 351 - 379.
          </p>
            </li>
          </ul>
        </div>
        <p>
    </p>
      </div>
      <div class="refsect1">
        <a id="idm281472876620232"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the urd opcode. It uses the file <a class="ulink" href="examples/urd.csd" target="_top"><em class="citetitle">urd.csd</em></a>.
            </p>
        <div class="example">
          <a id="idm281472876618376"></a>
          <p class="title">
            <strong>Example 1042. Example of the urd 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>
            <div class="refsect1">
              <a id="idm281472696699288"></a>
              <pre class="programlisting">
<span class="nt">&lt;CsoundSynthesizer&gt;</span>
<span class="nt">&lt;CsOptions&gt;</span>
<span class="c1">; Select audio/midi flags here according to platform</span>
-odac   <span class="c1">;;;realtime audio out</span>
<span class="c1">;-iadc    ;;;uncomment -iadc if realtime audio input is needed too</span>
<span class="c1">; For Non-realtime ouput leave only the line below:</span>
<span class="c1">; -o urd.wav -W ;;; for file output any platform</span>
<span class="nt">&lt;/CsOptions&gt;</span>
<span class="nt">&lt;CsInstruments&gt;</span>

<span class="vg">sr</span> <span class="o">=</span> <span class="mi">44100</span>
<span class="vg">ksmps</span> <span class="o">=</span> <span class="mi">32</span>
<span class="vg">nchnls</span> <span class="o">=</span> <span class="mi">2</span>
<span class="vg">0dbfs</span>  <span class="o">=</span> <span class="mi">1</span>

<span class="kd">instr</span> <span class="nf">1</span> 

k<span class="n">tab</span>  <span class="o">=</span> <span class="mi">1</span>			<span class="c1">;ftable 1</span>
k<span class="n">urd</span>  <span class="o">=</span> <span class="nb">urd</span><span class="p">(</span>k<span class="n">tab</span><span class="p">)</span> 
k<span class="n">trig</span> <span class="nb">metro</span> <span class="mi">5</span>			<span class="c1">;triggers 5 times per second</span>
k<span class="n">res</span>  <span class="nb">samphold</span> k<span class="n">urd</span><span class="p">,</span> k<span class="n">trig</span>	<span class="c1">;sample and hold value of kurd</span>
      <span class="nb">printk2</span> k<span class="n">res</span>		<span class="c1">;print it</span>
a<span class="n">sig</span>  <span class="nb">poscil</span> <span class="mf">.5</span><span class="p">,</span> <span class="mi">220</span><span class="o">+</span>k<span class="n">res</span><span class="p">,</span> <span class="mi">2</span>
      <span class="nb">outs</span> a<span class="n">sig</span><span class="p">,</span> a<span class="n">sig</span>
<span class="kd">endin</span>

<span class="kd">instr</span> <span class="nf">2</span>

<span class="nb">seed</span> <span class="mi">0</span>	<span class="c1">;every run new values</span>

k<span class="n">tab</span>  <span class="o">=</span> <span class="mi">1</span> 			<span class="c1">;ftable 1</span>
k<span class="n">urd</span>  <span class="o">=</span> <span class="nb">urd</span><span class="p">(</span>k<span class="n">tab</span><span class="p">)</span> 
k<span class="n">trig</span> <span class="nb">metro</span> <span class="mi">5</span>			<span class="c1">;triggers 5 times per second</span>
k<span class="n">res</span>  <span class="nb">samphold</span> k<span class="n">urd</span><span class="p">,</span> k<span class="n">trig</span>	<span class="c1">;sample and hold value of kurd</span>
      <span class="nb">printk2</span> k<span class="n">res</span>		<span class="c1">;print it</span>
a<span class="n">sig</span>  <span class="nb">poscil</span> <span class="mf">.5</span><span class="p">,</span> <span class="mi">220</span><span class="o">+</span>k<span class="n">res</span><span class="p">,</span> <span class="mi">2</span>
      <span class="nb">outs</span> a<span class="n">sig</span><span class="p">,</span> a<span class="n">sig</span>

<span class="kd">endin</span>
<span class="nt">&lt;/CsInstruments&gt;</span>
<span class="nt">&lt;CsScore&gt;</span>
<span class="nb">f</span><span class="mi">1</span> <span class="mi">0</span> <span class="o">-</span><span class="mi">20</span> <span class="o">-</span><span class="mi">42</span>  <span class="mi">10</span> <span class="mi">20</span> <span class="mf">.3</span> <span class="mi">100</span> <span class="mi">200</span> <span class="mf">.7</span> <span class="c1">;30% choose between 10 and 20 and 70% between 100 and 200</span>
<span class="nb">f</span><span class="mi">2</span> <span class="mi">0</span> <span class="mi">8192</span> <span class="mi">10</span> <span class="mi">1</span>			  <span class="c1">;sine wave</span>

<span class="nb">i</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">5</span>
<span class="nb">i</span> <span class="mi">2</span> <span class="mi">6</span> <span class="mi">5</span>
<span class="nb">e</span>
<span class="nt">&lt;/CsScore&gt;</span>
<span class="nt">&lt;/CsoundSynthesizer&gt;</span>
</pre>
            </div>
          </div>
        </div>
        <p><br class="example-break" />     
      Its output should include lines like these:
      </p>
        <pre class="screen">
 i1   184.61538
 i1   130.76923
 i1   169.23077
 i1    12.00000
.......

WARNING: Seeding from current time 3751086165

 i2   138.46154
 i2    12.00000
 i2   123.07692
 i2   161.53846
 i2   123.07692
 i2   153.84615
......
      </pre>
        <p>
    </p>
      </div>
      <div class="refsect1">
        <a id="idm281472876613144"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="cuserrnd.html" title="cuserrnd"><em class="citetitle">cuserrnd</em></a>,
      <a class="link" href="duserrnd.html" title="duserrnd"><em class="citetitle">duserrnd</em></a>
    </p>
      </div>
      <div class="refsect1">
        <a id="idm281472876610104"></a>
        <h2>Credits</h2>
        <p>Author: Gabriel Maldonado</p>
        <p>New in Version 4.16</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="urandom.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="vactrol.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">urandom </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> vactrol</td>
        </tr>
      </table>
    </div>
  </body>
</html>