In [1]:
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import librosa
import librosa.display
In [2]:
oggfile = librosa.util.example_audio_file()
In [3]:
oggfile
Out[3]:
In [18]:
y, sr = librosa.load('../data/AudioData/JE/a01.wav')
In [19]:
plt.plot(y)
Out[19]:
In [20]:
sr
Out[20]:
In [148]:
S = librosa.feature.melspectrogram(y, sr=22050, n_mels=128, n_fft=512, hop_length=384)
print(S.shape)
In [150]:
librosa.display.specshow(librosa.power_to_db(S, ref=np.max),
y_axis='mel', x_axis='time')
Out[150]:
In [152]:
np.min(S), np.max(S)
Out[152]:
In [67]:
from scipy import signal
In [104]:
f, t, Sxx = signal.spectrogram(y, 22050)
In [106]:
plt.pcolormesh(t, f, Sxx)
plt.xlabel('time (s)')
plt.ylabel('frequency [hz]')
plt.show()
In [ ]: