<?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>GEN24</title> <link rel="stylesheet" type="text/css" href="csound.css" /> <link rel="stylesheet" type="text/css" href="syntax-highlighting.css" /> <meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /> <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="GEN23.html" title="GEN23" /> <link rel="next" href="GEN25.html" title="GEN25" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">GEN24</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="GEN23.html">Prev</a> </td> <th width="60%" align="center">Score Statements and GEN Routines</th> <td width="20%" align="right"> <a accesskey="n" href="GEN25.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry"> <a id="GEN24"></a> <div class="titlepage"></div> <a id="IndexGEN24" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">GEN24</span> </h2> <p>GEN24 — Reads numeric values from another allocated function-table and rescales them. </p> </div> <div class="refsect1"> <a id="idm281472818917912"></a> <h2>Description</h2> <p> This subroutine reads numeric values from another allocated function-table and rescales them according to the max and min values given by the user. </p> </div> <div class="refsect1"> <a id="idm281472818914184"></a> <h2>Syntax</h2> <pre class="synopsis"><span class="command"><strong>f</strong></span> # time size -24 ftable min max</pre> </div> <div class="refsect1"> <a id="idm281472818912152"></a> <h2>Initialization</h2> <p> <span class="emphasis"><em>#, time, size</em></span> -- the usual GEN parameters. See <a class="link" href="f.html" title="f Statement (or Function Table Statement)">f statement</a>. </p> <p> <span class="emphasis"><em>ftable</em></span> -- ftable must be an already allocated table with the same size as this function. </p> <p> <span class="emphasis"><em>min, max</em></span> -- the rescaling range. </p> <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> <table border="0" summary="Note: Note"> <tr> <td rowspan="2" align="center" valign="top" width="25"> <img alt="[Note]" src="images/note.png" /> </td> <th align="left">Note</th> </tr> <tr> <td align="left" valign="top"> <p> This GEN is useful, for example, to eliminate the starting offset in exponential segments allowing a real starting from zero. </p> </td> </tr> </table> </div> </div> <div class="refsect1"> <a id="idm281472818837144"></a> <h2>Examples</h2> <p> Here is an example of the GEN24 opcode. It uses the file <a class="ulink" href="examples/gen24.csd" target="_top"><em class="citetitle">gen24.csd</em></a>. </p> <div class="example"> <a id="idm281472818835368"></a> <p class="title"> <strong>Example 1204. Example of the GEN24 generator.</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> <div class="refsect1"> <a id="idm281472682019368"></a> <pre class="programlisting"> <span class="nt"><CsoundSynthesizer></span> <span class="nt"><CsOptions></span> <span class="c1">; Select audio/midi flags here according to platform</span> -odac <span class="c1">;;;realtime audio out</span> <span class="c1">;-iadc ;;;uncomment -iadc if realtime audio input is needed too</span> <span class="c1">; For Non-realtime ouput leave only the line below:</span> <span class="c1">; -o gen24.wav -W ;;; for file output any platform</span> <span class="nt"></CsOptions></span> <span class="nt"><CsInstruments></span> <span class="vg">sr</span> <span class="o">=</span> <span class="mi">44100</span> <span class="vg">ksmps</span> <span class="o">=</span> <span class="mi">32</span> <span class="vg">nchnls</span> <span class="o">=</span> <span class="mi">2</span> <span class="vg">0dbfs</span> <span class="o">=</span> <span class="mi">1</span> <span class="kd">instr</span> <span class="nf">1</span> i<span class="n">fn</span> <span class="o">=</span> <span class="nb">p4</span> <span class="c1">;choose between tables</span> k<span class="n">cps</span> <span class="nb">init</span> <span class="mi">1</span><span class="o">/</span><span class="nb">p3</span> <span class="c1">;create index over duration of note.</span> k<span class="n">ndx</span> <span class="nb">phasor</span> k<span class="n">cps</span> i<span class="n">xmode</span> <span class="o">=</span> <span class="mi">1</span> <span class="c1">;normalize to 0-1</span> k<span class="n">val</span> <span class="nb">table</span> k<span class="n">ndx</span><span class="p">,</span> i<span class="n">fn</span><span class="p">,</span> i<span class="n">xmode</span> a<span class="n">sig</span> <span class="nb">poscil</span> <span class="mf">.7</span><span class="p">,</span> <span class="mi">440</span> <span class="o">+</span> k<span class="n">val</span><span class="p">,</span> <span class="mi">1</span> <span class="c1">;add to frequency</span> <span class="nb">outs</span> a<span class="n">sig</span><span class="p">,</span> a<span class="n">sig</span> <span class="kd">endin</span> <span class="nt"></CsInstruments></span> <span class="nt"><CsScore></span> <span class="nb">f</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">16384</span> <span class="mi">10</span> <span class="mi">1</span> <span class="c1">;sine wave</span> <span class="nb">f</span> <span class="mi">10</span> <span class="mi">0</span> <span class="mi">16384</span> <span class="o">-</span><span class="mi">24</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">400</span><span class="c1">;scale sine wave from table 1 from 0 to 400</span> <span class="nb">f</span> <span class="mi">11</span> <span class="mi">0</span> <span class="mi">16384</span> <span class="o">-</span><span class="mi">24</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">50</span> <span class="c1">;and from 0 to 50</span> <span class="nb">i</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">3</span> <span class="mi">10</span> <span class="nb">i</span> <span class="mi">1</span> <span class="mi">4</span> <span class="mi">3</span> <span class="mi">11</span> <span class="nb">e</span> <span class="nt"></CsScore></span> <span class="nt"></CsoundSynthesizer></span> </pre> </div> </div> </div> <p><br class="example-break" /> </p> </div> <div class="refsect1"> <a id="idm281472818831080"></a> <h2>Credits</h2> <p>Author: Gabriel Maldonado</p> <p>New in Csound version 4.16</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="GEN23.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="GEN25.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">GEN23 </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> GEN25</td> </tr> </table> </div> </body> </html>