Forums > Dev

### writing coef notch

Nov 11 2011 | 4:23 am

Dear all I try to write coeff notch object any comment is welcome so the idea is this :

//notch: H(s) = (s^2 + 1) / (s^2 + s/Q + 1);
// omega = 2*PI*CutOff_Frequency/Sampling_Frequency;
//sn = sin(omega);
//cs = cos(omega);
//alpha = sn/(2*Q);

//a0 = 1;
//a1 = -2*cs;
//a2 = 1;
//b0 = 1 + alpha;
//b1 = -2*cs;
//b2 = 1 – alpha;
//Q= CutOff_Frequency/BW_Coeff
void _coef_notch_Test(short int *Data_In,
short int *Data_Out,
long nData_Length,
double Sampling_Frequency,
double CutOff_Frequency,
double BW_Coeff)
{

{
// If wrong parameters:
if((NULL == Data_In)||(Data_Out)||(nData_Length < = 0)) return;
if((Sampling_Frequency < 0.0)||(CutOff_Frequency < 0.0)) return;
if(CutOff_Frequency > (Sampling_Frequency/2)) return;
if((BW_Coeff < = 0.0)||(BW_Coeff >= 1.0)) return;

//constantes:
static const double PI = 3.141592654;
static const double Sampling_Frequency = 22050;

//filter coefficients :

double a0 = 1;
double a1 = -2 * cos(2*PI*CutOff_Frequency/Sampling_Frequency);
double a2 = 1;
double b0 = 1 + sin(2*PI*CutOff_Frequency/Sampling_Frequency)/(2*(CutOff_Frequency/BW_Coeff));
double b1 = -2 * cos(2*PI*CutOff_Frequency/Sampling_Frequency);
double b2 = 1 – sin(2*PI*CutOff_Frequency/Sampling_Frequency)/(2*(CutOff_Frequency/BW_Coeff));

I try write an equivalent of maxmsp patcher.

###### Attachments:
1. coefnotch.maxpat
Nov 22 2011 | 10:06 am

ehm, so what is the question exactly? did you try to implement this?

Nov 24 2011 | 11:52 pm

Yes Timo, I try to implement this/

Viewing 3 posts - 1 through 3 (of 3 total)

Forums > Dev