Sophie

Sophie

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

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>soundin</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="socksend.html" title="socksend" />
    <link rel="next" href="space.html" title="space" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">soundin</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="socksend.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="space.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="soundin">
      <a id="soundin"></a>
      <div class="titlepage"></div>
      <a id="IndexSoundin" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">soundin</span>
        </h2>
        <p>soundin — 
      Reads audio data from an external device or stream.
          </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp44272824"></a>
        <h2>Description</h2>
        <p>
      Reads audio data from an external device or stream.  Up to 24
      channels may be read before v5.14, extended to 40 in later versions.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp44273728"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">ar1[, ar2[, ar3[, ... a24]]] <span class="command"><strong>soundin</strong></span> ifilcod [, iskptim] [, iformat] \
      [, iskipinit] [, ibufsize]</pre>
      </div>
      <div class="refsect1" title="Initialization">
        <a id="idp44284360"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>ifilcod</em></span> -- integer or character-string denoting the source soundfile name. An integer denotes the file soundin.filcod; a character-string (in double quotes, spaces permitted) gives the filename itself, optionally a full pathname. If not a full path, the named file is sought first in the current directory, then in that given by the environment variable <a class="link" href="CommandEnvironment.html" title="Csound Environment Variables"><em class="citetitle">SSDIR</em></a> (if defined) then by <a class="link" href="CommandEnvironment.html" title="Csound Environment Variables"><em class="citetitle">SFDIR</em></a>. See also <a class="link" href="GEN01.html" title="GEN01"><em class="citetitle">GEN01</em></a>.
    </p>
        <p>
      <span class="emphasis"><em>iskptim</em></span> (optional, default=0) -- time in seconds of input sound to be skipped. The default value is 0. In csound 5.00 and later, this may be negative to add a delay instead of skipping time.
    </p>
        <p>
      <span class="emphasis"><em>iformat</em></span> (optional, default=0) -- specifies the audio data file format:
      </p>
        <div class="itemizedlist">
          <ul class="itemizedlist" type="disc">
            <li class="listitem">
              <p>1 = 8-bit signed char (high-order 8 bits of a 16-bit integer)</p>
            </li>
            <li class="listitem">
              <p>2 = 8-bit A-law bytes</p>
            </li>
            <li class="listitem">
              <p>3 = 8-bit U-law bytes</p>
            </li>
            <li class="listitem">
              <p>4 = 16-bit short integers</p>
            </li>
            <li class="listitem">
              <p>5 = 32-bit long integers</p>
            </li>
            <li class="listitem">
              <p>6 = 32-bit floats</p>
            </li>
            <li class="listitem">
              <p>7 = 8-bit unsigned int (not available in Csound versions older than 5.00)</p>
            </li>
            <li class="listitem">
              <p>8 = 24-bit int (not available in Csound versions older than 5.00)</p>
            </li>
            <li class="listitem">
              <p>9 = 64-bit doubles (not available in Csound versions older than 5.00)</p>
            </li>
          </ul>
        </div>
        <p>
    </p>
        <p>
     <span class="emphasis"><em>iskipinit</em></span> -- switches off all initialisation if
     non zero (default=0).  This was introduced in 4_23f13 and
     csound5.
    </p>
        <p>
     <span class="emphasis"><em>ibufsize</em></span> -- buffer size in mono samples (not sample frames). Not available in Csound versions older than 5.00. The default buffer size is 2048.
    </p>
        <p>
      If <span class="emphasis"><em>iformat</em></span> = 0 it is taken from the soundfile header, and if no header from the Csound <a class="link" href="CommandFlags.html#FlagsMinusLowerO"><em class="citetitle">-o</em></a> command-line flag. The default value is 0.
    </p>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp44327000"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>soundin</em></span> is functionally an audio generator that derives its signal from a pre-existing file. The number of channels read in is controlled by the number of result cells, a1, a2, etc., which must match that of the input file. A <span class="emphasis"><em>soundin</em></span> opcode opens this file whenever the host instrument is initialized, then closes it again each time the instrument is turned off.
    </p>
        <p>
      There can be any number of <span class="emphasis"><em>soundin</em></span> opcodes within a single instrument or orchestra. Two or more of them can read simultaneously from the same external file.
    </p>
        <div class="caution" title="Note to Windows users" style="margin-left: 0.5in; margin-right: 0.5in;">
          <table border="0" summary="Caution: Note to Windows users">
            <tr>
              <td rowspan="2" align="center" valign="top" width="25">
                <img alt="[Caution]" src="images/caution.png" />
              </td>
              <th align="left">Note to Windows users</th>
            </tr>
            <tr>
              <td align="left" valign="top">
                <p>
        Windows users typically use back-slashes, <span class="quote">“<span class="quote">\</span>”</span>, when specifying the paths of their files. As an example, a Windows user might use the path <span class="quote">“<span class="quote">c:\music\samples\loop001.wav</span>”</span>. This is problematic because back-slashes are normally used to specify special characters.
      </p>
                <p>
	To correctly specify this path in Csound, one may alternately:
        </p>
                <div class="itemizedlist">
                  <ul class="itemizedlist" type="disc">
                    <li class="listitem">
                      <p><span class="emphasis"><em>Use forward slashes</em></span>: c:/music/samples/loop001.wav</p>
                    </li>
                    <li class="listitem">
                      <p><span class="emphasis"><em>Use back-slash special characters, <span class="quote">“<span class="quote">\\</span>”</span></em></span>: c:\\music\\samples\\loop001.wav</p>
                    </li>
                  </ul>
                </div>
                <p>
      </p>
              </td>
            </tr>
          </table>
        </div>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp44332248"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the soundin opcode. It uses the file <a class="ulink" href="examples/soundin.csd" target="_top"><em class="citetitle">soundin.csd</em></a>,
