The Synthesis Toolkit in C++ (STK) [Cook, 1996,Cook and Scavone, 1999] is a set of open source audio signal processing and algorithmic synthesis classes written in C++. It was developed to facilitate rapid development of music synthesis and audio processing software, with an emphasis on cross-platform functionality, real-time control, ease of use, and educational example code. The fundamental design goals of STK were defined as follows: (1) Cross-platform functionality; (2) Ease of use; (3) User extensibility; (4) Real-time synthesis and control; (5) Open source C and C++.
STK has been distributed freely since 1996 and included in various collections. Perry Cook started developing STK under NeXTStep at CCRMA in the early 90's. When he moved to Princeton in 1996 he ported everything to C++ on SGI hardware, added real-time and enhanced the synthesis algorithms. With the help of Bill Putman he made a port to Windows95. Gary Scavone began using STK in 1997 and completed a full port to Linux in 1998. He finished the fully compatible Windows port (using Direct Sound API) in June 1998. A great deal of improvements and extensions have been done since then[Cook and Scavone, 2003]. It has also been ported to Max/MSP on Mac by Dan Trueman and Luke Dubois, and distributed as PeRColate. STK is updated on a regular basis.
STK is a framework, not a particular application. Some applications are distributed as an example of usage but even these will probably have to be personalized. Examples don't have a fancy GUI wrapper as, according to the author, it goes against the spirit of STK to spend many hours developing GUI's that will then not be completely cross-platform.
STK works with real-time support (MIDI and audio) on SGI (Irix), Linux, Macintosh OS X, and Windows. STK is free for non-commercial use. It offers some simple Tcl/Tk GUI that offer the same interface as the MIDI input. It can generate SND, WAV, AIFF and MAT file outputs.
Almost all STK is regular C/C++ code that can be compiled on any platform. OS dependencies are kept within a small number of classes. In order to make the GUI cross-platform Tcl/Tk is used. It has no other hardware requirements than a regular sound card. STK is object-oriented and the code is clear. Some optimization issues are sometimes addressed but in general optimization is sacrificed for the sake of clarity.
All STK classes inherit from Object class. This class does not offer any functionality but it is a convenient mechanism for defining global program and operating system parameters. For instance, MY_FLOAT can be defined as either float or double in Object.h. Audio sample based classes implement the tick() method. This method returns a MY_FLOAT or a MY_MULTY (a pointer to MY_FLOAT for multichannel audio). Inside this method, all computations take place. The lastOut() method returns the last result of a computation allowing a single source to feed multiple consuming objects without having to copy the result in an external variable.
STK implements only single-sample tick() functions minimizing memory usage, allowing to build short recursive loops and guaranteeing minimum latency. No specific support for vectorized classes is planned but they are designed to allow easy conversion.
At its core, STK uses the unit generator paradigm from Music N (see section 2.6.1). All unit generators derive from the Instrument base class. Instrument classes include envelopes, filters, noise generators, nonlinearities, and data input/output handlers. WvIn and WvOut and associated classes allow to handle .wav, .snd, .mat (Matlab) and .raw files as well as real-time audio input and output.
There are many different synthesis algorithms: oscillator-based additive, subtractive, FM, modal, sampling, physical models of string and wind instruments and physically inspired particle models. Several models are provided for the voice and more are planned for the future. It also includes several simple delay based effects for reverberation, chorus, flanger and pitch shifting.
STK control sources connect to synthesis programs via pipes and sockets allowing for networked connections and decoupling audio synthesis from control generation. An input handler MD2SKINI converts input MIDI controls to the SKINI score format (see section 2.6.2).