input 2d complex slice with the shape (ntimes, nfreq)
(default nperseg / 2) short-time frame overlapped length for each FFT segment Returns 1d real slice with the shape (ntimes,)
test stft-istft health
import std.complex; import std.stdio; import mir.ndslice : map, sliced; import numir.testing : approxEqual; // first 16 samples from https://raw.githubusercontent.com/ShigekiKarita/torch-nmf-ss-toy/master/test10k.wav auto xs = [-10, 15, 106, -1, -655, -1553, -1501, -522, -106, 831, 1250, 381, 1096, 2302, 2686, 2427].sliced; // need larger overlaps to revert well auto ys = stft(xs, 8, 7); auto ixs = istft(ys, 7).map!(c => c.re); assert(approxEqual(ixs, xs));
Computes the inverse short time Fourier transform