I’m messing around with some audio stuff and the algorithm I’m trying to implement calls for a band-pass second-order FIR filter given by the equation
H(z) = z - z^(-1)
How do I implement such a bandpass filter in C?
I have raw audio data as well as an FFT on that audio data available to me, but I’m still not sure how to implement this filter, neither am I sure exactly what the equation means.
In the image below, I am trying to implement HF3:

z^-1is a unit (one sample) delay,zis one sample into the future. So your filter output at sampleidepends on input samples ati-1andi+1. (In general you can think ofz^-nis an n sample delay.)If you have time domain samples in an input buffer
x[], and you want to filter these samples to an an output buffery[], then you would implement the given transfer function like this:E.g. in C you might process a buffer of N samples like this:
This is a very simple first-order non-recursive high pass filter – it has zeroes at +1 and -1, so the magnitude response is zero at DC (0) and at Nyquist (Fs / 2), and it peaks at Fs / 4. So it’s a very broad bandpass filter.