|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defvar hts_synth_pre_hooks nil) |
|
(defvar hts_synth_post_hooks nil) |
|
(defvar hts_engine_params nil) |
|
|
|
(defvar hts_duration_stretch 0) |
|
(defvar hts_f0_mean 0) |
|
(defvar hts_f0_std 1) |
|
(defvar hts_fw_factor 0.42) |
|
(defvar hts_total_length 0.0) |
|
(defvar hts_uv_threshold 0.5) |
|
(defvar hts_use_phone_align 0) |
|
|
|
(defSynthType HTS |
|
(let ((featfile (make_tmp_filename)) |
|
(mcepfile (make_tmp_filename)) |
|
(f0file (make_tmp_filename)) |
|
(wavfile (make_tmp_filename)) |
|
(labfile (make_tmp_filename))) |
|
|
|
(apply_hooks hts_synth_pre_hooks utt) |
|
|
|
(set! hts_output_params |
|
(list |
|
(list "-labelfile" featfile) |
|
(list "-om" mcepfile) |
|
(list "-of" f0file) |
|
(list "-or" wavfile) |
|
(list "-od" labfile)) |
|
) |
|
|
|
(hts_dump_feats utt hts_feats_list featfile) |
|
|
|
(HTS_Synthesize utt) |
|
|
|
(delete-file featfile) |
|
(delete-file mcepfile) |
|
(delete-file f0file) |
|
(delete-file wavfile) |
|
(delete-file labfile) |
|
|
|
(apply_hooks hts_synth_post_hooks utt) |
|
utt) |
|
) |
|
|
|
(define (hts_feats_output ofd s) |
|
"This is bad as it makes decisions about what the feats are" |
|
|
|
|
|
|
|
|
|
(format ofd "%10.0f %10.0f " |
|
(* 10000000 (item.feat s "segment_start")) |
|
(* 10000000 (item.feat s "segment_end"))) |
|
|
|
|
|
(format ofd "%s" (if (string-equal "0" (item.feat s "p.p.name")) |
|
"x" (item.feat s "p.p.name"))) |
|
|
|
(format ofd "^%s" (if (string-equal "0" (item.feat s "p.name")) |
|
"x" (item.feat s "p.name"))) |
|
|
|
(format ofd "-%s" (if (string-equal "0" (item.feat s "name")) |
|
"x" (item.feat s "name"))) |
|
|
|
(format ofd "+%s" (if (string-equal "0" (item.feat s "n.name")) |
|
"x" (item.feat s "n.name"))) |
|
|
|
(format ofd "=%s" (if (string-equal "0" (item.feat s "n.n.name")) |
|
"x" (item.feat s "n.n.name"))) |
|
|
|
|
|
(format ofd "@") |
|
(format ofd "%s" (if (string-equal "pau" (item.feat s "name")) |
|
"x" (+ 1 (item.feat s "pos_in_syl")))) |
|
(format ofd "_%s" (if (string-equal "pau" (item.feat s "name")) |
|
"x" (- (item.feat s "R:SylStructure.parent.R:Syllable.syl_numphones") |
|
(item.feat s "pos_in_syl")))) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(format ofd "/A:%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
(item.feat s "p.R:SylStructure.parent.R:Syllable.stress") |
|
(item.feat s "R:SylStructure.parent.R:Syllable.p.stress"))) |
|
|
|
(format ofd "_%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
(item.feat s "p.R:SylStructure.parent.R:Syllable.accented") |
|
(item.feat s "R:SylStructure.parent.R:Syllable.p.accented"))) |
|
|
|
(format ofd "_%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
(item.feat s "p.R:SylStructure.parent.R:Syllable.syl_numphones") |
|
(item.feat s "R:SylStructure.parent.R:Syllable.p.syl_numphones"))) |
|
|
|
|
|
|
|
(format ofd "/B:%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
"x" |
|
(item.feat s "R:SylStructure.parent.R:Syllable.stress"))) |
|
|
|
(format ofd "-%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
"x" |
|
(item.feat s "R:SylStructure.parent.R:Syllable.accented"))) |
|
|
|
(format ofd "-%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
"x" |
|
(item.feat s "R:SylStructure.parent.R:Syllable.syl_numphones"))) |
|
|
|
|
|
(format ofd "@%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
"x" |
|
(+ 1 (item.feat s "R:SylStructure.parent.R:Syllable.pos_in_word")))) |
|
(format ofd "-%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
"x" |
|
(- |
|
(item.feat s "R:SylStructure.parent.parent.R:Word.word_numsyls") |
|
(item.feat s "R:SylStructure.parent.R:Syllable.pos_in_word")))) |
|
|
|
|
|
(format ofd "&%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
"x" |
|
(+ 1 |
|
(item.feat s "R:SylStructure.parent.R:Syllable.syl_in")))) |
|
(format ofd "-%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
"x" |
|
(+ 1 |
|
(item.feat s "R:SylStructure.parent.R:Syllable.syl_out")))) |
|
|
|
|
|
(format ofd "#%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
"x" |
|
(+ 1 |
|
(item.feat s "R:SylStructure.parent.R:Syllable.ssyl_in")))) |
|
(format ofd "-%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
"x" |
|
(+ 1 |
|
(item.feat s "R:SylStructure.parent.R:Syllable.ssyl_out")))) |
|
|
|
|
|
(format ofd "$%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
"x" |
|
(+ 1 |
|
(item.feat s "R:SylStructure.parent.R:Syllable.asyl_in")))) |
|
(format ofd "-%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
"x" |
|
(+ 1 |
|
(item.feat s "R:SylStructure.parent.R:Syllable.asyl_out")))) |
|
|
|
|
|
(format ofd "!%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
"x" |
|
(item.feat s "R:SylStructure.parent.R:Syllable.lisp_distance_to_p_stress"))) |
|
(format ofd "-%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
"x" |
|
(item.feat s "R:SylStructure.parent.R:Syllable.lisp_distance_to_n_stress"))) |
|
|
|
|
|
(format ofd ";%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
"x" |
|
(item.feat s "R:SylStructure.parent.R:Syllable.lisp_distance_to_p_accent"))) |
|
(format ofd "-%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
"x" |
|
(item.feat s "R:SylStructure.parent.R:Syllable.lisp_distance_to_n_accent"))) |
|
|
|
|
|
(format ofd "|%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
"x" |
|
(item.feat s "R:SylStructure.parent.R:Syllable.syl_vowel"))) |
|
|
|
|
|
(format ofd "/C:%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
(item.feat s "n.R:SylStructure.parent.R:Syllable.stress") |
|
(item.feat s "R:SylStructure.parent.R:Syllable.n.stress"))) |
|
|
|
(format ofd "+%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
(item.feat s "n.R:SylStructure.parent.R:Syllable.accented") |
|
(item.feat s "R:SylStructure.parent.R:Syllable.n.accented"))) |
|
|
|
(format ofd "+%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
(item.feat s "n.R:SylStructure.parent.R:Syllable.syl_numphones") |
|
(item.feat s "R:SylStructure.parent.R:Syllable.n.syl_numphones"))) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(format ofd "/D:%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
(item.feat s "p.R:SylStructure.parent.parent.R:Word.gpos") |
|
(item.feat s "R:SylStructure.parent.parent.R:Word.p.gpos"))) |
|
|
|
(format ofd "_%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
(item.feat s "p.R:SylStructure.parent.parent.R:Word.word_numsyls") |
|
(item.feat s "R:SylStructure.parent.parent.R:Word.p.word_numsyls"))) |
|
|
|
|
|
|
|
|
|
|
|
(format ofd "/E:%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
"x" |
|
(item.feat s "R:SylStructure.parent.parent.R:Word.gpos"))) |
|
|
|
(format ofd "+%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
"x" |
|
(item.feat s "R:SylStructure.parent.parent.R:Word.word_numsyls"))) |
|
|
|
|
|
(format ofd "@%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
"x" |
|
(+ 1 (item.feat s "R:SylStructure.parent.parent.R:Word.pos_in_phrase")))) |
|
(format ofd "+%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
"x" |
|
(item.feat s "R:SylStructure.parent.parent.R:Word.words_out"))) |
|
|
|
|
|
(format ofd "&%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
"x" |
|
(item.feat s "R:SylStructure.parent.parent.R:Word.content_words_in"))) |
|
(format ofd "+%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
"x" |
|
(item.feat s "R:SylStructure.parent.parent.R:Word.content_words_out"))) |
|
|
|
|
|
(format ofd "#%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
"x" |
|
(item.feat s "R:SylStructure.parent.parent.R:Word.lisp_distance_to_p_content"))) |
|
(format ofd "+%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
"x" |
|
(item.feat s "R:SylStructure.parent.parent.R:Word.lisp_distance_to_n_content"))) |
|
|
|
|
|
|
|
|
|
|
|
(format ofd "/F:%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
(item.feat s "n.R:SylStructure.parent.parent.R:Word.gpos") |
|
(item.feat s "R:SylStructure.parent.parent.R:Word.n.gpos"))) |
|
|
|
(format ofd "_%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
(item.feat s "n.R:SylStructure.parent.parent.R:Word.word_numsyls") |
|
(item.feat s "R:SylStructure.parent.parent.R:Word.n.word_numsyls"))) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(format ofd "/G:%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
(item.feat s "p.R:SylStructure.parent.parent.R:Phrase.parent.lisp_num_syls_in_phrase") |
|
(item.feat s "R:SylStructure.parent.parent.R:Phrase.parent.p.lisp_num_syls_in_phrase"))) |
|
|
|
|
|
(format ofd "_%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
(item.feat s "p.R:SylStructure.parent.parent.R:Phrase.parent.lisp_num_words_in_phrase") |
|
(item.feat s "R:SylStructure.parent.parent.R:Phrase.parent.p.lisp_num_words_in_phrase"))) |
|
|
|
|
|
|
|
|
|
|
|
(format ofd "/H:%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
"x" |
|
(item.feat s "R:SylStructure.parent.parent.R:Phrase.parent.lisp_num_syls_in_phrase"))) |
|
|
|
|
|
(format ofd "=%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
"x" |
|
(item.feat s "R:SylStructure.parent.parent.R:Phrase.parent.lisp_num_words_in_phrase"))) |
|
|
|
|
|
(format ofd "@%s" |
|
(+ 1 (item.feat s "R:SylStructure.parent.R:Syllable.sub_phrases"))) |
|
(format ofd "=%s" |
|
(- |
|
(item.feat s "lisp_total_phrases") |
|
(item.feat s "R:SylStructure.parent.R:Syllable.sub_phrases"))) |
|
|
|
|
|
(format ofd "|%s" |
|
(item.feat s "R:SylStructure.parent.parent.R:Phrase.parent.daughtern.R:SylStructure.daughtern.tobi_endtone")) |
|
|
|
|
|
|
|
|
|
|
|
(format ofd "/I:%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
(item.feat s "n.R:SylStructure.parent.parent.R:Phrase.parent.lisp_num_syls_in_phrase") |
|
(item.feat s "R:SylStructure.parent.parent.R:Phrase.parent.n.lisp_num_syls_in_phrase"))) |
|
|
|
|
|
(format ofd "=%s" |
|
(if (string-equal "pau" (item.feat s "name")) |
|
(item.feat s "n.R:SylStructure.parent.parent.R:Phrase.parent.lisp_num_words_in_phrase") |
|
(item.feat s "R:SylStructure.parent.parent.R:Phrase.parent.n.lisp_num_words_in_phrase"))) |
|
|
|
|
|
|
|
|
|
|
|
(format ofd "/J:%s" (item.feat s "lisp_total_syls")) |
|
|
|
|
|
(format ofd "+%s" (item.feat s "lisp_total_words")) |
|
|
|
|
|
(format ofd "-%s" (item.feat s "lisp_total_phrases")) |
|
|
|
(format ofd "\n") |
|
|
|
) |
|
|
|
(define (hts_dump_feats utt feats ofile) |
|
(let ((ofd (fopen ofile "w"))) |
|
(mapcar |
|
(lambda (s) |
|
(hts_feats_output ofd s)) |
|
(utt.relation.items utt 'Segment)) |
|
(fclose ofd) |
|
)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(define (distance_to_p_content i) |
|
(let ((c 0) (rc 0 ) (w (item.relation.prev i "Phrase"))) |
|
(while w |
|
(set! c (+ 1 c)) |
|
(if (string-equal "1" (item.feat w "contentp")) |
|
(begin |
|
(set! rc c) |
|
(set! w nil)) |
|
(set! w (item.prev w))) |
|
) |
|
rc)) |
|
|
|
(define (distance_to_n_content i) |
|
(let ((c 0) (rc 0) (w (item.relation.next i "Phrase"))) |
|
(while w |
|
(set! c (+ 1 c)) |
|
(if (string-equal "1" (item.feat w "contentp")) |
|
(begin |
|
(set! rc c) |
|
(set! w nil)) |
|
(set! w (item.next w))) |
|
) |
|
rc)) |
|
|
|
(define (distance_to_p_accent i) |
|
(let ((c 0) (rc 0 ) (w (item.relation.prev i "Syllable"))) |
|
(while (and w (member_string (item.feat w "syl_break") '("0" "1"))) |
|
(set! c (+ 1 c)) |
|
(if (string-equal "1" (item.feat w "accented")) |
|
(begin |
|
(set! rc c) |
|
(set! w nil)) |
|
(set! w (item.prev w))) |
|
) |
|
rc)) |
|
|
|
(define (distance_to_n_accent i) |
|
(let ((c 0) (rc 0 ) (w (item.relation.next i "Syllable"))) |
|
(while (and w (member_string (item.feat w "p.syl_break") '("0" "1"))) |
|
(set! c (+ 1 c)) |
|
(if (string-equal "1" (item.feat w "accented")) |
|
(begin |
|
(set! rc c) |
|
(set! w nil)) |
|
(set! w (item.next w))) |
|
) |
|
rc)) |
|
|
|
(define (distance_to_p_stress i) |
|
(let ((c 0) (rc 0 ) (w (item.relation.prev i "Syllable"))) |
|
(while (and w (member_string (item.feat w "syl_break") '("0" "1"))) |
|
(set! c (+ 1 c)) |
|
(if (string-equal "1" (item.feat w "stress")) |
|
(begin |
|
(set! rc c) |
|
(set! w nil)) |
|
(set! w (item.prev w))) |
|
) |
|
rc)) |
|
|
|
(define (distance_to_n_stress i) |
|
(let ((c 0) (rc 0 ) (w (item.relation.next i "Syllable"))) |
|
(while (and w (member_string (item.feat w "p.syl_break") '("0" "1"))) |
|
(set! c (+ 1 c)) |
|
(if (string-equal "1" (item.feat w "stress")) |
|
(begin |
|
(set! rc c) |
|
(set! w nil)) |
|
(set! w (item.next w))) |
|
) |
|
rc)) |
|
|
|
(define (num_syls_in_phrase i) |
|
(apply |
|
+ |
|
(mapcar |
|
(lambda (w) |
|
(length (item.relation.daughters w 'SylStructure))) |
|
(item.relation.daughters i 'Phrase)))) |
|
|
|
(define (num_words_in_phrase i) |
|
(length (item.relation.daughters i 'Phrase))) |
|
|
|
(define (total_words w) |
|
(length |
|
(utt.relation.items (item.get_utt w) 'Word))) |
|
|
|
(define (total_syls s) |
|
(length |
|
(utt.relation.items (item.get_utt s) 'Syllable))) |
|
|
|
(define (total_phrases s) |
|
(length |
|
(utt.relation_tree (item.get_utt s) 'Phrase))) |
|
|
|
(provide 'hts) |
|
|