0
点赞
收藏
分享

微信扫一扫

在ADSP21489上使用Biquad双二阶函数使用方法

书写经典 2022-04-26 阅读 160
算法

ToneChip科技致力于音频解决方案,简化使用难度,推广最通俗易懂的算法形式

编译环境:CCES 2.8.0

首先要知道的是库函数Biquad有2种形式

第一种缩放版本


#include <filters.h>
float biquad (float sample,const float pm coeffs[],float dm state[],int sections);

第二种向量版本

#include <filter.h>
float *biquad (const float dm input[],float dm output[],const float pm coeffs[],float dm state[],int samples,int sections);

讲关键参数(关键使用点)

sections指定是几阶,一个Biquad就是一个双二阶,一个双二阶有5个参数,A1, A2, B0, B1, and B2,其实这里还有A0,只不过一般A0 总是等于 1.0(归一化参数)

下面上例程

Scalar-Valued版本

#include <filters.h>
#define NSECTIONS 4
#define NSTATE (2*NSECTIONS)
    float sample, response, state[NSTATE];
    float pm coeffs[5 * NSECTIONS];
    int i;

    for (i = 0; i < NSTATE; i++)
    {
        state[i] = 0;    /* initialize state array */
    }

    response = biquad (sample, coeffs, state, NSECTIONS);

Vector-Valued版本


    include <filter.h>
#define NSECTIONS 4
#define NSAMPLES 64
#define NSTATE (2*NSECTIONS)
    float input[NSAMPLES];
    float output[NSAMPLES];
    float state[NSTATE];
    float pm coeffs[5 * NSECTIONS];
    int i;

    for (i = 0; i < NSTATE; i++)
    {
        state[i] = 0;    /* initialize state array */
    }

    biquad (input, output, coeffs, state, NSAMPLES,
            NSECTIONS);
举报

相关推荐

0 条评论