Skip to content

Instantly share code, notes, and snippets.

@AyishaR
Last active March 15, 2021 06:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AyishaR/797500f79e82bd35230fe8d0df82f59a to your computer and use it in GitHub Desktop.
Save AyishaR/797500f79e82bd35230fe8d0df82f59a to your computer and use it in GitHub Desktop.
#Selecting random index from train dataset
ind = int(np.random.uniform()*len(inputs_train))
#Displaying sample spectrogram and audio from train dataset
X = inputs_train[ind]
y = labels_train[ind].argmax()
print("Label :", textLabel(y) )
plt.imshow(X, cmap='hot', interpolation='nearest', aspect='auto')
plt.show()
audio = librosa.core.istft(X, hop_length=hop_len, win_length=win_len)
ipd.Audio(audio, rate=desired_sr, autoplay=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment