# Compute minimum phase version of a FIR

I am working with HRIR filters, in particular I am trying to interpolate them. One commod method in the literature to perform interpolation of HRIR is to use the minimum-phase decomposition and interpolate separately the minimum-phase part of the filter and then the all pass part.

What I am trying to do is to convert my arbitrary HRIR FIR into a minimum phase one. In particular, I am working in Python and I have been using this function.

However while performing the conversion from the original FIR into the minimum-phase one I get the following error:

RuntimeWarning: h does not appear to by symmetric, conversion may fail

With the following code:

min_phase_HRIR_0 = minimum_phase(hrtf, 'hilbert')


Where hrtf is a 256 long FIR extracted from a HRIR database (in particular the HUTUBS database).

If I plot the magnitude of my original FIR and the minimum-phase one I get the following plot: Which is obviously wrong since I am expecting the min phase and the original FIR to have the same magnitude spectrum.

I guess there is something wrong with the Scipy function. Is there anything for Python that converts a FIR into a minimum-phase version?

• The documentation clearly states Convert a linear-phase FIR filter to minimum phase. HRIR are not linear phase and that's exactly what h does not appear to by symmetric means. – Hilmar Feb 6 at 12:40
• Oh, I didn't notice that, my bad. Is there something in Python to compute the min phase version of a FIR? (non restricted to linear phase) – Mattia Surricchio Feb 6 at 13:02
• @JuhaP: that would require you to identify poles and zeros first and that's quite difficult with a measured HRIR. – Hilmar Feb 6 at 15:19
• Why wouldn’t a phase linear implementation preserve the magnitude response? – Dan Szabo Feb 6 at 19:15
• Also, I’d be way more concerned about the minimum phase converted magnitude response deviating than I would be a linear phase conversion. – Dan Szabo Feb 6 at 19:44

## 1 Answer

In the end I used the Hilbert transform to compute the minimum-phase phase of my FIR.

I have used the following formula: Where H is the spectrum of the desired filter.

Which has been used in:

However I am not sure of the results I got.

A follow up question discussing the results and implementation can be found here: minimum-phase phase via Hilbert transform returned values