您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ HTS_calloc函数代码示例

51自学网 2021-06-01 21:24:16
  C++
这篇教程C++ HTS_calloc函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中HTS_calloc函数的典型用法代码示例。如果您正苦于以下问题:C++ HTS_calloc函数的具体用法?C++ HTS_calloc怎么用?C++ HTS_calloc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了HTS_calloc函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: HTS_Window_load

/* HTS_Window_load: load dynamic windows */static HTS_Boolean HTS_Window_load(HTS_Window * win, HTS_File ** fp, int size){   int i, j;   int fsize, length;   char buff[HTS_MAXBUFLEN];   HTS_Boolean result = TRUE;   /* check */   if (win == NULL || fp == NULL || size <= 0)      return FALSE;   win->size = size;   win->l_width = (int *) HTS_calloc(win->size, sizeof(int));   win->r_width = (int *) HTS_calloc(win->size, sizeof(int));   win->coefficient = (double **) HTS_calloc(win->size, sizeof(double *));   /* set delta coefficents */   for (i = 0; i < win->size; i++) {      if (HTS_get_token(fp[i], buff) == FALSE) {         result = FALSE;         fsize = 1;      } else {         fsize = atoi(buff);         if (fsize <= 0) {            result = FALSE;            fsize = 1;         }      }      /* read coefficients */      win->coefficient[i] = (double *) HTS_calloc(fsize, sizeof(double));      for (j = 0; j < fsize; j++) {         if (HTS_get_token(fp[i], buff) == FALSE) {            result = FALSE;            win->coefficient[i][j] = 0.0;         } else {            win->coefficient[i][j] = (double) atof(buff);         }      }      /* set pointer */      length = fsize / 2;      win->coefficient[i] += length;      win->l_width[i] = -length;      win->r_width[i] = length;      if (fsize % 2 == 0)         win->r_width[i]--;   }   /* calcurate max_width to determine size of band matrix */   win->max_width = 0;   for (i = 0; i < win->size; i++) {      if (win->max_width < abs(win->l_width[i]))         win->max_width = abs(win->l_width[i]);      if (win->max_width < abs(win->r_width[i]))         win->max_width = abs(win->r_width[i]);   }   if (result == FALSE) {      HTS_Window_clear(win);      return FALSE;   }   return TRUE;}
开发者ID:naxingyu,项目名称:StreamGenerator,代码行数:61,


示例2: HTS_Engine_load_gv_from_fn

/* HTS_Engine_load_gv_from_fn: load GV pdfs and trees from file names */void HTS_Engine_load_gv_from_fn(HTS_Engine * engine, char **pdf_fn,                                char **tree_fn, int stream_index,                                int interpolation_size){    int i;    FILE **pdf_fp, **tree_fp;    pdf_fp = (FILE **) HTS_calloc(interpolation_size, sizeof(FILE *));    if (tree_fn)        tree_fp = (FILE **) HTS_calloc(interpolation_size, sizeof(FILE *));    else        tree_fp = NULL;    for (i = 0; i < interpolation_size; i++) {        pdf_fp[i] = HTS_get_fp(pdf_fn[i], "rb");        if (tree_fn) {            if (tree_fn[i])                tree_fp[i] = HTS_get_fp(tree_fn[i], "r");            else                tree_fp[i] = NULL;        }    }    HTS_Engine_load_gv_from_fp(engine, pdf_fp, tree_fp, stream_index,                               interpolation_size);    for (i = 0; i < interpolation_size; i++) {        fclose(pdf_fp[i]);        if (tree_fp && tree_fp[i])            fclose(tree_fp[i]);    }    HTS_free(pdf_fp);    if (tree_fp)        HTS_free(tree_fp);}
开发者ID:BackupTheBerlios,项目名称:festlang-svn,代码行数:33,


示例3: HTS_Engine_load_parameter_from_fn

/* HTS_Engine_load_parameter_from_fn: load parameter pdfs, trees and windows from file names */void HTS_Engine_load_parameter_from_fn(HTS_Engine * engine, char **pdf_fn,                                       char **tree_fn, char **win_fn,                                       int stream_index, HTS_Boolean msd_flag,                                       int window_size, int interpolation_size){    int i;    FILE **pdf_fp, **tree_fp, **win_fp;    pdf_fp = (FILE **) HTS_calloc(interpolation_size, sizeof(FILE *));    tree_fp = (FILE **) HTS_calloc(interpolation_size, sizeof(FILE *));    win_fp = (FILE **) HTS_calloc(window_size, sizeof(FILE *));    for (i = 0; i < interpolation_size; i++) {        pdf_fp[i] = HTS_get_fp(pdf_fn[i], "rb");        tree_fp[i] = HTS_get_fp(tree_fn[i], "r");    }    for (i = 0; i < window_size; i++)        win_fp[i] = HTS_get_fp(win_fn[i], "r");    HTS_Engine_load_parameter_from_fp(engine, pdf_fp, tree_fp, win_fp,                                      stream_index, msd_flag,                                      window_size, interpolation_size);    for (i = 0; i < interpolation_size; i++) {        fclose(pdf_fp[i]);        fclose(tree_fp[i]);    }    for (i = 0; i < window_size; i++)        fclose(win_fp[i]);    HTS_free(pdf_fp);    HTS_free(tree_fp);    HTS_free(win_fp);}
开发者ID:BackupTheBerlios,项目名称:festlang-svn,代码行数:31,


