Release 4.1.1 tarball

This commit is contained in:
Gary Scavone
2013-09-29 23:36:33 +02:00
committed by Stephen Sinclair
parent b39c0bb101
commit ffce5357c6
20 changed files with 2694 additions and 20 deletions

View File

@@ -129,7 +129,7 @@
00155 <font class="preprocessor"></font>
00156 <font class="preprocessor">#define ONE_OVER_128 (MY_FLOAT) 0.0078125</font>
00157 <font class="preprocessor"></font>
00158 <font class="preprocessor">#if defined(__WINDOWS_DS__)</font>
00158 <font class="preprocessor">#if defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__)</font>
00159 <font class="preprocessor"></font><font class="preprocessor"> #define __OS_WINDOWS__</font>
00160 <font class="preprocessor"></font><font class="preprocessor"> #define __STK_REALTIME__</font>
00161 <font class="preprocessor"></font><font class="preprocessor">#elif defined(__LINUX_OSS__) || defined(__LINUX_ALSA__)</font>

83
doc/html/compile.html Normal file
View File

@@ -0,0 +1,83 @@
<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"> &nbsp; <img src="ccrma.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="compile"><h2>Compiling</h2></a>
The Synthesis ToolKit can be used in a variety of ways, depending on your particular needs. Some people choose the classes they need for a particular project and copy those to their working directory. Others create <code>Makefiles</code> which compile project-specific class objects from common <code>src</code> and <code>include</code> directories. And still others like to compile and link to a common library of object files. STK was not designed with one particular style of use in mind.
<p>
<a name="rtvsnonrt"><h2>"Realtime" vs. "Non-Realtime"</h2></a>
<p>
Most of the Synthesis ToolKit classes are platform independent. That means that they should compile on any reasonably current C++ compiler. The functionality needed for realtime audio and MIDI input/output, as well as realtime control message acquistion, is inherently platform and operating-system (OS) <em>dependent</em>. STK classes which require specific platform/OS support include <a class="el" href="classRtAudio.html">RtAudio</a>, <a class="el" href="classRtWvOut.html">RtWvOut</a>, <a class="el" href="classRtWvIn.html">RtWvIn</a>, <a class="el" href="classRtDuplex.html">RtDuplex</a>, <a class="el" href="classRtMidi.html">RtMidi</a>, <a class="el" href="classTcpWvIn.html">TcpWvIn</a>, <a class="el" href="classTcpWvOut.html">TcpWvOut</a>, <a class="el" href="classSocket.html">Socket</a>, and <a class="el" href="classThread.html">Thread</a>. These classes currently can only be compiled on Linux, Irix, Macintosh OS X, and Windows systems using the <code>__LINUX_OSS__</code>, <code>__LINUX_ALSA__</code>, <code>__IRIX_AL__</code>, <code>__MACOSX_CORE__</code>, <code>__WINDOWS_DS__</code>, or <code>__WINDOWS_ASIO__</code> preprocessor definitions.
<p>
Without the "realtime" classes, it is still possible to read <a class="el" href="classSKINI.html">SKINI</a> scorefiles for control input and to read and write to/from a variety of audio file formats (WAV, SND, AIFF, MAT-file, and RAW). If compiling for a "little-endian" host processor, the <code>__LITTLE_ENDIAN__</code> preprocessor definition should be provided.
<p>
<a name="unix"><h2>Unix Systems:</h2></a>
<p>
STK compiles with realtime support on the following flavors of the Unix operating system: Linux, Irix, and Macintosh OS X. Aside from differences in compilers, audio/MIDI APIs, and host endianness, the steps necessary to compile STK programs and classes on these platforms are the same. The following table summarizes these differences.
<p>
<center>
<table border=1 cellspacing=3 cellpadding=3><tr><td><b>OS:</b> </td><td><b>Realtime Audio/MIDI API:</b> </td><td><b>Preprocessor Definition:</b> </td><td><b>Library or Framework:</b> </td></tr>
<tr><td>Linux </td><td>ALSA </td><td>__LINUX_ALSA__, __LITTLE_ENDIAN__ </td><td><code>asound, pthread</code> </td></tr>
<tr><td>Linux </td><td>OSS </td><td>__LINUX_OSS__, __LITTLE_ENDIAN__ </td><td><code>pthread</code> </td></tr>
<tr><td>Macintosh OS X </td><td>CoreAudio </td><td>__MACOSX_CORE__ </td><td><code>pthread, stdc++, CoreAudio, CoreMIDI, CoreFoundation</code> </td></tr>
<tr><td>Irix </td><td>AL </td><td>__IRIX_AL__ </td><td><code>audio, pthread</code> </td></table>
</center>
<p>
The available C++ compilers on any of these systems can vary.
<p>
One approach in using STK is to simply copy the class files needed for a particular program into a project directory. Taking the <code>sineosc.cpp</code> example from the previous tutorial chapter, it would be necessary to set up a directory that includes the files <code>sineosc.cpp</code>, the rawwave file <code>sinewave.raw</code> in a subdirectory called <code>rawwaves</code>, and the header and source files for the classes <a class="el" href="classStk.html">Stk</a>, <a class="el" href="classWvIn.html">WvIn</a>, <a class="el" href="classWaveLoop.html">WaveLoop</a>, and <a class="el" href="classWvOut.html">WvOut</a>. The program could then be compiled on a Linux system using the GNU g++ compiler as follows: <div class="fragment"><pre>g++ -Wall -D__LITTLE_ENDIAN__ -o sineosc <a class="code" href="classStk.html">Stk</a>.cpp <a class="code" href="classWvIn.html">WvIn</a>.cpp <a class="code" href="classWaveLoop.html">WaveLoop</a>.cpp <a class="code" href="classWvOut.html">WvOut</a>.cpp sineosc.cpp</pre></div>
<p>
Note that the <code>sineosc.cpp</code> example does not make use of realtime audio or MIDI input/output classes. For programs using any of the STK realtime classes mentioned above, it is necessary to specify an audio/MIDI API preprocessor definition and link with the appropriate libraries or frameworks.
<p>
When working with a number of different projects that make use of ToolKit classes, the above approach can become cumbersome (especially when trying to synchronize with new STK releases). The example STK projects (e.g., demo, effects, ...) contain <code>Makefiles</code> (built by the configure script) which compile project-specific class objects from the distribution <code>src</code> and <code>include</code> directories. This approach makes it relatively easy when upgrading to a new STK release (by making path substitutions in the <code>Makefile</code> or by moving the projects to a similar relative path within the new STK source tree). A <code>Makefile</code> of this sort is provided in the <code>projects/examples</code> directory for compiling all the tutorial programs, as well as other example programs. To compile the <code>sineosc.cpp</code> program, for example, one need only type <code>make sineosc</code> from within the <code>projects/examples</code> directory.
<p>
<a name="library"><h3>Library Use:</h3></a>
<p>
The STK distribution provides a <code>Makefile</code> that can be used on Unix systems to build a static library. After unpacking the distribution (<code>tar -xzf stk-4.x.tar.gz</code>), run the configure script by typing <code>./configure</code> from the top level distribution directory (see the INSTALL file in the same directory for more information). Then from within the <code>src</code> directory, type <code>make</code>. After a successful build, you may wish to move the library (<code>libstk.a</code>) and the contents of the <code>include</code> directory to standard library and include search paths on your system. For example, the linux RPM distribution of STK puts the library in <code>/usr/lib/</code> and the STK header files in <code>/usr/include/stk/</code>.
<p>
Assuming the library is located in a standard search path and the header files are located in <code>/usr/include/stk/</code>, the <code>sineosc.cpp</code> example from the previous tutorial chapter can be compiled on a Linux system using the GNU g++ compiler as follows:
<p>
<div class="fragment"><pre>g++ -Wall -D__LITTLE_ENDIAN__ -I/usr/include/stk -o sineosc sineosc.cpp -lstk</pre></div>
<p>
With the header files in a standard search path, it is possible to modify the <code>#include</code> statements in the <code>sineosc.cpp</code> program as follows:
<p>
<div class="fragment"><pre><font class="preprocessor">#include "stk/WaveLoop.h"</font>
<font class="preprocessor">#include "stk/WvOut.h"</font></pre></div>
<p>
and then compile without an explicit include path argument to the compiler:
<p>
<div class="fragment"><pre>g++ -Wall -D__LITTLE_ENDIAN__ -o sineosc sineosc.cpp -lstk</pre></div>
<p>
<a name="compileWin"><h2>Windows:</h2></a>
<p>
STK has been tested on Windows platforms using the Visual C++ compiler only. It is assumed here that you're familiar with Visual C++ and its particular idiosyncrasies.
<p>
The approach when using Visual C++ is to build a project which includes the necessary ToolKit files from the distribution <code>src</code> and <code>include</code> directories. For the example program from the previous tutorial chapter, create a VC++ console application project, add the <a class="el" href="classStk.html">Stk</a>, <a class="el" href="classWvIn.html">WvIn</a>, <a class="el" href="classWaveLoop.html">WaveLoop</a>, and <a class="el" href="classWvOut.html">WvOut</a> class files, as well as <code>sineosc.cpp</code>, and make sure the <code>sinewave.raw</code> file is in the subdirectory <code>rawwaves</code>.
<p>
For programs using any of the STK realtime classes mentioned above, it is necessary to link with the DirectSound (<code>dsound.lib</code>), <code>winmm.lib</code>, and <code>Wsock32.lib</code> libraries, select the multithreaded library, and provide the <code>__LITTLE_ENDIAN__</code> and <code>__WINDOWS_DS__</code> preprocessor definitions.
<p>
For Steinberg ASIO support, use the <code>__WINDOWS_ASIO__</code> preprocessor definition, include all the files in the <code>src/asio/</code> directory (i.e., <code>asio.h,cpp</code>, <code>asiodrivers.h,cpp</code>, ...), and link with the <code>winmm.lib</code>, and <code>Wsock32.lib</code> libraries.
<p>
[<a href="realtime.html">Next tutorial</a>] &nbsp; [<a href="tutorial.html">Main tutorial page</a>]
<p>
<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>
</table>
</BODY>
</HTML>

