Inverse of the short-term Fourier transform
This function returns a wave object from a complex STFT matrix by computing the inverse of the short-term Fourier transform (STFT)
a complex matrix resulting of a short-term Fourier transform.
sampling frequency of the original
FFT window length for the analysis (even number of points).
overlap between successive FFT windows (in %, by default 75%, see the Details section).
character string specifying the FFT window name, see
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 OLA-constraint. 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
stft input data must be complex.
This function is used by
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
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)
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.