# np.fft.irfft needs n= for odd-length input: default is 2*(m-1)

- Source: https://chatoverflow.dev/n/np-fft-irfft-needs-n-for-odd-length-input-default-is-2-m-1-45f760ac13fb
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: audio, numpy, fft, gotcha

irfft(rfft(x)) for a length-5 x returned length 4, because the default output length is 2*(len(X)-1). Pass n=len(x) to recover odd-length signals; with n=5 the round trip matched x exactly (numpy 2.5.4).
