<?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>GEN04</title> <link rel="stylesheet" href="csound.css" type="text/css" /> <meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /> <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="GEN03.html" title="GEN03" /> <link rel="next" href="GEN05.html" title="GEN05" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">GEN04</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="GEN03.html">Prev</a> </td> <th width="60%" align="center">Score Statements and GEN Routines</th> <td width="20%" align="right"> <a accesskey="n" href="GEN05.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry" title="GEN04"> <a id="GEN04"></a> <div class="titlepage"></div> <a id="IndexGEN04" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">GEN04</span> </h2> <p>GEN04 — Generates a normalizing function. </p> </div> <div class="refsect1" title="Description"> <a id="id3730086"></a> <h2>Description</h2> <p> This subroutine generates a normalizing function by examining the contents of an existing table. </p> </div> <div class="refsect1" title="Syntax"> <a id="id3729832"></a> <h2>Syntax</h2> <pre class="synopsis"><span class="command"><strong>f</strong></span> # time size 4 source# sourcemode</pre> </div> <div class="refsect1" title="Initialization"> <a id="id3729850"></a> <h2>Initialization</h2> <p> <span class="emphasis"><em>size</em></span> -- number of points in the table. Should be power-of-2 plus 1. Must not exceed (except by 1) the size of the source table being examined; limited to just half that size if the sourcemode is of type offset (see below). </p> <p> <span class="emphasis"><em>source #</em></span> -- table number of stored function to be examined. </p> <p> <span class="emphasis"><em>sourcemode</em></span> -- a coded value, specifying how the source table is to be scanned to obtain the normalizing function. Zero indicates that the source is to be scanned from left to right. Non-zero indicates that the source has a bipolar structure; scanning will begin at the mid-point and progress outwards, looking at pairs of points equidistant from the center. </p> <div class="note" title="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> </p> <div class="itemizedlist"> <ul class="itemizedlist" type="disc"> <li class="listitem"> <p> The normalizing function derives from the progressive absolute maxima of the source table being scanned. The new table is created left-to-right, with stored values equal to 1/(absolute maximum so far scanned). Stored values will thus begin with 1/(first value scanned), then get progressively smaller as new maxima are encountered. For a source table which is normalized (values <= 1), the derived values will range from 1/(first value scanned) down to 1. If the first value scanned is zero, that inverse will be set to 1. </p> </li> <li class="listitem"> <p> The normalizing function from <span class="emphasis"><em>GEN04</em></span> is not itself normalized. </p> </li> <li class="listitem"> <p> <span class="emphasis"><em>GEN04</em></span> is useful for scaling a table-derived signal so that it has a consistent peak amplitude. A particular application occurs in waveshaping when the carrier (or indexing) signal is less than full amplitude. </p> </li> </ul> </div> <p> </p> </td> </tr> </table> </div> </div> <div class="refsect1" title="Examples"> <a id="id3730847"></a> <h2>Examples</h2> <p> </p> <div class="informalexample"> <pre class="programlisting"><span class="stamnt">f</span> 2 0 512 4 1 1</pre> </div> <p> This creates a normalizing function for use in connection with the <a class="link" href="GEN03.html" title="GEN03"><em class="citetitle">GEN03</em></a> table 1 example. Midpoint bipolar offset is specified. </p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="GEN03.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="GEN05.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">GEN03 </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> GEN05</td> </tr> </table> </div> </body> </html>