Code example in C++ by Pieter Suurmond, march 2, 2004 - COPYLEFT, demonstrating: 1) How to implement linear difference equations as C++ objects. Focussing on a systems that became known as 'Karplus Strong'. 2) How to write AIFF files (on both big and little endians). 3) How to integrate pieces of C code into a larger C++ program. C++ object ========== ks.hxx Definition (i.e. specification) of the KS class. ks.cxx Source that implements our KS class, that is, allocating and running linear difference equations in the form y[n] = 0.49609375 (x[n] + y[n-L] + x[n-1] + y[n-L-1]). C object ======== wraiff.h C API for writing AIFF files. wraiff.c Implementation (in object oriented ISO/ANSI C style). C++ object ========== wraiff.hxx The same but now in C++ (just wrapping the above header). wraiff.cxx Just wrapping the above C code. C++ program =========== main.cxx C++ program containing main(). It uses both above objects, KS to pluck strings, WRAIFF to write the result to audiofile. Compilation =========== Makefile Tells how to do it on UNIX (also Mac OSX). Users with a graphical interface on top of their compilers can simply put the 3 sourcefiles ks.cxx, wraiff.cxx and main.cxx in an standard C++ project. That's all. Output ====== ks.aiff Is the audio result.