mirror of
https://github.com/thestk/stk
synced 2026-01-14 13:31:53 +00:00
266 lines
20 KiB
HTML
266 lines
20 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
|
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#FFFFFF">
|
|
<CENTER>
|
|
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
|
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
|
<HR>
|
|
<!-- Generated by Doxygen 1.6.2 -->
|
|
<div class="navpath"><a class="el" href="namespacestk.html">stk</a>::<a class="el" href="classstk_1_1FormSwep.html">FormSwep</a>
|
|
</div>
|
|
<div class="contents">
|
|
<h1>stk::FormSwep Class Reference</h1><!-- doxytag: class="stk::FormSwep" --><!-- doxytag: inherits="stk::Filter" -->
|
|
<p>STK sweepable formant filter class.
|
|
<a href="#_details">More...</a></p>
|
|
|
|
<p><code>#include <<a class="el" href="FormSwep_8h_source.html">FormSwep.h</a>></code></p>
|
|
<div class="dynheader">
|
|
Inheritance diagram for stk::FormSwep:</div>
|
|
<div class="dynsection">
|
|
<div class="center">
|
|
<img src="classstk_1_1FormSwep.png" usemap="#stk::FormSwep_map" alt=""/>
|
|
<map id="stk::FormSwep_map" name="stk::FormSwep_map">
|
|
<area href="classstk_1_1Filter.html" alt="stk::Filter" shape="rect" coords="0,56,93,80"/>
|
|
<area href="classstk_1_1Stk.html" alt="stk::Stk" shape="rect" coords="0,0,93,24"/>
|
|
</map>
|
|
</div>
|
|
</div>
|
|
|
|
<p><a href="classstk_1_1FormSwep-members.html">List of all members.</a></p>
|
|
<table border="0" cellpadding="0" cellspacing="0">
|
|
<tr><td colspan="2"><h2>Public Member Functions</h2></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aeb0093d5962acf4b5d582730e8c8bab9"></a><!-- doxytag: member="stk::FormSwep::FormSwep" ref="aeb0093d5962acf4b5d582730e8c8bab9" args="(void)" -->
|
|
</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FormSwep.html#aeb0093d5962acf4b5d582730e8c8bab9">FormSwep</a> (void)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Default constructor creates a second-order pass-through filter. <br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac02cd2882f67e8ed9c315dfbf10b05a9"></a><!-- doxytag: member="stk::FormSwep::~FormSwep" ref="ac02cd2882f67e8ed9c315dfbf10b05a9" args="()" -->
|
|
</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FormSwep.html#ac02cd2882f67e8ed9c315dfbf10b05a9">~FormSwep</a> ()</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Class destructor. <br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a91096ebd684df25fc36a759f642b2200"></a><!-- doxytag: member="stk::FormSwep::ignoreSampleRateChange" ref="a91096ebd684df25fc36a759f642b2200" args="(bool ignore=true)" -->
|
|
void </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FormSwep.html#a91096ebd684df25fc36a759f642b2200">ignoreSampleRateChange</a> (bool ignore=true)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">A function to enable/disable the automatic updating of class data when the STK sample rate changes. <br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FormSwep.html#aa6fe339cc937260c46e8c169a58d8529">setResonance</a> (StkFloat frequency, StkFloat radius)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Sets the filter coefficients for a resonance at <em>frequency</em> (in Hz). <a href="#aa6fe339cc937260c46e8c169a58d8529"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3aede7b088dbe2ca98b3398a5f953ae7"></a><!-- doxytag: member="stk::FormSwep::setStates" ref="a3aede7b088dbe2ca98b3398a5f953ae7" args="(StkFloat frequency, StkFloat radius, StkFloat gain=1.0)" -->
|
|
void </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FormSwep.html#a3aede7b088dbe2ca98b3398a5f953ae7">setStates</a> (StkFloat frequency, StkFloat radius, StkFloat gain=1.0)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Set both the current and target resonance parameters. <br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2f00d2edf80fbf8f74a284c68caf07d6"></a><!-- doxytag: member="stk::FormSwep::setTargets" ref="a2f00d2edf80fbf8f74a284c68caf07d6" args="(StkFloat frequency, StkFloat radius, StkFloat gain=1.0)" -->
|
|
void </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FormSwep.html#a2f00d2edf80fbf8f74a284c68caf07d6">setTargets</a> (StkFloat frequency, StkFloat radius, StkFloat gain=1.0)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Set target resonance parameters. <br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FormSwep.html#a27ba31acdbe8334da1830e14872fd226">setSweepRate</a> (StkFloat rate)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Set the sweep rate (between 0.0 - 1.0). <a href="#a27ba31acdbe8334da1830e14872fd226"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FormSwep.html#a242edcbe2a6f88393357b5a5ccec43e8">setSweepTime</a> (StkFloat time)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Set the sweep rate in terms of a time value in seconds. <a href="#a242edcbe2a6f88393357b5a5ccec43e8"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3d8405c24e8539b389daf86fccfe5d70"></a><!-- doxytag: member="stk::FormSwep::lastOut" ref="a3d8405c24e8539b389daf86fccfe5d70" args="(void) const " -->
|
|
StkFloat </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FormSwep.html#a3d8405c24e8539b389daf86fccfe5d70">lastOut</a> (void) const </td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Return the last computed output value. <br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aba0d15e1d102cb0fee0806e1bb05c774"></a><!-- doxytag: member="stk::FormSwep::tick" ref="aba0d15e1d102cb0fee0806e1bb05c774" args="(StkFloat input)" -->
|
|
StkFloat </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774">tick</a> (StkFloat input)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Input one sample to the filter and return a reference to one output. <br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FormSwep.html#a27f68dc2bb3fa41322ae49cf59cc9884">tick</a> (<a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> &frames, unsigned int channel=0)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Take a channel of the <a class="el" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> object as inputs to the filter and replace with corresponding outputs. <a href="#a27f68dc2bb3fa41322ae49cf59cc9884"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FormSwep.html#a8a16af2b4e169946cedb8fec2bb1417a">tick</a> (<a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> &iFrames, <a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> &oFrames, unsigned int iChannel=0, unsigned int oChannel=0)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Take a channel of the <code>iFrames</code> object as inputs to the filter and write outputs to the <code>oFrames</code> object. <a href="#a8a16af2b4e169946cedb8fec2bb1417a"></a><br/></td></tr>
|
|
</table>
|
|
<hr/><a name="_details"></a><h2>Detailed Description</h2>
|
|
<p>STK sweepable formant filter class. </p>
|
|
<p>This class implements a formant (resonance) which can be "swept" over time from one frequency setting to another. It provides methods for controlling the sweep rate and target frequency.</p>
|
|
<p>by Perry R. Cook and Gary P. Scavone, 1995-2011. </p>
|
|
<hr/><h2>Member Function Documentation</h2>
|
|
<a class="anchor" id="aa6fe339cc937260c46e8c169a58d8529"></a><!-- doxytag: member="stk::FormSwep::setResonance" ref="aa6fe339cc937260c46e8c169a58d8529" args="(StkFloat frequency, StkFloat radius)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void stk::FormSwep::setResonance </td>
|
|
<td>(</td>
|
|
<td class="paramtype">StkFloat </td>
|
|
<td class="paramname"> <em>frequency</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">StkFloat </td>
|
|
<td class="paramname"> <em>radius</em></td><td> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Sets the filter coefficients for a resonance at <em>frequency</em> (in Hz). </p>
|
|
<p>This method determines the filter coefficients corresponding to two complex-conjugate poles with the given <em>frequency</em> (in Hz) and <em>radius</em> from the z-plane origin. The filter zeros are placed at z = 1, z = -1, and the coefficients are then normalized to produce a constant unity gain (independent of the filter <em>gain</em> parameter). The resulting filter frequency response has a resonance at the given <em>frequency</em>. The closer the poles are to the unit-circle (<em>radius</em> close to one), the narrower the resulting resonance width. An unstable filter will result for <em>radius</em> >= 1.0. The <em>frequency</em> value should be between zero and half the sample rate. </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a27ba31acdbe8334da1830e14872fd226"></a><!-- doxytag: member="stk::FormSwep::setSweepRate" ref="a27ba31acdbe8334da1830e14872fd226" args="(StkFloat rate)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void stk::FormSwep::setSweepRate </td>
|
|
<td>(</td>
|
|
<td class="paramtype">StkFloat </td>
|
|
<td class="paramname"> <em>rate</em></td>
|
|
<td> ) </td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Set the sweep rate (between 0.0 - 1.0). </p>
|
|
<p>The formant parameters are varied in increments of the sweep rate between their current and target values. A sweep rate of 1.0 will produce an immediate change in resonance parameters from their current values to the target values. A sweep rate of 0.0 will produce no change in resonance parameters. </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a242edcbe2a6f88393357b5a5ccec43e8"></a><!-- doxytag: member="stk::FormSwep::setSweepTime" ref="a242edcbe2a6f88393357b5a5ccec43e8" args="(StkFloat time)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void stk::FormSwep::setSweepTime </td>
|
|
<td>(</td>
|
|
<td class="paramtype">StkFloat </td>
|
|
<td class="paramname"> <em>time</em></td>
|
|
<td> ) </td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Set the sweep rate in terms of a time value in seconds. </p>
|
|
<p>This method adjusts the sweep rate based on a given time for the formant parameters to reach their target values. </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a27f68dc2bb3fa41322ae49cf59cc9884"></a><!-- doxytag: member="stk::FormSwep::tick" ref="a27f68dc2bb3fa41322ae49cf59cc9884" args="(StkFrames &frames, unsigned int channel=0)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname"><a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> & stk::FormSwep::tick </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> & </td>
|
|
<td class="paramname"> <em>frames</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">unsigned int </td>
|
|
<td class="paramname"> <em>channel</em> = <code>0</code></td><td> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td><td><code> [inline, virtual]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Take a channel of the <a class="el" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> object as inputs to the filter and replace with corresponding outputs. </p>
|
|
<p>The <a class="el" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> argument reference is returned. The <code>channel</code> argument must be less than the number of channels in the <a class="el" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> argument (the first channel is specified by 0). However, range checking is only performed if _STK_DEBUG_ is defined during compilation, in which case an out-of-range value will trigger an <a class="el" href="classstk_1_1StkError.html" title="STK error handling class.">StkError</a> exception. </p>
|
|
|
|
<p>Implements <a class="el" href="classstk_1_1Filter.html#a3260a238824c4a748ac057b84b7d3f21">stk::Filter</a>.</p>
|
|
|
|
<p><div class="fragment"><pre class="fragment"><a name="l00154"></a>00154 {
|
|
<a name="l00155"></a>00155 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
|
<a name="l00156"></a>00156 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.channels() ) {
|
|
<a name="l00157"></a>00157 oStream_ << <span class="stringliteral">"FormSwep::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
|
<a name="l00158"></a>00158 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
|
<a name="l00159"></a>00159 }
|
|
<a name="l00160"></a>00160 <span class="preprocessor">#endif</span>
|
|
<a name="l00161"></a>00161 <span class="preprocessor"></span>
|
|
<a name="l00162"></a>00162 StkFloat *samples = &frames[channel];
|
|
<a name="l00163"></a>00163 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.channels();
|
|
<a name="l00164"></a>00164 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.frames(); i++, samples += hop )
|
|
<a name="l00165"></a>00165 *samples = <a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>( *samples );
|
|
<a name="l00166"></a>00166
|
|
<a name="l00167"></a>00167 <span class="keywordflow">return</span> frames;
|
|
<a name="l00168"></a>00168 }
|
|
</pre></div></p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a8a16af2b4e169946cedb8fec2bb1417a"></a><!-- doxytag: member="stk::FormSwep::tick" ref="a8a16af2b4e169946cedb8fec2bb1417a" args="(StkFrames &iFrames, StkFrames &oFrames, unsigned int iChannel=0, unsigned int oChannel=0)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname"><a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> & stk::FormSwep::tick </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> & </td>
|
|
<td class="paramname"> <em>iFrames</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype"><a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> & </td>
|
|
<td class="paramname"> <em>oFrames</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">unsigned int </td>
|
|
<td class="paramname"> <em>iChannel</em> = <code>0</code>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">unsigned int </td>
|
|
<td class="paramname"> <em>oChannel</em> = <code>0</code></td><td> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td><td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Take a channel of the <code>iFrames</code> object as inputs to the filter and write outputs to the <code>oFrames</code> object. </p>
|
|
<p>The <code>iFrames</code> object reference is returned. Each channel argument must be less than the number of channels in the corresponding <a class="el" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> argument (the first channel is specified by 0). However, range checking is only performed if _STK_DEBUG_ is defined during compilation, in which case an out-of-range value will trigger an <a class="el" href="classstk_1_1StkError.html" title="STK error handling class.">StkError</a> exception. </p>
|
|
|
|
<p><div class="fragment"><pre class="fragment"><a name="l00171"></a>00171 {
|
|
<a name="l00172"></a>00172 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
|
<a name="l00173"></a>00173 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.channels() || oChannel >= oFrames.channels() ) {
|
|
<a name="l00174"></a>00174 oStream_ << <span class="stringliteral">"FormSwep::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
|
<a name="l00175"></a>00175 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
|
<a name="l00176"></a>00176 }
|
|
<a name="l00177"></a>00177 <span class="preprocessor">#endif</span>
|
|
<a name="l00178"></a>00178 <span class="preprocessor"></span>
|
|
<a name="l00179"></a>00179 StkFloat *iSamples = &iFrames[iChannel];
|
|
<a name="l00180"></a>00180 StkFloat *oSamples = &oFrames[oChannel];
|
|
<a name="l00181"></a>00181 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.channels(), oHop = oFrames.channels();
|
|
<a name="l00182"></a>00182 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.frames(); i++, iSamples += iHop, oSamples += oHop )
|
|
<a name="l00183"></a>00183 *oSamples = <a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>( *iSamples );
|
|
<a name="l00184"></a>00184
|
|
<a name="l00185"></a>00185 <span class="keywordflow">return</span> iFrames;
|
|
<a name="l00186"></a>00186 }
|
|
</pre></div></p>
|
|
|
|
</div>
|
|
</div>
|
|
<hr/>The documentation for this class was generated from the following file:<ul>
|
|
<li><a class="el" href="FormSwep_8h_source.html">FormSwep.h</a></li>
|
|
</ul>
|
|
</div>
|
|
<HR>
|
|
|
|
<table>
|
|
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
|
<tr><td>©1995-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
|
</table>
|
|
|
|
</BODY>
|
|
</HTML>
|