Home Information Classes Download Usage Mail List Requirements Links FAQ Tutorial
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
Makefiles that compile project-specific class objects from common
include 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.
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) dependent. STK classes that require specific platform/OS support include RtAudio, RtWvOut, RtWvIn, RtDuplex, RtMidi, InetWvIn, InetWvOut, Socket, UdpSocket, TcpServer, TcpClient, Thread, and Mutex. These classes currently can only be compiled on Linux, Macintosh OS X, and Windows systems.
Without the "realtime" classes, it is still possible to read SKINI 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
__LITTLE_ENDIAN__ preprocessor definition should be provided.
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.
|OS:||Realtime Audio/MIDI API:||Preprocessor Definition:||Library or Framework:|
|Linux||OSS (version 4.0 only, use ALSA for MIDI support)||__LINUX_OSS__, LINUX_ALSA, LITTLE_ENDIAN|
|Linux and Macintosh OS-X||Jack||__UNIX_JACK__, LITTLE_ENDIAN|
|Macintosh OS X||CoreAudio||__MACOSX_CORE__|
The available C++ compilers on any of these systems can vary.
One approach in using STK is to simply copy the class files needed for a particular program into a project directory. Taking the
sineosc.cpp example from the previous tutorial chapter, it would be necessary to set up a directory that includes the files
sineosc.cpp, the rawwave file
sinewave.raw in a subdirectory called
rawwaves, and the header and source files for the classes Stk, FileRead, FileWrite, FileWvIn, FileLoop, and FileWvOut. The program could then be compiled on a little-endian system, such as a PC running Linux, using the GNU g++ compiler as follows:
Note that the
sineosc.cpp 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.
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). Most of the STK projects (e.g., demo, effects, ...) contain
Makefiles (built by the configure script) that compile project-specific class objects from the distribution
include directories. This approach makes it relatively easy when upgrading to a new STK release (by making path substitutions in the
Makefile or by moving the projects to a similar relative path within the new STK source tree). A
Makefile is provided in the
projects/examples directory for compiling all the tutorial programs, as well as other example programs. To compile the
sineosc.cpp program, for example, one need only type
make sineosc from within the
The STK distribution provides a
Makefile that can be used on Unix systems to build a static library. After unpacking the distribution (
tar -xzf stk-4.x.x.tar.gz), run the configure script by typing
./configure from the top level distribution directory (see the INSTALL file in the same directory for more information). Then from within the
src directory, type
make. After a successful build, you may wish to move the library (
libstk.a) and the contents of the
include directory to standard library and include search paths on your system. For example, the linux RPM distribution of STK puts the library in
/usr/lib/ and the STK header files in
Assuming the library is located in a standard search path and the header files are located in
sineosc.cpp example from the previous tutorial chapter can be compiled on a little-endian system using the GNU g++ compiler as follows:
With the header files in a standard search path, it is possible to modify the
#include statements in the
sineosc.cpp program as follows:
and then compile without an explicit include path argument to the compiler:
STK has been tested on Windows platforms using the Visual .NET compiler only. It is assumed here that you're familiar with Visual C++ and its particular idiosyncrasies. STK won't compile in Visual C++ 6.0 any more.
The approach when using Visual C++ is to build a project that includes the necessary ToolKit files from the distribution
include directories. For the example program from the previous tutorial chapter, create a VC++ console application project, add the Stk, FileRead, FileWrite, WvIn, FileWvIn, FileLoop, WvOut, and FileWvOut class files, as well as
sineosc.cpp, and make sure the
sinewave.raw file is in the subdirectory
For programs using any of the STK realtime classes mentioned above, it is necessary to link with the DirectSound (
Wsock32.lib libraries, select the multithreaded library, and provide the
__WINDOWS_MM__ preprocessor definitions.
For Steinberg ASIO support, use the
__WINDOWS_ASIO__ preprocessor definition (and the
__WINDOWS_MM__ definition for RtMidi support), include all the files in the
src/asio/ directory (i.e.,
asiodrivers.h,cpp, ...), and link with the
|The Synthesis ToolKit in C++ (STK)|
|©1995--2017 Perry R. Cook and Gary P. Scavone. All Rights Reserved.|