Skip to content

Instantly share code, notes, and snippets.

@dmastropole
dmastropole / mel_bands.py
Last active October 17, 2019 00:54
Mel Bands
# Compute the mel bands
n_bands = 25
# The "+ 2" will make sense in a bit!
m = np.linspace(mel_formula(f_low), mel_formula(f_high), n_bands + 2)
print(m)
@dmastropole
dmastropole / dct.py
Last active October 17, 2019 18:42
DCT
# Perform a DCT
from essentia.standard import DCT
dct = DCT(inputSize=n_bands, outputSize=13)
mfccs = dct(log_mels)
plt.bar(np.arange(len(mfccs)), mfccs, align='center')
plt.title('Mel-Frequency Cepstrum')
plt.xlabel('Cosines')
plt.ylabel('Coefficients')
@dmastropole
dmastropole / plot_mfccs.py
Last active October 17, 2019 18:43
Plot MFCCs
# Plot MFCCs
plt.imshow(mfccs,
aspect='auto',
origin='lower',
interpolation='none',
cmap=plt.cm.Blues)
plt.title("MFCCs")
plt.xlabel("Frames")
plt.ylabel("MFCCs")