Sophie

Sophie

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

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>mode</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="MixerClear.html" title="MixerClear" />
    <link rel="next" href="modmatrix.html" title="modmatrix" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">mode</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="MixerClear.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="modmatrix.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="mode">
      <a id="mode"></a>
      <div class="titlepage"></div>
      <a id="IndexMode" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">mode</span>
        </h2>
        <p>mode — 
      A filter that simulates a mass-spring-damper system
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp32002664"></a>
        <h2>Description</h2>
        <p>
      Filters the incoming signal with the specified resonance frequency and
      quality factor. It can also be seen as a signal generator for high quality
      factor, with an impulse for the excitation. You can combine several modes
      to built complex instruments such as bells or guitar tables.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp32003576"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">aout <span class="command"><strong>mode</strong></span> ain, kfreq, kQ [, iskip]</pre>
      </div>
      <div class="refsect1" title="Initialization">
        <a id="idp32050520"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>iskip</em></span>
      (optional, default=0) -- if non zero skip the initialisation of the
      filter.
    </p>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp32051432"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>aout</em></span> -- filtered signal
    </p>
        <p>
      <span class="emphasis"><em>ain</em></span> -- signal to filter
    </p>
        <p>
      <span class="emphasis"><em>kfreq</em></span> -- resonant frequency of the filter
      </p>
        <div class="warning" title="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>
          This filter becomes unstable if <span class="emphasis"><em>sr</em></span>/<span class="emphasis"><em>kfreq</em></span> &lt;
          pi (e.g <span class="emphasis"><em>kfreq</em></span> &gt; 14037 Hz @ 44 kHz)
        </p>
              </td>
            </tr>
          </table>
        </div>
        <p>
    </p>
        <p>
      <span class="emphasis"><em>kQ</em></span> -- quality factor of the filter
    </p>
        <p>The resonance time is roughly proportionnal to <span class="emphasis"><em>kQ</em></span>/<span class="emphasis"><em>kfreq</em></span>.</p>
        <p>
      See <a class="link" href="MiscModalFreq.html" title="Appendix E. Modal Frequency Ratios"><em class="citetitle">Modal Frequency Ratios</em></a> for frequency ratios of real intruments which can be used to determine the values of <span class="emphasis"><em>kfreq</em></span>.
    </p>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp32056656"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the mode opcode. It uses the file <a class="ulink" href="examples/mode.csd" target="_top"><em class="citetitle">mode.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp32057600"></a>
          <p class="title">
            <strong>Example 487. Example of the mode 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">; Audio out   Audio in    No messages</span>
-odac           -iadc     -d     <span class="comment">;;;RT audio I/O</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o moogvcf.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="comment">; Initialize the global variables.</span>
<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">kr</span> <span class="op">=</span> 4410
<span class="ohdr">ksmps</span> <span class="op">=</span> 10
<span class="ohdr">nchnls</span> <span class="op">=</span> 2

<span class="oblock">instr</span> 1<span class="comment">; 2 modes excitator</span>

idur <span class="opc">init</span> p3
ifreq11 <span class="opc">init</span> p4
ifreq12 <span class="opc">init</span> p5
iQ11    <span class="opc">init</span> p6
iQ12    <span class="opc">init</span> p7
iamp    <span class="opc">init</span> <span class="opc">ampdb</span>(p8)
ifreq21 <span class="opc">init</span> p9
ifreq22 <span class="opc">init</span> p10
iQ21    <span class="opc">init</span> p11
iQ22    <span class="opc">init</span> p12

<span class="comment">; to simulate the shock between the excitator and the resonator</span>
ashock  <span class="opc">mpulse</span>  3,0 

aexc1  <span class="opc">mode</span> ashock,ifreq11,iQ11
aexc1 <span class="op">=</span> aexc1<span class="op">*</span>iamp
aexc2  <span class="opc">mode</span> ashock,ifreq12,iQ12
aexc2 <span class="op">=</span> aexc2<span class="op">*</span>iamp


aexc <span class="op">=</span> (aexc1<span class="op">+</span>aexc2)<span class="op">/</span>2

<span class="comment">;"Contact" condition : when aexc reaches 0, the excitator looses </span>
<span class="comment">;contact with the resonator, and stops "pushing it"</span>
aexc <span class="opc">limit</span> aexc,0,3<span class="op">*</span>iamp 

<span class="comment">; 2modes resonator</span>

ares1  <span class="opc">mode</span> aexc,ifreq21,iQ21
ares2  <span class="opc">mode</span> aexc,ifreq22,iQ22

ares <span class="op">=</span> (ares1<span class="op">+</span>ares2)<span class="op">/</span>2

<span class="opc">display</span> aexc<span class="op">+</span>ares,p3
<span class="opc">outs</span>  aexc<span class="op">+</span>ares,aexc<span class="op">+</span>ares

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


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

<span class="comment">;wooden excitator against glass resonator</span>
<span class="stamnt">i</span>1 0 8  1000   3000  12  8  70  440   888   500  420 

<span class="comment">;felt against glass</span>
<span class="stamnt">i</span>1 4 8  80   188  8  3  70  440   888   500  420 

<span class="comment">;wood against wood</span>
<span class="stamnt">i</span>1 8 8  1000   3000  12  8  70  440  630   60  53 

<span class="comment">;felt against wood</span>
<span class="stamnt">i</span>1 12 8  80   180  8  3  70  440  630   60  53 


<span class="stamnt">i</span>1 16 8  1000   3000  12  8  70  440  888   2000  1630
<span class="stamnt">i</span>1 23 8  80   180  8  3  70  440  888   2000  1630


<span class="comment">;With a metallic excitator</span>

<span class="stamnt">i</span>1 33 8 1000  1800  1000  720  70   440   882  500  500
<span class="stamnt">i</span>1 37 8 1000  1800  1000  850  70   440   630  60  53

<span class="stamnt">i</span>1 42 8 1000  1800  2000  1720  70   440   442  500  500


<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="Credits">
        <a id="idp32059864"></a>
        <h2>Credits</h2>
        <p>Original UDO and documentation/example by François Blanc</p>
        <p>Opcode translation to C-code by Steven Yi</p>
        <p>New in version 5.04</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="MixerClear.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="modmatrix.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">MixerClear </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> modmatrix</td>
        </tr>
      </table>
    </div>
  </body>
</html>