Ejemplo n.º 1
0
cst_voice *register_cmu_us_kal16(const char *voxdir)
{
    cst_voice *v = new_voice();

    usenglish_init(v);

    /* Set up basic values for synthesizing with this voice */
    feat_set_string(v->features,"name","cmu_us_kal_diphone");

    /* Lexicon */
    cmu_lex_init();
    feat_set(v->features,"lexicon",lexicon_val(&cmu_lex));

    /* Intonation */
    feat_set_float(v->features,"int_f0_target_mean",105.0);
    feat_set_float(v->features,"int_f0_target_stddev",14.0);

    /* Post lexical rules */
    feat_set(v->features,"postlex_func",uttfunc_val(&cmu_us_kal_postlex));

    /* Duration */
    feat_set_float(v->features,"duration_stretch",1.1);

    /* Waveform synthesis: diphone_synth */
    feat_set(v->features,"wave_synth_func",uttfunc_val(&diphone_synth));
    feat_set(v->features,"diphone_db",diphone_db_val(&cmu_us_kal_db));
    feat_set_int(v->features,"sample_rate",cmu_us_kal_db.sts->sample_rate);
    feat_set_string(v->features,"resynth_type","fixed");
    feat_set_string(v->features,"join_type","modified_lpc");

    cmu_us_kal_diphone = v;

    return cmu_us_kal_diphone;
}
Ejemplo n.º 2
0
    cst_voice* register_cmu_us_no_wave( const char* voxdir )
    {
        cst_voice* v = new_voice();
        cst_lexicon* lex;

        v->name = "no_wave_voice";

        /* Set up basic values for synthesizing with this voice */
        usenglish_init( v );
        feat_set_string( v->features, "name", "cmu_us_no_wave" );

        /* Lexicon */
        lex = cmu_lex_init();
        feat_set( v->features, "lexicon", lexicon_val( lex ) );

        /* Intonation */
        feat_set_float( v->features, "int_f0_target_mean", 95.0 );
        feat_set_float( v->features, "int_f0_target_stddev", 11.0 );

        feat_set_float( v->features, "duration_stretch", 1.1 );

        /* Post lexical rules */
        feat_set( v->features, "postlex_func", uttfunc_val( lex->postlex ) );

        /* Waveform synthesis: diphone_synth */
        feat_set( v->features, "wave_synth_func", uttfunc_val( &no_wave_synth ) );

        cmu_us_no_wave = v;

        return cmu_us_no_wave;
    }
