Sophie

Sophie

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

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>locsig</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="locsend.html" title="locsend" />
    <link rel="next" href="log.html" title="log" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">locsig</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="locsend.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="log.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="locsig">
      <a id="locsig"></a>
      <div class="titlepage"></div>
      <a id="IndexLocsig" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">locsig</span>
        </h2>
        <p>locsig — 
      Takes an input signal and distributes between 2 or 4 channels.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp28631960"></a>
        <h2>Description</h2>
        <p>
      <span class="emphasis"><em>locsig</em></span> takes an input signal and distributes it among 2 or 4 channels using values in degrees to calculate the balance between adjacent channels. It also takes arguments for distance (used to attenuate signals that are to sound as if they are some distance further than the loudspeaker itself), and for the amount the signal that will be sent to reverberators. This unit is based upon the example in the Charles Dodge/Thomas Jerse book, <span class="emphasis"><em>Computer Music</em></span>, page 320.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp28667392"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">a1, a2 <span class="command"><strong>locsig</strong></span> asig, kdegree, kdistance, kreverbsend</pre>
        <pre class="synopsis">a1, a2,  a3, a4 <span class="command"><strong>locsig</strong></span> asig, kdegree, kdistance, kreverbsend</pre>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp28669248"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>kdegree</em></span> -- value between 0 and 360 for placement of the signal in a 2 or 4 channel space configured as: a1=0, a2=90, a3=180, a4=270 (kdegree=45 would balanced the signal equally between a1 and a2). <span class="emphasis"><em>locsig</em></span> maps <span class="emphasis"><em>kdegree</em></span> to sin and cos functions to derive the signal balances (e.g.: asig=1, kdegree=45, a1=a2=.707).
    </p>
        <p>
      <span class="emphasis"><em>kdistance</em></span> -- value &gt;= 1 used to attenuate the signal and to calculate reverb level to simulate distance cues.  As <span class="emphasis"><em>kdistance</em></span> gets larger the sound should get softer and somewhat more reverberant (assuming the use of <span class="emphasis"><em>locsend</em></span> in this case).
    </p>
        <p>
      <span class="emphasis"><em>kreverbsend</em></span> -- the percentage of the direct signal that will be factored along with the distance and degree values to derive signal amounts that can be sent to a reverb unit such as <span class="emphasis"><em>reverb</em></span>, or <span class="emphasis"><em>reverb2</em></span>.
    </p>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp28673008"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the locsig opcode. It uses the file <a class="ulink" href="examples/locsig_quad.csd" target="_top"><em class="citetitle">locsig_quad.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp28673992"></a>
          <p class="title">
            <strong>Example 397. Example of the locsig 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>
-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 locsig_quad.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> 4
<span class="ohdr">0dbfs</span>  <span class="op">=</span> 1

ga1 <span class="opc">init</span> 0
ga2 <span class="opc">init</span> 0
ga3 <span class="opc">init</span> 0
ga4 <span class="opc">init</span> 0

<span class="oblock">instr</span> 1

krevsend  <span class="op">=</span> p4
aout	  <span class="opc">diskin2</span> "beats.wav", 1, 0, 1
kdegree	  <span class="opc">line</span> 0, p3, 360 <span class="comment">;full circle</span>
kdistance <span class="opc">line</span> 1, p3 , 1
a1, a2, a3, a4     <span class="opc">locsig</span> aout, kdegree, kdistance, krevsend
ar1, ar2, ar3, ar4 <span class="opc">locsend</span>

ga1 <span class="op">=</span> ga1<span class="op">+</span>ar1
ga2 <span class="op">=</span> ga2<span class="op">+</span>ar2
ga3 <span class="op">=</span> ga3<span class="op">+</span>ar3
ga4 <span class="op">=</span> ga4<span class="op">+</span>ar4
    <span class="opc">outq</span> a1, a2, a3, a4

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

<span class="oblock">instr</span> 99 <span class="comment">; reverb instrument</span>
a1 <span class="opc">reverb2</span> ga1, 3.5, .5
a2 <span class="opc">reverb2</span> ga2, 3.5, .5
a3 <span class="opc">reverb2</span> ga3, 3.5, .5
a4 <span class="opc">reverb2</span> ga4, 3.5, .5
   <span class="opc">outq</span>	a1, a2, a3, a4
	
