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

📄 afnd_07.cc

📁 这是一个从音频信号里提取特征参量的程序
💻 CC
字号:
// file: $isip/class/sp/AudioFrontEnd/afnd_07.cc// version: $Id: afnd_07.cc,v 1.22 2002/10/17 19:31:42 gao Exp $//// isip include files//#include "AudioFrontEnd.h"#include <Sdb.h>// method: getVector//// arguments://  Vector<VectorFloat>& coeffs: (output) coefficients//  long frame_index: (input) frame index//  // return: a boolean value indicating status//// this method retrieves data from the internal buffers.//boolean AudioFrontEnd::getVector(Vector<VectorFloat>& coeffs_a,				 long frame_index_a) {  coeffs_a.setLength(1);  boolean status = getVector(coeffs_a(0), 0, frame_index_a);  long nchan = buf_d.getBuffer().length();  if (nchan > 1) {    coeffs_a.setLength(nchan);    for (long i = 1; i < nchan; i++) {      status &= getVector(coeffs_a(i), i, frame_index_a);    }  }  return status;}// method: isNameInput//// arguments://  const String& name: (input) needed coefficient name//  // return: a boolean value indicating status//// this method checks whether the specified coefficient name is// available among the inputs.//boolean AudioFrontEnd::isNameInput(const String& name_a) const {  // if input file do not exist, directly return true  //  if (!input_flag_d && name_a.eq(SAMPLED_DATA_NAME)) {    return true;  }    // if audio data is available allow for that name  //  if (audio_input_d.isOpen() && name_a.eq(SAMPLED_DATA_NAME)) {    return true;  }  // check the input coefficient hash  //  if (feature_input_d.isOpen()) {    String str(Recipe::INPUT_PREFIX);    str.concat(feature_input_d.getName());    if (str.eq(name_a)) {      // name found      //      return true;    }  }  // name not found  //  return false;}// method: getInputNames//// arguments://  Vector<String>& name: (output) list of inputs//  // return: a boolean value indicating status//// this method returns a list of all inputs//boolean AudioFrontEnd::getInputNames(Vector<String>& name_a) {  // clear the output  //  name_a.clear();  // if input file do not exist, directly copy a dummy starting point  //  if (!input_flag_d) {    name_a.concat(SAMPLED_DATA_NAME);  }  // if audio data is available allow for that name  //  if (audio_input_d.isOpen()) {    name_a.concat(SAMPLED_DATA_NAME);  }  // if feature data is available allow for that name  //  else if (feature_input_d.isOpen()) {    name_a.concat(feature_input_d.getName());  }  // exit gracefully  //  return true;}// method: configureComponents//// arguments: none//  // return: a boolean value indicating status//// this method passes information on this data into each process//boolean AudioFrontEnd::configureComponents() {  // get the signal length between users specify and real file  // signal  //  long num_frames = getNumFrames();    signal_duration_d = frame_duration_d * (float)num_frames;    // loop over all channels  //  for (long ctag = 0; ctag < num_channels_d; ctag++) {          // loop over all lags    //    for (long i = 0; i < coef_components_d.length(); i++) {      // loop over all processes in this list      //      for (boolean more = coef_components_d(i).gotoFirst();	   more; more = coef_components_d(i).gotoNext()) {      	Component* algo = coef_components_d(i).getCurr();	// set the sample frequency, freq, etc	//	algo->setFrameDuration(frame_duration_d);	algo->setSampleFrequency(sample_frequency_d);	algo->setSignalDuration(signal_duration_d);	algo->setBasename(id_d);	if (output_extension_d.length() > 0)	  algo->setOutputExtension(output_extension_d);	if (output_type_flag_d)	  algo->setOutputType(output_type_d);      }    }  }  // exit gracefully  //  return true;}

⌨️ 快捷键说明

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