<?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>polyaft</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="pol2rect.html" title="pol2rect" /> <link rel="next" href="polynomial.html" title="polynomial" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">polyaft</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="pol2rect.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="polynomial.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry"> <a id="polyaft"></a> <div class="titlepage"></div> <a id="IndexPolyaft" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">polyaft</span> </h2> <p>polyaft — Returns the polyphonic after-touch pressure of the selected note number. </p> </div> <div class="refsect1"> <a id="idm281472902870344"></a> <h2>Description</h2> <p> <span class="emphasis"><em>polyaft</em></span> returns the polyphonic pressure of the selected note number, optionally mapped to an user-specified range. </p> </div> <div class="refsect1"> <a id="idm281472902868472"></a> <h2>Syntax</h2> <pre class="synopsis">ires <span class="command"><strong>polyaft</strong></span> inote [, ilow] [, ihigh]</pre> <pre class="synopsis">kres <span class="command"><strong>polyaft</strong></span> inote [, ilow] [, ihigh]</pre> </div> <div class="refsect1"> <a id="idm281472902864808"></a> <h2>Initialization</h2> <p> <span class="emphasis"><em>inote</em></span> -- note number. Normally set to the value returned by <a class="link" href="notnum.html" title="notnum"><em class="citetitle">notnum</em></a> </p> <p> <span class="emphasis"><em>ilow</em></span> (optional, default: 0) -- lowest output value </p> <p> <span class="emphasis"><em>ihigh</em></span> (optional, default: 127) -- highest output value </p> </div> <div class="refsect1"> <a id="idm281472902860280"></a> <h2>Performance</h2> <p> <span class="emphasis"><em>kres</em></span> -- polyphonic pressure (aftertouch). </p> </div> <div class="refsect1"> <a id="idm281472902858552"></a> <h2>Examples</h2> <p> Here is an example of the polyaft opcode. It uses the file <a class="ulink" href="examples/polyaft.csd" target="_top"><em class="citetitle">polyaft.csd</em></a>. </p> <p> Don't forget that you must include the <a class="link" href="CommandFlags.html#FlagsMinusUpperF"><em class="citetitle">-F flag</em></a> when using an external MIDI file like <span class="quote">“<span class="quote">polyaft.mid</span>”</span>. </p> <p> </p> <div class="example"> <a id="idm281472902854456"></a> <p class="title"> <strong>Example 704. Example of the polyaft 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="idm281472723972824"></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 No messages MIDI in</span> -odac -iadc -d -M0 <span class="c1">;;;RT audio I/O with MIDI in</span> <span class="c1">; For Non-realtime ouput leave only the line below:</span> <span class="c1">; -o polyaft.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">10</span> <span class="vg">nchnls</span> <span class="o">=</span> <span class="mi">1</span> <span class="nb">massign</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span> i<span class="n">tmp</span> <span class="nb">ftgen</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1024</span><span class="p">,</span> <span class="mi">10</span><span class="p">,</span> <span class="mi">1</span> <span class="c1">; sine wave</span> <span class="kd">instr</span> <span class="nf">1</span> k<span class="n">cps</span> <span class="nb">cpsmidib</span> <span class="mi">2</span> <span class="c1">; note frequency</span> i<span class="n">note</span> <span class="nb">notnum</span> <span class="c1">; note number</span> k<span class="n">aft</span> <span class="nb">polyaft</span> i<span class="n">note</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">127</span> <span class="c1">; aftertouch</span> <span class="c1">; interpolate aftertouch to eliminate clicks</span> k<span class="n">tmp</span> <span class="nb">phasor</span> <span class="mi">40</span> k<span class="n">tmp</span> <span class="nb">trigger</span> <span class="mi">1</span> <span class="o">-</span> k<span class="n">tmp</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">,</span> <span class="mi">0</span> k<span class="n">aft</span> <span class="nb">tlineto</span> k<span class="n">aft</span><span class="p">,</span> <span class="mf">0.025</span><span class="p">,</span> k<span class="n">tmp</span> <span class="c1">; map to sine curve for crossfade</span> k<span class="n">aft</span> <span class="o">=</span> <span class="nb">sin</span><span class="p">(</span>k<span class="n">aft</span> <span class="o">*</span> <span class="mf">3.14159</span> <span class="o">/</span> <span class="mi">254</span><span class="p">)</span> <span class="o">*</span> <span class="mi">22000</span> a<span class="n">snd</span> <span class="nb">oscili</span> k<span class="n">aft</span><span class="p">,</span> k<span class="n">cps</span><span class="p">,</span> <span class="mi">1</span> <span class="nb">out</span> a<span class="n">snd</span> <span class="kd">endin</span> <span class="nt"></CsInstruments></span> <span class="nt"><CsScore></span> <span class="nb">t</span> <span class="mi">0</span> <span class="mi">120</span> <span class="nb">f</span> <span class="mi">0</span> <span class="mi">9</span> <span class="mi">2</span> <span class="o">-</span><span class="mi">2</span> <span class="mi">0</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="idm281472902850232"></a> <h2>Credits</h2> <p>Added thanks to an email from Istvan Varga</p> <p>New in version 4.12</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="pol2rect.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="polynomial.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">pol2rect </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> polynomial</td> </tr> </table> </div> </body> </html>