Keywords: resample upsample interpolate frequency-domain Fourier scipy
The problem:
from scipy.signal import resample # in Fourier space
for n in [100, 101]:
x = spike( n ) # [100 0 0 ...]
y = resample( x, 2*n ) # interpolate / upsample
print the middle part
plot
n 100 y middle * 100: [ -8 0 5 0 -2 0 -2 0 5 0 -8]
n 101 y middle * 100: [ 0 99 0 -99 0 99 0 -99 0 99 0]
spike is an extreme or silly testcase, but why is odd n so big ?
resample does: rfft( x ), 0-pad that at the end (inside irfft), irfft.
resample doc
resample .py
wikipedia Upsampling
interleaves 0s, [x0 0 x1 0 ...] in the time domain
dsp.stack why-to-pad-zeros-at-the-middle ff.
cheers
— denis 2025-10-28 October