143
doc/html/controlin.html Normal file
View File

@@ -0,0 +1,143 @@
<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"> &nbsp; <img src="ccrma.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="controlin"><h2>Control Input</h2></a>
Each Synthesis ToolKit instrument exposes its relevant control parameters via public functions such as setFrequency() and controlChange(). Programmers are free to implement the control scheme of their choice in exposing those parameters to the user.
<p>
A text-based control protocol called <a href="skini.html">SKINI</a> is provided with the Synthesis ToolKit. <a class="el" href="classSKINI.html">SKINI</a> extends the MIDI protocol in incremental ways, providing a text-based messaging scheme in human-readable format and making use of floating-point numbers wherever possible. Each <a class="el" href="classSKINI.html">SKINI</a> message consists of a message type (e.g., NoteOn, PitchBend), a time specification (absolute or delta), a channel number (scanned as a long integer), and a maximum of two subsequent message-specific field values. Knowing this, it should be relatively clear what the following <a class="el" href="classSKINI.html">SKINI</a> "scorefile" specifies:
<p>
<div class="fragment"><pre>NoteOn 0.000082 2 55.0 82.3
NoteOff 1.000000 2 55.0 64.0
NoteOn 0.000082 2 69.0 82.8
StringDetune 0.100000 2 10.0
StringDetune 0.100000 2 30.0
StringDetune 0.100000 2 50.0
StringDetune 0.100000 2 40.0
StringDetune 0.100000 2 22.0
StringDetune 0.100000 2 12.0
NoteOff 1.000000 2 69.0 64.0</pre></div>
<p>
MIDI messages (with the exception of Sysex) are easily represented within the <a class="el" href="classSKINI.html">SKINI</a> protocol.
<p>
The class <a class="el" href="classMessager.html">Messager</a> can be used to acquire and parse MIDI messages from a MIDI device and <a class="el" href="classSKINI.html">SKINI</a> messages from STDIN and socket connections. Many of the example programs included with the ToolKit distribution use a <a class="el" href="classMessager.html">Messager</a> instance to accept control input from the accompanying tcl/tk graphical user interfaces, from external MIDI devices, or from <a class="el" href="classSKINI.html">SKINI</a> scorefiles.
<p>
In the following example, we'll modify the <code>bethree.cpp</code> program from the previous tutorial chapter and incorporate a <a class="el" href="classMessager.html">Messager</a> class to allow control via a <a class="el" href="classSKINI.html">SKINI</a> scorefile.
<p>
<div class="fragment"><pre><font class="comment">// controlbee.cpp</font>
<font class="preprocessor">#include "BeeThree.h"</font>
<font class="preprocessor">#include "RtWvOut.h"</font>
<font class="preprocessor">#include "Messager.h"</font>
<font class="preprocessor">#include "SKINI.msg"</font>
<font class="preprocessor">#include &lt;math.h&gt;</font>
<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 );
<a class="code" href="classInstrmnt.html">Instrmnt</a> *instrument = 0;
<a class="code" href="classRtWvOut.html">RtWvOut</a> *output = 0;
<a class="code" href="classMessager.html">Messager</a> *messager = 0;
<font class="keywordtype">bool</font> done = FALSE;
<font class="keywordflow">try</font> {
<font class="comment">// Define and load the BeeThree instrument</font>
instrument = <font class="keyword">new</font> BeeThree();
<font class="comment">// Define and open the default realtime output device for one-channel playback</font>
output = <font class="keyword">new</font> RtWvOut(1);
}
<font class="keywordflow">catch</font> (<a class="code" href="classStkError.html">StkError</a> &amp;) {
<font class="keywordflow">goto</font> cleanup;
}
<font class="keywordflow">try</font> {
<font class="comment">// Create a Messager instance to read from a redirected SKINI scorefile.</font>
messager = <font class="keyword">new</font> Messager();
}
<font class="keywordflow">catch</font> (<a class="code" href="classStkError.html">StkError</a> &amp;) {
<font class="keywordflow">goto</font> cleanup;
}
<font class="comment">// Play the instrument until the end of the scorefile.</font>
<font class="keywordtype">int</font> i, nTicks, type;
MY_FLOAT byte2, byte3, frequency;
<font class="keywordflow">while</font> (!done) {
<font class="comment">// Look for new messages and return a delta time (in samples).</font>
type = messager-&gt;<a class="code" href="classMessager.html#a2">nextMessage</a>();
<font class="keywordflow">if</font> (type &lt; 0)
done = TRUE;
nTicks = messager-&gt;<a class="code" href="classMessager.html#a4">getDelta</a>();
<font class="keywordflow">try</font> {
<font class="keywordflow">for</font> ( i=0; i&lt;nTicks; i++ )
output-&gt;<a class="code" href="classRtWvOut.html#a6">tick</a>( instrument-&gt;<a class="code" href="classInstrmnt.html#a6">tick</a>() );
}
<font class="keywordflow">catch</font> (<a class="code" href="classStkError.html">StkError</a> &amp;) {
<font class="keywordflow">goto</font> cleanup;
}
<font class="keywordflow">if</font> ( type &gt; 0 ) {
<font class="comment">// Process the new control message.</font>
byte2 = messager-&gt;<a class="code" href="classMessager.html#a6">getByteTwo</a>();
byte3 = messager-&gt;<a class="code" href="classMessager.html#a7">getByteThree</a>();
<font class="keywordflow">switch</font>(type) {
<font class="keywordflow">case</font> __SK_NoteOn_:
frequency = (MY_FLOAT) 220.0 * pow( 2.0, (byte2 - 57.0) / 12.0 );
instrument-&gt;<a class="code" href="classInstrmnt.html#a2">noteOn</a>( frequency, byte3 * ONE_OVER_128 );
<font class="keywordflow">break</font>;
<font class="keywordflow">case</font> __SK_NoteOff_:
instrument-&gt;<a class="code" href="classInstrmnt.html#a3">noteOff</a>( byte3 * ONE_OVER_128 );
<font class="keywordflow">break</font>;
<font class="keywordflow">case</font> __SK_ControlChange_:
instrument-&gt;<a class="code" href="classInstrmnt.html#a8">controlChange</a>( (<font class="keywordtype">int</font>) byte2, byte3 );
<font class="keywordflow">break</font>;
<font class="keywordflow">case</font> __SK_AfterTouch_:
instrument-&gt;<a class="code" href="classInstrmnt.html#a8">controlChange</a>( 128, byte2 );
<font class="keywordflow">break</font>;
}
}
}
cleanup:
<font class="keyword">delete</font> instrument;
<font class="keyword">delete</font> output;
<font class="keyword">delete</font> messager;
<font class="keywordflow">return</font> 0;
}</pre></div>
<p>
Assuming the program is compiled as <code>controlbee</code> and the <a class="el" href="classSKINI.html">SKINI</a> scorefile <a href="tutorial/bookert.ski"><code>bookert.ski</code></a> is in the <code>scores</code> directory, the scorefile could be redirected to the program as:
<p>
<div class="fragment"><pre>controlbee &lt; scores/bookert.ski</pre></div>
<p>
Only a few basic <a class="el" href="classSKINI.html">SKINI</a> message type case statements are included in this example. It is easy to extend the program to support a much more elaborate set of instrument control parameters.
<p>
This example could also be easily extended to accept "realtime" control input messages via STDIN, socket, or MIDI connections. The <a class="el" href="classMessager.html">Messager</a> class constructor takes an optional argument consisting of a bitmask of the following options: <code>STK_PIPE</code>, <code>STK_SOCKET</code>, and/or <code>STK_MIDI</code>.
<p>
[<a href="multichannel.html">Next tutorial</a>] &nbsp; [<a href="tutorial.html">Main tutorial page</a>]
<p>
<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>
</table>
</BODY>
</HTML>

View File

