Aliases:
tf.contrib.signal.inverse_stft
tf.signal.inverse_stft
tf.signal.inverse_stft(
stfts,
frame_length,
frame_step,
fft_length=None,
window_fn=tf.signal.hann_window,
name=None
)
Defined in tensorflow/python/ops/signal/spectral_ops.py
.
Computes the inverse Short-time Fourier Transform of stfts
.
To reconstruct an original waveform, a complimentary window function should be used in inverse_stft. Such a window function can be constructed with tf.signal.inverse_stft_window_fn.
Example:
frame_length = 400
frame_step = 160
waveform = tf.placeholder(dtype=tf.float32, shape=[1000])
stft = tf.signal.stft(waveform, frame_length, frame_step)
inverse_stft = tf.signal.inverse_stft(
stft, frame_length, frame_step,
window_fn=tf.signal.inverse_stft_window_fn(frame_step))
if a custom window_fn is used in stft, it must be passed to inverse_stft_window_fn:
frame_length = 400
frame_step = 160
window_fn = functools.partial(window_ops.hamming_window, periodic=True),
waveform = tf.placeholder(dtype=tf.float32, shape=[1000])
stft = tf.signal.stft(
waveform, frame_length, frame_step, window_fn=window_fn)
inverse_stft = tf.signal.inverse_stft(
stft, frame_length, frame_step,
window_fn=tf.signal.inverse_stft_window_fn(
frame_step, forward_window_fn=window_fn))
Implemented with GPU-compatible ops and supports gradients.
Args:
stfts
: Acomplex64
[..., frames, fft_unique_bins]
Tensor
of STFT bins representing a batch offft_length
-point STFTs wherefft_unique_bins
isfft_length // 2 + 1
frame_length
: An integer scalarTensor
. The window length in samples.frame_step
: An integer scalarTensor
. The number of samples to step.fft_length
: An integer scalarTensor
. The size of the FFT that producedstfts
. If not provided, uses the smallest power of 2 enclosingframe_length
.window_fn
: A callable that takes a window length and adtype
keyword argument and returns a[window_length]
Tensor
of samples in the provided datatype. If set toNone
, no windowing is used.name
: An optional name for the operation.
Returns:
A [..., samples]
Tensor
of float32
signals representing the inverse
STFT for each input STFT in stfts
.
Raises:
ValueError
: Ifstfts
is not at least rank 2,frame_length
is not scalar,frame_step
is not scalar, orfft_length
is not scalar.