Skip to content

Instantly share code, notes, and snippets.

@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 / compute_mfccs.py
Created October 15, 2019 00:00
Compute MFCCs
from essentia.standard import MFCC, FrameGenerator
mfcc = MFCC(highFrequencyBound=f_high,
lowFrequencyBound=f_low,
inputSize=1024,
numberBands=n_bands,
numberCoefficients=13,
type='magnitude',
sampleRate=44100)
@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")