python-acoustics icon indicating copy to clipboard operation
python-acoustics copied to clipboard

minimum_phase method returns a longer input sequence when n is longer than the input

Open 7sharp9 opened this issue 2 years ago • 0 comments

If I use minimum_phase like this:

def next_power_of_2(x):
    return 1 if x == 0 else 2 ** np.ceil(np.log2(x)).astype('int')
    
n = next_power_of_2 (len(signal))
mpt = minimum_phase(signal, n)

Then I get back a size of mpt thats being minimum phase transformed thats the same size as the expanded fft, rather than the original signal length.

I think something like this would need to be done:

m = np.fft.ifft(np.exp(np.fft.fft(window[:len(x)] * ceps))).real

7sharp9 avatar Jan 18 '24 22:01 7sharp9