Next  |  Prev  |  Up  |  Top  |  REALSIMPLE Top

STK Program for Digital Echo Simulation

The Synthesis Tool Kit (STK) is an object-oriented C++ tool kit useful for rapid prototyping of real-time computational acoustic models.

/* Acoustic echo simulator, main C++ program.
   Compatible with STK version 4.2.1.
   Usage: main inputsoundfile 
   Writes main.wav as output soundfile

#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));

Next  |  Prev  |  Up  |  Top  |  REALSIMPLE Top

Download Delay.pdf
Download Delay_2up.pdf
Download Delay_4up.pdf

``Computational Acoustic Modeling with Digital Delay'', by Julius O. Smith III and Nelson Lee,
REALSIMPLE Project — work supported by the Wallenberg Global Learning Network .
Released 2008-06-05 under the Creative Commons License (Attribution 2.5), by Julius O. Smith III and Nelson Lee
Center for Computer Research in Music and Acoustics (CCRMA),   Stanford University