Sophie

Sophie

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

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>GEN52</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="ScoregensTop.html" title="Score Statements and GEN Routines" />
    <link rel="prev" href="GEN51.html" title="GEN51" />
    <link rel="next" href="GENtanh.html" title="GENtanh" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">GEN52</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="GEN51.html">Prev</a> </td>
          <th width="60%" align="center">Score Statements and GEN Routines</th>
          <td width="20%" align="right"> <a accesskey="n" href="GENtanh.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="GEN52">
      <a id="GEN52"></a>
      <div class="titlepage"></div>
      <a id="IndexGEN52" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">GEN52</span>
        </h2>
        <p>GEN52 — 
      Creates an interleaved multichannel table from the specified
	 source tables, in the format expected by the <span class="emphasis"><em>ftconv</em></span> opcode.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp78492080"></a>
        <h2>Description</h2>
        <p>
    GEN52 creates an interleaved multichannel table from the specified
	source tables, in the format expected by the <a class="link" href="ftconv.html" title="ftconv"><em class="citetitle">ftconv</em></a> opcode.
	It can also be used to extract a channel from a multichannel table
	and store it in a normal mono table, copy tables with skipping some
	samples, adding delay, or store in reverse order, etc.
    </p>
        <p>
      Three parameters must be given for each channel to be processed. <span class="emphasis"><em>fsrc</em></span> declares the source f-table number. The parameter <span class="emphasis"><em>offset</em></span> specifies an offset for the source file. If different to 0, the source file is not read from the beginning, but the  <span class="emphasis"><em>offset</em></span> number of values are skipped. The <span class="emphasis"><em>offset</em></span> is used to determine the channel number to be read from interleaved f-tables, e.g. for channel 2, <span class="emphasis"><em>offset</em></span> must be 1. It can also be used to set a read offset on the source table. This parameter gives absolute values, so if a skip of 20 sample frames for a 2 channel f-table is desired, <span class="emphasis"><em>offset</em></span> must be set to 40. The <span class="emphasis"><em>srcchnls</em></span> parameter is used to declare the number of channels in the source f-table. This parameter sets the skip size when reading the source f-table.
    </p>
        <p>
      When more than one channel (<span class="emphasis"><em>nchannels</em></span> &gt; 1) is given, source f-tables are interleaved in the newly created table.
    </p>
        <p>
      If the source f-table is finished before the destination f-table is full, the remaining values are set to 0.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp78499016"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>f</strong></span> # time size 52 nchannels fsrc1 offset1 srcchnls1 [fsrc2 offset2 srcchnls2 ... fsrcN offsetN srcchnlsN]</pre>
      </div>
      <div class="refsect1" title="Example">
        <a id="idp78548928"></a>
        <h2>Example</h2>
        <pre class="programlisting">
<span class="comment">; source tables</span>
<span class="stamnt">f</span> 1 0 16384 10 1
<span class="stamnt">f</span> 2 0 16384 10 0 1
<span class="comment">; create 2 channel interleaved table</span>
<span class="stamnt">f</span> 3 0 32768 -52 2 1 0 1 2 0 1
<span class="comment">; extract first channel from table 3</span>
<span class="stamnt">f</span> 4 0 16384 -52 1 3 0 2
<span class="comment">; extract second channel from table 3</span>
<span class="stamnt">f</span> 5 0 16384 -52 1 3 1 2</pre>
        <p>
      Here is a complete example of the GEN52 opcode. It uses the file <a class="ulink" href="examples/gen52.csd" target="_top"><em class="citetitle">gen52.csd</em></a>.
           </p>
        <div class="example">
          <a id="idp78553424"></a>
          <p class="title">
            <strong>Example 1072. Example of the GEN52 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 gen52.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

garvb   <span class="opc">init</span> 0
gaW     <span class="opc">init</span> 0
gaX     <span class="opc">init</span> 0
gaY     <span class="opc">init</span> 0

itmp    <span class="ohdr">ftgen</span>  1, 0, 64, <span class="op">-</span>2, 2, 40, <span class="op">-</span>1, <span class="op">-</span>1, <span class="op">-</span>1, 123,           \
               1, 13.000, 0.05, 0.85, 20000.0, 0.0, 0.50, 2,   \
               1,  2.000, 0.05, 0.85, 20000.0, 0.0, 0.25, 2,   \
               1, 16.000, 0.05, 0.85, 20000.0, 0.0, 0.35, 2,   \
               1,  9.000, 0.05, 0.85, 20000.0, 0.0, 0.35, 2,   \
               1, 12.000, 0.05, 0.85, 20000.0, 0.0, 0.35, 2,   \
               1,  8.000, 0.05, 0.85, 20000.0, 0.0, 0.35, 2

