# Music recommendation by Cepstral coefficients

I have to make a music recommender system by taking signal features. I have decided to take MFCC coefficients as feature vector. So I extracted a dataset of 13 MFCC coefficients for each song. Here the problem is MFCC coefficients are taken at each time sample so the row size is pretty large. So for each song a huge matrix is generated as feature vector.

• How should I come up with this ?
• Should I take mean of MFCC ?
• Any advice how to make MFCC for each song as one dimensional feature vector ?
• MFCCs are something only defined over vectors of samples. You can't, mathematically, have one set of MFCC for every sample. I don't know what you're actually doing, but it seems strange; are you overlapping things? Please add formulas detailing what you're doing. – Marcus Müller Mar 8 '17 at 22:29
• I have taken the dataset from cal500data The link is calab1.ucsd.edu/~datasets/cal500/cal500data . Example for a song it has mfcc features like this: – Nazmus Salehin Mar 8 '17 at 22:35
• I don't care about the data, first you'll have to explain how you calculate your 13 coefficents. – Marcus Müller Mar 8 '17 at 22:37
• Well i have not calculated them manually. I found the dataset which has mfccs for each song as a huge number of rows(different number for each song) and columns (13,so i assume 13 coeficients) . I do not know which formula they used. Is is wrong ? Should i manually find mfcc ? – Nazmus Salehin Mar 8 '17 at 22:45
• That huge matrix is your feature vector. Simply ad-hoc reducing it may throw away needed (or unneeded) information needed by your recommender. – hotpaw2 Mar 8 '17 at 22:49

'I have extracted mfcc coefficients for each song' ... I don't know what you mean by this. It's difficult to interpret. In a typical system computing MFCC features a framesize of 8ms - 32ms is used. The most common frame sizes used in communications system are 10ms and 20ms.

Assume a frame has Xms frame size then the window size is typically 2X ms. That is, if you use a 10ms frame, you'll compute the FFT of a 20ms window with each FFT computation having 10ms overlap. This filterbank is commonly referred to as the WOLA (Weighted Overlap and Add) or sometimes OLA (Overlap and Add) filterbank. You can read more here https://ccrma.stanford.edu/~jos/sasp/WOLA_Processing_Steps.html

Some examples of open source software which compute MFCC coefficients in the above manner include the HTK toolkit (http://htk.eng.cam.ac.uk/) and Voicebox (won't let me post the link as my reputation is too low). There are however many more, often times utilizing similar but different techniques.

I am assuming when you talk about creating a matrix of MFCC coefficients that you are creating an MxN matrix of real coefficients. Where M is the number of cepstral coefficients (13 is your suggestion but 24 is more typical) while N is the number of frames for a song of interest.

Some possible solutions (please keep in mind that I haven't done this and am 'shooting from the hip')

1.) Gaussian Mixture Models: Use a GMM classifier for each frame of cepstral coefficients. That is, for each column of your MxN matrix, you can compute a decision that classifies that frame as belonging to a particular class (e.g. rock, pop, classical, speech or noise). The final decision could be determined by selecting the most common classifier.

2.) Neural Networks: Similar to above, but use neural nets ...

3.) Mahalanobis Distance: Compute the mahalanobis distance between the matrix features and the mean/variance of the different classes your trying to detect.

4.) Many many more ...

Solutions 1 and 2 will some amplitude dependence unless you normalize the coefficients. You may want to experiment with different normalization techniques in your training/verification of these approaches.

I would not go with mean or average since it might suppress the content if there are peaks.