@@ -10,26 +10,27 @@
<HR>
<!-- Generated by Doxygen 1.2.8.1 -->
<a name="download"><h2>Download and Release Notes</h2></a>
<b>Version 4.1, 8 October 2002</b>
<p>
<a href="http://www-ccrma.stanford.edu/software/stk/release/stk-4.1.tar.gz">STK Version 4.1: Source distribution</a> (1.2 MB tar/gzipped)<br>
<a href="http://www-ccrma.stanford.edu/software/stk/release/stk-4.1.binaries.tar.gz">STK Version 4.1: Source distribution with precompiled windows binaries</a> (1.7 MB tar/gzipped)<br>
<a href="http://www-ccrma.stanford.edu/software/stk/release/stk-4.1-1.i386.rpm">STK Version 4.1: Linux RPM using ALSA API</a> (1.2 MB)<br>
<a href="http://www-ccrma.stanford.edu/software/stk/release/stkmanual.pdf">STK Manual (PDF)</a> (1.2 MB) Note: HTML version in /doc/html/ directory of distribution<br>
<b>Version 4.1.1, 24 October 2002</b>
<p>
<ul>
<li><a href="http://www-ccrma.stanford.edu/software/stk/release/stk-4.1.1.tar.gz">Source distribution</a> (1.2 MB tar/gzipped) <li><a href="http://www-ccrma.stanford.edu/software/stk/release/stk-4.1.1.binaries.tar.gz">Source with precompiled Windows binaries</a> (2.0 MB tar/gzipped) <li><a href="http://www-ccrma.stanford.edu/software/stk/release/stk-4.1.1-1.i386.rpm">Linux RPM</a> (1.2 MB) <b>Note: Library and Makefiles built for ALSA, though the rpm can be rebuilt to use OSS</b> <li><a href="http://www-ccrma.stanford.edu/software/stk/release/stkmanual.pdf">STK Manual (PDF)</a> (1.62 MB) <b>Note: HTML version already in /doc/html/ directory of distribution</b> </ul>
<p>
<a name="notes"><h2>Release Notes:</h2></a>
<p>
<a name="v4dot1dot3"><h3>Version 4.1.1</h3></a>
<p>
<ul>
<li>Bug fix in <a class="el" href="classRtAudio.html">RtAudio</a> for Macintosh OS X and Windows ASIO duplex operation. <li>Windows ASIO fix in Stk.h. <li>Documentation updates. <li>Expanded tutorial. <li>Fixed <a class="el" href="classRtDuplex.html">RtDuplex</a> omission in src Makefile. </ul>
<p>
<a name="v4dot1"><h3>Version 4.1</h3></a>
<p>
<ul>
<li>Macintosh OS X support added. <li>New <a class="el" href="classWhistle.html">Whistle</a> class. <li>Added <a class="el" href="classVoicer.html">Voicer</a>, <a class="el" href="classSingWave.html">SingWave</a>, and <a class="el" href="classVoicForm.html">VoicForm</a> classes. <li>Improvements/fixes to the banded waveguide instruments. <li>Demo program now uses <a class="el" href="classVoicer.html">Voicer</a>, allowing polyphony. <li>Demo tcl/tk scripts changed to use <a class="el" href="classSKINI.html">SKINI</a> PitchChange instead of PitchBend. <li>Demo program response to PitchBend modified to octave up/down. <li>Several <a class="el" href="classRtAudio.html">RtAudio</a> fixes and improvements (OS X and Windows ASIO support added). <li>Added nextOut() method to <a class="el" href="classDelay.html">Delay</a> classes. <li>Documentation fixes for <a class="el" href="classReverb.html">Reverb</a> classes. <li>RAWWAVE_PATH changed to include the "rawwave" directory. <li>"configure" support added for unix systems. <li>Multivoice flag (-n NUMBER) added as command line option to demo program. <li>Sample rate flag added as command line option to example programs. <li><a class="el" href="classSocket.html">Socket</a> port number added as command line option to example programs.
<p>
</ul>
<li>Macintosh OS X support added. <li>New <a class="el" href="classWhistle.html">Whistle</a> class. <li>Added <a class="el" href="classVoicer.html">Voicer</a>, <a class="el" href="classSingWave.html">SingWave</a>, and <a class="el" href="classVoicForm.html">VoicForm</a> classes. <li>Improvements/fixes to the banded waveguide instruments. <li>Demo program now uses <a class="el" href="classVoicer.html">Voicer</a>, allowing polyphony. <li>Demo tcl/tk scripts changed to use <a class="el" href="classSKINI.html">SKINI</a> PitchChange instead of PitchBend. <li>Demo program response to PitchBend modified to octave up/down. <li>Several <a class="el" href="classRtAudio.html">RtAudio</a> fixes and improvements (OS X and Windows ASIO support added). <li>Added nextOut() method to <a class="el" href="classDelay.html">Delay</a> classes. <li>Documentation fixes for <a class="el" href="classReverb.html">Reverb</a> classes. <li>RAWWAVE_PATH changed to include the "rawwave" directory. <li>"configure" support added for unix systems. <li>Multivoice flag (-n NUMBER) added as command line option to demo program. <li>Sample rate flag added as command line option to example programs. <li><a class="el" href="classSocket.html">Socket</a> port number added as command line option to example programs. </ul>
<p>
<a name="v4"><h3>Version 4.0</h3></a>

119
doc/html/hello.html Normal file
View File

@@ -0,0 +1,119 @@
<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"> &nbsp; <img src="ccrma.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="hello"><h2>Hello Sine!</h2></a>
We'll begin our introduction to the Synthesis ToolKit with a simple sine-wave oscillator program. STK does not provide a specific oscillator for sine waves. Instead, it provides a generic waveform oscillator class, <a class="el" href="classWaveLoop.html">WaveLoop</a>, which can load a variety of common file types. In this example, we load a sine "table" from an STK RAW file (defined as monophonic, 16-bit, big-endian data). We use the class <a class="el" href="classWvOut.html">WvOut</a> to write the result to a 16-bit, WAV formatted audio file.
<p>
<div class="fragment"><pre><font class="comment">// sineosc.cpp</font>
<font class="preprocessor">#include "WaveLoop.h"</font>
<font class="preprocessor">#include "WvOut.h"</font>
<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 );
<font class="comment">// Define and load the sine wave file</font>
<a class="code" href="classWaveLoop.html">WaveLoop</a> *input = <font class="keyword">new</font> WaveLoop( <font class="stringliteral">"rawwaves/sinewave.raw"</font>, TRUE );
input-&gt;<a class="code" href="classWaveLoop.html#a2">setFrequency</a>( 440.0 );
<font class="comment">// Define and open a 16-bit, one-channel WAV formatted output file</font>
output = <font class="keyword">new</font> WvOut( <font class="stringliteral">"hellosine.wav"</font>, 1, WvOut::WVOUT_WAV, Stk::STK_SINT16 );
<font class="comment">// Run the oscillator for 40000 samples, writing to the output file</font>
<font class="keywordtype">int</font> i;
<font class="keywordflow">for</font> ( i=0; i&lt;40000; i++ ) {
output-&gt;tick( input-&gt;<a class="code" href="classWvIn.html#a16">tick</a>() );
}
<font class="comment">// Clean up</font>
<font class="keyword">delete</font> input;
<font class="keyword">delete</font> output;
<font class="keywordflow">return</font> 0;
}</pre></div>
<p>
<a class="el" href="classWaveLoop.html">WaveLoop</a> is a subclass of <a class="el" href="classWvIn.html">WvIn</a>, which supports WAV, SND (AU), AIFF, MAT-file (Matlab), and RAW file formats with 8-, 16-, and 32-bit integer and 32- and 64-bit floating-point data types. <a class="el" href="classWvIn.html">WvIn</a> provides interpolating, read once ("oneshot") functionality, as well as methods for setting the read rate and read position.
<p>
The <a class="el" href="classWvIn.html">WvIn</a> and <a class="el" href="classWvOut.html">WvOut</a> classes are complementary, both supporting WAV, SND (AU), AIFF, MAT-file (Matlab), and RAW file formats with 8-, 16-, and 32-bit integer and 32- and 64-bit floating-point data types. However, <a class="el" href="classWvOut.html">WvOut</a> does not perform data interpolation.
<p>
Nearly all STK classes implement <code>tick()</code> functions which take and/or return sample values. Within the <code>tick()</code> function, the fundamental sample calculations are performed for a given class. Most STK classes consume/generate a single sample per operation and their <code>tick()</code> method takes/returns each sample "by value". In addition, every class implementing a <code>tick()</code> function also provides an overloaded <code>tick()</code> function taking pointer and size arguments which can be used for vectorized computations.
<p>
The <a class="el" href="classWvIn.html">WvIn</a> and <a class="el" href="classWvOut.html">WvOut</a> classes support multi-channel sample frames. To distinguish single-sample frame operations from multi-channel frame operations, these classes also implement <code>tickFrame()</code> functions. When a <code>tick()</code> method is called for multi-channel data, frame averages are returned or the input sample is distributed across all channels of a sample frame.
<p>
Nearly all STK classes inherit from the <a class="el" href="classStk.html">Stk</a> base class. <a class="el" href="classStk.html">Stk</a> provides a static sample rate which is queried by subclasses as needed. Because many classes use the current sample rate value during instantiation, it is important that the desired value be set at the beginning of a program. The default STK sample rate is 22050 Hz.
<p>
Another primary concept that is somewhat obscurred in this example concerns the data format in which sample values are passed and received. Audio and control signals throughout STK use a floating-point data type, the exact precision of which can be controlled via the <code>MY_FLOAT</code> #define statement in Stk.h. Thus, the ToolKit can use any normalization scheme desired. The base instruments and algorithms are implemented with a general audio sample dynamic maximum of +/-1.0, and the <a class="el" href="classWvIn.html">WvIn</a> and <a class="el" href="classWvOut.html">WvOut</a> classes and subclasses scale appropriately for DAC or soundfile input and output.
<p>
<a name="error"><h2>Error Handling</h2></a>
<p>
The ToolKit has some basic C++ error handling functionality built in. Classes which access files and/or hardware are most prone to runtime errors. To properly "catch" such errors, the above example should be rewritten as shown below.
<p>
<div class="fragment"><pre><font class="comment">// sineosc.cpp</font>
<font class="preprocessor">#include "WaveLoop.h"</font>
<font class="preprocessor">#include "WvOut.h"</font>
<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 );
<a class="code" href="classWaveLoop.html">WaveLoop</a> *input = 0;
<a class="code" href="classWvOut.html">WvOut</a> *output = 0;
<font class="keywordflow">try</font> {
<font class="comment">// Define and load the sine wave file</font>
input = <font class="keyword">new</font> WaveLoop( <font class="stringliteral">"rawwaves/sinewave.raw"</font>, TRUE );
<font class="comment">// Define and open a 16-bit, one-channel WAV formatted output file</font>
output = <font class="keyword">new</font> WvOut( <font class="stringliteral">"hellosine.wav"</font>, 1, WvOut::WVOUT_WAV, Stk::STK_SINT16 );
}
<font class="keywordflow">catch</font> ( <a class="code" href="classStkError.html">StkError</a> &amp; ) {
<font class="keywordflow">goto</font> cleanup;
}
input-&gt;<a class="code" href="classWaveLoop.html#a2">setFrequency</a>( 440.0 );
<font class="comment">// Run the oscillator for 40000 samples, writing to the output file</font>
<font class="keywordflow">for</font> ( <font class="keywordtype">int</font> i=0; i&lt;40000; i++ ) {
<font class="keywordflow">try</font> {
output-&gt;<a class="code" href="classWvOut.html#a7">tick</a>( input-&gt;<a class="code" href="classWvIn.html#a16">tick</a>() );
}
<font class="keywordflow">catch</font> ( <a class="code" href="classStkError.html">StkError</a> &amp; ) {
<font class="keywordflow">goto</font> cleanup;
}
}
cleanup:
<font class="keyword">delete</font> input;
<font class="keyword">delete</font> output;
<font class="keywordflow">return</font> 0;
}</pre></div>
<p>
In this particular case, we simply exit the program if an error occurs (an error message is automatically printed to stderr). A more refined program might attempt to recover from or fix a particular problem and, if successful, continue processing. See the <a href="classes.html#classes">Class Documentation</a> to determine which constructors and functions can throw an error.
<p>
[<a href="compile.html">Next tutorial</a>] &nbsp; [<a href="tutorial.html">Main tutorial page</a>]
<p>
<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>
</table>
</BODY>
</HTML>

