网站公告列表

  没有公告

加入收藏
设为首页
联系站长
您现在的位置: 61IC中国电子在线 >> DSP >> 代码示例 >> TI DSP代码示例 >> C5000 >> 文章正文
  Digital Audio Effects(数字音效处理)DSP开发数值运算方面经典C代码         ★★★ 【字体:
Digital Audio Effects(数字音效处理)DSP开发数值运算方面经典C代码
作者:61IC    文章来源:本站原创    点击数:    更新时间:2007-1-22    

Digital Audio Effects(数字音效处理)DSP开发数值运算方面经典C代码

 


allpass.c - allpass reverberator
 
lowpass.c - lowpass reverberator
 
plain.c - plain reverberator
 
tapi.c - interpolated circular delay-line tap outputs
 
tapi2.c - interpolated circular delay-line tap outputs

 

-------------------------------------------------------------

/* tapi2.c - interpolated tap output of a delay line */

 

double tap2();

 

double tapi2(D, w, q, d)                  /* usage: sd = tapi2(D, w, q, d); */

double *w, d;                             /* \(d\) = desired non-integer delay */

int D, q;                                 /* \(q\) = circular offset index */

{

       int i, j;

       double si, sj;

 

       i = (int) d;                       /* interpolate between \(s\sb{i}\) and \(s\sb{j}\) */

       j = (i+1) % (D+1);                 /* if \(i=D\), then \(j=0\); otherwise, \(j=i+1\) */

 

       si = tap2(D, w, q, i);             /* note, \(s\sb{i}(n) = x(n-i)\) */

       sj = tap2(D, w, q, j);             /* note, \(s\sb{j}(n) = x(n-j)\) */

 

       return si + (d - i) * (sj - si);

}

 

-------------------------------------------------------------

/* tapi.c - interpolated tap output of a delay line */

 

double tap();

 

double tapi(D, w, p, d)                   /* usage: sd = tapi(D, w, p, d); */

double *w, *p, d;                         /* \(d\) = desired non-integer delay */

int D;                                    /* \(p\) = circular pointer to \(w\) */

{

       int i, j;

       double si, sj;

 

       i = (int) d;                       /* interpolate between \(s\sb{i}\) and \(s\sb{j}\) */

       j = (i+1) % (D+1);                 /* if \(i=D\), then \(j=0\); otherwise, \(j=i+1\) */

 

       si = tap(D, w, p, i);              /* note, \(s\sb{i}(n) = x(n-i)\) */

       sj = tap(D, w, p, j);              /* note, \(s\sb{j}(n) = x(n-j)\) */

 

       return si + (d - i) * (sj - si);

}

 

-------------------------------------------------------------

/* plain.c - plain reverberator with circular delay line */

 

double tap();

void cdelay();

 

double plain(D, w, p, a, x)                     /* usage: y=plain(D,w,&p,a,x); */

double *w, **p, a, x;                           /* \(p\) is passed by address */

int D;

{

       double y, sD;

 

       sD = tap(D, w, *p, D);                   /* \(D\)th tap delay output */

       y = x + a * sD;                          /* filter output */

       **p = y;                                 /* delay input */

       cdelay(D, w, p);                         /* update delay line */

 

       return y;

}

 

-------------------------------------------------------------

/* lowpass.c - lowpass reverberator with feedback filter G(z) */

 

double tap(), can();

void cdelay();

 

double lowpass(D, w, p, M, a, b, v, x)

double *w, **p, *a, *b, *v, x;                   /* \(v\) = state vector for \(G(z)\) */

int D;                                           /* \(a,b,v\) are \((M+1)\)-dimensional */

{

       double y, sD;

 

       sD = tap(D, w, *p, D);                    /* delay output is \(G(z)\) input */

       y = x + can(M, a, M, b, v, sD);           /* reverb output */

       **p = y;                                  /* delay input */

       cdelay(D, w, p);                          /* update delay line */

 

       return y;

}

 

-------------------------------------------------------------

/* allpass.c - allpass reverberator with circular delay line */

 

double tap();

void cdelay();

 

double allpass(D, w, p, a, x)                   /* usage: y=allpass(D,w,&p,a,x); */

double *w, **p, a, x;                           /* \(p\) is passed by address */

int D;

{

       double y, s0, sD;

 

       sD = tap(D, w, *p, D);                   /* \(D\)th tap delay output */

       s0 = x + a * sD;

       y  = -a * s0 + sD;                       /* filter output */

       **p = s0;                                /* delay input */

       cdelay(D, w, p);                         /* update delay line */

 

       return y;

}

 

-------------------------------------------------------------

               欢迎点击进入:TI德州中文网   (国内唯一针对TI应用的中文技术网站)    文章录入:admin    责任编辑:admin 
  • 上一篇文章:

  • 下一篇文章:
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    最新热点 最新推荐 相关文章
    数字信号控制器适用成本敏感…
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    站长:61IC 湘ICP备05002478号