Beispiel #1
0
/* HTS_Label_clear: free label */
void HTS_Label_clear(HTS_Label * label)
{
   HTS_LabelString *lstring, *next_lstring;

   for (lstring = label->head; lstring; lstring = next_lstring) {
      next_lstring = lstring->next;
      HTS_free(lstring->name);
      HTS_free(lstring);
   }
   HTS_Label_initialize(label);
}
/* 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);
}
Beispiel #3
0
/* HTS_Engine_initialize: initialize engine */
void HTS_Engine_initialize(HTS_Engine * engine)
{
   /* global */
   engine->condition.sampling_frequency = 0;
   engine->condition.fperiod = 0;
   engine->condition.audio_buff_size = 0;
   engine->condition.stop = FALSE;
   engine->condition.volume = 1.0;
   engine->condition.msd_threshold = NULL;
   engine->condition.gv_weight = NULL;

   /* duration */
   engine->condition.speed = 1.0;
   engine->condition.phoneme_alignment_flag = FALSE;

   /* spectrum */
   engine->condition.stage = 0;
   engine->condition.use_log_gain = FALSE;
   engine->condition.alpha = 0.0;
   engine->condition.beta = 0.0;

   /* log F0 */
   engine->condition.additional_half_tone = 0.0;

   /* interpolation weights */
   engine->condition.duration_iw = NULL;
   engine->condition.parameter_iw = NULL;
   engine->condition.gv_iw = NULL;

   /* initialize audio */
   HTS_Audio_initialize(&engine->audio);
   /* initialize model set */
   HTS_ModelSet_initialize(&engine->ms);
   /* 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);
}