I need to compare some melcpstrums (audio coefficients).
For example, the 11 mceps for one audio are
mcepsA[0]=4.93723823
mcepsA[1]=2.3972343
mcepsA[2]=1.2305712
etc.
Now I need to compare these with 11 different mceps, for example with
mcepsB[0]=3.9902323
mcepsB[1]=1.988323
mcepsB[2]=9.93723
etc.
I am calculating the audible difference like this:
double diff=0;
for (unsigned int i=0;i<11;i++)
{
if (mcepsA[i] > mcepsB[i])
{
diff+=mcepsA[i]-mcepsB[i];
}
else
{
diff+=mcepsB[i]-mcepsA[i];
}
}
However, storing all the mcep values is really problematic for me. Unfortunately I am not a mathematician. Is there somebody here who recognizes this problem and perhaps knows a solution for me where I can perhaps store all mcepsA in one value instead of having 11 of them?
Thank you for the help.
Your 11 cepstrum values are deduced from hundreds, if not thousands of audio samples. You really, really need to check where your performance problems are originating; it's rather unlikely that these few lines are the problem.
That said, use diff += abs(mcepsA[i]-mcepsB[i]);
.