Skip to content

Instantly share code, notes, and snippets.

@grohith327
Created October 30, 2019 04:18
Show Gist options
  • Save grohith327/0e6b2071b8e3f57961a24d06c495fe33 to your computer and use it in GitHub Desktop.
Save grohith327/0e6b2071b8e3f57961a24d06c495fe33 to your computer and use it in GitHub Desktop.
import librosa
import matplotlib.pyplot as plt
import numpy as np
import librosa.display
data, sr = librosa.load('Dataset/decrease_volume/1.wav')
D = np.abs(librosa.stft(data))
plt.figure(figsize=(20,8))
librosa.display.specshow(librosa.amplitude_to_db(D,ref=np.max),y_axis='log', x_axis='time')
plt.title('Spectrogram')
plt.colorbar(format='%+2.0f dB')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment