How to implement the bandpass filter defined by this equation?

I was messing around with some audio files and the algorithm I'm trying to implement for querying a second-order second-order FIR filter specified by the equation

H(z) = z - z^(-1) 

How to implement such a bandpass filter in C?

I have the source audio data as well as the FFT on this audio data available to me, but I'm still not sure how to implement this filter, and I don’t know exactly what this equation means.

In the image below, I am trying to implement HF3:

Band pass filter

+4
source share
2 answers

z^-1 is a single (one sample) delay, z is a single sample in the future. Thus, the filter output on sample i depends on the input samples at i-1 and i+1 . (In general, you might think that z^-n is the delay for fetching n.)

If you have samples in the time domain in the input buffer x[] , and you want to filter these samples in the output buffer y[] , then you implement this transfer function as follows:

 y[i] = x[i+1] - x[i-1] 

eg. in C, you can process a buffer of N samples as follows:

 for (i = 1; i < N - 1; ++i) { y[i] = x[i + 1] - x[i - 1]; } 

This is a very simple non-recursive high-pass filter of the first order - it has zeros at +1 and -1, so the amplitude response is zero at DC (0) and in Nyquist (Fs / 2), and these are peaks at Fs / 4. Thus, it is a very wide bandpass filter.

+7
source

The FIR filter is multiplied by coefficients and accumulates a bunch of contiguous samples of input data for each output data array. The number of coefficients will be the same as the number of z-members in the correct size of your Z-transform.

Note that a FIR bandpass filter typically requires a lot more terms or coefficients, which is roughly proportional to the steepness of the required bandpasses, so the 2 branches are probably too short for any useful bandpass filtering.

+1
source

Source: https://habr.com/ru/post/1384070/


All Articles