ga1 <span class="op">=</span> 0
ga2 <span class="op">=</span> 0
ga3 <span class="op">=</span> 0
ga4 <span class="op">=</span> 0

<span class="oblock">endin</span>
<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="comment">; sine wave.</span>
<span class="stamnt">f</span> 1 0 16384 10 1

<span class="stamnt">i</span> 1 0  14  .1	<span class="comment">;with reverb</span>
<span class="stamnt">i</span> 1 14 14  0	<span class="comment">;no reverb</span>
<span class="stamnt">i</span>99 0 36
<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>
        <p>
      In the above example, the signal, <span class="emphasis"><em>aout</em></span>, is sent around a complete circle once during the duration of a note while at the same time it becomes more and more "distant" from the listeners' location. <span class="emphasis"><em>locsig</em></span> sends the appropriate amount of the signal internally to <span class="emphasis"><em>locsend</em></span>. The outputs of the <span class="emphasis"><em>locsend</em></span> are added to global accumulators in a common Csound style and the global signals are used as inputs to the reverb units in a separate instrument.
    </p>
        <p>
      <span class="emphasis"><em>locsig</em></span> is useful for quad and stereo panning as well as fixed placed of sounds anywhere between two loudspeakers. Below is an example of the fixed placement of sounds in a stereo field.
    </p>
        <p>
      </p>
        <div class="informalexample">
          <pre class="programlisting">
<span class="oblock">instr</span> 1
  a1, a2             <span class="opc">locsig</span>  asig, p4, p5, .1
  ar1, ar2           <span class="opc">locsend</span>
  ga1 <span class="op">=</span> ga1<span class="op">+</span>ar1
  ga2 <span class="op">=</span> ga2<span class="op">+</span>ar2
                     <span class="opc">outs</span> a1, a
<span class="oblock">endin</span>
<span class="oblock">instr</span> 99 
  <span class="comment">; reverb....</span>
<span class="oblock">endin</span></pre>
        </div>
        <p>
    </p>
        <p>
      A few notes:
      </p>
        <div class="informalexample">
          <pre class="programlisting">
  <span class="comment">;place the sound in the left speaker and near:</span>
  <span class="stamnt">i</span>1 0 1 0 1
  
  <span class="comment">;place the sound in the right speaker and far:</span>
  <span class="stamnt">i</span>1 1 1 90 25
  
  <span class="comment">;place the sound equally between left and right and in the middle ground distance:</span>
  <span class="stamnt">i</span>1 2 1 45 12
  <span class="stamnt">e</span></pre>
        </div>
        <p>
    </p>
        <p>
      The next example shows a simple intuitive use of the distance value to simulate Doppler shift. The same value is used to scale the frequency as is used as the distance input to <span class="emphasis"><em>locsig</em></span>.
      </p>
        <div class="informalexample">
          <pre class="programlisting">
  kdistance          <span class="opc">line</span>    1, p3, 10
  kfreq <span class="op">=</span> (ifreq <span class="op">*</span> 340) <span class="op">/</span> (340 <span class="op">+</span> kdistance)
  asig               <span class="opc">oscili</span>  iamp, kfreq, 1
  kdegree            <span class="opc">line</span>    0, p3, 360
  a1, a2, a3, a4     <span class="opc">locsig</span>  asig, kdegree, kdistance, .1
  ar1, ar2, ar3, ar4 <span class="opc">locsend</span></pre>
        </div>
        <p>
    </p>
      </div>
      <div class="refsect1" title="See Also">
        <a id="idp28690712"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="locsend.html" title="locsend"><em class="citetitle">locsend</em></a>
    </p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp28691768"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Richard Karpen</td>
          </tr>
          <tr>
            <td>Seattle, WA USA</td>
          </tr>
          <tr>
            <td>1998</td>
          </tr>
        </table>
        <p>
    </p>
        <p>New in Csound version 3.48</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="locsend.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="log.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">locsend </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> log</td>
        </tr>
      </table>
    </div>
  </body>
</html>