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

📄 ht_phone_4.cc

📁 这是处理语音信号的程序
💻 CC
字号:
// file: ht_phone_4.cc//// system include files//#include <string.h>// isip include files//#include "hmm_train.h"#include "hmm_train_constants.h"// method: get_phn_index_cc//// arguments://  char_1** phn_list : (input) the whole phone sequence//  char_1** monophones : (input) the monophones//  int_4 num_mono : (input) the number of monophones//  int_4 ph_size : (input) the context size//  int_4 context_mode : (input) the current context mode//  int_4* phone_map : (input) the phone map used to compute the index//  int_4& mid_phn : (output) index of central phone//// return: a logical_1 indicating success//// this method loops over all the phones in the input sequence and return// the index of each one//int_4 get_phn_index_cc(char_1* phn_list_a, char_1** monophones_a,		       int_4 num_mono_a, int_4 ph_size_a,		       int_4 context_mode_a, int_4* phone_map_a,		       int_4& mid_phn_a, int_4 num_sph_a,		       int_4* sph_index_a) {    // local variables  //  int_4 ind = (int_4)0;  int_4* phn = new int_4[ph_size_a];  char_1* phn_str = (char_1*)NULL;  char_1* tmp_str = (char_1*)NULL;  // start checking the seperate phone  //  tmp_str = (char_1*)strstr((char*)phn_list_a, "-");  if (tmp_str == (char_1*)NULL) {                  // no "-" in this phone    // set the first phone    //    phn[0] = (int_4)0;        // check the middle phone    //    tmp_str = (char_1*)strstr((char*)phn_list_a, "+");        // check if this phone is a monophone    //    if (tmp_str == (char_1*)NULL) {                // no "+" in this phone            // this is a monophone, set the third phone      //      phn[2] = (int_4)0;            // set the middle phone      //      for (int_4 k = 0; k < num_mono_a; k++) {	int_4 ind1 = strlen((char*)phn_list_a);	int_4 ind2 = strlen((char*)monophones_a[k]);	if (ind1 == ind2) {	  if (strcmp((char*)phn_list_a, (char*)monophones_a[k]) == 0) {	    mid_phn_a = k;	    phn[1] = k;	    break;	  }	}      }      ind = phone_map_a[get_nphone_ind_cc(ph_size_a, num_mono_a, phn,					  context_mode_a, num_sph_a,					  sph_index_a)];    }    else {                                      // only "+" in this phone            // set the middle phone      //      tmp_str = (char_1*)strtok((char*)phn_list_a, "+");      for (int_4 k = 0; k < num_mono_a; k++) {	if (strcmp((char*)tmp_str, (char*)monophones_a[k]) == 0) {	  mid_phn_a = k;	  phn[1] = k;	  break;	}      }            // set the third phone      //      tmp_str = (char_1*)strtok(NULL, " ");      for (int_4 k = 0; k < num_mono_a; k++) {	if (strcmp((char*)tmp_str, (char*)monophones_a[k]) == 0) {	  phn[2] = k;	  break;	}      }      ind = phone_map_a[get_nphone_ind_cc(ph_size_a, num_mono_a, phn,					  context_mode_a, num_sph_a,					  sph_index_a)];    }  }  else {                                         // "-" in this phone        // check the "+" symbol    //    tmp_str = (char_1*)strstr((char*)phn_list_a, "+");    if (tmp_str == (char_1*)NULL) {              // only "-" in this phone            // set the third phone      //      phn[2] = (int_4)0;            // set the first phone      //      tmp_str = (char_1*)strtok((char*)phn_list_a, "-");      for (int_4 k = 0; k < num_mono_a; k++) {	if (strcmp((char*)tmp_str, (char*)monophones_a[k]) == 0) {	  phn[0] = k;	  break;	}      }            // set the second phone      //      tmp_str = (char_1*)strtok(NULL, " ");      for (int_4 k = 0; k < num_mono_a; k++) {	if (strcmp((char*)tmp_str, (char*)monophones_a[k]) == 0) {	  mid_phn_a = k;	  phn[1] = k;	  break;	}      }      ind = phone_map_a[get_nphone_ind_cc(ph_size_a,num_mono_a, phn,					  context_mode_a, num_sph_a,					  sph_index_a)];    }    else {                                   // both "-" & "+" in this phone            // set the first phone      //      tmp_str = (char_1*)strtok((char*)phn_list_a, "-");      for (int_4 k = 0; k < num_mono_a; k++) {	if (strcmp((char*)tmp_str, (char*)monophones_a[k]) == 0) {	  phn[0] = k;	  break;	}      }      // set the second phone      //      tmp_str = (char_1*)strtok(NULL, "+");      for (int_4 k = 0; k < num_mono_a; k++) {	if (strcmp((char*)tmp_str, (char*)monophones_a[k]) == 0) {	  mid_phn_a = k;	  phn[1] = k;	  break;	}      }            // set the third phone      //      tmp_str = (char_1*)strtok(NULL, " ");      for (int_4 k = 0; k < num_mono_a; k++) {	if (strcmp((char*)tmp_str, (char*)monophones_a[k]) == 0) {	  phn[2] = k;	  break;	}      }      ind = phone_map_a[get_nphone_ind_cc(ph_size_a, num_mono_a, phn,					  context_mode_a, num_sph_a,					  sph_index_a)];    }  } // end of "-" in this phone  // free memory  //  delete [] phn;  tmp_str = (char_1*)NULL;  phn_str = (char_1*)NULL;   // exit gracefully  //  return ind;}							      

⌨️ 快捷键说明

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