/[marvin]/marvin/src/gui/identify_user.cc
ViewVC logotype

Diff of /marvin/src/gui/identify_user.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by castor_fou, Tue Sep 16 20:25:36 2003 UTC revision 1.5 by srv89, Wed Sep 17 00:44:58 2003 UTC
# Line 181  DiscSignal *open_wav_file(const char *fi Line 181  DiscSignal *open_wav_file(const char *fi
181    return (new DiscSignal(data, size));    return (new DiscSignal(data, size));
182  }  }
183    
184  static DiscSignal *create_mfcc(std::string path)  static DiscSignal create_mfcc(std::string path)
185  {  {
186    DiscSignal    *wav, *window, *res;    DiscSignal    *wav, *window, res(NULL, 0);
187    unsigned      max;    int   max;
188    mfcc          *make;    mfcc          *make;
189        
   std::cout << "Dans create mfcc" << std::endl;  
190    wav = open_wav_file(path.c_str());    wav = open_wav_file(path.c_str());
191    std::cout << "open wav file" << std::endl;    //wav->perl_capture();
   wav->perl_capture();  
192    max = -wav->min() > wav->max() ?    max = -wav->min() > wav->max() ?
193      wav->min() :      wav->min() :
194      wav->max();      wav->max();  
   std::cout << "Mouarf !!!" << std::endl;  
195    if (max < 512)    if (max < 512)
196      {      {
197        std::cerr << "Sorry: max(" << max<< ") < 512" << std::endl;        std::cerr << "Sorry: max(" << max<< ") < 512" << std::endl;
198        assert(0);        assert(0);
199      }      }
200    std::cout << "max calcule" << std::endl;    window = &wav->windowing_size(max - 512, 1024);
201    window = &wav->windowing(max - 512, max + 512);    //window->perl_capture();
   std::cout << "windowing fait" << std::endl;  
   std::cout << max << " "<<window->length() << std::endl;  
   window->perl_capture();  
   std::cout << "perl capture" << std::endl;  
202    make = new mfcc(*window);    make = new mfcc(*window);
203    std::cout << "mfcc faite" << std::endl;    res = make->get_result();
204    *res = make->get_result();    res.perl_capture();
   std::cout << "resultat acquis" << std::endl;  
205    return res;    return res;
206  }  }
207    
# Line 217  double *create_tab() Line 209  double *create_tab()
209  {  {
210    std::string file;    std::string file;
211    double *tmp = (double *)calloc(sizeof (double), 12 * NB_RECORD);    double *tmp = (double *)calloc(sizeof (double), 12 * NB_RECORD);
212    DiscSignal *res;    DiscSignal res(0, 0);
213    int k, i;    int k, i;
214    
215    if (tmp == NULL)    if (tmp == NULL)
# Line 229  double *create_tab() Line 221  double *create_tab()
221        file += ".wav";        file += ".wav";
222        std::cout << "path crée" << std::endl;        std::cout << "path crée" << std::endl;
223        res = create_mfcc(file);        res = create_mfcc(file);
224          if (res.length() == 0)
225            exit(51);
226        std::cout << "mfcc create" << std::endl;        std::cout << "mfcc create" << std::endl;
227        if (res == NULL)        for (int j = 1; j < res.length(); j++, k++)
228          {          tmp[k] = res.get_data()[j];
           std::cerr << "DiscSignal null" << std::endl;  
           exit(1);  
         }  
       for (int j = 1; j < res->length(); j++, k++)  
         tmp[k] = res->get_data()[j];  
229        std::cout << "tab rempli" << std::endl;        std::cout << "tab rempli" << std::endl;
230      }      }
231    std::cout << "tab\n" << tmp << std::endl;    std::cout << "tab\n" << tmp << std::endl;

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26