Sophie

Sophie

distrib > Mageia > 5 > x86_64 > media > core-release > by-pkgid > b707d9a4ee443103660a75ccb6e51334 > files > 2861

csound-doc-5.19.01-10.mga5.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>vrandh</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="vpvoc.html" title="vpvoc" />
    <link rel="next" href="vrandi.html" title="vrandi" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">vrandh</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="vpvoc.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="vrandi.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="vrandh">
      <a id="vrandh"></a>
      <div class="titlepage"></div>
      <a id="IndexVrandh" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">vrandh</span>
        </h2>
        <p>vrandh — 
      Generates a vector of random numbers stored into a table, holding the values for a period of time.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp52817088"></a>
        <h2>Description</h2>
        <p>
      Generates a vector of random numbers stored into a table, holding the values for a period of time. Generates a sort of 'vectorial band-limited noise'.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp52874032"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>vrandh</strong></span>  ifn,  krange, kcps, ielements [, idstoffset] [, iseed] \
      [, isize] [, ioffset]</pre>
      </div>
      <div class="refsect1" title="Initialization">
        <a id="idp52875104"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>ifn</em></span> - number of the table where the vectorial signal will be generated
    </p>
        <p>
      <span class="emphasis"><em>ielements</em></span> - number of elements of the vector
    </p>
        <p>
      <span class="emphasis"><em>idstoffset</em></span> - (optional, default=0) -- index offset for the destination table
    </p>
        <p>
      <span class="emphasis"><em>iseed</em></span> (optional, default=0.5) -- seed value for the recursive pseudo-random formula. A value between 0 and +1 will produce an initial output of <span class="emphasis"><em>kamp</em></span> * <span class="emphasis"><em>iseed</em></span>. A negative value will cause seed re-initialization to be skipped. A value greater than 1 will seed from system time, this is the best option to generate a different random sequence for each run.
    </p>
        <p>
      <span class="emphasis"><em>isize</em></span> (optional, default=0) -- if zero, a 16 bit number is generated. If non-zero, a 31-bit random number is generated. Default is 0.
    </p>
        <p>
      <span class="emphasis"><em>ioffset</em></span> - (optional, default=0) -- a base value added to the random result.
    </p>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp52879096"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>krange</em></span> - range of random elements (from -<span class="emphasis"><em>krange</em></span> to <span class="emphasis"><em>krange</em></span>).
    </p>
        <p>
      <span class="emphasis"><em>kcps</em></span> - rate of generated elements in cycles per seconds.
    </p>
        <p>
      This opcode is similar to <a class="link" href="randh.html" title="randh"><em class="citetitle">randh</em></a>, but operates on vectors instead of with scalar values.
    </p>
        <p>
      Though the argument <span class="emphasis"><em>isize</em></span> defaults to 0, thus using a 16-bit random number generator, using the newer 31-bit algorithm is recommended, as this will produce a random sequence with a longer period (more random numbers before the sequence starts repeating).
    </p>
        <p>
      The output is a vector contained in <span class="emphasis"><em>ifn</em></span> (that must be previously allocated).
    </p>
        <p>
      All these operators are designed to be used together with other opcodes that operate with vector such as bmscan, <a class="link" href="adsynt.html" title="adsynt"><em class="citetitle">adsynt</em></a>, etc.
    </p>
        <p><span class="emphasis"><em>Note:</em></span> bmscan not yet available on Canonical Csound</p>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp52883960"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the vrandh opcode. It uses the file <a class="ulink" href="examples/vrandh.csd" target="_top"><em class="citetitle">vrandh.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp52884928"></a>
          <p class="title">
            <strong>Example 969. Example of the vrandh 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">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
<span class="comment">; Audio out   Audio in    No messages</span>
-odac           -iadc     -d     <span class="comment">;;;RT audio I/O</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o vranh.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>
<span class="comment">;Example by Andres Cabrera</span>

<span class="ohdr">sr</span><span class="op">=</span>44100
<span class="ohdr">ksmps</span><span class="op">=</span>128
<span class="ohdr">nchnls</span><span class="op">=</span>2

gitab <span class="ohdr">ftgen</span> 0, 0, 16, <span class="op">-</span>7, 0, 128, 0


<span class="oblock">instr</span> 1
  krange <span class="opc">init</span> p4
  kcps <span class="opc">init</span> p5
  ioffset <span class="opc">init</span> p6

  kav1 <span class="opc">init</span> 0
  kav2 <span class="opc">init</span> 0
  kcount <span class="opc">init</span> 0

  <span class="comment">;       table   krange  kcps  ielements   idstoffset  iseed  isize ioffset</span>
  <span class="opc">vrandh</span>  gitab,  krange, kcps,     3,         3,         2,   0,   ioffset

  kfreq1 <span class="opc">table</span> 3, gitab
  kfreq2 <span class="opc">table</span> 4, gitab
  kfreq3 <span class="opc">table</span> 5, gitab

  <span class="comment">;Change the frequency of three oscillators according to the random values</span>
  aosc1 <span class="opc">oscili</span> 4000, kfreq1, 1
  aosc2 <span class="opc">oscili</span> 2000, kfreq2, 1
  aosc3 <span class="opc">oscili</span> 4000, kfreq3, 1

  <span class="opc">outs</span> aosc1<span class="op">+</span>aosc2, aosc3<span class="op">+</span>aosc2
<span class="oblock">endin</span>

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="stamnt">f</span> 1 0 1024 10 1
<span class="comment">;             krange  kcps    ioffset</span>
<span class="stamnt">i</span> 1 0 	5	100	1	300
<span class="stamnt">i</span> 1 5 	5	300	1	400
<span class="stamnt">i</span> 1 10 	5	100	2	1000
<span class="stamnt">i</span> 1 15 	5	400	4	1000
<span class="stamnt">i</span> 1 20 	5	1000	8	2000
<span class="stamnt">i</span> 1 25 	5	250	16	300
<span class="stamnt">e</span>

<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1" title="See also">
        <a id="idp52887200"></a>
        <h2>See also</h2>
        <p>
      <a class="link" href="vrandi.html" title="vrandi"><em class="citetitle">vrandi</em></a>, 
      <a class="link" href="randh.html" title="randh"><em class="citetitle">randh</em></a>
    </p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp52888696"></a>
        <h2>Credits</h2>
        <p>Written by Gabriel Maldonado.</p>
        <p>New in Csound 5 (Previously available only on CsoundAV)</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="vpvoc.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="vrandi.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">vpvoc </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> vrandi</td>
        </tr>
      </table>
    </div>
  </body>
</html>