mirror of
https://github.com/thestk/stk
synced 2026-01-18 07:01:53 +00:00
Release 4.1.3 tarball
This commit is contained in:
committed by
Stephen Sinclair
parent
503ed3cc9f
commit
e11bff2fe8
@@ -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.6 -->
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1><a class="anchor" name="hello">Hello Sine!</a></h1>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>
|
||||
<pre class="fragment"><div><span class="comment">// sineosc.cpp</span>
|
||||
<div class="fragment"><pre><span class="comment">// sineosc.cpp</span>
|
||||
|
||||
<span class="preprocessor">#include "WaveLoop.h"</span>
|
||||
<span class="preprocessor">#include "WvOut.h"</span>
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
<span class="keywordflow">return</span> 0;
|
||||
}
|
||||
</div></pre><p>
|
||||
</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>
|
||||
@@ -48,7 +48,7 @@ Nearly all STK classes inherit from the <a class="el" href="classStk.html">Stk</
|
||||
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 <a class="el" href="Stk_8h.html">Stk.h</a>. 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.<h2><a class="anchor" name="error">
|
||||
Error Handling</a></h2>
|
||||
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>
|
||||
<pre class="fragment"><div><span class="comment">// sineosc.cpp</span>
|
||||
<div class="fragment"><pre><span class="comment">// sineosc.cpp</span>
|
||||
|
||||
<span class="preprocessor">#include "WaveLoop.h"</span>
|
||||
<span class="preprocessor">#include "WvOut.h"</span>
|
||||
@@ -92,7 +92,7 @@ The ToolKit has some basic C++ error handling functionality built in. Classes wh
|
||||
|
||||
<span class="keywordflow">return</span> 0;
|
||||
}
|
||||
</div></pre><p>
|
||||
</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 class="el" href="classes.html">Class Documentation</a> to determine which constructors and functions can throw an error.<p>
|
||||
[<a href="compile.html">Next tutorial</a>] [<a href="tutorial.html">Main tutorial page</a>] <HR>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user