HIIR Latency

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?

Thanks

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).

Group delay is a function of frequency. It’s not a constant for IIR filters.

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.

It pretty much depends on what you‘re going to do with the number. What are you trying to achieve?

Maybe you should compute it at various frequencies and then plot the data, so you get a feel of what this means and how your specific filter behaves?