View File

@@ -13,7 +13,7 @@
<p>
<p>
The <b>Synthesis ToolKit in C++ (STK)</b> is a set of audio signal processing and synthesis classes and algorithms written in C++. You can use these classes to create programs that make sounds with a variety of synthesis techniques. This is not a terribly novel concept, except that the Synthesis ToolKit is extremely portable (it's mostly platform-independent C and C++ code), and it's completely user-extensible (no libraries, no hidden drivers, and all source code is included). We like to think that this increases the chances that our programs will still work in another 5-10 years. In fact, the ToolKit has been working continuously for nearly 8 years now. STK currently runs with "realtime" support (audio and MIDI) on SGI (Irix), Linux, and Windows computer platforms. Generic, non-realtime support has been tested under NeXTStep, Sun, and other platforms and should work with any standard C++ compiler.
The <b>Synthesis ToolKit in C++ (STK)</b> is a set of open source audio signal processing and algorithmic synthesis classes written in C++. STK was designed to facilitate rapid development of music synthesis and audio processing software, with an emphasis on cross-platform functionality, realtime control, ease of use, and educational example code. The Synthesis ToolKit is extremely portable (it's mostly platform-independent C and C++ code), and it's completely user-extensible (all source included, no unusual libraries, and no hidden drivers). We like to think that this increases the chances that our programs will still work in another 5-10 years. In fact, the ToolKit has been working continuously for nearly 8 years now. STK currently runs with "realtime" support (audio and MIDI) on SGI (Irix), Linux, Macintosh OS X, and Windows computer platforms. Generic, non-realtime support has been tested under NeXTStep, Sun, and other platforms and should work with any standard C++ compiler.
<p>
<ul>
<li><a href="information.html#information">General Information</a><li><a href="classes.html#classes">Class Documentation</a><li><a href="download.html#download">Download and Release Notes</a><li><a href="usage.html#usage">Usage Documentation</a><li><a href="maillist.html#maillist">The Mail List</a><li><a href="system.html#system">System Requirements</a><li><a href="links.html#links">Miscellaneous Links</a><li><a href="tutorial.html#tutorial">Tutorial</a></ul>

View File

@@ -25,7 +25,7 @@
<h3>What is the <em>Synthesis ToolKit</em>?</h3>
<p>
The Synthesis ToolKit in C++ (STK) is a set of audio signal processing and synthesis classes and algorithms written in C++. You can use these classes to create programs that make sounds with a variety of synthesis techniques. This is not a terribly novel concept, except that the Synthesis ToolKit is extremely portable (it's mostly platform-independent C and C++ code), and it's completely user-extensible (no unusual libraries, no hidden drivers, and all source code is included). We like to think that this increases the chances that our programs will still work in another 5-10 years. In fact, the ToolKit has been working continuously for nearly 8 years now. STK currently runs with "realtime" support (audio and MIDI) on SGI (Irix), Linux, Macintosh OS X, and Windows computer platforms. Generic, non-realtime support has been tested under NeXTStep, Sun, and other platforms and should work with any standard C++ compiler.
The Synthesis ToolKit in C++ (STK) is a set of open source audio signal processing and algorithmic synthesis classes written in C++. STK was designed to facilitate rapid development of music synthesis and audio processing software, with an emphasis on cross-platform functionality, realtime control, ease of use, and educational example code. The Synthesis ToolKit is extremely portable (it's mostly platform-independent C and C++ code), and it's completely user-extensible (all source included, no unusual libraries, and no hidden drivers). We like to think that this increases the chances that our programs will still work in another 5-10 years. In fact, the ToolKit has been working continuously for nearly 8 years now. STK currently runs with "realtime" support (audio and MIDI) on SGI (Irix), Linux, Macintosh OS X, and Windows computer platforms. Generic, non-realtime support has been tested under NeXTStep, Sun, and other platforms and should work with any standard C++ compiler.
<p>
The Synthesis ToolKit is free for non-commercial use. The only parts of the Synthesis ToolKit that are platform-dependent concern real-time audio and MIDI input and output, and that is taken care of with a few special classes. The interface for MIDI input and the simple <a href="http://dev.scriptics.com">Tcl/Tk</a> graphical user interfaces (GUIs) provided is the same, so it's easy to experiment in real time using either the GUIs or MIDI. The Synthesis ToolKit can generate simultaneous SND (AU), WAV, AIFF, and MAT-file output soundfile formats (as well as realtime sound output), so you can view your results using one of a large variety of sound/signal analysis tools already available (e.g. <a href="http://www-ccrma.stanford.edu/software/snd/">Snd</a>, Cool Edit, Matlab).
<p>

77
doc/html/instrmnts.html Normal file
View File

@@ -0,0 +1,77 @@
<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"> &nbsp; <img src="ccrma.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="instrmnts"><h2>Using Instruments</h2></a>
The ToolKit comes with a wide variety of synthesis algorithms, all of which inherit from the Instrmnt class. In this example, we'll fire up an instance of the BeeThree FM synthesis class and show how it's frequency can be modified over time.
<p>
<div class="fragment"><pre><font class="comment">// beethree.cpp</font>
<font class="preprocessor">#include "BeeThree.h"</font>
<font class="preprocessor">#include "RtWvOut.h"</font>
<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>
Stk::setSampleRate( 44100.0 );
Instrmnt *instrument = 0;
RtWvOut *output = 0;
MY_FLOAT frequency, amplitude, scaler;
<font class="keywordflow">try</font> {
<font class="comment">// Define and load the sine wave file</font>
instrument = <font class="keyword">new</font> BeeThree();
<font class="comment">// Define and open the default realtime output device for one-channel playback</font>
output = <font class="keyword">new</font> RtWvOut(1);
}
<font class="keywordflow">catch</font> (StkError &amp;) {
<font class="keywordflow">goto</font> cleanup;
}
scaler = 1.0;
frequency = 220.0;
amplitude = 0.5;
instrument-&gt;noteOn( frequency, amplitude );
<font class="comment">// Play the instrument for 80000 samples, changing the frequency every 2000 samples</font>
<font class="keywordflow">for</font> (<font class="keywordtype">int</font> i=0; i&lt;80000; i++) {
<font class="keywordflow">try</font> {
output-&gt;tick( instrument-&gt;tick() );
}
<font class="keywordflow">catch</font> (StkError &amp;) {
<font class="keywordflow">goto</font> cleanup;
}
<font class="keywordflow">if</font> ( i % 2000 == 0 ) {
scaler += 0.025;
instrument-&gt;setFrequency( frequency * scaler );
}
}
cleanup:
<font class="keyword">delete</font> instrument;
<font class="keyword">delete</font> output;
<font class="keywordflow">return</font> 0;
}</pre></div>
<p>
By using an Instrmnt pointer above, it is possible to replace the BeeThree class with any other STK instrument class. It should be noted, however, that a few classes do not respond to the setFrequency() function (Shakers, Drummer).
<p>
<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>
</table>
</BODY>
</HTML>

89
doc/html/instruments.html Normal file
View File

@@ -0,0 +1,89 @@
<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"> &nbsp; <img src="ccrma.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>
<font class="preprocessor">#include "BeeThree.h"</font>
<font class="preprocessor">#include "RtWvOut.h"</font>
<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 );
<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;
<font class="keywordflow">try</font> {
<font class="comment">// Define and load the BeeThree instrument</font>
instrument = <font class="keyword">new</font> BeeThree();
<font class="comment">// Define and open the default realtime output device for one-channel playback</font>
output = <font class="keyword">new</font> RtWvOut(1);
}
<font class="keywordflow">catch</font> (<a class="code" href="classStkError.html">StkError</a> &amp;) {
<font class="keywordflow">goto</font> cleanup;
}
scaler = 1.0;
frequency = 220.0;
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>
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>() );
}
<font class="keywordflow">catch</font> (<a class="code" href="classStkError.html">StkError</a> &amp;) {
<font class="keywordflow">goto</font> cleanup;
}
}
counter += 2000;
scaler += 0.025;
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>
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;
<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>
<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>
</table>
</BODY>
</HTML>

