The Synthesis Tool Kit (STK) is an object-oriented C++ tool kit useful for rapid prototyping of real-time computational acoustic models.
#include "FileWvIn.h" /* STK soundfile input support */ #include "FileWvOut.h" /* STK soundfile output support */ #include "Stk.h" /* STK global variables, etc. */ static const int M = 20000; /* echo delay in samples */ static const StkFloat g = 0.8; /* relative gain factor */ #include "delayline.c" /* defined previously */ int main(int argc, char *argv[]) { unsigned long i; FileWvIn input(argv[1]); /* read input soundfile */ FileWvOut output("main"); /* creates main.wav */ unsigned long nframes = input.getSize(); for (i=0;i<nframes+M;i++) { StkFloat insamp = input.tick(); output.tick(insamp + g * delayline(insamp)); } }