示例4: HTS_Audio_open

/* HTS_Audio_open: open audio device */static void HTS_Audio_open(HTS_Audio * audio, int sampling_rate, int max_buff_size){   MMRESULT error;   if (audio->sampling_rate == sampling_rate && audio->max_buff_size == max_buff_size)      return;   HTS_Audio_close(audio);   audio->sampling_rate = sampling_rate;   audio->max_buff_size = max_buff_size;   if (audio->max_buff_size <= 0)      return;   /* queue */   audio->which_buff = 1;   audio->now_buff_1 = FALSE;   audio->now_buff_2 = FALSE;   audio->buff = (short *) HTS_calloc(max_buff_size, sizeof(short));   /* format */   audio->waveformatex.wFormatTag = WAVE_FORMAT_PCM;   audio->waveformatex.nChannels = AUDIO_CHANNEL;   audio->waveformatex.nSamplesPerSec = sampling_rate;   audio->waveformatex.wBitsPerSample = sizeof(short) * 8;   audio->waveformatex.nBlockAlign = AUDIO_CHANNEL * audio->waveformatex.wBitsPerSample / 8;   audio->waveformatex.nAvgBytesPerSec = sampling_rate * audio->waveformatex.nBlockAlign;   /* open */   error = waveOutOpen(&audio->hwaveout, WAVE_MAPPER, &audio->waveformatex, (DWORD) HTS_Audio_callback_function, (DWORD) audio, CALLBACK_FUNCTION);   if (error != MMSYSERR_NOERROR)      HTS_error(0, "hts_engine: Failed to open your output audio device to play waveform./n");   /* prepare */   audio->buff_1.lpData = (LPSTR) HTS_calloc(max_buff_size, sizeof(short));   audio->buff_1.dwBufferLength = max_buff_size * sizeof(short);   audio->buff_1.dwFlags = WHDR_BEGINLOOP | WHDR_ENDLOOP;   audio->buff_1.dwLoops = 1;   audio->buff_1.lpNext = 0;   audio->buff_1.reserved = 0;   error = waveOutPrepareHeader(audio->hwaveout, &(audio->buff_1), sizeof(WAVEHDR));   if (error != MMSYSERR_NOERROR)      HTS_error(0, "hts_engine: Cannot initialize audio datablocks to play waveform./n");   audio->buff_2.lpData = (LPSTR) HTS_calloc(max_buff_size, sizeof(short));   audio->buff_2.dwBufferLength = max_buff_size * sizeof(short);   audio->buff_2.dwFlags = WHDR_BEGINLOOP | WHDR_ENDLOOP;   audio->buff_2.dwLoops = 1;   audio->buff_2.lpNext = 0;   audio->buff_2.reserved = 0;   error = waveOutPrepareHeader(audio->hwaveout, &(audio->buff_2), sizeof(WAVEHDR));   if (error != MMSYSERR_NOERROR)      HTS_error(0, "hts_engine: Cannot initialize audio datablocks to play waveform./n");}
开发者ID:A-L-E-X,项目名称:RHVoice,代码行数:54,


示例5: HTS_Model_load_tree

/* HTS_Model_load_tree: load trees */static void HTS_Model_load_tree(HTS_Model * model, FILE * fp){   char buff[HTS_MAXBUFLEN];   HTS_Question *question, *last_question;   HTS_Tree *tree, *last_tree;   int state;   /* check */   if (fp == NULL)      HTS_error(1, "HTS_Model_load_tree: File for trees is not specified./n");   model->ntree = 0;   last_question = NULL;   last_tree = NULL;   while (!feof(fp)) {      HTS_get_pattern_token(fp, buff);      /* parse questions */      if (strcmp(buff, "QS") == 0) {         question = (HTS_Question *) HTS_calloc(1, sizeof(HTS_Question));         HTS_Question_load(question, fp);         if (model->question)            last_question->next = question;         else            model->question = question;         question->next = NULL;         last_question = question;      }      /* parse trees */      state = HTS_get_state_num(buff);      if (state != 0) {         tree = (HTS_Tree *) HTS_calloc(1, sizeof(HTS_Tree));         tree->next = NULL;         tree->root = NULL;         tree->head = NULL;         tree->state = state;         HTS_Tree_parse_pattern(tree, buff);         HTS_Tree_load(tree, fp, model->question);         if (model->tree)            last_tree->next = tree;         else            model->tree = tree;         tree->next = NULL;         last_tree = tree;         model->ntree++;      }   }   /* No Tree information in tree file */   if (model->tree == NULL)      HTS_error(1, "HTS_Model_load_tree: No trees are loaded./n");}
开发者ID:Datikos,项目名称:RHVoice,代码行数:51,


示例6: HTS_freqt