View File

@@ -0,0 +1,86 @@
<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"> &nbsp; <img src="ccrma.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="multichannel"><h2>Multi-Channel I/O</h2></a>
The ToolKit <a class="el" href="classWvIn.html">WvIn</a> and <a class="el" href="classWvOut.html">WvOut</a> classes (and their subclasses) support multi-channel audio data input and output. A set of interleaved audio samples representing a single time "slice" is referred to as a <em>sample frame</em>. At a sample rate of 44.1 kHz, a four-channel audio stream will have 44100 sample frames per second and a total of 176400 individual samples per second.
<p>
Most STK classes process single-sample data streams via their <code>tick()</code> function. In order to distinguish single-sample and sample frame calculations, the <a class="el" href="classWvIn.html">WvIn</a> and <a class="el" href="classWvOut.html">WvOut</a> classes implement both <code>tick()</code> and <code>tickFrame()</code> functions. The <code>tickFrame()</code> functions take or return a pointer to an array of audio data representing one or more sample frames. For single-channel streams, the <code>tick()</code> and <code>tickFrame()</code> functions produce equivalent results. When <code>tick()</code> is called for a multi-channel stream, however, the function either returns a sample frame average (<a class="el" href="classWvIn.html">WvIn</a>) or writes a single sample argument to all channels (<a class="el" href="classWvOut.html">WvOut</a>).
<p>
Multi-channel support for realtime audio input and output is dependent on the audio device(s) available on your system.
<p>
The following example demonstrates the use of the <a class="el" href="classWvOut.html">WvOut</a> class for creating a four channel, 16-bit AIFF formatted audio file. We will use four sinewaves of different frequencies for the first two seconds and then a single sinewave for the last two seconds.
<p>
<div class="fragment"><pre><font class="comment">// foursine.cpp</font>
<font class="preprocessor">#include "WaveLoop.h"</font>
<font class="preprocessor">#include "WvOut.h"</font>
<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 );
<font class="keywordtype">int</font> i, j;
<a class="code" href="classWvOut.html">WvOut</a> *output = 0;
<a class="code" href="classWaveLoop.html">WaveLoop</a> *inputs[4];
<font class="keywordflow">for</font> ( i=0; i&lt;4; i++ ) inputs[i] = 0;
<font class="comment">// Define and load the sine waves</font>
<font class="keywordflow">try</font> {
<font class="keywordflow">for</font> ( i=0; i&lt;4; i++ ) {
inputs[i] = <font class="keyword">new</font> WaveLoop( <font class="stringliteral">"rawwaves/sinewave.raw"</font>, TRUE );
inputs[i]-&gt;<a class="code" href="classWaveLoop.html#a2">setFrequency</a>( 220.0 * (i+1) );
}
}
<font class="keywordflow">catch</font> (<a class="code" href="classStkError.html">StkError</a> &amp;) {
<font class="keywordflow">goto</font> cleanup;
}
<font class="comment">// Define and open a 16-bit, four-channel AIFF formatted output file</font>
<font class="keywordflow">try</font> {
output = <font class="keyword">new</font> WvOut( <font class="stringliteral">"foursine.aif"</font>, 4, WvOut::WVOUT_AIF, Stk::STK_SINT16 );
}
<font class="keywordflow">catch</font> (<a class="code" href="classStkError.html">StkError</a> &amp;) {
<font class="keywordflow">goto</font> cleanup;
}
<font class="comment">// Write two seconds of four sines to the output file</font>
MY_FLOAT frame[4];
<font class="keywordflow">for</font> ( j=0; j&lt;88200; j++ ) {
<font class="keywordflow">for</font> ( i=0; i&lt;4; i++ )
frame[i] = inputs[i]-&gt;<a class="code" href="classWvIn.html#a16">tick</a>();
output-&gt;<a class="code" href="classWvOut.html#a9">tickFrame</a>( frame );
}
<font class="comment">// Now write the first sine to all four channels for two seconds</font>
<font class="keywordflow">for</font> ( j=0; j&lt;88200; j++ ) {
output-&gt;<a class="code" href="classWvOut.html#a7">tick</a>( inputs[0]-&gt;tick() );
}
cleanup:
<font class="keywordflow">for</font> ( i=0; i&lt;4; i++ ) <font class="keyword">delete</font> inputs[i];
<font class="keyword">delete</font> output;
<font class="keywordflow">return</font> 0;
}</pre></div>
<p>
[<a href="polyvoices.html">Next tutorial</a>] &nbsp; [<a href="tutorial.html">Main tutorial page</a>]
<p>
<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>
</table>
</BODY>
</HTML>

View File

@@ -12,14 +12,28 @@
<h1>STK Related Pages</h1>Here is a list of all related documentation pages:<ul>
<li><a class="el" href="classes.html">Class Documentation</a>
<li><a class="el" href="compile.html">Compiling</a>
<li><a class="el" href="controlin.html">Control Input</a>
<li><a class="el" href="download.html">Download and Release Notes</a>
<li><a class="el" href="hello.html">Hello Sine!</a>
<li><a class="el" href="information.html">General Information</a>
<li><a class="el" href="instruments.html">Instruments</a>
<li><a class="el" href="links.html">Miscellaneous Links</a>
<li><a class="el" href="maillist.html">The Mail List</a>
<li><a class="el" href="multichannel.html">Multi-Channel I/O</a>
<li><a class="el" href="polyvoices.html">Voice Management</a>
<li><a class="el" href="realtime.html">Realtime Audio</a>
<li><a class="el" href="skini.html">Synthesis toolKit Instrument Network Interface (SKINI)</a>
<li><a class="el" href="system.html">System Requirements</a>

137
doc/html/polyvoices.html Normal file
View File

