Next  |  Prev  |  Top  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search

Customizing the STK for Development

Download the file stk4p2p1josoverlay.tar.gz and unpack it as follows (assuming ~/stk/stk/ contains release 4.2.1 of the STK as prescribed above):

 
$ cd ~/stk
$ wget http://ccrma.stanford.edu/~jos/stk4p2p1josoverlay.tar.gz
$ tar -zxf stk4p2p1josoverlay.tar.gz
$ cp -rp stk4p2p1josoverlay/* stk/

Notice that one new directory (~/stk/stk/myproj) has appeared. This directory is logically parallel to the STK projects directory. It is kept separate so that it can be easily copied into new releases of the STK.

Now, as described in the new file ~/stk/stk/INSTALL.jos, to configure and compile the STK, just type, in the directory ~/stk/stk/,

 
configure --enable-debug CFLAGS="-g -O0"
make

The configure command generates all the various Makefiles4 based on automatically detected characteristics of your system [8]. The file INSTALL contains more detailed installation instructions which you should not need under UNIX if you are following this example. On the other hand, it is good to read INSTALL and README for your general edification. Similarly, the doc/ directory should be explored to learn about the STK in general.

The -enable-debug configure-option is desirable during software development. It results in two changes to the C++ compiler options written into the various makefiles:

  1. Symbols are retained in the executable file by adding the -g compiler option.
  2. Optimization level is reduced using the -O2 option in place of the -O3 option. The second argument to configure, namely CFLAGS="-g -O0", sets the optimization level to zero. This is because even optimization level 2 results in eliminated intermediate variables, which cannot be inspected while single-stepping gdb.
Additionally, -enable-debug results in the compile-time macro _STK_DEBUG_ being defined. This turns on debugging code such as assertions and warnings. In particular, various warnings from STK library modules are enabled by the _STK_DEBUG_ macro:
#if defined(_STK_DEBUG_)
  handleError( StkError::DEBUG_WARNING );
#endif

To enable support for the jack audio server, add the configure option -with-jack. The jack server ``owns'' the audio I/O resources, and provides connection services among multiple client applications. If you do not already start the jack server on your Linux system, you can do it using qjackctl (installed with the Planet CCRMA distribution).

The jack audio server is included in the Planet CCRMA5 distribution. Say configure -help in the main STK directory (~/stk/stk in the above examples) to see other STK configuration options.

To test out the added ~/stk/stk/myproj directory from the JOS Overlay, type

 
cd myproj
make
The default make target in the myproj directory makefile is test. Therefore, you should hear a test sound emitted after each subdirectory is made. Before the tests are compiled, however, the STK library is made, so first you will see the many library files being compiled. (See the various Makefiles regarding how this is carried out.) If you do not hear the test sounds, read myproj/delay/README for some trouble-shooting tips.



Subsections
Next  |  Prev  |  Top  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search

Download stkintro.pdf
Visit the book (DRAFT) containing this material.
[How to cite and copy this work] 
``Introduction to the Synthesis Tool Kit (STK)'', by Julius O. Smith III, Music 420 Reader (updated Appendices O and P of the text).
Copyright © 2006-01-16 by Julius O. Smith III
Center for Computer Research in Music and Acoustics (CCRMA),   Stanford University
CCRMA  [Automatic-links disclaimer]