/* HTS_freqt: frequency transformation */static void HTS_freqt(HTS_Vocoder * v, const double *c1, const int m1, double *c2, const int m2, const double a){   int i, j;   const double b = 1 - a * a;   double *g;   if (m2 > v->freqt_size) {      if (v->freqt_buff != NULL)         HTS_free(v->freqt_buff);      v->freqt_buff = (double *) HTS_calloc(m2 + m2 + 2, sizeof(double));      v->freqt_size = m2;   }   g = v->freqt_buff + v->freqt_size + 1;   for (i = 0; i < m2 + 1; i++)      g[i] = 0.0;   for (i = -m1; i <= 0; i++) {      if (0 <= m2)         g[0] = c1[-i] + a * (v->freqt_buff[0] = g[0]);      if (1 <= m2)         g[1] = b * v->freqt_buff[0] + a * (v->freqt_buff[1] = g[1]);      for (j = 2; j <= m2; j++)         g[j] = v->freqt_buff[j - 1] + a * ((v->freqt_buff[j] = g[j]) - g[j - 1]);   }   HTS_movem(g, c2, m2 + 1);}
开发者ID:MaxMEllon,项目名称:node-openjtalk,代码行数:29,


示例7: HTS_ModelSet_load_parameter

/* HTS_ModelSet_load_parameter: load model */void HTS_ModelSet_load_parameter(HTS_ModelSet * ms, FILE ** pdf_fp,                                 FILE ** tree_fp, FILE ** win_fp,                                 int stream_index, HTS_Boolean msd_flag,                                 int window_size, int interpolation_size){   int i;   /* check */   if (pdf_fp == NULL)      HTS_error(1,                "HTS_ModelSet_load_parameter: File for pdfs is not specified./n");   if (tree_fp == NULL)      HTS_error(1,                "HTS_ModelSet_load_parameter: File for wins is not specified./n");   if (win_fp == NULL)      HTS_error(1,                "HTS_ModelSet_load_parameter: File for wins is not specified./n");   /* initialize */   if (!ms->stream) {      ms->stream = (HTS_Stream *) HTS_calloc(ms->nstream, sizeof(HTS_Stream));      for (i = 0; i < ms->nstream; i++)         HTS_Stream_initialize(&ms->stream[i]);   }   /* load */   HTS_Stream_load_pdf_and_tree(&ms->stream[stream_index], pdf_fp, tree_fp,                                msd_flag, interpolation_size);   HTS_Stream_load_dynamic_window(&ms->stream[stream_index], win_fp,                                  window_size);}
开发者ID:Datikos,项目名称:RHVoice,代码行数:30,


示例8: HTS_Stream_load_pdf_and_tree

/* HTS_Stream_load_pdf_and_tree: load PDFs and trees */static void HTS_Stream_load_pdf_and_tree(HTS_Stream * stream, FILE ** pdf_fp,                                         FILE ** tree_fp, HTS_Boolean msd_flag,                                         int interpolation_size){   int i;   /* initialize */   stream->msd_flag = msd_flag;   stream->interpolation_size = interpolation_size;   stream->model =       (HTS_Model *) HTS_calloc(interpolation_size, sizeof(HTS_Model));   /* load */   for (i = 0; i < stream->interpolation_size; i++) {      if (!pdf_fp[i])         HTS_error(1,                   "HTS_Stream_load_pdf_and_tree: File for duration PDFs is not specified./n");      if (!tree_fp[i])         HTS_error(1,                   "HTS_Stream_load_pdf_and_tree: File for duration trees is not specified./n");      HTS_Model_initialize(&stream->model[i]);      HTS_Model_load_tree(&stream->model[i], tree_fp[i]);      HTS_Model_load_pdf(&stream->model[i], pdf_fp[i], stream->model[i].ntree,                         stream->msd_flag);   }   /* check */   for (i = 1; i < stream->interpolation_size; i++)      if (stream->model[0].vector_length != stream->model[i].vector_length)         HTS_error(1,                   "HTS_Stream_load_pdf_and_tree: Vector sizes of state output vectors are different in between given modelsets./n");   /* set */   stream->vector_length = stream->model[0].vector_length;}
开发者ID:Datikos,项目名称:RHVoice,代码行数:33,


示例9: HTS_Tree_parse_pattern

/* HTS_Tree_parse_pattern: parse pattern specified for each tree */static void HTS_Tree_parse_pattern(HTS_Tree * tree, char *string){   char *left, *right;   HTS_Pattern *pattern, *last_pattern;   tree->head = NULL;   last_pattern = NULL;   /* parse tree pattern */   if ((left = strchr(string, '{')) != NULL) {  /* pattern is specified */      string = left + 1;      if (*string == '(')         ++string;      right = strrchr(string, '}');      if (string < right && *(right - 1) == ')')         --right;      *right = ',';      /* parse pattern */      while ((left = strchr(string, ',')) != NULL) {         pattern = (HTS_Pattern *) HTS_calloc(1, sizeof(HTS_Pattern));         if (tree->head) {            last_pattern->next = pattern;         } else {            tree->head = pattern;         }         *left = '/0';         pattern->string = HTS_strdup(string);         string = left + 1;         pattern->next = NULL;         last_pattern = pattern;      }   }}
开发者ID:Datikos,项目名称:RHVoice,代码行数:35,


示例10: HTS_b2en

