Forums

Hilbert transforms and sampling rate?

Started by MatthewA February 19, 2018
Hi all,

My knowledge of biquad filter coefficients isn't great but from what I've experienced, they change based on sampling rate.  but I've bumped into these two examples of hilbert transforms online and neither takes sampling rate into account.  Are they okay to use or are they just based on 44.1kHz?

Thanks,
Matt

// hilbert quadrature filter
hilbertBiquad(x0) {

	x1 = biquadTdf2(x0, 0.94657, -1.94632, 1., -1.94632, 0.94657);
	x2 = biquadTdf2(x1, 0.06338, -0.83774, 1., -0.83774, 0.06338);

	y1 = biquadTdf2(x0, -0.260502, 0.02569, 1., 0.02569, -0.260502);
	y2 = biquadTdf2(y1, 0.870686, -1.8685, 1., -1.8685, 0.870686);

	return x2, y2; // real, imaginary
}

// polyphase IIR filter
polyphaseIIR(y0) {
	// one sample delay
	History x0(0);
	// first phase allpass cascade
	x1 = biquadTdf2(x0, 0.479401,	0., -1., 0.,	-0.479401);
	x2 = biquadTdf2(x1, 0.876218,	0., -1., 0.,	-0.876218);
	x3 = biquadTdf2(x2, 0.976599,	0., -1., 0.,	-0.976599);
	x4 = biquadTdf2(x3, 0.9975,		0., -1., 0.,	-0.9975);
	// second phase allpass cascade
	y1 = biquadTdf2(y0, 0.161758,	0., -1., 0.,	-0.161758);
	y2 = biquadTdf2(y1, 0.733029,	0., -1., 0.,	-0.733029);
	y3 = biquadTdf2(y2, 0.94535,	0., -1., 0.,	-0.94535);
	y4 = biquadTdf2(y3, 0.990598,	0., -1., 0.,	-0.990598);
	// update
	x0 = y0;
	// real, imaginary
	return x4, y4;
}