<a class="ulink" href="examples/fox.wav" target="_top"><em class="citetitle">fox.wav</em></a> and <a class="ulink" href="examples/kickroll.wav" target="_top"><em class="citetitle">kickroll.wav</em></a>.
      </p>
        <div class="example">
          <a id="idp44334112"></a>
          <p class="title">
            <strong>Example 782. Example of the soundin 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">;-odac     ;;;realtime audio out</span>
-iadc   <span class="comment">;;;uncomment -iadc if realtime audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">;-o soundin.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</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="ohdr">0dbfs</span>  <span class="op">=</span> 1

<span class="oblock">instr</span> 1 <span class="comment">; choose between mono or stereo file</span>

ichn <span class="opc">filenchnls</span>  p4	<span class="comment">;check number of channels</span>
<span class="opc">print</span>  ichn

<span class="octrl">if</span> ichn <span class="op">==</span> 1 then	
asig   <span class="opc">soundin</span> p4	<span class="comment">;mono signal</span>
       <span class="opc">outs</span>    asig, asig
<span class="octrl">else</span>			<span class="comment">;stereo signal</span>
aL, aR <span class="opc">soundin</span> p4
       <span class="opc">outs</span>    aL, aR
<span class="octrl">endif</span>

<span class="oblock">endin</span>
<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="stamnt">i</span> 1 0 3 "fox.wav"	<span class="comment">;mono signal</span>
<span class="stamnt">i</span> 1 5 2 "k<span class="stamnt">i</span>ckroll.wav"	<span class="comment">;stereo signal</span>

<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="idp44336392"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="diskin.html" title="diskin"><em class="citetitle">diskin</em></a>,
      <a class="link" href="in.html" title="in"><em class="citetitle">in</em></a>,
      <a class="link" href="inh.html" title="inh"><em class="citetitle">inh</em></a>,
      <a class="link" href="ino.html" title="ino"><em class="citetitle">ino</em></a>,
      <a class="link" href="inq.html" title="inq"><em class="citetitle">inq</em></a>,
      <a class="link" href="ins.html" title="ins"><em class="citetitle">ins</em></a>
     </p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp44339720"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Authors: Barry L. Vercoe, Matt Ingalls/Mike Berry</td>
          </tr>
          <tr>
            <td>MIT, Mills College</td>
          </tr>
          <tr>
            <td>1993-1997</td>
          </tr>
        </table>
        <p>
    </p>
        <p>Warning to Windows users added by Kevin Conder, April 2002</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="socksend.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="space.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">socksend </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> space</td>
        </tr>
      </table>
    </div>
  </body>
</html>