Kai Lassfolk
Department of Musicology
P.O.Box 35 (Vironkatu 1)
00014 University of Helsinki
Finland
E-Mail: kpl@elisir.helsinki.fi
This document is a revised version of the paper published in The Proceedings Of The 1995 International Computer Music Conference.
SPKit was originally designed as a framework for student projects on object-oriented digital audio signal processing. The system was first implemented in Objective-C under the NEXTSTEP operating system. However, the design proved to be elegant enough for further development. To enhance portability to other platforms, SPKit was re-written in C++. In the future, SPKit may grow into a full-featured sound synthesis and processing language.
SPKit objects are connected in a C++ program to form a patch, where the first object is a "reader" (an instance of the class SPKitReader) and the last one is a "writer" (an instance of SPKitWriter). Other objects in a typical SPKit patch simulate conventional signal processing or flow control units. When all objects are connected and initialized, a "run" call is issued on the writer. It executes the call by requesting samples from its "input" in a loop, one sample on each iteration. The run routine terminates when the writer's input object runs out of samples. The reader object reads the processed audio samples from a data stream such as a sound file or a pasteboard. Respectively, the writer writes the resulting samples to a data stream. SPKitReader and SPKitWriter classes also hide sound file format specific details such as sample encoding. Samples are passed between objects in floating point format.
In addition, an SPKit class may need to implement an initialization routine named setInput, which connects the object to its signal input and performs other initialization routines. SPKitProcessor, through its default setInput member function, automatically initializes some fundamental parameters, such as sampling rate and channel count. These parameters are accessible by derived classes as protected data members. A new class may also need additional member functions e.g. for setting and retrieving parameter data.
SPKit includes classes demonstrating code re-use through both inheritance and aggregation. Inheritance is demonstrated by a set of Butterworth filters, where an abstract base class implements the getSample member function implementing the sample processing algorithm common to all Butterworth filter variants, and the setInput member function for initialization and memory allocation. These functions are inherited by derived (concrete) classes which implement the low-pass, high-pass, band-pass and band-reject filter variants. The derived classes differ only in the implementation of setCutoffFreq (set cutoff frequency) or setCenterFreqAndBW (set center frequency and bandwidth) member functions.
Aggregation is demonstrated by a Schroeder reverberator, which consists of comb filters and allpass networks. They in turn consist of delay lines as well as signal routing modules including multiplexers, amplifiers and sum units. Each module in the Schroeder reverberator is implemented as a distinct class.
SPKit is developed under the NEXTSTEP operating system but is designed to be portable to practically any platform providing an AT&T CFront 2.0 compatible C++ compiler. SPKit includes on-line documentation in HTML format with links to up-to-date manuals and software updates over the Internet. The first public release of the software is scheduled for September 1995.
Several students from the Department of Musicology have contributed to the design and implementation of SPKit. In particular, Janne Halmkrona and Juha Henriksson wrote several classes and helped to test and debug the Objective-C version. Mikko Rinne has implemented a phase vocoder in C++ (to be included in a later version of SPKit), including classes for signal processing in the frequency domain.