mirror of
https://github.com/thestk/stk
synced 2026-01-19 07:31:52 +00:00
Release 4.2.1 tarball
This commit is contained in:
committed by
Stephen Sinclair
parent
11cf5faa0a
commit
21b93795e7
@@ -8,9 +8,9 @@
|
||||
<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="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<!-- Generated by Doxygen 1.4.4 -->
|
||||
<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 its frequency can be modified over time.<p>
|
||||
<div class="fragment"><pre><span class="comment">// bethree.cpp STK tutorial program</span>
|
||||
<div class="fragment"><pre class="fragment"><span class="comment">// bethree.cpp STK tutorial program</span>
|
||||
|
||||
<span class="preprocessor">#include "BeeThree.h"</span>
|
||||
<span class="preprocessor">#include "RtAudio.h"</span>
|
||||
@@ -58,16 +58,16 @@
|
||||
<a class="code" href="classStk.html#e3">Stk::setRawwavePath</a>( <span class="stringliteral">"../../rawwaves/"</span> );
|
||||
|
||||
TickData data;
|
||||
RtAudio *dac = 0;
|
||||
<a class="code" href="classRtAudio.html">RtAudio</a> *dac = 0;
|
||||
|
||||
<span class="comment">// Figure out how many bytes in an StkFloat and setup the RtAudio object.</span>
|
||||
RtAudioFormat format = ( <span class="keyword">sizeof</span>(StkFloat) == 8 ) ? RTAUDIO_FLOAT64 : RTAUDIO_FLOAT32;
|
||||
<span class="keywordtype">int</span> bufferSize = RT_BUFFER_SIZE;
|
||||
<span class="keywordflow">try</span> {
|
||||
dac = <span class="keyword">new</span> RtAudio(0, 1, 0, 0, format, (<span class="keywordtype">int</span>)Stk::sampleRate(), &bufferSize, 4);
|
||||
dac = <span class="keyword">new</span> <a class="code" href="classRtAudio.html">RtAudio</a>(0, 1, 0, 0, format, (<span class="keywordtype">int</span>)<a class="code" href="classStk.html#e0">Stk::sampleRate</a>(), &bufferSize, 4);
|
||||
}
|
||||
<span class="keywordflow">catch</span> (<a class="code" href="classRtError.html">RtError</a>& error) {
|
||||
error.printMessage();
|
||||
error.<a class="code" href="classRtError.html#a2">printMessage</a>();
|
||||
<span class="keywordflow">goto</span> cleanup;
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
dac-><a class="code" href="classRtAudio.html#a13">startStream</a>();
|
||||
}
|
||||
<span class="keywordflow">catch</span> (<a class="code" href="classRtError.html">RtError</a> &error) {
|
||||
error.printMessage();
|
||||
error.<a class="code" href="classRtError.html#a2">printMessage</a>();
|
||||
<span class="keywordflow">goto</span> cleanup;
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
dac-><a class="code" href="classRtAudio.html#a12">closeStream</a>();
|
||||
}
|
||||
<span class="keywordflow">catch</span> (<a class="code" href="classRtError.html">RtError</a> &error) {
|
||||
error.printMessage();
|
||||
error.<a class="code" href="classRtError.html#a2">printMessage</a>();
|
||||
}
|
||||
|
||||
cleanup:
|
||||
@@ -112,13 +112,13 @@
|
||||
}
|
||||
</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>
|
||||
The noteOn() function initiates an instrument attack. Instruments that 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>] [<a href="tutorial.html">Main tutorial page</a>] <HR>
|
||||
[<a href="tutorial.html">Main tutorial page</a>] [<a href="controlin.html">Next tutorial</a>] <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-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td>©1995-2005 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
Reference in New Issue
Block a user