<?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>lphasor</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="OpcodesTop.html" title="Orchestra Opcodes and Operators" /> <link rel="prev" href="lpfreson.html" title="lpfreson" /> <link rel="next" href="lpinterp.html" title="lpinterp" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">lphasor</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="lpfreson.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="lpinterp.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry"> <a id="lphasor"></a> <div class="titlepage"></div> <a id="IndexLphasor" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">lphasor</span> </h2> <p>lphasor — Generates a table index for sample playback </p> </div> <div class="refsect1"> <a id="idm281472917795032"></a> <h2>Description</h2> <p> This opcode can be used to generate table index for sample playback (e.g. <a class="link" href="tablexkt.html" title="tablexkt">tablexkt</a>). </p> </div> <div class="refsect1"> <a id="idm281472917753000"></a> <h2>Syntax</h2> <pre class="synopsis">ares <span class="command"><strong>lphasor</strong></span> xtrns [, ilps] [, ilpe] [, imode] [, istrt] [, istor]</pre> </div> <div class="refsect1"> <a id="idm281472917750792"></a> <h2>Initialization</h2> <p> <span class="emphasis"><em>ilps</em></span> -- loop start. </p> <p> <span class="emphasis"><em>ilpe</em></span> -- loop end (must be greater than <span class="emphasis"><em>ilps</em></span> to enable looping). The default value of <span class="emphasis"><em>ilps</em></span> and <span class="emphasis"><em>ilpe</em></span> is zero. </p> <p> <span class="emphasis"><em>imode</em></span> (optional: default = 0) -- loop mode. Allowed values are: </p> <div class="itemizedlist"> <ul class="itemizedlist" style="list-style-type: disc; "> <li class="listitem"> <p><span class="emphasis"><em>0:</em></span> no loop</p> </li> <li class="listitem"> <p><span class="emphasis"><em>1:</em></span> forward loop</p> </li> <li class="listitem"> <p><span class="emphasis"><em>2:</em></span> backward loop</p> </li> <li class="listitem"> <p><span class="emphasis"><em>3:</em></span> forward-backward loop</p> </li> </ul> </div> <p> </p> <p> <span class="emphasis"><em>istrt</em></span> (optional: default = 0) -- The initial output value (phase). It must be less than <span class="emphasis"><em>ilpe</em></span> if looping is enabled, but is allowed to be greater than <span class="emphasis"><em>ilps</em></span> (i.e. you can start playback in the middle of the loop). </p> <p> <span class="emphasis"><em>istor</em></span> (optional: default = 0) -- skip initialization if set to any non-zero value. </p> </div> <div class="refsect1"> <a id="idm281472917738136"></a> <h2>Performance</h2> <p> <span class="emphasis"><em>ares</em></span> -- a raw table index in samples (same unit for loop points). Can be used as index with the table opcodes. </p> <p> <span class="emphasis"><em>xtrns</em></span> -- transpose factor, expressed as a playback ratio. <span class="emphasis"><em>ares</em></span> is incremented by this value, and wraps around loop points. For example, 1.5 means a fifth above, 0.75 means fourth below. It is not allowed to be negative. </p> </div> <div class="refsect1"> <a id="idm281472917734648"></a> <h2>Examples</h2> <p> Here is an example of the lphasor opcode. It uses the file <a class="ulink" href="examples/lphasor.csd" target="_top"><em class="citetitle">lphasor.csd</em></a>. </p> <div class="example"> <a id="idm281472917732792"></a> <p class="title"> <strong>Example 499. Example of the lphasor 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> <div class="refsect1"> <a id="idm281472743728936"></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> <span class="c1">; Audio out Audio in</span> -odac -iadc <span class="c1">;;;RT audio I/O</span> <span class="c1">; For Non-realtime ouput leave only the line below:</span> <span class="c1">; -o lphashor.wav -W ;;; for file output any platform</span> <span class="nt"></CsOptions></span> <span class="nt"><CsInstruments></span> <span class="c1">; Example by Jonathan Murphy Dec 2006</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">10</span> <span class="vg">nchnls</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="mi">1</span> <span class="c1">; table number</span> i<span class="n">len</span> <span class="o">=</span> <span class="nb">nsamp</span><span class="p">(</span>i<span class="n">fn</span><span class="p">)</span> <span class="c1">; return actual number of samples in table</span> i<span class="n">trns</span> <span class="o">=</span> <span class="mi">1</span> <span class="c1">; no transposition</span> i<span class="n">lps</span> <span class="o">=</span> <span class="mi">0</span> <span class="c1">; loop starts at index 0</span> i<span class="n">lpe</span> <span class="o">=</span> i<span class="n">len</span> <span class="c1">; ends at value returned by nsamp above</span> i<span class="n">mode</span> <span class="o">=</span> <span class="mi">3</span> <span class="c1">; loop forwards & backwards</span> i<span class="n">strt</span> <span class="o">=</span> <span class="mi">10000</span> <span class="c1">; commence playback at index 10000 samples</span> <span class="c1">; lphasor provides index into f1 </span> a<span class="n">lphs</span> <span class="nb">lphasor</span> i<span class="n">trns</span><span class="p">,</span> i<span class="n">lps</span><span class="p">,</span> i<span class="n">lpe</span><span class="p">,</span> i<span class="n">mode</span><span class="p">,</span> i<span class="n">strt</span> a<span class="n">tab</span> <span class="nb">tablei</span> a<span class="n">lphs</span><span class="p">,</span> i<span class="n">fn</span> <span class="c1">; amplify signal</span> a<span class="n">tab</span> <span class="o">=</span> a<span class="n">tab</span> <span class="o">*</span> <span class="mi">10000</span> <span class="nb">out</span> a<span class="n">tab</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">262144</span> <span class="mi">1</span> <span class="s">"beats.wav"</span> <span class="mi">0</span> <span class="mi">4</span> <span class="mi">1</span> <span class="nb">i</span><span class="mi">1</span> <span class="mi">0</span> <span class="mi">60</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="idm281472917728472"></a> <h2>Credits</h2> <p> </p> <table border="0" summary="Simple list" class="simplelist"> <tr> <td>Author: Istvan Varga</td> </tr> <tr> <td>January 2002</td> </tr> <tr> <td>Example by: Jonathan Murphy</td> </tr> </table> <p> </p> <p>New in version 4.18</p> <p>Updated April 2002 and November 2002 by 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="lpfreson.html">Prev</a> </td> <td width="20%" align="center"> <a accesskey="u" href="OpcodesTop.html">Up</a> </td> <td width="40%" align="right"> <a accesskey="n" href="lpinterp.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">lpfreson </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> lpinterp</td> </tr> </table> </div> </body> </html>