Created
March 8, 2023 15:51
-
-
Save gustheman/f576df0bf3f3eb58e07d0f86c980ac74 to your computer and use it in GitHub Desktop.
Creates a spectrogram based on a waveform
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
import tensorflow_io as tfio | |
tensor = tf.cast(audio_tensor, tf.float32) / 32768.0 | |
spectrogram = tfio.audio.spectrogram( | |
tensor, nfft=512, window=512, stride=256) | |
mel_spectrogram= tfio.audio.melscale( | |
spectrogram, rate=16000, mels=128, fmin=0, fmax=8000) | |
dbscale_mel_spectrogram= tfio.audio.dbscale(mel_spectrogram, top_db=80) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment