0
$\begingroup$

I want to write an speaker recognition application (based on some password recorded few times for the authorized person).

I've decided to do it with C++ and BASS library (http://www.un4seen.com/).

I managed to get the FFT data (calculated for each update() with the active microphone stream):

float fft[1024];
BASS_ChannelGetData(chan, fft, BASS_DATA_FFT2048); // get the FFT data

I send the data to the buffer so I can draw it in real-time:

// "normal" FFT
memset(specbuf, 0, SPECWIDTH*SPECHEIGHT);
for (x = 0; x<SPECWIDTH / 2; x++) {
y = sqrt(fft[x + 1]) * 3 * SPECHEIGHT - 4; // sqrt makes low values more visible
//y = fft[x + 1] * 10 * SPECHEIGHT; // linear scale (alternative)
if (y>SPECHEIGHT) y = SPECHEIGHT; // cap it
if (x && (y1 = (y + y1) / 2)) // interpolate from previous to make the display smoother
    while (--y1 >= 0) specbuf[y1*SPECWIDTH + x * 2 - 1] = y1 + 1;
y1 = y;
while (--y >= 0) specbuf[y*SPECWIDTH + x * 2] = y + 1; // draw level
}

The problem is, how to calculate the MFCC from it? I'm a very begging in the field of signal processing, please take it into account.

$\endgroup$
1
$\begingroup$

You might be interested in Hidden Markov Model Toolkit HTK. It is already developed and ready to use so you could compare your results with this.

The link to the tutorial in Nikolay's answer should really be everything you need to begin with. I've made my own MFCC function in MATLAB based on this tutorial and I was very close to HTK. There are some differences in terms of input parameters, filter banks, minimum and maximum frequency but idea is exactly the same.

In MATLAB, if you decided to use it, you could try HTK MFCC MATLAB or PLP and RASTA (and MFCC, and inversion) in Matlab using melfcc.m and invmelfcc.m

$\endgroup$
0
$\begingroup$

First link from the google on "MFCC Tutorial"

http://www.practicalcryptography.com/miscellaneous/machine-learning/guide-mel-frequency-cepstral-coefficients-mfccs/

$\endgroup$
  • $\begingroup$ Yes, I've seen that 5 times. Still I don't know how to calculate it. E.g. in the "Steps at a Glance" chapter, I've done so far the 1. (I guess?). I know that with those parameters BASS applied the window function to the calculated FFT, but maybe I should force it not to it because of some differences. It's hard to determine if the result I get is "right". I'm a beginner in that field and takes me a while to understand if "spectra" is the same thing as "spectrum" from another book ;P Here they say to discard the 1st coefficient, somewhere else to keep the first 13. I'm lost in details. $\endgroup$ – PolGraphic Apr 7 '15 at 22:12
  • 1
    $\begingroup$ You need to ask more specific question then. From the steps you did steps 1) and 2). You need to others starting from 3). For result verification it is better to compare values to some existing toolkit implementing MFCC extraction, there are many of them. For beginner it is advised to study the existing code before starting to write your own. $\endgroup$ – Nikolay Shmyrev Apr 7 '15 at 22:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.