Next  |  Prev  |  Up  |  Top  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search

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.

#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  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search

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

``Computational Acoustic Modeling with Digital Delay'', by Julius O. Smith III, (From Lecture Overheads, Music 420).
Copyright © 2014-03-24 by Julius O. Smith III
Center for Computer Research in Music and Acoustics (CCRMA),   Stanford University
CCRMA  [Automatic-links disclaimer]