Next  |  Prev  |  Up  |  Top  |  REALSIMPLE Top

Delay Line in C

C Code:


    static double D[M]; /* initialized to zero */
    static long ptr=0;  /* read-write offset */

    double delayline(double x)
    {
      double y = D[ptr]; /* read operation */
      D[ptr++] = x;      /* write operation */
      if (ptr >= M) { ptr -= M; } /* wrap ptr */
      return y;
    }



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
CCRMA