Sophie

Sophie

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

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>GEN32</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="GEN31.html" title="GEN31" />
    <link rel="next" href="GEN33.html" title="GEN33" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">GEN32</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="GEN31.html">Prev</a> </td>
          <th width="60%" align="center">Score Statements and GEN Routines</th>
          <td width="20%" align="right"> <a accesskey="n" href="GEN33.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="GEN32">
      <a id="GEN32"></a>
      <div class="titlepage"></div>
      <a id="IndexGEN32" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">GEN32</span>
        </h2>
        <p>GEN32 — 
      Mixes any waveform, resampled with either FFT or linear interpolation.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp78204960"></a>
        <h2>Description</h2>
        <p>
      This routine is similar to <a class="link" href="GEN31.html" title="GEN31"><em class="citetitle">GEN31</em></a>, but allows specifying source ftable for each partial. Tables can be resampled either with FFT, or linear interpolation.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp78199496"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>f</strong></span> # time size  32  srca  pna stra phsa  srcb pnb strb phsb  ...</pre>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp78200568"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>srca, srcb</em></span> -- source table number. A negative value can be used to read the table with linear interpolation (by default, the source waveform is transposed and phase shifted using FFT); this is less accurate, but faster, and allows non-integer and negative partial numbers.
    </p>
        <p>
      <span class="emphasis"><em>pna, pnb, ...</em></span> -- partial number, must be a positive integer if source table number is positive (i.e. resample with FFT).
    </p>
        <p>
      <span class="emphasis"><em>stra, strb, ...</em></span> -- amplitude scale
    </p>
        <p>
      <span class="emphasis"><em>phsa, phsb, ...</em></span> -- start phase (0 to 1)
    </p>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp78252776"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the GEN32 routine. It uses the file <a class="ulink" href="examples/gen32.csd" target="_top"><em class="citetitle">gen32.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp78253744"></a>
          <p class="title">
            <strong>Example 1064. Example of the gen32 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 gen32.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

itmp    <span class="ohdr">ftgen</span> 1, 0, 16384, 7, 1, 16384, <span class="op">-</span>1		<span class="comment">; sawtooth</span>
itmp    <span class="ohdr">ftgen</span> 2, 0, 8192, 10, 1				<span class="comment">; sine</span>
itmp    <span class="ohdr">ftgen</span> 5, 0, 4096, <span class="op">-</span>32, <span class="op">-</span>2, 1.5, 1.0, 0.25, 1, 2, 0.5, 0, 1, 3, <span class="op">-</span>0.25, 0.5	<span class="comment">; mix tables</span>
itmp    <span class="ohdr">ftgen</span> 6, 0, 16384, 20, 3, 1			<span class="comment">; window</span>
<span class="comment">; generate band-limited waveforms</span>
inote   <span class="op">=</span>  0
<span class="olabel">loop0</span><span class="op">:</span>
icps    <span class="op">=</span>  440 <span class="op">*</span> <span class="opc">exp</span>(<span class="opc">log</span>(2) <span class="op">*</span> (inote <span class="op">-</span> 69) <span class="op">/</span> 12)        <span class="comment">; one table for</span>
inumh   <span class="op">=</span>  <span class="ohdr">sr</span> <span class="op">/</span> (2 <span class="op">*</span> icps)                              <span class="comment">; each MIDI note number</span>
ift     <span class="op">=</span>  <span class="opc">int</span>(inote <span class="op">+</span> 256.5)
itmp    <span class="ohdr">ftgen</span> ift, 0, 4096, <span class="op">-</span>30, 5, 1, inumh
inote   <span class="op">=</span>  inote <span class="op">+</span> 1
        <span class="octrl">if</span> (inote <span class="op">&lt;</span> 127.5) <span class="octrl">igoto</span> <span class="olabel">loop0</span>

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

kcps    <span class="opc">expon</span> 20, p3, 16000
kft     <span class="op">=</span>  <span class="opc">int</span>(256.5 <span class="op">+</span> 69 <span class="op">+</span> 12 <span class="op">*</span> <span class="opc">log</span>(kcps <span class="op">/</span> 440) <span class="op">/</span> <span class="opc">log</span>(2))
kft     <span class="op">=</span>  (kft <span class="op">&gt;</span> 383 <span class="op">?</span> 383 <span class="op">:</span> kft)
a1      <span class="opc">phasor</span> kcps
a1      <span class="opc">tableikt</span> a1, kft, 1, 0, 1
        <span class="opc">outs</span> a1<span class="op">*</span>.5, a1<span class="op">*</span>.5
<span class="oblock">endin</span>
        
<span class="oblock">instr</span> 2

kcps    <span class="opc">expon</span> 20, p3, 16000
kft     <span class="op">=</span>  <span class="opc">int</span>(256.5 <span class="op">+</span> 69 <span class="op">+</span> 12 <span class="op">*</span> <span class="opc">log</span>(kcps <span class="op">/</span> 440) <span class="op">/</span> <span class="opc">log</span>(2))
kft     <span class="op">=</span>  (kft <span class="op">&gt;</span> 383 <span class="op">?</span> 383 <span class="op">:</span> kft)
kgdur   <span class="opc">limit</span> 10 <span class="op">/</span> kcps, 0.1, 1
a1      <span class="opc">grain2</span> kcps, 0.02, kgdur, 30, kft, 6, <span class="op">-</span>0.5
        <span class="opc">outs</span> a1<span class="op">*</span>.08, a1<span class="op">*</span>.08

<span class="oblock">endin</span>
<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="stamnt">t</span> 0 60

<span class="stamnt">i</span> 1 0 10
<span class="stamnt">i</span> 2 12 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" />
    </p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp78256016"></a>
        <h2>Credits</h2>
        <p>Author: Rasmus Ekman</p>
        <p>Programmer: Istvan Varga</p>
        <p>New in version 4.17</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="GEN31.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="GEN33.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">GEN31 </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> GEN33</td>
        </tr>
      </table>
    </div>
  </body>
</html>