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

Compiling the STK Library and Demos

The STK library and demos were built above when make was type in the top-level directory (assuming the JOS Overlay was installed). Here we look a little closer at what was going on there--also, this is how you do it if you don't have the JOS Overlay installed. First we build the STK library, stklib.a, and then build and try out a demo:

$ cd ~/stk/stk/src
$ make
g++ -g -Wall ... -c Stk.cpp -o Debug/Stk.o
g++ -g -Wall ... -c Noise.cpp -o Debug/Noise.o
...
/bin/rm -f libstk.a
ar -rsc libstk.a Debug/*.o
$
$ cd ../projects/demo
$ make
g++ -g -O2 -Wall ... -c ../../src/Stk.cpp -o Debug/Stk.o
g++ -g -O2 -Wall ... -c ../../src/Generator.cpp -o Debug/Generator.o
...
g++ -g -O2 -Wall ... -o Md2Skini Md2Skini.cpp Debug/Stk.o 
                        Debug/RtMidi.o -lasound -lpthread -lm  
$ Physical.bat
(Yes, the .bat files are executable files, even under UNIX.) The file
Physical.bat contains the following line:
wish < tcl/Physical.tcl | demo Clarinet -or -ip
The program wish is a UNIX shell supporting Tcl/Tk commands for constructing a graphical user interface (GUI) [5]. If you have Tcl/Tk installed, the wish program should be available. Say ``man wish'' to find out more about it. If you don't have it, yum install tk will install it on a Fedora system.7

Figure 1: Tcl/Tk GUI launched by the STK demo Physical.bat.
\includegraphics[width=!,height=6.5in]{eps/Physical4p2p1.eps}
After invoking Physical.bat, you should be looking at a GUI which presents a number of buttons and sliders, as shown in Fig. 1. Press the NoteOn button, and you should hear a pleasant woodwind-like sound. Try increasing the vibrato amplitude with the Vibrato Amplitude slider. Next, play with the Breath Pressure slider to see how the instrument responds.

If you don't hear sound, you probably have a sound card problem. Read the file INSTALL in the main stk directory for pointers and suggestions. See also the file myproj/delay/README (toward the end) for a short trouble-shooting guide for sound playback. One common source of silence in the STK is trying to play sound at a sampling-rate not supported by the sound hardware.8


Next  |  Prev  |  Up  |  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]