⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 isip_segment_concat.cc

📁 这是一个从音频信号里提取特征参量的程序
💻 CC
字号:
// file: $isip/util/speech/isip_segment_concat/isip_segment_concat.cc// version: $Id: isip_segment_concat.cc,v 1.4 2003/05/07 15:55:11 parihar Exp $//// isip include files//#include "isip_segment_concat.h"// isip_concat_segment: utility that extractes the segmental features.//int main(int argc, const char** argv) {  // configure the command line parser and an Sdb object.  //  Sdb sdb;  CommandLine cmdl(sdb);    cmdl.setUsage(#include "usage_message.text"                );  cmdl.setHelp(#include "help_message.text"               );  cmdl.setIdent("$Revision: 1.4 $",		"$Name: isip_r00_n11 $",		"$Date: 2003/05/07 15:55:11 $");    // add a command line flag for the min-max file generation  //  Boolean min_max_flag;  cmdl.addFlagParam(min_max_flag, OPTION_MIN_MAX_FLAG);  // add a command line option for the min-max (input/output) file type  //  String min_max_file_type;  cmdl.addOptionParam(min_max_file_type, OPTION_MIN_MAX_TYPE, DEF_FILE_TYPE);  // add a command line option for the min-max (input/output) file  //  Filename min_max_file;  cmdl.addOptionParam(min_max_file, OPTION_MIN_MAX_FILE, (Filename)EMPTY);   // add a command line option for the input feature vector dimension  // incase the features are in raw format.  //  Long dim(0);  cmdl.addOptionParam(dim, OPTION_DIM, DEF_DIM);  // add a command line option for the format of the input feature-files  //  String input_file_format;  cmdl.addOptionParam(input_file_format, OPTION_INPUT_FILE_FORMAT,		      DEF_FILE_FORMAT);    // add a command line option for the type of the input feature-files  //  String input_file_type;  cmdl.addOptionParam(input_file_type, OPTION_INPUT_FILE_TYPE, DEF_FILE_TYPE);    // add a command line option for the debug level  //  DebugLevel debug_level;  cmdl.addOptionParam(debug_level, OPTION_DEBUG_LEVEL, DEBUG_LEVEL_DEFAULT);  // add a command line option for the log file  //  Filename log_file;  cmdl.addOptionParam(log_file, OPTION_LOG_FILE, (Filename)LOG_FILE_DEFAULT);  // add a command line option for output file type  //  String output_file_type;  cmdl.addOptionParam(output_file_type, OPTION_OUTPUT_FILE_TYPE, EMPTY);  // add a command line option for the format of the output feature-files  //  String output_file_format;  cmdl.addOptionParam(output_file_format, OPTION_OUTPUT_FILE_FORMAT,		      DEF_FILE_FORMAT);    // add a command line option for suffix  //  String output_suffix;  cmdl.addOptionParam(output_suffix, OPTION_OUTPUT_SUFFIX, EMPTY);        // add a command line option for ratio  //  String ratio;  cmdl.addOptionParam(ratio, OPTION_RATIO, EMPTY);        // add a command line option for transcription database  //  Filename transdb_file;  cmdl.addOptionParam(transdb_file, OPTION_TRANS_DB, (Filename)EMPTY);        // add a command line option for audio database  //  Filename audiodb_file;  cmdl.addOptionParam(audiodb_file, OPTION_AUDIO_DB, (Filename)EMPTY);        // add a command line option for transcription level in the  // transcription database  //  String trans_level;  cmdl.addOptionParam(trans_level, OPTION_TRANS_LEVEL, EMPTY);        // add a command line flag for log-duration feature  //  Boolean duration_flag;  cmdl.addFlagParam(duration_flag, OPTION_DURATION_FLAG);  // add a command line flag for the normalization of the mfcc  // features before extracting the segmental features  //  Boolean normalize_flag;  cmdl.addFlagParam(normalize_flag, OPTION_NORMALIZE_FLAG);  // parse the command line  //  if (!cmdl.parse(argc, argv)) {    cmdl.printUsage();  }    // open the log file  //  if (log_file.ne(L"-")) {    Console::open(log_file);    Console::setLineWrap(File::NO_WRAP);  }  // case 1: if min_max flag is set, compute the min and max in each  // dimension  //  if (min_max_flag) {        // verification incase the user specifies the min_max_flag, check    // for min_max_file    //    if (min_max_file.eq((Filename)EMPTY)) {      cmdl.printUsage();    }        // verification for the audio database file    //    if (audiodb_file.eq((Filename)EMPTY)) {      cmdl.printUsage();    }        // verification incase the user specifies the feature-file format as    // RAW, then, we need the dimension    //    if (input_file_format.eq(FILE_FORMAT_RAW) && ((long)dim <= (long)0)) {      cmdl.printUsage();    };        // set the file format    //    FeatureFile::FILE_FORMAT in_f_format = FeatureFile::SOF;    if (input_file_format.eq(FILE_FORMAT_RAW)) {      in_f_format = FeatureFile::RAW;    }      // set the file type    //    FeatureFile::FILE_TYPE in_f_type = FeatureFile::TEXT;    if (input_file_type.eq(FILE_TYPE_BINARY)) {      in_f_type = FeatureFile::BINARY;    }        // compute the min-max values    //    Vector<VectorFloat> min_max;    SegmentConcat sc;    sc.setDebug(debug_level);    sc.setDimension(dim);    sc.compute(sdb, audiodb_file, in_f_type, in_f_format, min_max);        // write the min-max values to the file    //    Sof tmp_sof;    VectorFloat temp;    tmp_sof.open(min_max_file, File::WRITE_ONLY);    min_max.write(tmp_sof, (long)0);    tmp_sof.close();  }    // case 2: compute the segmental features  //  else  {            // verification incase the user specifies the feature-file format as    // RAW, then, we need the dimension    //    if (input_file_format.eq(FILE_FORMAT_RAW) && ((long)dim <= (long)0)) {      cmdl.printUsage();    };        // verification for ratio    //    if (ratio.eq(EMPTY)) {      cmdl.printUsage();    };        // verification for the audio database file    //    if (audiodb_file.eq((Filename)EMPTY)) {      cmdl.printUsage();    }        // verification for transcription database    //    if (transdb_file.eq((Filename)EMPTY)) {      cmdl.printUsage();    };    // verification for transcription level    //    if (trans_level.eq(EMPTY)) {      cmdl.printUsage();    };    // specifics for normalize flag    //    if (normalize_flag) {            // verification incase the user specifies the normalize flag,      // check for min_max_file      //      if (min_max_file.eq((Filename)EMPTY)) {	cmdl.printUsage();      }    }    // set the file format    //    FeatureFile::FILE_FORMAT in_f_format = FeatureFile::SOF;    if (input_file_format.eq(FILE_FORMAT_RAW)) {      in_f_format = FeatureFile::RAW;    }    FeatureFile::FILE_FORMAT o_f_format = FeatureFile::SOF;    if (output_file_format.eq(FILE_FORMAT_RAW)) {      o_f_format = FeatureFile::RAW;    }      // set the file type    //    FeatureFile::FILE_TYPE in_f_type = FeatureFile::TEXT;    if (input_file_type.eq(FILE_TYPE_BINARY)) {      in_f_type = FeatureFile::BINARY;    }    FeatureFile::FILE_TYPE o_f_type = FeatureFile::TEXT;    if (output_file_type.eq(FILE_TYPE_BINARY)) {      o_f_type = FeatureFile::BINARY;    }    // compute the segmental features    //    SegmentConcat sc;    sc.setDebug(debug_level);    sc.setDimension(dim);    sc.compute(sdb, audiodb_file, transdb_file, in_f_type, in_f_format,	       trans_level, ratio, duration_flag, normalize_flag, min_max_file,	       o_f_type, o_f_format, output_suffix);  }    // exit gracefully  //  return Integral::exit();}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -