Skip to content

Instantly share code, notes, and snippets.

@dmastropole
Created October 15, 2019 00:00
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 dmastropole/cc155a4351cf9d672134b78f02602810 to your computer and use it in GitHub Desktop.
Save dmastropole/cc155a4351cf9d672134b78f02602810 to your computer and use it in GitHub Desktop.
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)
# Compute MFCCs for all frames
mfccs = []
for frame in FrameGenerator(audio,
frameSize=1024,
hopSize=512,
startFromZero=True):
_, coeffs = mfcc(spectrum(w(frame)))
mfccs.append(coeffs)
# Take the transpose so frames can be plotted on the x-axis
mfccs = essentia.array(mfccs).T
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment