# mfcc
MFCC extraction algorithm implmentation for older versions of MATLAB (pre-2018).
### Function description
The MATLAB function file _mfcc.m_ implements the mel-frequency cepstral coefficients (MFCC) extraction algorithm.
Function usage:
```
y = mfcc(x, Tw, Tstep, Fs, window, Flow, Fhigh, Nfilt, Nmfcc, p, D, replC0)
```
A description for all variables involved is given below:
* OUTPUT:
- y = MFCC matrix; size(y) = [#Frames, #MFCC]
* INPUT:
- x = input signal (mono);
- Tw = frame duration [s] (e.g. 0.025 s = 25 ms);
- Tstep = frame step [s] (e.g. 0.01 s = 10 ms);
- Fs = sampling frequency [Hz] (e.g. 16 kHz);
- window = function handler for the windowing (e.g. @hamming);
- Flow = the starting frequency of the mel filterbank (e.g. 80 Hz);
- Fhigh = the tail frequency of the mel filterbank (e.g. Fs/2 = 8 kHz);
- Nfilt = the number of filters in the mel filterank (e.g. 26);
- Nmfcc = the number of MFCCs to return (e.g. 13);
- p = the pre-emphasis HPF coefficient (e.g. 0.97); use 0 to skip pre-emphasis;
- D = the sinusoidal liftering coefficient (e.g. 22); use 0 to skip liftering;
- replC0 = if 1, replaces the first MFCC (C0) with the log-energy, for each frame; use 0 to avoid the replacement.
**Note**: Yes, I am aware [**this**](https://www.mathworks.com/help/audio/ref/mfcc.html) already exists, but, like it says in the title, this is targeted towards users with older versions of MATLAB.
### Unimplemented features
- No argument checking is present in the function -- avoid improper values.
- No function for calculating the delta and delta-delta coefficients is included.
- No multi-to-single channel conversion -- make sure to only use mono recordings.
### Demo script
The file _mfcc\_test.m_ demonstrates how to use the function and provides a few interesting visual results.
You can test it yourself using any audio file or the small sample included in this repository.
**Cheers!**