<?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>chnclear</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="chn.html" title="chn" /> <link rel="next" href="chnexport.html" title="chnexport" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">chnclear</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="chn.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="chnexport.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry" title="chnclear"> <a id="chnclear"></a> <div class="titlepage"></div> <a id="Indexchnclear" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">chnclear</span> </h2> <p>chnclear — Clears an audio output channel of the named software bus. </p> </div> <div class="refsect1" title="Description"> <a id="idp15590616"></a> <h2>Description</h2> <p> Clears an audio channel of the named software bus to zero. Implies declaring the channel with <span class="emphasis"><em>imode</em></span>=2 (see also <a class="link" href="chn.html" title="chn"><em class="citetitle">chn_a</em></a>). </p> </div> <div class="refsect1" title="Syntax"> <a id="idp15675672"></a> <h2>Syntax</h2> <pre class="synopsis"><span class="command"><strong>chnclear</strong></span> Sname</pre> </div> <div class="refsect1" title="Initialization"> <a id="idp15676664"></a> <h2>Initialization</h2> <p> <span class="emphasis"><em>Sname</em></span> -- a string that indicates which named channel of the software bus to clear. </p> </div> <div class="refsect1" title="Examples"> <a id="idp15677584"></a> <h2>Examples</h2> <p> Here is an example of the chnclear opcode. It uses the file <a class="ulink" href="examples/chnclear.csd" target="_top"><em class="citetitle">chnclear.csd</em></a>. </p> <div class="example"> <a id="idp15678576"></a> <p class="title"> <strong>Example 102. Example of the chnclear opcode.</strong> </p> <div class="example-contents"> <pre class="programlisting"> <span class="csdtag"><CsoundSynthesizer></span> <span class="csdtag"><CsOptions></span> <span class="comment">; Select audio/midi flags here according to platform</span> -odac <span class="comment">;;;realtime audio out</span> <span class="comment">;-iadc ;;;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 chnclear.wav -W ;;; for file output any platform</span> <span class="csdtag"></CsOptions></span> <span class="csdtag"><CsInstruments></span> <span class="comment">;Example by Joachim Heintz</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">; send i-values</span> <span class="opc">chnset</span> 1, "sio" <span class="opc">chnset</span> <span class="op">-</span>1, "non" <span class="oblock">endin</span> <span class="oblock">instr</span> 2<span class="comment">; send k-values</span> kfreq <span class="opc">randomi</span> 100, 300, 1 <span class="opc">chnset</span> kfreq, "cntrfreq" kbw <span class="op">=</span> kfreq<span class="op">/</span>10 <span class="opc">chnset</span> kbw, "bandw" <span class="oblock">endin</span> <span class="oblock">instr</span> 3<span class="comment">; send a-values</span> anois <span class="opc">rand</span> .1 <span class="opc">chnset</span> anois, "noise" loop<span class="op">:</span> idur <span class="opc">random</span> .3, 1.5 <span class="octrl">timout</span> 0, idur, do <span class="opc">reinit</span> loop do<span class="op">:</span> ifreq <span class="opc">random</span> 400, 1200 iamp <span class="opc">random</span> .1, .3 asig <span class="opc">oscils</span> iamp, ifreq, 0 aenv <span class="opc">transeg</span> 1, idur, <span class="op">-</span>10, 0 asine <span class="op">=</span> asig <span class="op">*</span> aenv <span class="opc">chnset</span> asine, "sine" <span class="oblock">endin</span> <span class="oblock">instr</span> 11<span class="comment">; receive some chn values and send again</span> ival1 <span class="opc">chnget</span> "sio" ival2 <span class="opc">chnget</span> "non" <span class="opc">print</span> ival1, ival2 kcntfreq <span class="opc">chnget</span> "cntrfreq" kbandw <span class="opc">chnget</span> "bandw" anoise <span class="opc">chnget</span> "noise" afilt <span class="opc">reson</span> anoise, kcntfreq, kbandw afilt <span class="opc">balance</span> afilt, anoise <span class="opc">chnset</span> afilt, "filtered" <span class="oblock">endin</span> <span class="oblock">instr</span> 12<span class="comment">; mix the two audio signals</span> amix1 <span class="opc">chnget</span> "sine" amix2 <span class="opc">chnget</span> "filtered" <span class="opc">chnmix</span> amix1, "mix" <span class="opc">chnmix</span> amix2, "mix" <span class="oblock">endin</span> <span class="oblock">instr</span> 20<span class="comment">; receive and reverb</span> amix <span class="opc">chnget</span> "mix" aL, aR <span class="opc">freeverb</span> amix, amix, .8, .5 <span class="opc">outs</span> aL, aR <span class="oblock">endin</span> <span class="oblock">instr</span> 100<span class="comment">; clear</span> <span class="opc">chnclear</span> "mix" <span class="oblock">endin</span> <span class="csdtag"></CsInstruments></span> <span class="csdtag"><CsScore></span> <span class="stamnt">i</span> 1 0 20 <span class="stamnt">i</span> 2 0 20 <span class="stamnt">i</span> 3 0 20 <span class="stamnt">i</span> 11 0 20 <span class="stamnt">i</span> 12 0 20 <span class="stamnt">i</span> 20 0 20 <span class="stamnt">i</span> 100 0 20 <span class="csdtag"></CsScore></span> <span class="csdtag"></CsoundSynthesizer></span> </pre> </div> </div> <p><br class="example-break" /> </p> </div> <div class="refsect1" title="Credits"> <a id="idp15679592"></a> <h2>Credits</h2> <p> </p> <table border="0" summary="Simple list" class="simplelist"> <tr> <td>Author: Istvan Varga</td> </tr> <tr> <td>2006</td> </tr> </table> <p> </p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="chn.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="chnexport.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">chn </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> chnexport</td> </tr> </table> </div> </body> </html>