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

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  |  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]