Ejemplo n.º 3
0
cst_voice *register___VOICENAME__(const char *voxdir)
{
    cst_voice *v = new_voice();

    v->name = "__NICKNAME__";

    /* Sets up language specific parameters in the __VOICENAME__. */
    usenglish_init(v);

    /* Things that weren't filled in already. */
    feat_set_string(v->features,"name","__VOICENAME__");

    /* Lexicon */
    cmu_lex_init();
    feat_set(v->features,"lexicon",lexicon_val(&cmu_lex));

    /* Waveform synthesis */
    feat_set(v->features,"wave_synth_func",uttfunc_val(&clunits_synth));
    feat_set(v->features,"clunit_db",clunit_db_val(&__VOICENAME___db));
    feat_set_int(v->features,"sample_rate",__VOICENAME___db.sts->sample_rate);
    feat_set_string(v->features,"join_type","simple_join");
    feat_set_string(v->features,"resynth_type","fixed");

    /* Unit selection */
    __VOICENAME___db.unit_name_func = __VOICENAME___unit_name;

    __VOICENAME___clunits = v;

    return __VOICENAME___clunits;
}
cst_voice *register___VOICENAME__(const char *voxdir)
{
    cst_voice *v;
    cst_lexicon *lex;

    if (__VOICENAME___clunits)
        return __VOICENAME___clunits;  /* Already registered */

    v = new_voice();
    v->name = "__NICKNAME__";

    /* Sets up language specific parameters in the __VOICENAME__. */
    __FLITELANG___init(v);

    /* Things that weren't filled in already. */
    flite_feat_set_string(v->features,"name","__VOICENAME__");

    /* Duration model */
    flite_feat_set(v->features,"dur_cart",cart_val(&__VOICENAME___dur_cart));
    flite_feat_set(v->features,"dur_stats",dur_stats_val((dur_stats *)__VOICENAME___dur_stats));

    /* Lexicon */
    lex = __FLITELEX___init();
    flite_feat_set(v->features,"lexicon",lexicon_val(lex));
    flite_feat_set(v->features,"postlex_func",uttfunc_val(lex->postlex));

    /* Waveform synthesis */
    flite_feat_set(v->features,"wave_synth_func",uttfunc_val(&clunits_synth));
    flite_feat_set(v->features,"clunit_db",clunit_db_val(&__VOICENAME___db));
    flite_feat_set_int(v->features,"sample_rate",__VOICENAME___db.sts->sample_rate);
    flite_feat_set_string(v->features,"join_type","simple_join");
    flite_feat_set_string(v->features,"resynth_type","fixed");

    if ((voxdir != NULL) &&
        (__VOICENAME___db.sts->sts == NULL) &&
        (__VOICENAME___db.sts->sts_paged == NULL) &&
        (__VOICENAME___db.sts->frames == NULL))
        flite_mmap_clunit_voxdata(voxdir,v);

    /* Unit selection */
    __VOICENAME___db.unit_name_func = __VOICENAME___unit_name;

    __VOICENAME___clunits = v;

    return __VOICENAME___clunits;
}
Ejemplo n.º 5
0
cst_voice *register_cmu_us_kal(const char *voxdir)
{
    cst_voice *v;
    cst_lexicon *lex;

    if (cmu_us_kal_diphone)
        return cmu_us_kal_diphone;  /* Already registered */
    
    v  = new_voice();
    v->name = "kal";

    /* Set up basic values for synthesizing with this voice */
    usenglish_init(v);
#ifndef FLITE_PLUS_HTS_ENGINE
    flite_feat_set_string(v->features,"name","cmu_us_kal_diphone");
#endif /* !FLITE_PLUS_HTS_ENGINE */

    /* Lexicon */
    lex = cmu_lex_init();
    flite_feat_set(v->features,"lexicon",lexicon_val(lex));

#ifndef FLITE_PLUS_HTS_ENGINE
    /* Intonation */
    flite_feat_set_float(v->features,"int_f0_target_mean",95.0);
    flite_feat_set_float(v->features,"int_f0_target_stddev",11.0);

    flite_feat_set_float(v->features,"duration_stretch",1.1); 
#endif /* !FLITE_PLUS_HTS_ENGINE */

    /* Post lexical rules */
    flite_feat_set(v->features,"postlex_func",uttfunc_val(&cmu_us_kal_postlex));

#ifndef FLITE_PLUS_HTS_ENGINE
    /* Waveform synthesis: diphone_synth */
    flite_feat_set(v->features,"wave_synth_func",uttfunc_val(&diphone_synth));
    flite_feat_set(v->features,"diphone_db",diphone_db_val(&cmu_us_kal_db));
    flite_feat_set_int(v->features,"sample_rate",cmu_us_kal_db.sts->sample_rate);
    flite_feat_set_string(v->features,"resynth_type","fixed");
    flite_feat_set_string(v->features,"join_type","modified_lpc");
#endif /* !FLITE_PLUS_HTS_ENGINE */

    cmu_us_kal_diphone = v;

    return cmu_us_kal_diphone;
}
cst_voice *register_cmu_time_awb(const char *voxdir)
{
    cst_voice *v = new_voice();

    v->name = "awb_time";

    /* Sets up language specific parameters in the voice. */
    usenglish_init(v);

    /* Things that weren't filled in already. */
    flite_feat_set_string(v->features,"name","cmu_time_awb");

    /* Lexicon */
    cmu_time_awb_lex.name = "cmu_time_awb";
    cmu_time_awb_lex.num_entries = cmu_time_awb_num_entries;
    cmu_time_awb_lex.num_bytes = cmu_time_awb_num_bytes;
    cmu_time_awb_lex.data = (unsigned char*) cmu_time_awb_lex_data;
    cmu_time_awb_lex.phone_table = (char**) cmu_time_awb_lex_phone_table;
    cmu_time_awb_lex.syl_boundary = cmu_syl_boundary;
    cmu_time_awb_lex.lts_rule_set = NULL;
    cmu_time_awb_lex.phone_hufftable = cmu_time_awb_lex_phones_huff_table;
    cmu_time_awb_lex.entry_hufftable = cmu_time_awb_lex_entries_huff_table;
    
    flite_feat_set(v->features,"lexicon",lexicon_val(&cmu_time_awb_lex));

    /* Waveform synthesis */
    flite_feat_set(v->features,"wave_synth_func",uttfunc_val(&clunits_synth));
    flite_feat_set(v->features,"clunit_db",clunit_db_val(&cmu_time_awb_db));
    flite_feat_set_int(v->features,"sample_rate",cmu_time_awb_db.sts->sample_rate);
    flite_feat_set_string(v->features,"join_type","simple_join");
    flite_feat_set_string(v->features,"resynth_type","fixed");

    /* Unit selection */
    cmu_time_awb_db.unit_name_func = cmu_time_awb_unit_name;

    cmu_time_awb_ldom = v;

    return cmu_time_awb_ldom;
}
cst_voice *register_cmu_us_kal16(const char *voxdir)
{
    cst_voice *v;
    cst_lexicon *lex;

    if (cmu_us_kal16_diphone)
        return cmu_us_kal16_diphone;  /* Already registered */

    v = new_voice();
    v->name = "kal16";

    /* Sets up language specific parameters in the cmu_us_kal16. */
    usenglish_init(v);

    feat_set_string(v->features,"name","cmu_us_kal16");

    feat_set_float(v->features,"int_f0_target_mean",95.0);
    feat_set_float(v->features,"int_f0_target_stddev",11.0);

    feat_set_float(v->features,"duration_stretch",1.1); 

    /* Lexicon */
    lex = cmu_lex_init();
    feat_set(v->features,"lexicon",lexicon_val(lex));
    feat_set(v->features,"postlex_func",uttfunc_val(lex->postlex));

    /* Waveform synthesis */
    feat_set(v->features,"wave_synth_func",uttfunc_val(&diphone_synth));
    feat_set(v->features,"diphone_db",diphone_db_val(&cmu_us_kal16_db));
    feat_set_int(v->features,"sample_rate",cmu_us_kal16_db.sts->sample_rate);
/*    feat_set_string(v->features,"join_type","simple_join"); */
    feat_set_string(v->features,"join_type","modified_lpc");
    feat_set_string(v->features,"resynth_type","fixed");

    cmu_us_kal16_diphone = v;

    return cmu_us_kal16_diphone;
}
Ejemplo n.º 8
0
cst_voice *register_cmu_us_rms(const char *voxdir)
{
    cst_voice *vox;
    cst_lexicon *lex;

    if (cmu_us_rms_cg)
        return cmu_us_rms_cg;  /* Already registered */

    vox = new_voice();
    vox->name = "rms";

    /* Sets up language specific parameters in the cmu_us_rms. */
    usenglish_init(vox);

    /* Things that weren't filled in already. */
    flite_feat_set_string(vox->features,"name","cmu_us_rms");

    /* Lexicon */
    lex = cmu_lex_init();
    flite_feat_set(vox->features,"lexicon",lexicon_val(lex));
    flite_feat_set(vox->features,"postlex_func",uttfunc_val(lex->postlex));

    /* No standard segment durations are needed as its done at the */
    /* HMM state level */
    flite_feat_set_string(vox->features,"no_segment_duration_model","1");
    flite_feat_set_string(vox->features,"no_f0_target_model","1");

    /* Waveform synthesis */
    flite_feat_set(vox->features,"wave_synth_func",uttfunc_val(&cg_synth));
    flite_feat_set(vox->features,"cg_db",cg_db_val(&cmu_us_rms_cg_db));
    flite_feat_set_int(vox->features,"sample_rate",cmu_us_rms_cg_db.sample_rate);

    cmu_us_rms_cg = vox;

    return cmu_us_rms_cg;
}
Ejemplo n.º 9
0
cst_voice *register___VOICENAME__(const char *voxdir)
{
    cst_voice *vox;
    cst_lexicon *lex;

    if (__VOICENAME___cg)
        return __VOICENAME___cg;  /* Already registered */

    vox = new_voice();
    vox->name = "__NICKNAME__";

    /* Sets up language specific parameters in the __VOICENAME__. */
    __MIMICLANG___init(vox);

    /* Things that weren't filled in already. */
    mimic_feat_set_string(vox->features,"name","__VOICENAME__");

    /* Lexicon */
    lex = __MIMICLEX___init();
    mimic_feat_set(vox->features,"lexicon",lexicon_val(lex));
    mimic_feat_set(vox->features,"postlex_func",uttfunc_val(lex->postlex));

    /* No standard segment durations are needed as its done at the */
    /* HMM state level */
    mimic_feat_set_string(vox->features,"no_segment_duration_model","1");
    mimic_feat_set_string(vox->features,"no_f0_target_model","1");

    /* Waveform synthesis */
    mimic_feat_set(vox->features,"wave_synth_func",uttfunc_val(&cg_synth));
    mimic_feat_set(vox->features,"cg_db",cg_db_val(&__VOICENAME___cg_db));
    mimic_feat_set_int(vox->features,"sample_rate",__VOICENAME___cg_db.sample_rate);

    __VOICENAME___cg = vox;

    return __VOICENAME___cg;
}
cst_voice *cst_cg_load_voice(const char *filename,
                             const cst_lang *lang_table)
{
    cst_voice *vox;
    cst_lexicon *lex = NULL;
    int i, end_of_features;
    const char *language;
    const char *xname;
    cst_cg_db *cg_db;
    char* fname;
    char* fval;
    cst_file vd;

    vd = cst_fopen(filename,CST_OPEN_READ | CST_OPEN_BINARY);
    if (vd == NULL)
    {
        cst_errmsg("Error load voice: can't open file %s\n",filename);
	return NULL;
    }

    if (cst_cg_read_header(vd) != 0)
    {
        cst_errmsg("Error load voice: %s does not have expected header\n",filename);
        cst_fclose(vd);
        return NULL;
    }

    vox = new_voice();

    /* Read voice features from the external file */
    /* Read until the feature is "end_of_features" */
    fname="";
    end_of_features = 0;
    while (end_of_features == 0)
    {
	cst_read_voice_feature(vd,&fname, &fval);
        if (cst_streq(fname,"end_of_features"))
            end_of_features = 1;
        else
        {
            xname = feat_own_string(vox->features,fname);
            flite_feat_set_string(vox->features,xname, fval);
        }
        cst_free(fname);
        cst_free(fval);
    }

    /* Load up cg_db from external file */
    cg_db = cst_cg_load_db(vox,vd);

    if (cg_db == NULL)
    {
	cst_fclose(vd);
        return NULL;
    }

    /* Use the language feature to initialize the correct voice */
    language = flite_get_param_string(vox->features, "language", "");

    /* Search Lang table for lang_init() and lex_init(); */
    for (i=0; lang_table[i].lang; i++)
    {
        if (cst_streq(language,lang_table[i].lang))
        {
            (lang_table[i].lang_init)(vox);
            lex = (lang_table[i].lex_init)();
            break;
        }
    }
    if (lex == NULL)
    {   /* Language is not supported */
	/* Delete allocated memory in cg_db */
	cst_cg_free_db(vd,cg_db);
	cst_fclose(vd);
        cst_errmsg("Error load voice: lang/lex %s not supported in this binary\n",language);
	return NULL;	
    }
    
    /* Things that weren't filled in already. */
    vox->name = cg_db->name;
    flite_feat_set_string(vox->features,"name",cg_db->name);
    flite_feat_set_string(vox->features,"pathname",filename);
    
    flite_feat_set(vox->features,"lexicon",lexicon_val(lex));
    flite_feat_set(vox->features,"postlex_func",uttfunc_val(lex->postlex));

    /* No standard segment durations are needed as its done at the */
    /* HMM state level */
    flite_feat_set_string(vox->features,"no_segment_duration_model","1");
    flite_feat_set_string(vox->features,"no_f0_target_model","1");

    /* Waveform synthesis */
    flite_feat_set(vox->features,"wave_synth_func",uttfunc_val(&cg_synth));
    flite_feat_set(vox->features,"cg_db",cg_db_val(cg_db));
    flite_feat_set_int(vox->features,"sample_rate",cg_db->sample_rate);

    cst_fclose(vd);
    return vox;
}