/* HTS_b2en: calculate frame energy */static double HTS_b2en(HTS_Vocoder * v, const double *b, const int m, const double a){   int i;   double en = 0.0;   double *cep;   double *ir;   if (v->spectrum2en_size < m) {      if (v->spectrum2en_buff != NULL)         HTS_free(v->spectrum2en_buff);      v->spectrum2en_buff = (double *) HTS_calloc((m + 1) + 2 * IRLENG, sizeof(double));      v->spectrum2en_size = m;   }   cep = v->spectrum2en_buff + m + 1;   ir = cep + IRLENG;   HTS_b2mc(b, v->spectrum2en_buff, m, a);   HTS_freqt(v, v->spectrum2en_buff, m, cep, IRLENG - 1, -a);   HTS_c2ir(cep, IRLENG, ir, IRLENG);   for (i = 0; i < IRLENG; i++)      en += ir[i] * ir[i];   return (en);}
开发者ID:MaxMEllon,项目名称:node-openjtalk,代码行数:26,


示例11: HTS_Question_load

/* HTS_Question_load: Load questions from file */static void HTS_Question_load(HTS_Question * question, FILE * fp){   char buff[HTS_MAXBUFLEN];   HTS_Pattern *pattern, *last_pattern;   /* get question name */   HTS_get_pattern_token(fp, buff);   question->string = HTS_strdup(buff);   question->head = NULL;   /* get pattern list */   HTS_get_pattern_token(fp, buff);   last_pattern = NULL;   if (strcmp(buff, "{") == 0) {      while (1) {         HTS_get_pattern_token(fp, buff);         pattern = (HTS_Pattern *) HTS_calloc(1, sizeof(HTS_Pattern));         if (question->head)            last_pattern->next = pattern;         else                   /* first time */            question->head = pattern;         pattern->string = HTS_strdup(buff);         pattern->next = NULL;         HTS_get_pattern_token(fp, buff);         if (!strcmp(buff, "}"))            break;         last_pattern = pattern;      }   }}
开发者ID:Datikos,项目名称:RHVoice,代码行数:30,


示例12: HTS_gc2gc

/* HTS_gc2gc: generalized cepstral transformation */static void HTS_gc2gc(HTS_Vocoder * v, double *c1, const int m1, const double g1, double *c2, const int m2, const double g2){   int i, min, k, mk;   double ss1, ss2, cc;   if (m1 > v->gc2gc_size) {      if (v->gc2gc_buff != NULL)         HTS_free(v->gc2gc_buff);      v->gc2gc_buff = (double *) HTS_calloc(m1 + 1, sizeof(double));      v->gc2gc_size = m1;   }   HTS_movem(c1, v->gc2gc_buff, m1 + 1);   c2[0] = v->gc2gc_buff[0];   for (i = 1; i <= m2; i++) {      ss1 = ss2 = 0.0;      min = m1 < i ? m1 : i - 1;      for (k = 1; k <= min; k++) {         mk = i - k;         cc = v->gc2gc_buff[k] * c2[mk];         ss2 += k * cc;         ss1 += mk * cc;      }      if (i <= m1)         c2[i] = v->gc2gc_buff[i] + (g2 * ss2 - g1 * ss1) / i;      else         c2[i] = (g2 * ss2 - g1 * ss1) / i;   }}
开发者ID:MaxMEllon,项目名称:node-openjtalk,代码行数:32,


示例13: HTS_lsp2en

/* HTS_lsp2en: calculate frame energy */static double HTS_lsp2en(HTS_Vocoder * v, double *lsp, size_t m, double alpha){   size_t i;   double en = 0.0;   double *buff;   if (v->spectrum2en_size < m) {      if (v->spectrum2en_buff != NULL)         HTS_free(v->spectrum2en_buff);      v->spectrum2en_buff = (double *) HTS_calloc(m + 1 + IRLENG, sizeof(double));      v->spectrum2en_size = m;   }   buff = v->spectrum2en_buff + m + 1;   /* lsp2lpc */   HTS_lsp2lpc(v, lsp + 1, v->spectrum2en_buff, m);   if (v->use_log_gain)      v->spectrum2en_buff[0] = exp(lsp[0]);   else      v->spectrum2en_buff[0] = lsp[0];   /* mgc2mgc */   if (NORMFLG1)      HTS_ignorm(v->spectrum2en_buff, v->spectrum2en_buff, m, v->gamma);   else if (MULGFLG1)      v->spectrum2en_buff[0] = (1.0 - v->spectrum2en_buff[0]) * ((double) v->stage);   if (MULGFLG1)      for (i = 1; i <= m; i++)         v->spectrum2en_buff[i] *= -((double) v->stage);   HTS_mgc2mgc(v, v->spectrum2en_buff, m, alpha, v->gamma, buff, IRLENG - 1, 0.0, 1);   for (i = 0; i < IRLENG; i++)      en += buff[i] * buff[i];   return en;}
开发者ID:MaxMEllon,项目名称:node-openjtalk,代码行数:36,


示例14: HTS_Vocoder_postfilter_mcp

