<?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>GENsone</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="GENexp.html" title="GENexp" /> <link rel="next" href="GENfarey.html" title="GENfarey" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">GENsone</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="GENexp.html">Prev</a> </td> <th width="60%" align="center">Score Statements and GEN Routines</th> <td width="20%" align="right"> <a accesskey="n" href="GENfarey.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry" title="GENsone"> <a id="GENsone"></a> <div class="titlepage"></div> <a id="IndexGENsone" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">GENsone</span> </h2> <p>"sone" — Generate a table with values of the sone function. </p> </div> <div class="refsect1" title="Description"> <a id="idp78604448"></a> <h2>Description</h2> <p> Creates an ftable with values of the sone function for equal power. </p> </div> <div class="refsect1" title="Syntax"> <a id="idp78605128"></a> <h2>Syntax</h2> <pre class="synopsis"><span class="command"><strong>f</strong></span> # time size "sone" start end equalpoint rescale</pre> </div> <div class="refsect1" title="Initialization"> <a id="idp78615552"></a> <h2>Initialization</h2> <p> <span class="emphasis"><em>size</em></span> -- number of points in the table. Must be a power of 2 or power-of-2 plus 1 (see <a class="link" href="f.html" title="f Statement (or Function Table Statement)"><em class="citetitle">f statement</em></a>). </p> <p> <span class="emphasis"><em>start, end</em></span> -- first and last value to be stored. The points stored are uniformly spaced between these to the table size. </p> <p> <span class="emphasis"><em>equalpoint</em></span> -- the point on the curve when the input and output values are equal. </p> <p> <span class="emphasis"><em>rescale</em></span> -- if not zero the table is not rescaled </p> <p> The table is filled with the function x*POWER(x/eqlp, FL(33.0)/FL(78.0)) for x between the start and end points. This is the Sone loudness curve. </p> </div> <div class="refsect1" title="Examples"> <a id="idp78618752"></a> <h2>Examples</h2> <p> Here is an example of the GENsone routine. It uses the files <a class="ulink" href="examples/gensone.csd" target="_top"><em class="citetitle">gensone.csd</em></a>. </p> <div class="example"> <a id="idp78654632"></a> <p class="title"> <strong>Example 1075. An example of the GENsone routine.</strong> </p> <div class="example-contents"> <pre class="programlisting"> <span class="csdtag"><CsoundSynthesizer></span> <span class="csdtag"><CsOptions></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 gensone.wav -W ;;; for file output any platform</span> <span class="csdtag"></CsOptions></span> <span class="csdtag"><CsInstruments></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 <span class="oblock">instr</span> 1 <span class="comment">; simple oscillator with loudness correction. </span> kcps <span class="op">=</span> <span class="opc">cpspch</span>(p4) kenv <span class="opc">linseg</span> 0, p3<span class="op">*</span>0.25, 1, p3<span class="op">*</span>0.75, 0 <span class="comment">;amplitude envelope</span> kamp <span class="opc">tablei</span> 16384 <span class="op">*</span>kenv, 2 asig <span class="opc">oscil</span> kamp, kcps, 1 <span class="opc">outs</span> asig, asig <span class="oblock">endin</span> <span class="oblock">instr</span> 2 <span class="comment">;neutral oscillator to compare with</span> kcps <span class="op">=</span> <span class="opc">cpspch</span>(p4) kenv <span class="opc">linseg</span> 0, p3<span class="op">*</span>0.25, 1, p3<span class="op">*</span>0.75, 0 <span class="comment">;amplitude envelope</span> asig <span class="opc">oscil</span> kenv, kcps, 1 <span class="opc">outs</span> asig, asig <span class="oblock">endin</span> <span class="csdtag"></CsInstruments></span> <span class="csdtag"><CsScore></span> <span class="stamnt">f</span> 1 0 16384 10 1 <span class="comment">;sine wave</span> <span class="stamnt">f</span> 2 0 16385 "sone" 0 32000 32000 0 <span class="stamnt">s</span> <span class="stamnt">f</span> 0 1 <span class="comment">;1 second of silence before we start...</span> <span class="stamnt">s</span> <span class="stamnt">i</span> 1 0 2 7.00 <span class="stamnt">i</span> 1 + . 7.01 <span class="stamnt">i</span> 1 + . 8.02 <span class="stamnt">i</span> 1 + . 8.03 <span class="stamnt">s</span> <span class="stamnt">i</span> 2 0 2 7.00 <span class="stamnt">i</span> 2 + . 7.01 <span class="stamnt">i</span> 2 + . 8.02 <span class="stamnt">i</span> 2 + . 8.03 <span class="stamnt">e</span> <span class="csdtag"></CsScore></span> <span class="csdtag"></CsoundSynthesizer></span> </pre> </div> </div> <p><br class="example-break" /> <span>This is the diagram of the waveforms of the GENsone routine, as used in the example:</span> </p> <div class="mediaobject"> <img src="images/gensone.png" alt="f 2 0 16385 "sone" 0 32000 32000 0" /> <div class="caption"> <p>f 2 0 16385 "sone" 0 32000 32000 0</p> </div> </div> <p> </p> </div> <div class="refsect1" title="See Also"> <a id="idp78657688"></a> <h2>See Also</h2> <p> More information on Sone: <a class="ulink" href="http://en.wikipedia.org/wiki/Sone" target="_top"><em class="citetitle">http://en.wikipedia.org/wiki/Sone</em></a></p> </div> <div class="refsect1" title="Credits"> <a id="idp78658688"></a> <h2>Credits</h2> <p>Written by Victor Lazzarini</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="GENexp.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="GENfarey.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">GENexp </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> GENfarey</td> </tr> </table> </div> </body> </html>