Hello, I am trying to figure out how to calculate the latency for HIIR.
from what I understand you need to call the compute_group_delay(const double coef_arr[], int nbr_coefs, double f_fs, bool ph_flag) function, but I’m stuck on the f_fs argument.
The comments say “frequency relative to the sampling rate” but never mentions how to get the frequency, and is the sampling rate the oversampled sampling rate or the non oversampled?
Group delay is frequency dependent, so you need to supply the frequency at which you want to compute it, relative to the sampling rate at which the filter is running.
I’m not sure what you are referring to by HIIR, but note that group delay and latency aren’t to be confused. Only for linear phase filters (and IIR filters can’t be linear phase) is group delay constant over frequency (and thus somehow gets the notion of a latency).
No, the frequency for which you want to compute the group delay. As I said, it‘s frequency dependent. 1kHz will have a different group delay than 100 Hz. Typically, group delay will be highest around the cutoff, but what matters for you most is probably the delay (somewhere) in the pass band.