<?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>in</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="imagesize.html" title="imagesize" /> <link rel="next" href="in32.html" title="in32" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">in</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="imagesize.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="in32.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry"> <a id="in"></a> <div class="titlepage"></div> <a id="Indexin" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">in</span> </h2> <p>in — Reads mono audio data from an external device or stream. </p> </div> <div class="refsect1"> <a id="idm281472924033976"></a> <h2>Description</h2> <p> Reads audio data from an external device or stream. </p> <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"> <table border="0" summary="Warning: Warning"> <tr> <td rowspan="2" align="center" valign="top" width="25"> <img alt="[Warning]" src="images/warning.png" /> </td> <th align="left">Warning</th> </tr> <tr> <td align="left" valign="top"> <p> There are two versions of this opcode. The first is designed to be used only with orchestras that have inchnls=1. Doing so with orchestras with inchnls > 1 will cause incorrect audio input. </p> <p> The second form will read multiple channels into an array. </p> </td> </tr> </table> </div> </div> <div class="refsect1"> <a id="idm281472924028616"></a> <h2>Syntax</h2> <pre class="synopsis">ar1 <span class="command"><strong>in</strong></span></pre> <pre class="synopsis">aarray <span class="command"><strong>in</strong></span></pre> </div> <div class="refsect1"> <a id="idm281472923960584"></a> <h2>Performance</h2> <p> Form 1 reads mono audio data from an external device or stream. If the command-line <a class="link" href="CommandFlags.html#FlagsMinusLowerI"><em class="citetitle">-i</em></a> flag is set, sound is read continuously from the audio input stream (e.g. <span class="emphasis"><em>stdin</em></span> or a soundfile) into an internal buffer. Any number of these opcodes can read freely from this buffer. </p> <p> The second format will read upto ichnls of audio into an audio array, which must be initialised. </p> </div> <div class="refsect1"> <a id="idm281472923957224"></a> <h2>Examples</h2> <p> Here is an example of the in opcode. It uses the file <a class="ulink" href="examples/in.csd" target="_top"><em class="citetitle">in.csd</em></a>. </p> <div class="example"> <a id="idm281472923955368"></a> <p class="title"> <strong>Example 427. Example of the in opcode.</strong> </p> <div class="example-contents"> <div class="refsect1"> <a id="idm281472751605128"></a> <pre class="programlisting"> <span class="nt"><CsoundSynthesizer></span> <span class="nt"><CsOptions></span> <span class="c1">; Select audio/midi flags here according to platform</span> -odac -idac <span class="c1">;;;realtime audio I/O</span> <span class="c1">; For Non-realtime ouput leave only the line below:</span> <span class="c1">; in.wav -W ;;; for file output any platform</span> <span class="nt"></CsOptions></span> <span class="nt"><CsInstruments></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> <span class="c1">;1 channel in, two channels out</span> a<span class="n">in1</span> <span class="nb">in</span> <span class="c1">;grab your mic and sing</span> a<span class="n">del</span> <span class="nb">linseg</span> <span class="mi">0</span><span class="p">,</span> <span class="nb">p3</span><span class="o">*</span><span class="mf">.5</span><span class="p">,</span> <span class="mf">0.02</span><span class="p">,</span> <span class="nb">p3</span><span class="o">*</span><span class="mf">.5</span><span class="p">,</span> <span class="mi">0</span> <span class="c1">;max delay time = 20ms</span> a<span class="n">out</span> <span class="nb">flanger</span> a<span class="n">in1</span><span class="p">,</span> a<span class="n">del</span><span class="p">,</span> <span class="mf">.7</span> <span class="nb">fout</span> <span class="s">"in_1.wav"</span><span class="p">,</span> <span class="mi">14</span><span class="p">,</span> a<span class="n">out</span><span class="p">,</span> a<span class="n">out</span> <span class="c1">;write to stereo file,</span> <span class="nb">outs</span> a<span class="n">out</span><span class="p">,</span> a<span class="n">out</span> <span class="c1">;16 bits with header</span> <span class="kd">endin</span> <span class="nt"></CsInstruments></span> <span class="nt"><CsScore></span> <span class="nb">i</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">10</span> <span class="nb">e</span> <span class="nt"></CsScore></span> <span class="nt"></CsoundSynthesizer></span> </pre> </div> </div> </div> <p><br class="example-break" /> </p> </div> <div class="refsect1"> <a id="idm281472923953496"></a> <h2>See Also</h2> <p> <a class="link" href="diskin.html" title="diskin"><em class="citetitle">diskin</em></a>, <a class="link" href="inch.html" title="inch"><em class="citetitle">inh</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>, <a class="link" href="soundin.html" title="soundin"><em class="citetitle">soundin</em></a> </p> </div> <div class="refsect1"> <a id="idm281472923945944"></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> <tr> <td>Authors: John ffitch</td> </tr> <tr> <td>NUIM, 2013</td> </tr> </table> <p> </p> <p>Already in version 3.30</p> <p>Array version in versio 6.01</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="imagesize.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="in32.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">imagesize </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> in32</td> </tr> </table> </div> </body> </html>