// Copyright (c) 2015-2016, XMOS Ltd, All rights reserved // AN00209 app_design // Modified by Teig to also print out the params and the coeffs plus fixed some sloppy errors (5May2022) #include #include "dsp.h" // Results of biquad coeff generation ara normalized such that a0 == 1. // When using lib_dsp biquad functions that data arrays must be DWORD aligned. // Declaring coeffs/state data globablly ensures this while locally does not! // The biquad functions utilize coeffs arrays of length 5 but ... // The coeffs below are arraned as N x 6 to keep coeff arrays DWORD aligned. // From dsp_filters.h #define DSP_NUM_COEFFS_PER_BIQUAD_DWALIGNED (DSP_NUM_COEFFS_PER_BIQUAD + 1) // = 5+1 Double word aligned, else crash // DSP_NUM_STATES_PER_BIQUAD // = 4 #define NUM_PASSES 8 #define NUM_FILTERS 8 int32_t coeff[NUM_FILTERS][DSP_NUM_COEFFS_PER_BIQUAD_DWALIGNED]; // Coefficients for each filter //Note: array size of 6 is chosen to enforce 64 bit alignment for ldd and std int32_t state[NUM_FILTERS][DSP_NUM_STATES_PER_BIQUAD]; // State data for each filter. Init below const char* names[NUM_FILTERS] = { "notch ", "lowpass ", "highpass ", "allpass ", "bandpass ", "peaking ", "lowshelf ", "highshelf", }; #define Q_FORMAT 28 #define GAIN_DB 3.0 #define GAIN_DBs (0b11<