This function returns a wave object from a complex STFT matrix by computing the inverse of the shortterm Fourier transform (STFT)
1 
stft 
a complex matrix resulting of a shortterm Fourier transform. 
f 
sampling frequency of the original 
wl 
FFT window length for the analysis (even number of points). 
ovlp 
overlap between successive FFT windows (in %, by default 75%, see the Details section). 
wn 
character string specifying the FFT window name, see 
output 
character string, the class of the object to return, either

The function is based on the inverse of the FFT (see fft
) and on
the overlap add (OLA) method.
The overlap percentage must satisfy the Perfect Reconstruction OLAconstraint. For
the most windows, this constraint is:
ovlp = 100 * (1  1/(4 * n)),
with n being a positive integer.
A default value is set to 75%. We suggest not to change it.
A new wave is returned. The class of the returned object is set with the argument output
.
The stft
input data must be complex.
This function is used by ffilter
, lfs
to
respectively filter in frequency and shift in frequency a sound.
The function can be used to reconstruct or modify a sound. See examples.
Original Matlab code by Hristo Zhivomirov (Technical University of Varna, Bulgaria), translated and adapted to R by Jerome Sueur
spectro
, ffilter
, lfs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  ## Not run:
# STFT and iSTFT parameters
wl < 1024
ovlp < 75
# reconstruction of the tico sound from the stft complex data matrix
data(tico)
data < spectro(tico, wl=wl, ovlp=ovlp, plot=FALSE, norm=FALSE, dB=NULL, complex=TRUE)$amp
res < istft(data, ovlp=ovlp, wn="hanning", wl=wl, f=22050, out="Wave")
spectro(res)
# a strange frequency filter
n < noisew(d=1, f=44100)
data < spectro(n, f=44100, wl=wl, ovlp=ovlp, plot=FALSE, norm=FALSE, dB=NULL, complex=TRUE)$amp
data[64:192, 6:24] < 0
nfilt < istft(data, f=8000, wl=wl, ovlp=ovlp, output="Wave")
spectro(nfilt, wl=wl, ovlp=ovlp)
## End(Not run)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.