Sophie

Sophie

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

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>readf</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="readclock.html" title="readclock" />
    <link rel="next" href="readfi.html" title="readfi" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">readf</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="readclock.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="readfi.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="readf"></a>
      <div class="titlepage"></div>
      <a id="IndexReadf" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">readf</span>
        </h2>
        <p>readf — 
      Read a line of text from an external file.
    </p>
      </div>
      <div class="refsect1">
        <a id="idm281472896369240"></a>
        <h2>Description</h2>
        <p>
      Read a line of text from an external file once each k-cycle.
    </p>
      </div>
      <div class="refsect1">
        <a id="idm281472896365896"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">Sres, kline <span class="command"><strong>readf</strong></span> ifilname</pre>
      </div>
      <div class="refsect1">
        <a id="idm281472896363720"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>ifilname</em></span> -- an integer N denoting a file
      named "input.N" or a character string (in double quotes, spaces
      permitted) denoting the external file name. For a string, it may
      either be a full path name with directory specified or a simple
      filename.  In the later case, the file is sought first in the
      current directory, then in SSDIR, and finally in SFDIR.
    </p>
      </div>
      <div class="refsect1">
        <a id="idm281472896289032"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>Sres</em></span> -- output of the line read from
      <span class="emphasis"><em>ifilname</em></span>. 
    </p>
        <p>
      <span class="emphasis"><em>kline</em></span> -- line number, or -1 when end of file has been reached. 
    </p>
        <p>
      This opcode allows a line of text to be read from a named
      external file.  There may be any number of
      <span class="emphasis"><em>readf</em></span> opcodes in an instrument or orchestra
      but they read separately from the same or different files.
    </p>
      </div>
      <div class="refsect1">
        <a id="idm281472896285128"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the readf opcode. It uses the file <a class="ulink" href="examples/readf.csd" target="_top"><em class="citetitle">readf.csd</em></a>.
      </p>
        <div class="example">
          <a id="idm281472896283272"></a>
          <p class="title">
            <strong>Example 810. Example of the readf 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="idm281472718458024"></a>
              <pre class="programlisting">
<span class="nt">&lt;CsoundSynthesizer&gt;</span>
<span class="nt">&lt;CsOptions&gt;</span>
-n
<span class="nt">&lt;/CsOptions&gt;</span>

<span class="nt">&lt;CsInstruments&gt;</span>
<span class="kd">instr</span> <span class="nf">1</span>
  S<span class="n">wd</span>           <span class="nb">pwd</span>
                <span class="nb">printf_i</span>      <span class="s">"Working directory is '%s'</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> S<span class="n">wd</span>
                <span class="nb">prints</span>        <span class="s">"Reading myself =):</span><span class="se">\n</span><span class="s">"</span>
<span class="nl">read</span><span class="p">:</span>
  S<span class="n">line</span><span class="p">,</span> k<span class="n">LinNum</span> <span class="nb">readf</span> <span class="s">"readf.csd"</span>
                <span class="nb">printf</span> <span class="s">"Line </span><span class="si">%d</span><span class="s">: %s"</span><span class="p">,</span> k<span class="n">LinNum</span><span class="p">,</span> k<span class="n">LinNum</span><span class="p">,</span> S<span class="n">line</span>
  <span class="k">if</span> k<span class="n">LinNum</span> <span class="o">!=</span> <span class="o">-</span><span class="mi">1</span> <span class="k">then</span>
                <span class="k">kgoto</span> <span class="nl">read</span>
  <span class="k">else</span> 
                <span class="nb">turnoff</span>
  <span class="k">endif</span>
<span class="kd">endin</span>
<span class="nt">&lt;/CsInstruments&gt;</span>

<span class="nt">&lt;CsScore&gt;</span>
<span class="nb">i</span><span class="mi">1</span> <span class="mi">0</span> <span class="mi">1</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" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idm281472896278984"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="readfi.html" title="readfi"><em class="citetitle">readfi</em></a>.
    </p>
      </div>
      <div class="refsect1">
        <a id="idm281472896276904"></a>
        <h2>Credits</h2>
        <p>John ffitch and Joachim Heintz</p>
        <p>2012; new in 5.17.12</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="readclock.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="readfi.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">readclock </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> readfi</td>
        </tr>
      </table>
    </div>
  </body>
</html>