sein
Code: Select all
spectrogram = tf.signal.stft(waveform, frame_length=?, frame_step=?)
spectrogram = tf.abs(spectrogram)
< /code>
Überwählen von Frame_Length = 255 & Frame_Step = 128 i Erhaltendef plot_spectrogram(spectrogram, ax):
# Convert to frequencies to log scale and transpose so that the time is
# represented in the x-axis (columns).
log_spec = np.log(spectrogram.T)
height = log_spec.shape[0]
X = np.arange(2880000, step=height + 1)
Y = range(height)
ax.pcolormesh(X, Y, log_spec)
fig, axes = plt.subplots(2, figsize=(12, 8))
timescale = np.arange(audio.shape[0])
axes[0].plot(timescale, audio.numpy())
axes[0].set_title('Waveform')
axes[0].set_xlim([0, 2880000])
plot_spectrogram(spectrogram.numpy(), axes[1])
axes[1].set_title('Spectrogram')
plt.show()
Die Frage ist also, wie Sie Parameter auswählen, und visualisieren Sie dann