improving classification performance with mel frequency cepstral coefficients we have already learned that fft is pointing us in the right directionbut in itself it will not be enough to finally arrive at classifier that successfully manages to organize our scrambled directory containing songs of diverse music genres into individual genre directories we somehow need more advanced version of it at this pointit is always wise to acknowledge that we have to do more research other people might have had similar challenges in the past and already found out new ways that might also help us and indeedthere is even yearly conference only dedicated to music genre classification organized by the international society for music information retrieval (ismirapparentlyautomatic music genre classification (amgcis an established subfield of music information retrieval (mirglancing over some of the amgc paperswe see that there is bunch of work targeting automatic genre classification that might help us one technique that seems to be successfully applied in many of those works is called mel frequency cepstral coefficients (mfccthe mel frequency cepstrum (mfcencodes the power spectrum of sound it is calculated as the fourier transform of the logarithm of the signal' spectrum if that sounds too complicatedsimply remember that the name "cepstrumoriginates from "spectrum"with the first four characters reversed mfc has been successfully used in speech and speaker recognition let' see whether it also works in our case we are in lucky situation where someone else has already needed exactly what we need and published an implementation of it as the talkbox scikit we can install it from the mfcc(functionwhich calculates the mfc coefficients as followsfrom scikits talkbox features import mfcc sample_ratex scipy io wavfile read(fncepsmspecspec mfcc(xprint(ceps shape( the data we would want to feed into our classifier is stored in cepswhich contains coefficients (the default value for the nceps parameter of the mfcc(functionfor each of the frames for the song with the filename fn taking all of the data would overwhelm our classifier what we could do instead is to do an averaging per coefficient over all the frames assuming that the start and end of each song are possibly less genre-specific than the middle part of itwe also ignore the first and last percentx np mean(ceps[int(num_ceps* / ):int(num_ceps* / )]axis=