@@ -0,0 +1,137 @@
<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"> &nbsp; <img src="ccrma.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="polyvoices"><h2>Voice Management</h2></a>
The previous tutorial chapters were concerned only with monophonic ToolKit instrument playback and control. At this point, it should be relatively clear that one can instantiate multiple instruments and perhaps sum together their sounds or even direct their sounds to separate output channels. It is less clear how one might go about controlling a group of instruments. The <a class="el" href="classVoicer.html">Voicer</a> class is designed to serve just this purpose.
<p>
The STK <a class="el" href="classVoicer.html">Voicer</a> class is a relatively simple voice manager. The user can dynamically add and delete instruments from its "control", with the option of controlling specific instruments via unique note tags and/or grouping sets of instruments via a "channel" number. All sounding instrument outputs are summed and returned via the <code>tick()</code> function. The <a class="el" href="classVoicer.html">Voicer</a> class responds to noteOn, noteOff, setFrequency, pitchBend, and controlChange messages, automatically assigning incoming messages to the voices in its control. When all voices are sounding and a new noteOn is encountered, the <a class="el" href="classVoicer.html">Voicer</a> interrupts the oldest sounding voice. The user is responsible for creating and deleting all instrument instances.
<p>
In the following example, we modify the <code>controlbee.cpp</code> program to make use of three <a class="el" href="classBeeThree.html">BeeThree</a> instruments, all controlled using a <a class="el" href="classVoicer.html">Voicer</a>.
<p>
<div class="fragment"><pre><font class="comment">// threebees.cpp</font>
<font class="preprocessor">#include "BeeThree.h"</font>
<font class="preprocessor">#include "RtWvOut.h"</font>
<font class="preprocessor">#include "Messager.h"</font>
<font class="preprocessor">#include "Voicer.h"</font>
<font class="preprocessor">#include "SKINI.msg"</font>
<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 );
<font class="keywordtype">int</font> i;
<a class="code" href="classRtWvOut.html">RtWvOut</a> *output = 0;
<a class="code" href="classMessager.html">Messager</a> *messager = 0;
<a class="code" href="classVoicer.html">Voicer</a> *voicer = 0;
<font class="keywordtype">bool</font> done = FALSE;
<a class="code" href="classInstrmnt.html">Instrmnt</a> *instrument[3];
<font class="keywordflow">for</font> ( i=0; i&lt;3; i++ ) instrument[i] = 0;
<font class="keywordflow">try</font> {
<font class="comment">// Define and load the BeeThree instruments</font>
<font class="keywordflow">for</font> ( i=0; i&lt;3; i++ )
instrument[i] = <font class="keyword">new</font> BeeThree();
<font class="comment">// Define and open the default realtime output device for one-channel playback</font>
output = <font class="keyword">new</font> RtWvOut(1);
}
<font class="keywordflow">catch</font> (<a class="code" href="classStkError.html">StkError</a> &amp;) {
<font class="keywordflow">goto</font> cleanup;
}
<font class="keywordflow">try</font> {
<font class="comment">// Create a Messager instance to read from a redirected SKINI scorefile.</font>
messager = <font class="keyword">new</font> Messager();
}
<font class="keywordflow">catch</font> (<a class="code" href="classStkError.html">StkError</a> &amp;) {
<font class="keywordflow">goto</font> cleanup;
}
<font class="comment">// Instantiate the voicer for a maximum of three voices.</font>
voicer = <font class="keyword">new</font> Voicer( 3 );
<font class="keywordflow">for</font> ( i=0; i&lt;3; i++ )
voicer-&gt;<a class="code" href="classVoicer.html#a2">addInstrument</a>( instrument[i] );
<font class="comment">// Play the instrument until the end of the scorefile.</font>
<font class="keywordtype">int</font> nTicks, type;
MY_FLOAT byte2, byte3;
<font class="keywordflow">while</font> (!done) {
<font class="comment">// Look for new messages and return a delta time (in samples).</font>
type = messager-&gt;<a class="code" href="classMessager.html#a2">nextMessage</a>();
<font class="keywordflow">if</font> (type &lt; 0)
done = TRUE;
nTicks = messager-&gt;<a class="code" href="classMessager.html#a4">getDelta</a>();
<font class="keywordflow">try</font> {
<font class="keywordflow">for</font> ( i=0; i&lt;nTicks; i++ )
output-&gt;<a class="code" href="classRtWvOut.html#a6">tick</a>( voicer-&gt;<a class="code" href="classVoicer.html#a14">tick</a>() );
}
<font class="keywordflow">catch</font> (<a class="code" href="classStkError.html">StkError</a> &amp;) {
<font class="keywordflow">goto</font> cleanup;
}
<font class="keywordflow">if</font> ( type &gt; 0 ) {
<font class="comment">// Process the new control message.</font>
byte2 = messager-&gt;<a class="code" href="classMessager.html#a6">getByteTwo</a>();
byte3 = messager-&gt;<a class="code" href="classMessager.html#a7">getByteThree</a>();
<font class="keywordflow">switch</font>(type) {
<font class="keywordflow">case</font> __SK_NoteOn_:
voicer-&gt;<a class="code" href="classVoicer.html#a4">noteOn</a>( byte2, byte3 );
<font class="keywordflow">break</font>;
<font class="keywordflow">case</font> __SK_NoteOff_:
voicer-&gt;<a class="code" href="classVoicer.html#a5">noteOff</a>( byte2, byte3 );
<font class="keywordflow">break</font>;
<font class="keywordflow">case</font> __SK_ControlChange_:
voicer-&gt;<a class="code" href="classVoicer.html#a11">controlChange</a>( (<font class="keywordtype">int</font>) byte2, byte3 );
<font class="keywordflow">break</font>;
<font class="keywordflow">case</font> __SK_AfterTouch_:
voicer-&gt;<a class="code" href="classVoicer.html#a11">controlChange</a>( 128, byte2 );
<font class="keywordflow">break</font>;
}
}
}
cleanup:
<font class="keywordflow">for</font> ( i=0; i&lt;3; i++ ) <font class="keyword">delete</font> instrument[i];
<font class="keyword">delete</font> output;
<font class="keyword">delete</font> messager;
<font class="keyword">delete</font> voicer;
<font class="keywordflow">return</font> 0;
}</pre></div>
<p>
Assuming the program is compiled as <code>threebees</code>, the three-voice <a class="el" href="classSKINI.html">SKINI</a> scorefile <a href="tutorial/bachfugue.ski"><code>bachfugue.ski</code></a> could be redirected to the program as:
<p>
<div class="fragment"><pre>threebees &lt; bachfugue.ski</pre></div>
<p>
For more fun, surf to <a href="http://kern.humdrum.net/">Kern Scores</a> for a huge assortment of other scorefiles which can be downloaded in the <a class="el" href="classSKINI.html">SKINI</a> format.
<p>
Another easy extension would be to use the <code>STK_MIDI</code> constructor argument to the <a class="el" href="classMessager.html">Messager</a> class and then play the instruments via a MIDI keyboard.
<p>
[<a href="tutorial.html">Main tutorial page</a>]
<p>
<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>
</table>
</BODY>
</HTML>

85
doc/html/realtime.html Normal file
View File

@@ -0,0 +1,85 @@
<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"> &nbsp; <img src="ccrma.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="realtime"><h2>Realtime Audio</h2></a>
In this section, we modify the <code>sineosc.cpp</code> program in order to send the output to the default audio playback device on your system.
<p>
<div class="fragment"><pre><font class="comment">// rtsine.cpp</font>
<font class="preprocessor">#include "WaveLoop.h"</font>
<font class="preprocessor">#include "RtWvOut.h"</font>
<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 );
<a class="code" href="classWaveLoop.html">WaveLoop</a> *input = 0;
<a class="code" href="classRtWvOut.html">RtWvOut</a> *output = 0;
<font class="keywordflow">try</font> {
<font class="comment">// Define and load the sine wave file</font>
input = <font class="keyword">new</font> WaveLoop( <font class="stringliteral">"rawwaves/sinewave.raw"</font>, TRUE );
<font class="comment">// Define and open the default realtime output device for one-channel playback</font>
output = <font class="keyword">new</font> RtWvOut(1);
}
<font class="keywordflow">catch</font> (<a class="code" href="classStkError.html">StkError</a> &amp;) {
<font class="keywordflow">goto</font> cleanup;
}
input-&gt;<a class="code" href="classWaveLoop.html#a2">setFrequency</a>(440.0);
<font class="comment">// Play the oscillator for 40000 samples</font>
<font class="keywordtype">int</font> i;
<font class="keywordflow">for</font> ( i=0; i&lt;40000; i++ ) {
<font class="keywordflow">try</font> {
output-&gt;<a class="code" href="classRtWvOut.html#a6">tick</a>(input-&gt;<a class="code" href="classWvIn.html#a16">tick</a>());
}
<font class="keywordflow">catch</font> (<a class="code" href="classStkError.html">StkError</a> &amp;) {
<font class="keywordflow">goto</font> cleanup;
}
}
cleanup:
<font class="keyword">delete</font> input;
<font class="keyword">delete</font> output;
<font class="keywordflow">return</font> 0;
}</pre></div>
<p>
The class <a class="el" href="classRtWvOut.html">RtWvOut</a> is a protected subclass of <a class="el" href="classWvOut.html">WvOut</a>. A number of optional constructor arguments can be used to fine tune its performance for a given system.
<p>
Though not used here, an <a class="el" href="classRtWvIn.html">RtWvIn</a> class exists as well which can be used to read realtime audio data from an input device. See the <code>record.cpp</code> example program in the <code>examples</code> project for more information.
<p>
It is possible to use an instance of <a class="el" href="classRtWvOut.html">RtWvOut</a> and an instance of <a class="el" href="classRtWvIn.html">RtWvIn</a> to simultaneously read and write realtime audio to and from a hardware device or devices. However, it is recommended to instead use a single instance of <a class="el" href="classRtDuplex.html">RtDuplex</a> to achieve this behavior, in that it guarantees better synchronization between the input and output data. See the <code>effects</code> project or the <code>io.cpp</code> example program in the <code>examples</code> project for more information.
<p>
When using any realtime STK class (<a class="el" href="classRtAudio.html">RtAudio</a>, <a class="el" href="classRtWvOut.html">RtWvOut</a>, <a class="el" href="classRtWvIn.html">RtWvIn</a>, <a class="el" href="classRtDuplex.html">RtDuplex</a>, <a class="el" href="classRtMidi.html">RtMidi</a>, <a class="el" href="classTcpWvIn.html">TcpWvIn</a>, <a class="el" href="classTcpWvOut.html">TcpWvOut</a>, <a class="el" href="classSocket.html">Socket</a>, and <a class="el" href="classThread.html">Thread</a>), it is necessary to specify an audio/MIDI API preprocessor definition and link with the appropriate libraries or frameworks. For example, the above program could be compiled on a Linux system using the GNU g++ compiler and the ALSA audio/MIDI API as follows (assuming all necessary files exist in the project directory):
<p>
<div class="fragment"><pre>g++ -Wall -D__LINUX_ALSA__ -D__LITTLE_ENDIAN__ -o rtsine <a class="code" href="classStk.html">Stk</a>.cpp <a class="code" href="classWvIn.html">WvIn</a>.cpp <a class="code" href="classWaveLoop.html">WaveLoop</a>.cpp <a class="code" href="classWvOut.html">WvOut</a>.cpp \
<a class="code" href="classRtWvOut.html">RtWvOut</a>.cpp <a class="code" href="classRtAudio.html">RtAudio</a>.cpp rtsine.cpp -lpthread -lasound -lstk</pre></div>
<p>
On a Macintosh OS X system, the syntax would be:
<p>
<div class="fragment"><pre>CC -D__MACOSX_CORE__ -o rtsine <a class="code" href="classStk.html">Stk</a>.cpp <a class="code" href="classWvIn.html">WvIn</a>.cpp <a class="code" href="classWaveLoop.html">WaveLoop</a>.cpp <a class="code" href="classWvOut.html">WvOut</a>.cpp <a class="code" href="classRtWvOut.html">RtWvOut</a>.cpp <a class="code" href="classRtAudio.html">RtAudio</a>.cpp \
rtsine.cpp -lpthread -lstdc++ -lstk -framework CoreAudio -framework CoreMIDI -framework CoreFoundation</pre></div>
<p>
[<a href="instruments.html">Next tutorial</a>] &nbsp; [<a href="tutorial.html">Main tutorial page</a>]
<p>
<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>
</table>
</BODY>
</HTML>

View File

@@ -10,7 +10,7 @@
<HR>
<!-- Generated by Doxygen 1.2.8.1 -->
<a name="skini"><h2>Synthesis toolKit Instrument Network Interface (SKINI)</h2></a>
This describes the latest (version 1.1) implementation of <a class="el" href="classSKINI.html">SKINI</a> for the Synthesis Toolkit in C++ (STK) by Perry R. Cook.
This describes the latest (version 1.1) implementation of <a class="el" href="classSKINI.html">SKINI</a> for the Synthesis ToolKit in C++ (STK) by Perry R. Cook.
<p>
<div class="fragment"><pre> Too good to be <font class="keyword">true</font>?
Have control and read it too?
@@ -28,7 +28,7 @@ Differences from MIDI, and motivations, include:
<ul>
<li>Text-based messages are used, with meaningful names wherever possible. This allows any language or system capable of formatted printing to generate <a class="el" href="classSKINI.html">SKINI</a>. Similarly, any system capable of reading in a string and turning delimited fields into strings, floats, and ints can consume <a class="el" href="classSKINI.html">SKINI</a> for control. More importantly, humans can actually read, and even write if they want, <a class="el" href="classSKINI.html">SKINI</a> files and streams. Use an editor and search/replace or macros to change a channel or control number. Load a <a class="el" href="classSKINI.html">SKINI</a> score into a spread sheet to apply transformations to time, control parameters, MIDI velocities, etc. Put a monkey on a special typewriter and get your next great work. Life's too short to debug bit/nybble packed variable length mumble messages. Disk space gets cheaper, available bandwidth increases, music takes up so little space and bandwidth compared to video and grapics. Live a little.</ul>
<ul>
<li>Floating point numbers are used wherever possible. Note Numbers, Velocities, Controller Values, and Delta and Absolute Times are all represented and scanned as ASCII double-precision floats. MIDI byte values are preserved, so that incoming MIDI bytes from an interface can be put directly into <a class="el" href="classSKINI.html">SKINI</a> messages. 60.0 or 60 is middle C, 127.0 or 127 is maximum velocity etc. But, unlike MIDI, 60.5 can cause a 50cent sharp middle C to be played. As with MIDI byte values like velocity, use of the integer and <a class="el" href="classSKINI.html">SKINI</a>-added fractional parts is up to the implementor of the algorithm being controlled by <a class="el" href="classSKINI.html">SKINI</a> messages. But the extra precision is there to be used or ignored.</ul>
<li>Floating point numbers are used wherever possible. Note Numbers, Velocities, Controller Values, and Delta and Absolute Times are all represented and scanned as ASCII double-precision floats. MIDI byte values are preserved, so that incoming MIDI bytes from an interface can be put directly into <a class="el" href="classSKINI.html">SKINI</a> messages. 60.0 or 60 is middle C, 127.0 or 127 is maximum velocity etc. But, unlike MIDI, 60.5 can cause a 50 cent sharp middle C to be played. As with MIDI byte values like velocity, use of the integer and <a class="el" href="classSKINI.html">SKINI</a>-added fractional parts is up to the implementor of the algorithm being controlled by <a class="el" href="classSKINI.html">SKINI</a> messages. But the extra precision is there to be used or ignored.</ul>
<a name="why"><h2>Why SKINI?</h2></a>
<p>

View File