itmp    <span class="ohdr">ftgen</span> 2, 0, 262144, <span class="op">-</span>2, 0
        <span class="opc">spat3dt</span> 2, <span class="op">-</span>0.2, 1, 0, 1, 1, 2, 0.005

itmp    <span class="ohdr">ftgen</span> 3, 0, 262144, <span class="op">-</span>52, 3, 2, 0, 4, 2, 1, 4, 2, 2, 4

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

a1      <span class="opc">vco2</span> 1, 440, 10
kfrq    <span class="opc">port</span> 100, 0.008, 20000
a1      <span class="opc">butterlp</span> a1, kfrq
a2      <span class="opc">linseg</span> 0, 0.003, 1, 0.01, 0.7, 0.005, 0, 1, 0
a1      <span class="op">=</span>  a1 <span class="op">*</span> a2 <span class="op">*</span> 2
        <span class="opc">denorm</span> a1
        <span class="opc">vincr</span> garvb, a1
aw, ax, ay, az  <span class="opc">spat3di</span> a1, p4, p5, p6, 1, 1, 2
        <span class="opc">vincr</span> gaW, aw
        <span class="opc">vincr</span> gaX, ax
        <span class="opc">vincr</span> gaY, ay

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

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

       <span class="opc">denorm</span> garvb
<span class="comment">; skip as many samples as possible without truncating the IR</span>
arW, arX, arY   <span class="opc">ftconv</span> garvb, 3, 2048, 2048, (65536 <span class="op">-</span> 2048)
aW      <span class="op">=</span>  gaW <span class="op">+</span> arW
aX      <span class="op">=</span>  gaX <span class="op">+</span> arX
aY      <span class="op">=</span>  gaY <span class="op">+</span> arY
garvb   <span class="op">=</span>  0
gaW     <span class="op">=</span>  0
gaX     <span class="op">=</span>  0
gaY     <span class="op">=</span>  0

aWre, aWim      <span class="opc">hilbert</span> aW
aXre, aXim      <span class="opc">hilbert</span> aX
aYre, aYim      <span class="opc">hilbert</span> aY
aWXr    <span class="op">=</span>  0.0928<span class="op">*</span>aXre <span class="op">+</span> 0.4699<span class="op">*</span>aWre
aWXiYr  <span class="op">=</span>  0.2550<span class="op">*</span>aXim <span class="op">-</span> 0.1710<span class="op">*</span>aWim <span class="op">+</span> 0.3277<span class="op">*</span>aYre
aL      <span class="op">=</span>  aWXr <span class="op">+</span> aWXiYr
aR      <span class="op">=</span>  aWXr <span class="op">-</span> aWXiYr

       <span class="opc">outs</span> aL, aR

<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 0.5  0.0  2.0 -0.8
<span class="stamnt">i</span> 1 1 0.5  1.4  1.4 -0.6
<span class="stamnt">i</span> 1 2 0.5  2.0  0.0 -0.4
<span class="stamnt">i</span> 1 3 0.5  1.4 -1.4 -0.2
<span class="stamnt">i</span> 1 4 0.5  0.0 -2.0  0.0
<span class="stamnt">i</span> 1 5 0.5 -1.4 -1.4  0.2
<span class="stamnt">i</span> 1 6 0.5 -2.0  0.0  0.4
<span class="stamnt">i</span> 1 7 0.5 -1.4  1.4  0.6
<span class="stamnt">i</span> 1 8 0.5  0.0  2.0  0.8
<span class="stamnt">i</span> 2 0 10
<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" />  
        <span>This is the diagram of the waveform of the GEN52 routine, as used in the example:</span>

      </p>
        <div class="mediaobject">
          <img src="images/gen52.png" alt="f 3 0 262144 -52 3 2 0 4 2 1 4 2 2 4" />
          <div class="caption">
            <p>f 3 0 262144 -52 3 2 0 4 2 1 4 2 2 4</p>
          </div>
        </div>
        <p>
   
    </p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp78557784"></a>
        <h2>Credits</h2>
        <p>Author: Istvan Varga</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="GEN51.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="ScoregensTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="GENtanh.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">GEN51 </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> GENtanh</td>
        </tr>
      </table>
    </div>
  </body>
</html>