示例#1
0
文件: ebu.hpp 项目: dlevin256/kfr
KFR_SINTRIN expression_pointer<T> make_kfilter(int samplerate)
{
    const biquad_params<T> bq[] = {
        biquad_highshelf(T(1681.81 / samplerate), T(+4.0)),
        biquad_highpass(T(38.1106678246655 / samplerate), T(0.5)).normalized_all()
    };
    return to_pointer(biquad(bq, placeholder<T>()));
}
示例#2
0
/**
 * Given a sample rate, a buffer of 3 samples, the cutoff frequency, and the quality
 * of the filter, will return a single sample
 ***/
float filtLowPass(float sampRate, filtStream_t* stream, double cutoff, float q )
{
	double w0 = 2 * M_PI * (cutoff / sampRate);

	double sinw0 = sin(w0);
	double cosw0 = cos(w0);

	double alpha = sinw0 / (2 * q);

	filter_t LPF;

	LPF.b0 =  (1 - cosw0)/2;
	LPF.b1 =   1 - cosw0;
	LPF.b2 =  (1 - cosw0)/2;
	LPF.a0 =   1 + alpha;
	LPF.a1 =  -2 * cosw0;
	LPF.a2 =   1 - alpha;

	double y = biquad(&LPF, stream);
	return y;
}