Zero-padding in STFT I a recent topic, it has been told that zero-padding in the STFT can improve it, and avoid some circular convolution related things.

Here is my Python code for STFT : 

fftsize = 8192;  overlap = 4;  hop = fftsize / overlap  # ie hop = 2048 here
w = scipy.hamming(fftsize)       # hamming window

# x is the input signal, I assume it is already of length 2^k, ie no zero padding required for x

# STFT
x_stft = scipy.array([scipy.fft(w*x[i:i+fftsize]) for i in range(0, len(x)-fftsize, hop)])

# ISTFT
y = scipy.zeros(len(x))
for n,i in enumerate(range(0, len(x)-fftsize, hop)):
  y[i:i+fftsize] += scipy.real(scipy.ifft(x_stft[n])) * w    # overlap-add


How can I do the zero padding with this code ? Which array should I enlarge ?

PS : in order to simplify the code, I haven't normalized the window, so for perfect reconstruction, one has to add a multiplying constant, etc. (it's not important here)
For linear time invariant filtering, the best methods are overlap add (e.g. http://en.wikipedia.org/wiki/Overlap%E2%80%93add_method) or overlap save. If latency is an issue that can be improved with "block convolvers" or "segmented overlap add" (e.g. http://www.cs.ust.hk/mjg_lib/bibs/DPSu/DPSu.Files/Ga95.PDF) 

If the processing is time variant, things get a lot more complicated and the right choice of FFT length, analysis window, step size &amp; synthesis window really depends on the specific of the application.

If you don't want to do any processing but just data analysis, the only thing that zero padding does is interpolation in the frequency domain. You get graphs with higher resolution but not more information.