/* HTS_Vocoder_postfilter_mcp: postfilter for MCP */void HTS_Vocoder_postfilter_mcp(HTS_Vocoder *v, double *mcp, const int m,                                double alpha, double beta){   double e1, e2;   int k;   if (beta > 0.0 && m > 1) {      if (v->postfilter_size < m) {         if (v->postfilter_buff != NULL)            HTS_free(v->postfilter_buff);         v->postfilter_buff = (double *) HTS_calloc(m + 1, sizeof(double));         v->postfilter_size = m;      }      HTS_mc2b(mcp, v->postfilter_buff, m, alpha);      e1 = HTS_b2en(v, v->postfilter_buff, m, alpha);      v->postfilter_buff[1] -= beta * alpha * mcp[2];      for (k = 2; k <= m; k++)         v->postfilter_buff[k] *= (1.0 + beta);      e2 = HTS_b2en(v, v->postfilter_buff, m, alpha);      v->postfilter_buff[0] += log(e1 / e2) / 2;      HTS_b2mc(v->postfilter_buff, mcp, m, alpha);   }}
开发者ID:celsius,项目名称:mage-1.0-legacy,代码行数:26,


示例15: HTS_Stream_load_pdf

/* HTS_Stream_load_pdf: load pdf */static HTS_Boolean HTS_Stream_load_pdf(HTS_Stream * stream, HTS_File ** fp, int ntree, int interpolation_size){   int i;   HTS_Boolean result = TRUE;   /* initialize */   stream->interpolation_size = interpolation_size;   stream->model = (HTS_Model *) HTS_calloc(interpolation_size, sizeof(HTS_Model));   /* load pdfs */   for (i = 0; i < stream->interpolation_size; i++) {      HTS_Model_initialize(&stream->model[i]);      if (HTS_Model_load_pdf(&stream->model[i], fp[i], ntree, &stream->msd_flag) == FALSE)         result = FALSE;   }   if (result == FALSE) {      HTS_Stream_clear(stream);      return FALSE;   }   /* check */   for (i = 1; i < stream->interpolation_size; i++) {      if (stream->model[0].vector_length != stream->model[1].vector_length) {         HTS_error(1, "HTS_Stream_load_pdf: # of states are different in between given modelsets./n");         HTS_Stream_clear(stream);         return FALSE;      }   }   /* set */   stream->vector_length = stream->model[0].vector_length;   return TRUE;}
开发者ID:naxingyu,项目名称:StreamGenerator,代码行数:32,


示例16: HTS_Vocoder_initialize

/* HTS_Vocoder_initialize: initialize vocoder */void HTS_Vocoder_initialize(HTS_Vocoder * v, size_t m, size_t stage, HTS_Boolean use_log_gain, size_t rate, size_t fperiod){   /* set parameter */   v->is_first = TRUE;   v->stage = stage;   if (stage != 0)      v->gamma = -1.0 / v->stage;   else      v->gamma = 0.0;   v->use_log_gain = use_log_gain;   v->fprd = fperiod;   v->next = SEED;   v->gauss = GAUSS;   v->rate = rate;   v->pitch_of_curr_point = 0.0;   v->pitch_counter = 0.0;   v->pitch_inc_per_point = 0.0;   v->excite_ring_buff = NULL;   v->excite_buff_size = 0;   v->excite_buff_index = 0;   v->sw = 0;   v->x = 0x55555555;   /* init buffer */   v->freqt_buff = NULL;   v->freqt_size = 0;   v->gc2gc_buff = NULL;   v->gc2gc_size = 0;   v->lsp2lpc_buff = NULL;   v->lsp2lpc_size = 0;   v->postfilter_buff = NULL;   v->postfilter_size = 0;   v->spectrum2en_buff = NULL;   v->spectrum2en_size = 0;   if (v->stage == 0) {         /* for MCP */      v->c = (double *) HTS_calloc(m * (3 + PADEORDER) + 5 * PADEORDER + 6, sizeof(double));      v->cc = v->c + m + 1;      v->cinc = v->cc + m + 1;      v->d1 = v->cinc + m + 1;   } else {                     /* for LSP */      v->c = (double *) HTS_calloc((m + 1) * (v->stage + 3), sizeof(double));      v->cc = v->c + m + 1;      v->cinc = v->cc + m + 1;      v->d1 = v->cinc + m + 1;   }}
开发者ID:MaxMEllon,项目名称:node-openjtalk,代码行数:46,


示例17: HTS_Label_load_from_strings

/* HTS_Label_load_from_strings: load label from strings */void HTS_Label_load_from_strings(HTS_Label * label, size_t sampling_rate, size_t fperiod, char **lines, size_t num_lines){   char buff[HTS_MAXBUFLEN];   HTS_LabelString *lstring = NULL;   size_t i;   size_t data_index;   double start, end;   const double rate = (double) sampling_rate / ((double) fperiod * 1e+7);   if (label->head || label->size != 0) {      HTS_error(1, "HTS_Label_load_from_fp: label list is not initialized./n");      return;   }   /* copy label */   for (i = 0; i < num_lines; i++) {      if (!isgraph((int) lines[i][0]))         break;      label->size++;      if (lstring) {         lstring->next = (HTS_LabelString *) HTS_calloc(1, sizeof(HTS_LabelString));         lstring = lstring->next;      } else {                  /* first time */         lstring = (HTS_LabelString *) HTS_calloc(1, sizeof(HTS_LabelString));         label->head = lstring;      }      data_index = 0;      if (isdigit_string(lines[i])) {   /* has frame infomation */         HTS_get_token_from_string(lines[i], &data_index, buff);         start = atof(buff);         HTS_get_token_from_string(lines[i], &data_index, buff);         end = atof(buff);         HTS_get_token_from_string(lines[i], &data_index, buff);         lstring->name = HTS_strdup(buff);         lstring->start = rate * start;         lstring->end = rate * end;      } else {         lstring->start = -1.0;         lstring->end = -1.0;         lstring->name = HTS_strdup(lines[i]);      }      lstring->next = NULL;   }   HTS_Label_check_time(label);}
开发者ID:KTaskn,项目名称:MMDAgent,代码行数:46,


