catosphere:

(1025, n_frames+4) which is the right number of onesided frequency bins but 4 more frames than what I expected since I cropped the signal.


Hi, since you specified center=True, for each sampled time, a window will be placed so it is centered around that time, and the input will be padded on both sides so that the first and last sample will have sufficient data in the window. Hence you shouldn’t subtracted win_size when calculating n_frames.
See the doc here 10:

If  center  is  True  (default),  input  will be padded on both sides so that the tt-th frame is centered at time t \times \text{hop_length}t×hop_length. Otherwise, the tt-th frame begins at time t \times \text{hop_length}t×hop_length.

This behavior is also consistent with librosa.