Release 4.1.2 tarball

This commit is contained in:
Gary Scavone
2013-09-29 23:37:27 +02:00
committed by Stephen Sinclair
parent d12ef806ac
commit 5d63b50e85
436 changed files with 17966 additions and 14506 deletions

View File

@@ -5,37 +5,35 @@
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<CENTER>
<img src="princeton.gif"> &nbsp; <img src="ccrma.gif"><P>
<img src="princeton.gif"> &nbsp; <img src="ccrma.gif"> &nbsp; <img src="mcgill.gif"><P>
<a class="qindex" href="index.html">Home</a> &nbsp; <a class="qindex" href="information.html">Information</a> &nbsp; <a class="qindex" href="classes.html">Classes</a> &nbsp; <a class="qindex" href="download.html">Download</a> &nbsp; <a class="qindex" href="usage.html">Usage</a> &nbsp; <a class="qindex" href="maillist.html">Mail List</a> &nbsp; <a class="qindex" href="system.html">Requirements</a> &nbsp; <a class="qindex" href="links.html">Links</a> &nbsp; <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
<HR>
<!-- Generated by Doxygen 1.2.8.1 -->
<a name="instruments"><h2>Instruments</h2></a>
The ToolKit comes with a wide variety of synthesis algorithms, all of which inherit from the <a class="el" href="classInstrmnt.html">Instrmnt</a> class. In this example, we'll fire up an instance of the <a class="el" href="classBeeThree.html">BeeThree</a> <a class="el" href="classFM.html">FM</a> synthesis class and show how it's frequency can be modified over time.
<p>
<div class="fragment"><pre><font class="comment">// bethree.cpp</font>
<!-- Generated by Doxygen 1.3.6 -->
<h1><a class="anchor" name="instruments">Instruments</a></h1>The ToolKit comes with a wide variety of synthesis algorithms, all of which inherit from the <a class="el" href="classInstrmnt.html">Instrmnt</a> class. In this example, we'll fire up an instance of the <a class="el" href="classBeeThree.html">BeeThree</a> <a class="el" href="classFM.html">FM</a> synthesis class and show how it's frequency can be modified over time.<p>
<pre class="fragment"><div><span class="comment">// bethree.cpp</span>
<font class="preprocessor">#include "BeeThree.h"</font>
<font class="preprocessor">#include "RtWvOut.h"</font>
<span class="preprocessor">#include "BeeThree.h"</span>
<span class="preprocessor">#include "RtWvOut.h"</span>
<font class="keywordtype">int</font> main()<font class="keyword"></font>
<font class="keyword"></font>{
<font class="comment">// Set the global sample rate before creating class instances.</font>
<a class="code" href="classStk.html#d1">Stk::setSampleRate</a>( 44100.0 );
<span class="keywordtype">int</span> main()
{
<span class="comment">// Set the global sample rate before creating class instances.</span>
<a class="code" href="classStk.html#e1">Stk::setSampleRate</a>( 44100.0 );
<a class="code" href="classInstrmnt.html">Instrmnt</a> *instrument = 0;
<a class="code" href="classRtWvOut.html">RtWvOut</a> *output = 0;
MY_FLOAT frequency, amplitude, scaler;
<font class="keywordtype">long</font> counter, i;
<span class="keywordtype">long</span> counter, i;
<font class="keywordflow">try</font> {
<font class="comment">// Define and load the BeeThree instrument</font>
instrument = <font class="keyword">new</font> BeeThree();
<span class="keywordflow">try</span> {
<span class="comment">// Define and load the BeeThree instrument</span>
instrument = <span class="keyword">new</span> <a class="code" href="classBeeThree.html">BeeThree</a>();
<font class="comment">// Define and open the default realtime output device for one-channel playback</font>
output = <font class="keyword">new</font> RtWvOut(1);
<span class="comment">// Define and open the default realtime output device for one-channel playback</span>
output = <span class="keyword">new</span> <a class="code" href="classRtWvOut.html">RtWvOut</a>(1);
}
<font class="keywordflow">catch</font> (<a class="code" href="classStkError.html">StkError</a> &amp;) {
<font class="keywordflow">goto</font> cleanup;
<span class="keywordflow">catch</span> (<a class="code" href="classStkError.html">StkError</a> &amp;) {
<span class="keywordflow">goto</span> cleanup;
}
scaler = 1.0;
@@ -43,15 +41,15 @@
amplitude = 0.5;
instrument-&gt;<a class="code" href="classInstrmnt.html#a2">noteOn</a>( frequency, amplitude );
<font class="comment">// Play the instrument for 80000 samples, changing the frequency every 2000 samples</font>
<span class="comment">// Play the instrument for 80000 samples, changing the frequency every 2000 samples</span>
counter = 0;
<font class="keywordflow">while</font> ( counter &lt; 80000 ) {
<font class="keywordflow">for</font> ( i=0; i&lt;2000; i++ ) {
<font class="keywordflow">try</font> {
output-&gt;<a class="code" href="classRtWvOut.html#a6">tick</a>( instrument-&gt;<a class="code" href="classInstrmnt.html#a6">tick</a>() );
<span class="keywordflow">while</span> ( counter &lt; 80000 ) {
<span class="keywordflow">for</span> ( i=0; i&lt;2000; i++ ) {
<span class="keywordflow">try</span> {
output-&gt;<a class="code" href="classRtWvOut.html#a6">tick</a>( instrument-&gt;<a class="code" href="classInstrmnt.html#a8">tick</a>() );
}
<font class="keywordflow">catch</font> (<a class="code" href="classStkError.html">StkError</a> &amp;) {
<font class="keywordflow">goto</font> cleanup;
<span class="keywordflow">catch</span> (<a class="code" href="classStkError.html">StkError</a> &amp;) {
<span class="keywordflow">goto</span> cleanup;
}
}
@@ -60,29 +58,24 @@
instrument-&gt;<a class="code" href="classInstrmnt.html#a4">setFrequency</a>( frequency * scaler );
}
<font class="comment">// Turn the instrument off with maximum decay envelope.</font>
<span class="comment">// Turn the instrument off with maximum decay envelope.</span>
instrument-&gt;<a class="code" href="classInstrmnt.html#a3">noteOff</a>( 1.0 );
cleanup:
<font class="keyword">delete</font> instrument;
<font class="keyword">delete</font> output;
<span class="keyword">delete</span> instrument;
<span class="keyword">delete</span> output;
<font class="keywordflow">return</font> 0;
}</pre></div>
<p>
We have used an <a class="el" href="classInstrmnt.html">Instrmnt</a> pointer when referencing the <a class="el" href="classBeeThree.html">BeeThree</a> instance above, so it would be simple to replace the <a class="el" href="classBeeThree.html">BeeThree</a> class with any other STK instrument class. It should be noted, however, that a few classes do not respond to the setFrequency() function (e.g., <a class="el" href="classShakers.html">Shakers</a>, <a class="el" href="classDrummer.html">Drummer</a>).
<p>
The noteOn() function initiates an instrument attack. Instruments which are continuously excited (e.g., <a class="el" href="classClarinet.html">Clarinet</a>, <a class="el" href="classBeeThree.html">BeeThree</a>) will continue to sound until stopped with a noteOff(). Impulsively excited instrument sounds (e.g., <a class="el" href="classPlucked.html">Plucked</a>, <a class="el" href="classWurley.html">Wurley</a>) typically decay within a few seconds time, requiring subsequent noteOn() messages for re-attack.
<p>
Instrument parameters can be precisely controlled as demonstrated above. A more flexible approach to instrument control, allowing arbitrary scorefile or realtime updates, is described in the next tutorial chapter.
<p>
[<a href="controlin.html">Next tutorial</a>] &nbsp; [<a href="tutorial.html">Main tutorial page</a>]
<p>
<HR>
<span class="keywordflow">return</span> 0;
}
</div></pre><p>
We have used an <a class="el" href="classInstrmnt.html">Instrmnt</a> pointer when referencing the <a class="el" href="classBeeThree.html">BeeThree</a> instance above, so it would be simple to replace the <a class="el" href="classBeeThree.html">BeeThree</a> class with any other STK instrument class. It should be noted, however, that a few classes do not respond to the setFrequency() function (e.g., <a class="el" href="classShakers.html">Shakers</a>, <a class="el" href="classDrummer.html">Drummer</a>).<p>
The noteOn() function initiates an instrument attack. Instruments which are continuously excited (e.g., <a class="el" href="classClarinet.html">Clarinet</a>, <a class="el" href="classBeeThree.html">BeeThree</a>) will continue to sound until stopped with a noteOff(). Impulsively excited instrument sounds (e.g., <a class="el" href="classPlucked.html">Plucked</a>, <a class="el" href="classWurley.html">Wurley</a>) typically decay within a few seconds time, requiring subsequent noteOn() messages for re-attack.<p>
Instrument parameters can be precisely controlled as demonstrated above. A more flexible approach to instrument control, allowing arbitrary scorefile or realtime updates, is described in the next tutorial chapter.<p>
[<a href="controlin.html">Next tutorial</a>] &nbsp; [<a href="tutorial.html">Main tutorial page</a>] <HR>
<table>
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
<tr><td>&copy;1995-2002 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
<tr><td>&copy;1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
</table>
</BODY>