From CCRMA Wiki
Revision as of 15:13, 26 April 2014 by Eberdahl (Talk | contribs) (Created page with 'stk2pd is a script to convert STK objects to Pd objects. This has now been upgraded for STK 4.4.1 (compared to [ version 4.2.1] with binarie…')

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

stk2pd is a script to convert STK objects to Pd objects. This has now been upgraded for STK 4.4.1 (compared to version 4.2.1 with binaries for OS X)

It is currently tested on:

  • Raspberry Pi running Satellite CCRMA (tested by Edgar Berdahl)

It was made by Chris Chafe and Michael Gurevich, 2007.


The code and scripts in this package are provided for free with no warranty. Use at your own risk. The source package includes the rawwaves directory from the STK, which may or may not be covered by a license. The binary Pd objects generated by this package use libstk.a. See the STK source for licensing and legal information about STK.

Getting the Binary Objects

You can either get the souce and compile the objects yourself, or try using the precompiled binary objects.


(Compiled under Satellite CCRMA Raspbian for Raspberry Pi)

Note that these require the rawwaves directory to be located in /usr/share/stk/rawwaves If you don't have a /usr/share/stk directory, you'll need to create it:

   $ sudo mkdir /usr/share/stk

After downloading and uncompressing the externs, navigate to the directory and copy the rawwaves to /usr/share/stk by typing from the terminal:

   $ sudo cp -r rawwaves /usr/share/stk/rawwaves

Compiling from Source

Alternatively, you can download the source here:

1. Get STK4.4.4 You can download and compile it from source from:

1.1 Compile STK4.4.4 Follow the instructions in the STK documentation.

Some of the STK instruments use short sound files that live in a directory called "rawwaves". These are loaded when you load the Pd object, but the path to these must be specified when you compile the STK. When you compile STK, make sure that you set the rawwaves path to somewhere that this directory will live. The precompiled version of these objects sets the path to /usr/share/stk/rawwaves. To set that path, when you configure STK, type:

    stk4.2.1$ ./configure RAWWAVE_PATH="/usr/share/stk/rawwaves/"

1.2 You can then copy the rawwaves directory to the location specified in the previous step (you may first need to create /usr/share/stk):

    stk4.2.1$ sudo cp -r rawwaves /usr/share/stk/rawwaves/

1.3 Now, you can compile STK4.4.4 by typing "make" from its src directory.

2. Autoconf. From the stk2pd directory, type:

    stk2pd$ autoconf

This will generate a configure file.

3. Configure. You probably need to set the pd path and the stk path, and may want to set the installation prefix. You can do this by typing:

   stk2od$ ./configure --with-pd-dir=/path/to/pd/include --with-stk-dir=/path/to/stk --prefix=/where/you/put/your/pd/externs

4. If this is successful, you can type:

   stk2pd$ make

and then

   stk2pd$ make install

This will copy the compiled externs to the installation directory, determined by --prefix

5. Note that to install the help patches, you'll need to copy them manually to where you keep your Pd help patches.

How this (hopefully) works

  • When you type make, the Makefile (generated by configure) calls a shell script called ProcessInstrument.
  • This script generates a .cpp file for each stk instrument in the list defined on first line of the Makefile. The .cpp files are put in the cppfiles directory.
  • To change this list, you can edit the Makefile (or, and then re-run configure).
  • The .cpp files are generated by find and replace, based on the template cpp file called stk2pdTemplate.
  • After each is generated, a Pd extern is compiled into the externs directory.
  • The install: make target stupidly copies the compiled externs and the rawwaves directory to the path set by --prefix.