Hi,

I'm trying to search in an audio file based on keyword spotting so i recorded the key words in different .wav files...and then compare the incoming .wav file with the key words...

I applied feature extraction on the incoming .wav file as well as the keyword um using to search by and get the MFCC file for each of them.

my question is how to compare between these 2 MFCC files...most of the articles i found on the net is how to get the MFCC files not how to compare between 2 MFCC files...

Thanks,

Mostafa Fouly

hey,
I compared to files using the following code:

int SpeechIndex = 0;
int Compare(istream &in1, istream &in2,ostream &out) 
{
    char ch1, ch2;
      
    int KeyWord_Length = 0;
    int mismatch = 0;

    while (in1.get(ch1))
    {
        KeyWord_Length++;
        if (!in2.get(ch2) || (ch1 != ch2)) 
        {
            mismatch ++;
            /*cout << "not equal";
            return;*/
        }
    }
    float Accuracy = (float)(KeyWord_Length - mismatch) / (float)KeyWord_Length;
    cout<<Accuracy<<endl;
    SpeechIndex++;
    if(in2.eof())
        return 0;
    ifstream inFile1;
    inFile1.open("e:\\Download.mfc");
    ifstream inFile2;
    inFile2.open("e:\\DownloadDatabase.mfc");
    char temp;
    for(int i=0; i < SpeechIndex; i++)
        inFile2.get(temp);
    Compare(inFile1, inFile2, out);

   /*here when no more characters in in1
   input files are the same iff there are also no more characters in in2*/
  /*if (!in2.get(ch2)) out << "equal";
  else out << "not equal";*/
}

int main() {
ifstream inFile1, inFile2;
int KeyWord_Length = 0;
int Speech_Length = 0;


inFile1.open("e:\\Download.mfc");
  if (inFile1.fail()) {
      cerr << "unable to open file Comp1 for reading" << endl;
      exit(1);
  }
  // Calculate File1 Length

  inFile2.open("e:\\DownloadDatabase.mfc");
  if (inFile2.fail()) {
      cerr << "unable to open file Comp2 for reading" << endl;
      exit(1);
  }
  Compare(inFile1, inFile2, cout);
  return 0;
}

well it works with normal files but files with special encoding don't work efficiently...

for ex: file of size 300kb ends before file of 20kb!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.