View source on GitHub |
Computes the inverse Short-time Fourier Transform of stfts
.
tf.signal.inverse_stft(
stfts,
frame_length,
frame_step,
fft_length=None,
window_fn=tf.signal.hann_window
,
name=None
)
To reconstruct an original waveform, a complementary window function should
be used with 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.random.normal(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 with tf.signal.stft
, it must be passed to
tf.signal.inverse_stft_window_fn
:
frame_length = 400
frame_step = 160
window_fn = tf.signal.hamming_window
waveform = tf.random.normal(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 TPU/GPU-compatible ops and supports gradients.
Returns | |
---|---|
A [..., samples] Tensor of float32 /float64 signals representing
the inverse STFT for each input STFT in stfts .
|
Raises | |
---|---|
ValueError
|
If stfts is not at least rank 2, frame_length is not scalar,
frame_step is not scalar, or fft_length is not scalar.
|