Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 #include <liatools.h>
00056 #include "alize.h"
00057 #include "EnergyDetector.h"
00058
00059
00060
00061
00062
00063 int main (int argc, char *argv[])
00064 {
00065 using namespace std;
00066 using namespace alize;
00067
00068 ConfigChecker cc;
00069 cc.addStringParam("config", false, true, "default config filename");
00070 cc.addStringParam("inputFeatureFilename",true,true,"input feature - could be a simple feature file or a list of filename");
00071 cc.addStringParam("labelFilesPath",false,true,"path of input and output labels");
00072 cc.addStringParam("saveLabelFileExtension",true,true,"output labelFile extension");
00073 cc.addStringParam("labelOutputFrames",true,true,"output label tag");
00074 cc.addFloatParam("alpha",true,true,"threshold giving the percentage of data of the middle Gaussian to take into account");
00075 cc.addStringParam("segmentalMode",true,true,"file to have a file by file behaviour");
00076
00077
00078 cc.addStringParam("thresholdMode",true,true,"this parameter must be set to select 3 top gaussian. It's a default parameter");
00079
00080 try
00081 {
00082 CmdLine cmdLine (argc, argv);
00083 if (cmdLine.displayHelpRequired ()){
00084 cout << "************************************" << endl;
00085 cout << "********** EnergyDetector.exe *********" << endl;
00086 cout << "************************************" << endl;
00087 cout << endl;
00088 cout << "Speech/Non Speech Detector." << endl;
00089 cout<<cc.getParamList()<<endl;
00090 }
00091 else if (cmdLine.displayVersionRequired ())
00092 cout << "Version 2beta" << endl;
00093 else{
00094
00095 Config tmp;
00096 cmdLine.copyIntoConfig (tmp);
00097 Config config;
00098 if (tmp.existsParam("config")) config.load(tmp.getParam("config"));
00099 cmdLine.copyIntoConfig(config);
00100 cc.check(config);
00101 debug=config.getParam_debug();
00102 if (config.existsParam("verbose")) verbose=config.getParam("verbose").toBool();
00103 else verbose=false;
00104 if (verbose) verboseLevel=1;else verboseLevel=0;
00105 if (config.existsParam("verboseLevel"))verboseLevel=config.getParam("verboseLevel").toLong();
00106 if (verboseLevel>0) verbose=true;
00107
00108 bool energy=true;
00109 if (config.existsParam("turnDetection")) energy=false;
00110 String inputFeatureFileName =config.getParam("inputFeatureFilename");
00111 String extOutput=".lbl";
00112 if (config.existsParam("saveLabelFileExtension")) extOutput=config.getParam("saveLabelFileExtension");
00113 String pathOutput="./";
00114 if (config.existsParam("labelFilesPath")) pathOutput=config.getParam("labelFilesPath");
00115 XLine inputFeatureFileNameList;
00116 try{
00117 XList inputFileNameXList(inputFeatureFileName,config);
00118 inputFeatureFileNameList=inputFileNameXList.getAllElements();
00119 }
00120 catch(FileNotFoundException& e){
00121 inputFeatureFileNameList.addElement(inputFeatureFileName);
00122 }
00123 String *file;
00124 while ((file=inputFeatureFileNameList.getElement())!= NULL){
00125 String & fileName=*file;
00126 SegServer segServer;
00127 if (energy){
00128 SegCluster &outputSeg=energyDetector(config,segServer,fileName);
00129 outputLabelFile(outputSeg,pathOutput+fileName+extOutput,config);
00130 }
00131 }
00132 }
00133 }
00134 catch (alize::Exception & e) {cout << e.toString () << endl << cc.getParamList() << endl;}
00135 return 0;
00136 }
00137