Sophie

Sophie

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

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>GEN23</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="ScoregensTop.html" title="Score Statements and GEN Routines" />
    <link rel="prev" href="GEN21.html" title="GEN21" />
    <link rel="next" href="GEN24.html" title="GEN24" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">GEN23</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="GEN21.html">Prev</a> </td>
          <th width="60%" align="center">Score Statements and GEN Routines</th>
          <td width="20%" align="right"> <a accesskey="n" href="GEN24.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="GEN23"></a>
      <div class="titlepage"></div>
      <a id="IndexGEN23" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">GEN23</span>
        </h2>
        <p>GEN23 — 
      Reads numeric values from a text file.
    </p>
      </div>
      <div class="refsect1">
        <a id="idm281472818944824"></a>
        <h2>Description</h2>
        <p>
      This subroutine reads numeric values from an external ASCII file.
    </p>
      </div>
      <div class="refsect1">
        <a id="idm281472818901240"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>f</strong></span> # time size -23 "filename.txt"</pre>
      </div>
      <div class="refsect1">
        <a id="idm281472818899208"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>"filename.txt"</em></span> -- numeric values contained in "filename.txt" (which indicates the complete pathname of the character file to be read), can be separated by spaces, tabs, newline characters or commas.
    </p>
        <p>
      <span class="emphasis"><em>size</em></span> -- number of points in the table. Must be a power of 2 , power of 2 + 1, or zero.  If <span class="emphasis"><em>size</em></span> = 0, table size is determined by the number of numeric values in <span class="emphasis"><em>filename.txt</em></span>. (New in Csound version 3.57)
    </p>
        <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
          <table border="0" summary="Note: Note">
            <tr>
              <td rowspan="2" align="center" valign="top" width="25">
                <img alt="[Note]" src="images/note.png" />
              </td>
              <th align="left">Note</th>
            </tr>
            <tr>
              <td align="left" valign="top">
                <p>
        All characters following ';', '#' (comment) or '&lt;' (XML
        tag from version 6.04) are ignored until next line (numbers too).
      </p>
              </td>
            </tr>
          </table>
        </div>
      </div>
      <div class="refsect1">
        <a id="idm281472818893816"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the GEN23 generator. It uses the file <a class="ulink" href="examples/gen23.csd" target="_top"><em class="citetitle">gen23.csd</em></a> and <a class="ulink" href="examples/spectrum.txt" target="_top"> <em class="citetitle">spectrum.txt</em></a>.
           </p>
        <div class="example">
          <a id="idm281472818890984"></a>
          <p class="title">
            <strong>Example 1203. Example of the GEN23 generator.</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="idm281472682022664"></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 gen23.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="c1">;"spectrum.txt" is created by the spectrum plotter of Audacity (set at size 128), using "fox.wav".</span>

<span class="kd">instr</span> <span class="nf">1</span>	<span class="c1">;performs additive synthesis based on spectrum.txt</span>

i<span class="n">ndx</span> <span class="o">=</span><span class="mi">0</span>						<span class="c1">;start reading at first value</span>
<span class="nl">loop</span><span class="p">:</span>
i<span class="n">freq</span> <span class="nb">tab_i</span> i<span class="n">ndx</span><span class="p">,</span> <span class="mi">2</span>				<span class="c1">;take odd values of list (= frequency)</span>
i<span class="n">amp</span> <span class="nb">tab_i</span> i<span class="n">ndx</span><span class="o">+</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span>				<span class="c1">;take even values of list (= amplitude)</span>
<span class="nb">event_i</span> <span class="s">"i"</span><span class="p">,</span> <span class="mi">10</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="nb">p3</span><span class="p">,</span> i<span class="n">amp</span><span class="p">,</span> i<span class="n">freq</span>   		<span class="c1">;use "event_i" to trigger instr. 10 </span>
    <span class="k">loop_lt</span> i<span class="n">ndx</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">126</span><span class="p">,</span> <span class="nl">loop</span>			<span class="c1">;use all 128 frequency and amplitude values</span>

<span class="kd">endin</span>

<span class="kd">instr</span> <span class="nf">10</span> <span class="c1">;generate sound</span>

i<span class="n">amp</span>  <span class="o">=</span> <span class="nb">p4</span>
i<span class="n">freq</span> <span class="o">=</span> <span class="nb">p5</span>
a<span class="n">sig</span>  <span class="nb">poscil</span> <span class="nb">ampdb</span><span class="p">(</span>i<span class="n">amp</span><span class="p">),</span> i<span class="n">freq</span><span class="p">,</span> <span class="mi">1</span>
a<span class="n">sig</span>  <span class="nb">linen</span> a<span class="n">sig</span><span class="p">,</span> <span class="mf">.01</span><span class="p">,</span> <span class="nb">p3</span><span class="p">,</span> <span class="nb">p2</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="mi">16384</span> <span class="mi">10</span> <span class="mi">1</span>		<span class="c1">;sine wave</span>
<span class="nb">f</span> <span class="mi">2</span> <span class="mi">0</span> <span class="mi">128</span> <span class="o">-</span><span class="mi">23</span> <span class="s">"spectrum.txt"</span>	<span class="c1">;"spectrum.txt" can be found in /manual/examples</span>

<span class="nb">i</span><span class="mi">1</span> <span class="mi">0</span> <span class="mi">2</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" />  
        <span class="phrase">This is the diagram of the waveform of the GEN23 routine, as used in the example:</span>

      </p>
        <div class="mediaobject">
          <img src="images/gen23.png" alt="f 2 0 128 -23 &quot;spectrum.txt&quot; - not normalized" />
          <div class="caption">
            <p>f 2 0 128 -23 "spectrum.txt" - not normalized</p>
          </div>
        </div>
        <p>
   
    </p>
      </div>
      <div class="refsect1">
        <a id="idm281472818882664"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Gabriel Maldonado</td>
          </tr>
          <tr>
            <td>Italy</td>
          </tr>
          <tr>
            <td>February, 1998</td>
          </tr>
        </table>
        <p>
    </p>
        <p>New in Csound version 3.47. Comments starting with '#' are
    ignored from Csound version 5.12.</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="GEN21.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="ScoregensTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="GEN24.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">GEN21 </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> GEN24</td>
        </tr>
      </table>
    </div>
  </body>
</html>