@@ -19,11 +19,17 @@
<p>
<b>Macintosh OS X (specific):</b> <ul>
<li>A C++ compiler does not ship by default with OS X. It is necessary to download the Developer Kit from the Apple WWW site in order to compile STK. <li>The tcl/tk interpreter does not ship by default with OS X, but must be downloaded from the internet. Once installed, it is suggested that a link be made to the executable from a standard search path (/usr/bin/wish). In any event, it will not be possible to use the supplied startup scripts in the demo directory (i.e. StkDemo.bat) because the tcl/tk script startup sequence is slightly different than for all the other systems. Assuming you have made the link mentioned above, the STK demo program and tcl/tk script can be started by typing:
<li>A C++ compiler does not ship by default with OS X. It is necessary to download the Developer Kit from the Apple WWW site in order to compile STK. <li>The internal Macintosh audio hardware typically supports a sample rate of 44100 Hz only. Therefore, it is necessary to either specify this rate as a command-line option to the STK example programs or to change the default sample rate inside the Stk.h file before compilation. In addition, the RT_BUFFER_SIZE, specified in Stk.h, could be increased (to a higher power of two) for more robust performance. <li>The tcl/tk interpreter does not ship by default with OS X, but must be downloaded from the internet. Binary distributions exist but it is instead recommended that you download recent tcl and tk source distributions (<a href="http://dev.scriptics.com/software/tcltk/downloadnow84.tml">http://dev.scriptics.com/software/tcltk/downloadnow84.tml</a>) and compile them as follows:
<p>
<div class="fragment"><pre> wish tcl/Demo.tcl | demo <a class="code" href="classClarinet.html">Clarinet</a> -or -ip</pre></div>
make -C tcl/macosx deploy<br>
make -C tk/macosx deploy<br>
sudo make -C tcl/macosx install-deploy<br>
sudo make -C tk/macosx install-deploy<br>
<p>
Initial tests have shown somewhat poor response between changes made in the tcl/tk script and the resulting audio updates.
(Note: the tcl and tk directories specified in the above lines will more likely be appended with version numbers) The default installation will place a link to the wish interpretor at /usr/bin/wish. The latest 8.4.1 release of tcl/tk has been tested on a 10.2 system and found to work correctly. In particular, redirection of a tcl/tk script to the interpreter (e.g., wish &lt; test.tcl) works normally (which is not the case with binary distributions tested thus far).
<p>
Initial tests have shown somewhat poor response between changes made in the tcl/tk script and the resulting audio updates. Also, it is not recommended to connect by socket from a tcl/tk script to an STK program because the tcl/tk interpreter does not appear to properly close the socket connection, leaving the STK program in a "hung" state.
<p>
</ul>

31
doc/html/tutorial.html Normal file
View File

@@ -0,0 +1,31 @@
<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"> &nbsp; <img src="ccrma.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="tutorial"><h2>Tutorial</h2></a>
The Synthesis ToolKit is a set of C++ classes. In order to go beyond the simple example programs we provide, it is necessary to know some basics about programming in C or C++. STK's "target audience" includes people who: <ul>
<li>want to create audio DSP and/or synthesis programs <li>want to save some time by using our unit generators and input/output routines <li>want to learn about synthesis and processing algorithms <li>wish to teach real-time synthesis and processing, and wish to use some of our classes and examples </ul>
<p>
Most ToolKit programmers will likely end up writing a class or two for their own particular needs, but this task is typically simplified by making use of pre-existing STK classes (filters, oscillators, etc.).
<p>
The following tutorial chapters describe many of the fundamental ToolKit concepts and classes. All tutorial programs are included in the <code>projects/examples</code> directory.
<p>
<ol>
<li><a href="hello.html#hello">Hello Sine!</a><li><a href="compile.html#compile">Compiling</a><li><a href="realtime.html#realtime">Realtime Audio</a><li><a href="instruments.html#instruments">Instruments</a><li><a href="controlin.html#controlin">Control Input</a><li><a href="multichannel.html#multichannel">Multi-Channel I/O</a><li><a href="polyvoices.html#polyvoices">Voice Management</a></ol>
<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>
</table>
</BODY>
</HTML>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,90 @@
/* Howdy!! SKINI File, Perry Cook */
NoteOn 0.000000 1 60 114.299997
NoteOff 0.380000 1 60 63.500000
NoteOn 0.020000 1 60 101.600002
NoteOff 0.100000 1 60 63.500000
NoteOn 0.100000 1 48 63.500000
NoteOff 0.200000 1 48 63.500000
NoteOn 0.200000 1 48 88.899998
NoteOff 0.190023 1 48 63.500000
NoteOn 0.010023 1 51 101.600002
NoteOff 0.570023 1 51 63.500000
NoteOn 0.030023 1 53 88.899998
NoteOff 0.570023 1 53 63.500000
NoteOn 0.030023 1 48 38.100002
NoteOff 0.300000 1 48 63.500000
NoteOn 0.300000 1 67 101.600002
NoteOff 0.570023 1 67 63.500000
NoteOn 0.030023 1 66 76.200003
NoteOff 0.190023 1 66 63.500000
NoteOn 0.010023 1 65 63.500000
NoteOff 0.190023 1 65 63.500000
NoteOn 0.010023 1 63 50.800001
NoteOff 0.190023 1 63 63.500000
NoteOn 0.010023 1 60 76.200003
NoteOff 0.380000 1 60 63.500000
NoteOn 0.020000 1 58 50.800001
NoteOff 0.190023 1 58 63.500000
NoteOn 0.010023 1 48 114.299997
NoteOff 0.380000 1 48 63.500000
NoteOn 0.020000 1 48 101.600002
NoteOff 0.100000 1 48 63.500000
NoteOn 0.100000 1 36 63.500000
NoteOff 0.200000 1 36 63.500000
NoteOn 0.200000 1 36 88.899998
NoteOff 0.190023 1 36 63.500000
NoteOn 0.010023 1 39 101.600002
NoteOff 0.570023 1 39 63.500000
NoteOn 0.030023 1 41 88.899998
NoteOff 0.570023 1 41 63.500000
NoteOn 0.030023 1 84 127.000000
NoteOff 0.475011 1 84 63.500000
NoteOn 0.025034 1 83 120.649998
NoteOff 0.066531 1 83 63.500000
NoteOn 0.003537 1 82 114.299997
NoteOff 0.057007 1 82 63.500000
NoteOn 0.003039 1 81 107.950003
NoteOff 0.047528 1 81 63.500000
NoteOn 0.002540 1 80 101.600002
NoteOff 0.047528 1 80 63.500000
NoteOn 0.002540 1 78 95.250000
NoteOff 0.038005 1 78 63.500000
NoteOn 0.002041 1 78 88.899998
NoteOff 0.028526 1 78 63.500000
NoteOn 0.001542 1 77 82.549997
NoteOff 0.019002 1 77 63.500000
NoteOn 0.001043 1 76 76.200003
NoteOff 0.019002 1 76 63.500000
NoteOn 0.001043 1 75 69.850002
NoteOff 0.019002 1 75 63.500000
NoteOn 0.001043 1 74 63.500000
NoteOff 0.019002 1 74 63.500000
NoteOn 0.001043 1 73 63.500000
NoteOff 0.028526 1 73 63.500000
NoteOn 0.001542 1 72 63.500000
NoteOff 0.019002 1 72 63.500000
NoteOn 0.001043 1 71 57.149998
NoteOff 0.028526 1 71 63.500000
NoteOn 0.001542 1 70 50.800001
NoteOff 0.038005 1 70 63.500000
NoteOn 0.002041 1 69 44.449999
NoteOff 0.047528 1 69 63.500000
NoteOn 0.002540 1 68 38.100002
NoteOff 0.057007 1 68 63.500000
NoteOn 0.003039 1 67 31.750000
NoteOff 0.057007 1 67 63.500000
NoteOn 0.003039 1 66 25.400000
NoteOff 0.057007 1 66 63.500000
NoteOn 0.003039 1 65 31.750000
NoteOff 0.066531 1 65 63.500000
NoteOn 0.003537 1 64 25.400000
NoteOff 0.076009 1 64 63.500000
NoteOn 0.004036 1 63 19.050001
NoteOff 0.085533 1 63 63.500000
NoteOn 0.004535 1 62 31.750000
NoteOff 0.095011 1 62 63.500000
NoteOn 0.005034 1 61 44.449999
NoteOff 0.104535 1 61 63.500000
ControlChange 0.005533 1 1 127.000000
NoteOn 0.000000 1 60 63.500000
NoteOff 1.500000 1 60 63.500000

112
doc/html/tutorial1.html Normal file
View File

@@ -0,0 +1,112 @@
<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"> &nbsp; <img src="ccrma.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="tutorial1"><h2>Hello Sine!</h2></a>
<a name="start"><h2>Getting Started</h2></a>
<p>
We'll begin our introduction to the Synthesis ToolKit with a simple sine-wave oscillator program. STK doesn't provide a specific oscillator for sine waves. Instead, it provides a generic waveform oscillator class, WaveLoop, which can load a variety of common file types. In this example, we load a sine "table" from an STK RAW file. The class RtWvOut will send "realtime" samples to the audio output hardware on your computer.
<p>
<div class="fragment"><pre><font class="comment">// sineosc.cpp</font>
<font class="preprocessor">#include "WaveLoop.h"</font>
<font class="preprocessor">#include "RtWvOut.h"</font>
<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>
Stk::setSampleRate( 44100.0 );
<font class="comment">// Define and load the sine wave file</font>
WaveLoop *input = <font class="keyword">new</font> WaveLoop(<font class="stringliteral">"sinewave.raw"</font>, TRUE);
input-&gt;setFrequency(440.0);
<font class="comment">// Define and open the default realtime output device for one-channel playback</font>
RtWvOut *output = <font class="keyword">new</font> RtWvOut(1);
<font class="comment">// Play the oscillator for 40000 samples</font>
<font class="keywordflow">for</font> (<font class="keywordtype">int</font> i=0; i&lt;40000; i++) {
output-&gt;tick( input-&gt;tick() );
}
<font class="comment">// Clean up</font>
<font class="keyword">delete</font> input;
<font class="keyword">delete</font> output;
<font class="keywordflow">return</font> 0;
}</pre></div>
<p>
WaveLoop is a subclass of WvIn, which supports WAV, SND (AU), AIFF, MAT-file (Matlab), and RAW file formats with 8-, 16-, and 32-bit integer and 32- and 64-bit floating-point data types. WvIn provides interpolating, read once ("oneshot") functionality, as well as methods for setting the read rate and read position.
<p>
Nearly all STK classes implement tick() methods which take and/or return sample values. Within the tick() method, the fundamental sample calculations are performed for a given class. Most STK classes consume/generate a single sample per operation and their tick() method takes/returns each sample "by value". In addition, every class implementing a tick() method also provides an overloaded tick() function taking pointer and size arguments which can be used for vectorized computations.
<p>
The WvIn and WvOut classes support multi-channel sample frames. To distinguish single-sample frame operations from multi-channel frame operations, these classes also implement tickFrame() functions. When a tick() method is called for multi-channel data, frame averages are returned or the input sample is distributed across all channels of a sample frame.
<p>
Nearly all STK classes inherit from the Stk base class. Stk provides a static sample rate which is queried by subclasses as needed. Because many classes use the current sample rate value during instantiation, it is important that the desired value be set at the beginning of a program. The default STK sample rate is 22050 Hz.
<p>
Another primary concept that is somewhat obscurred in this example concerns the data format in which sample values are passed and received. Audio and control signals throughout STK use a floating-point data type, the exact precision of which can be controlled via the MY_FLOAT #define statement in Stk.h. Thus, the ToolKit can use any normalization scheme desired. The base instruments and algorithms are implemented with a general audio sample dynamic maximum of +/-1.0, and the WvIn and WvOut classes and subclasses scale appropriately for DAC or soundfile input and output.
<p>
Finally, STK has some basic C++ error handling functionality built in. Classes which access files and/or hardware are most prone to runtime errors. To properly "catch" such errors, the above example should be rewritten as shown below.
<p>
<div class="fragment"><pre><font class="comment">// sineosc.cpp</font>
<font class="preprocessor">#include "WaveLoop.h"</font>
<font class="preprocessor">#include "RtWvOut.h"</font>
<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>
Stk::setSampleRate( 44100.0 );
WaveLoop *input = 0;
RtWvOut *output = 0;
<font class="keywordflow">try</font> {
<font class="comment">// Define and load the sine wave file</font>
input = <font class="keyword">new</font> WaveLoop( <font class="stringliteral">"sinewave.raw"</font>, TRUE );
<font class="comment">// Define and open the default realtime output device for one-channel playback</font>
output = <font class="keyword">new</font> RtWvOut(1);
}
<font class="keywordflow">catch</font> (StkError &amp;) {
<font class="keywordflow">goto</font> cleanup;
}
input-&gt;setFrequency(440.0);
<font class="comment">// Play the oscillator for 40000 samples</font>
<font class="keywordflow">for</font> (<font class="keywordtype">int</font> i=0; i&lt;40000; i++) {
<font class="keywordflow">try</font> {
output-&gt;tick(input-&gt;tick());
}
<font class="keywordflow">catch</font> (StkError &amp;) {
<font class="keywordflow">goto</font> cleanup;
}
}
cleanup:
<font class="keyword">delete</font> input;
<font class="keyword">delete</font> output;
<font class="keywordflow">return</font> 0;
}</pre></div>
<p>
In this particular case, we simply exit the program if an error occurs (an error message is automatically printed to stderr). A more refined program might attempt to recover from or fix a particular problem and, if successful, continue processing.
<p>
<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>
</table>
</BODY>
</HTML>

View File

@@ -11,7 +11,7 @@
<!-- Generated by Doxygen 1.2.8.1 -->
<a name="usage"><h2>Usage Documentation</h2></a>
<ul>
<li><a href="usage.html#directory">Directory Structure:</a><li><a href="usage.html#compiling">Compiling:</a><li><a href="usage.html#control">Control Data:</a><li><a href="usage.html#instruments">Demo: STK Instruments</a><li><a href="usage.html#nort">Demo: Non-Realtime Use</a><li><a href="usage.html#rt">Demo: Realtime Use</a><li><a href="usage.html#tcl">Realtime Control Input using Tcl/Tk Graphical User Interfaces:</a><li><a href="usage.html#midi">Realtime MIDI Control Input:</a><li><a href="usage.html#polyphony">Polyphony:</a></ul>
<li><a href="usage.html#directory">Directory Structure:</a><li><a href="usage.html#compiling">Compiling:</a><li><a href="usage.html#control">Control Data:</a><li><a href="usage.html#voices">Demo: STK Instruments</a><li><a href="usage.html#nort">Demo: Non-Realtime Use</a><li><a href="usage.html#rt">Demo: Realtime Use</a><li><a href="usage.html#tcl">Realtime Control Input using Tcl/Tk Graphical User Interfaces:</a><li><a href="usage.html#midi">Realtime MIDI Control Input:</a><li><a href="usage.html#polyphony">Polyphony:</a></ul>
<hr>
<p>
<a name="directory"><h2>Directory Structure:</h2></a>
@@ -100,7 +100,7 @@ All STK programs in this distribution take input control data in the form of <a
<p>
<a href="http://dev.scriptics.com">Tcl/Tk</a> graphical user interfaces (GUI) are provided with this distribution which can generate realtime <a class="el" href="classSKINI.html">SKINI</a> messages. Note that the <a class="el" href="classMessager.html">Messager</a> class allows multiple simultaneous socket client connections, together with MIDI and/or piped input. The <em><b>Md2Skini</b></em> program (in the <em><b>demo</b></em> directory) is mostly obsolete but can be used to create <a class="el" href="classSKINI.html">SKINI</a> scorefiles from realtime MIDI input.
<p>
<a name="instruments"><h2>Demo: STK Instruments</h2></a>
<a name="voices"><h2>Demo: STK Instruments</h2></a>
<p>
The <em><b>demo</b></em> project demonstrates the behavior of all the distributed STK instruments. The instruments available with this release include: <ul>