示例18: return

/* HTS_strdup: wrapper for strdup */char *HTS_strdup(const char *string) {#ifdef FESTIVAL    return (wstrdup(string));#else    char *buff = (char *) HTS_calloc(strlen(string) + 1, sizeof(char));    strcpy(buff, string);    return buff;#endif                          /* FESTIVAL */}
开发者ID:vsooda,项目名称:cppmary,代码行数:10,


示例19: HTS_Engine_load

/* HTS_Engine_load: load HTS voices */HTS_Boolean HTS_Engine_load(HTS_Engine * engine, char **voices, size_t num_voices){   size_t i, j;   size_t nstream;   double average_weight;   const char *option, *find;   /* reset engine */   HTS_Engine_clear(engine);   /* load voices */   if (HTS_ModelSet_load(&engine->ms, voices, num_voices) != TRUE) {      HTS_Engine_clear(engine);      return FALSE;   }   nstream = HTS_ModelSet_get_nstream(&engine->ms);   average_weight = 1.0 / num_voices;   /* global */   engine->condition.sampling_frequency = HTS_ModelSet_get_sampling_frequency(&engine->ms);   engine->condition.fperiod = HTS_ModelSet_get_fperiod(&engine->ms);   engine->condition.msd_threshold = (double *) HTS_calloc(nstream, sizeof(double));   for (i = 0; i < nstream; i++)      engine->condition.msd_threshold[i] = 0.5;   engine->condition.gv_weight = (double *) HTS_calloc(nstream, sizeof(double));   for (i = 0; i < nstream; i++)      engine->condition.gv_weight[i] = 1.0;   /* spectrum */   option = HTS_ModelSet_get_option(&engine->ms, 0);   find = strstr(option, "GAMMA=");   if (find != NULL)      engine->condition.stage = (size_t) atoi(&find[strlen("GAMMA=")]);   find = strstr(option, "LN_GAIN=");   if (find != NULL)      engine->condition.use_log_gain = atoi(&find[strlen("LN_GAIN=")]) == 1 ? TRUE : FALSE;   find = strstr(option, "ALPHA=");   if (find != NULL)      engine->condition.alpha = atof(&find[strlen("ALPHA=")]);   /* interpolation weights */   engine->condition.duration_iw = (double *) HTS_calloc(num_voices, sizeof(double));   for (i = 0; i < num_voices; i++)      engine->condition.duration_iw[i] = average_weight;   engine->condition.parameter_iw = (double **) HTS_calloc(num_voices, sizeof(double *));   for (i = 0; i < num_voices; i++) {      engine->condition.parameter_iw[i] = (double *) HTS_calloc(nstream, sizeof(double));      for (j = 0; j < nstream; j++)         engine->condition.parameter_iw[i][j] = average_weight;   }   engine->condition.gv_iw = (double **) HTS_calloc(num_voices, sizeof(double *));   for (i = 0; i < num_voices; i++) {      engine->condition.gv_iw[i] = (double *) HTS_calloc(nstream, sizeof(double));      for (j = 0; j < nstream; j++)         engine->condition.gv_iw[i][j] = average_weight;   }   return TRUE;}
开发者ID:hecomi,项目名称:node-openjtalk,代码行数:60,


示例20: HTS_Engine_initialize

/* HTS_Engine_initialize: initialize engine */void HTS_Engine_initialize(HTS_Engine * engine, int nstream){    int i;    /* default value for control parameter */    engine->global.stage = 0;    engine->global.use_log_gain = FALSE;    engine->global.sampling_rate = 16000;    engine->global.fperiod = 80;    engine->global.alpha = 0.42;    engine->global.beta = 0.0;    engine->global.audio_buff_size = 0;    engine->global.msd_threshold =        (double *) HTS_calloc(nstream, sizeof(double));    for (i = 0; i < nstream; i++)        engine->global.msd_threshold[i] = 0.5;    /* interpolation weight */    engine->global.parameter_iw =        (double **) HTS_calloc(nstream, sizeof(double *));    engine->global.gv_iw = (double **) HTS_calloc(nstream, sizeof(double *));    engine->global.duration_iw = NULL;    for (i = 0; i < nstream; i++)        engine->global.parameter_iw[i] = NULL;    for (i = 0; i < nstream; i++)        engine->global.gv_iw[i] = NULL;    /* GV weight */    engine->global.gv_weight = (double *) HTS_calloc(nstream, sizeof(double));    for (i = 0; i < nstream; i++)        engine->global.gv_weight[i] = 1.0;    /* initialize model set */    HTS_ModelSet_initialize(&engine->ms, nstream);    /* initialize label list */    HTS_Label_initialize(&engine->label);    /* initialize state sequence set */    HTS_SStreamSet_initialize(&engine->sss);    /* initialize pstream set */    HTS_PStreamSet_initialize(&engine->pss);    /* initialize gstream set */    HTS_GStreamSet_initialize(&engine->gss);}
开发者ID:BackupTheBerlios,项目名称:festlang-svn,代码行数:44,


示例21: HTS_Vocoder_initialize

/* HTS_Vocoder_initialize: initialize vocoder */void HTS_Vocoder_initialize(HTS_Vocoder * v, const int m, const int stage, HTS_Boolean use_log_gain, const int rate, const int fperiod){   /* set parameter */   v->stage = stage;   if (stage != 0)      v->gamma = -1.0 / v->stage;   else      v->gamma = 0.0;   v->use_log_gain = use_log_gain;   v->fprd = fperiod;   v->iprd = IPERIOD;   v->seed = SEED;   v->next = SEED;   v->gauss = GAUSS;   v->rate = rate;   v->p1 = -1.0;   v->sw = 0;   v->x = 0x55555555;   /* init buffer */   v->freqt_buff = NULL;   v->freqt_size = 0;   v->gc2gc_buff = NULL;   v->gc2gc_size = 0;   v->lsp2lpc_buff = NULL;   v->lsp2lpc_size = 0;   v->postfilter_buff = NULL;   v->postfilter_size = 0;   v->spectrum2en_buff = NULL;   v->spectrum2en_size = 0;   if (v->stage == 0) {         /* for MCP */      v->c = (double *) HTS_calloc(m * (3 + PADEORDER) + 5 * PADEORDER + 6, sizeof(double));      v->cc = v->c + m + 1;      v->cinc = v->cc + m + 1;      v->d1 = v->cinc + m + 1;   } else {                     /* for LSP */      v->c = (double *) HTS_calloc((m + 1) * (v->stage + 3), sizeof(double));      v->cc = v->c + m + 1;      v->cinc = v->cc + m + 1;      v->d1 = v->cinc + m + 1;   }   v->pulse_list = (double *) HTS_calloc(PULSELISTSIZE, sizeof(double));}
开发者ID:misonojapan,项目名称:nvdajpmiscdep,代码行数:43,


示例22: HTS_Engine_load_duration_from_fp

/* HTS_Engine_load_duration_from_fp: load duration pdfs, trees and number of state from file pointers */void HTS_Engine_load_duration_from_fp(HTS_Engine * engine, FILE ** pdf_fp,                                      FILE ** tree_fp, int interpolation_size){    int i;    HTS_ModelSet_load_duration(&engine->ms, pdf_fp, tree_fp, interpolation_size);    engine->global.duration_iw =        (double *) HTS_calloc(interpolation_size, sizeof(double));    for (i = 0; i < interpolation_size; i++)        engine->global.duration_iw[i] = 1.0 / interpolation_size;}
开发者ID:BackupTheBerlios,项目名称:festlang-svn,代码行数:12,


示例23: HTS_calloc

/* HTS_fopen_from_data: wrapper for fopen */HTS_File *HTS_fopen_from_data(void *data, size_t size) {    HTS_Data *d;    HTS_File *f;    if (data == NULL || size == 0)        return NULL;    d = (HTS_Data *) HTS_calloc(1, sizeof(HTS_Data));    d->data = (unsigned char *) HTS_calloc(size, sizeof(unsigned char));    d->size = size;    d->index = 0;    memcpy(d->data, data, size);    f = (HTS_File *) HTS_calloc(1, sizeof(HTS_File));    f->type = HTS_DATA;    f->pointer = (void *) d;    return f;}
开发者ID:vsooda,项目名称:cppmary,代码行数:21,


示例24: HTS_Label_load_from_string

/* HTS_Label_load_from_string: load label from string */void HTS_Label_load_from_string(HTS_Label * label, int sampling_rate,                                int fperiod, char *data){   char buff[HTS_MAXBUFLEN];   HTS_LabelString *lstring = NULL;   int data_index = 0;          /* data index */   double start, end;   const double rate = (double) sampling_rate / ((double) fperiod * 1e+7);   if (label->head || label->size != 0)      HTS_error(1, "HTS_Label_load_from_fp: label list is not initialized./n");   /* copy label */   while (HTS_get_token_from_string(data, &data_index, buff)) {      if (!isgraph(buff[0]))         break;      label->size++;      if (lstring) {         lstring->next =             (HTS_LabelString *) HTS_calloc(1, sizeof(HTS_LabelString));         lstring = lstring->next;      } else {                  /* first time */         lstring = (HTS_LabelString *) HTS_calloc(1, sizeof(HTS_LabelString));         label->head = lstring;      }      if (isdigit_string(buff)) {       /* has frame infomation */         start = atof(buff);         HTS_get_token_from_string(data, &data_index, buff);         end = atof(buff);         HTS_get_token_from_string(data, &data_index, buff);         lstring->start = rate * start;         lstring->end = rate * end;      } else {         lstring->start = -1.0;         lstring->end = -1.0;      }      lstring->next = NULL;      lstring->name = HTS_strdup(buff);   }   HTS_Label_check_time(label);}
开发者ID:BackupTheBerlios,项目名称:festlang-svn,代码行数:42,


示例25: HTS_Label_load

/* HTS_Label_load: load label */static void HTS_Label_load(HTS_Label * label, size_t sampling_rate, size_t fperiod, HTS_File * fp){   char buff[HTS_MAXBUFLEN];   HTS_LabelString *lstring = NULL;   double start, end;   const double rate = (double) sampling_rate / ((double) fperiod * 1e+7);   if (label->head || label->size != 0) {      HTS_error(1, "HTS_Label_load_from_fp: label is not initialized./n");      return;   }   /* parse label file */   while (HTS_get_token_from_fp(fp, buff)) {      if (!isgraph((int) buff[0]))         break;      label->size++;      if (lstring) {         lstring->next = (HTS_LabelString *) HTS_calloc(1, sizeof(HTS_LabelString));         lstring = lstring->next;      } else {                  /* first time */         lstring = (HTS_LabelString *) HTS_calloc(1, sizeof(HTS_LabelString));         label->head = lstring;      }      if (isdigit_string(buff)) {       /* has frame infomation */         start = atof(buff);         HTS_get_token_from_fp(fp, buff);         end = atof(buff);         HTS_get_token_from_fp(fp, buff);         lstring->start = rate * start;         lstring->end = rate * end;      } else {         lstring->start = -1.0;         lstring->end = -1.0;      }      lstring->next = NULL;      lstring->name = HTS_strdup(buff);   }   HTS_Label_check_time(label);}
开发者ID:KTaskn,项目名称:MMDAgent,代码行数:42,


示例26: HTS_Engine_load_duration_from_fn

/* HTS_Engine_load_duratin_from_fn: load duration pdfs, trees and number of state from file names */void HTS_Engine_load_duration_from_fn(HTS_Engine * engine, char **pdf_fn,                                      char **tree_fn, int interpolation_size){    int i;    FILE **pdf_fp, **tree_fp;    pdf_fp = (FILE **) HTS_calloc(interpolation_size, sizeof(FILE *));    tree_fp = (FILE **) HTS_calloc(interpolation_size, sizeof(FILE *));    for (i = 0; i < interpolation_size; i++) {        pdf_fp[i] = HTS_get_fp(pdf_fn[i], "rb");        tree_fp[i] = HTS_get_fp(tree_fn[i], "r");    }    HTS_Engine_load_duration_from_fp(engine, pdf_fp, tree_fp,                                     interpolation_size);    for (i = 0; i < interpolation_size; i++) {        fclose(pdf_fp[i]);        fclose(tree_fp[i]);    }    HTS_free(pdf_fp);    HTS_free(tree_fp);}
开发者ID:BackupTheBerlios,项目名称:festlang-svn,代码行数:22,


示例27: HTS_Engine_load_gv_from_fp

/* HTS_Engine_load_gv_from_fp: load GV pdfs and trees from file pointers */void HTS_Engine_load_gv_from_fp(HTS_Engine * engine, FILE ** pdf_fp,                                FILE ** tree_fp, int stream_index,                                int interpolation_size){    int i;    HTS_ModelSet_load_gv(&engine->ms, pdf_fp, tree_fp, stream_index,                         interpolation_size);    engine->global.gv_iw[stream_index] =        (double *) HTS_calloc(interpolation_size, sizeof(double));    for (i = 0; i < interpolation_size; i++)        engine->global.gv_iw[stream_index][i] = 1.0 / interpolation_size;}
开发者ID:BackupTheBerlios,项目名称:festlang-svn,代码行数:14,


示例28: HTS_Tree_load

/* HTS_Tree_load: Load trees */static void HTS_Tree_load(HTS_Tree * tree, FILE * fp, HTS_Question * question){   char buff[HTS_MAXBUFLEN];   HTS_Node *node, *last_node;   HTS_get_pattern_token(fp, buff);   node = (HTS_Node *) HTS_calloc(1, sizeof(HTS_Node));   node->index = 0;   tree->root = last_node = node;   if (strcmp(buff, "{") == 0) {      while (HTS_get_pattern_token(fp, buff), strcmp(buff, "}") != 0) {         node = HTS_Node_find(last_node, atoi(buff));         HTS_get_pattern_token(fp, buff);       /* load question at this node */         node->quest = HTS_Question_find_question(question, buff);         node->yes = (HTS_Node *) HTS_calloc(1, sizeof(HTS_Node));         node->no = (HTS_Node *) HTS_calloc(1, sizeof(HTS_Node));         HTS_get_pattern_token(fp, buff);         if (HTS_is_num(buff))            node->no->index = atoi(buff);         else            node->no->pdf = HTS_name2num(buff);         node->no->next = last_node;         last_node = node->no;         HTS_get_pattern_token(fp, buff);         if (HTS_is_num(buff))            node->yes->index = atoi(buff);         else            node->yes->pdf = HTS_name2num(buff);         node->yes->next = last_node;         last_node = node->yes;      }   } else {      node->pdf = HTS_name2num(buff);   }}
开发者ID:Datikos,项目名称:RHVoice,代码行数:40,



注:本文中的HTS_calloc函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ HTS_error函数代码示例
C++ HTONS函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。