language-resources icon indicating copy to clipboard operation
language-resources copied to clipboard

How to conversion of FestVox voices to Flite?

Open wannaphong opened this issue 6 years ago • 25 comments

Hello. I want conversion of FestVox voices to Flite (for thai language #25 ). Can you recommend me?

wannaphong avatar Sep 16 '19 13:09 wannaphong

This [1] tutorial is good I think.

1 - http://www.festvox.org/flite/doc/flite_8.html#Statistical-Voice-Building-_0028Clustergen_0029

pasindud avatar Sep 17 '19 03:09 pasindud

It has problems.

cg_convert:    converting 01 duration model
cg_convert: converting phone to state map
flite_build cg complete.  You can compile the generated voice by
   cd flite; make
root@c9ab845ea55b:/usr/local/src/tts2# cd flite; make
making in flite ...
gcc -g -O2 -Wall      -I/usr/local/src/tools/flite/lang/cmu_th_lang -I/usr/local/src/tools/flite/lang/cmu_th_lex -I/usr/local/src/tools/flite/include  -c -o goog_th_unison.o goog_th_unison.c
goog_th_unison.c:45:25: fatal error: cmu_th_lang.h: No such file or directory
 #include "cmu_th_lang.h"
                         ^
compilation terminated.
<builtin>: recipe for target 'goog_th_unison.o' failed
make: *** [goog_th_unison.o] Error 1
root@c9ab845ea55b:/usr/local/src/tts2/flite# ls
Makefile			 goog_th_unison_cg_01_durmodel.h    goog_th_unison_cg_phonestate.c
f0_params.scm			 goog_th_unison_cg_01_f0_trees.c    goog_th_unison_voice_feats.c
flite_main.c			 goog_th_unison_cg_01_f0_trees.h    paramfiles.mak
goog_th_unison.c		 goog_th_unison_cg_01_mcep_trees.c  voxdefs.h
goog_th_unison_cg.c		 goog_th_unison_cg_01_mcep_trees.h
goog_th_unison_cg_01_durmodel.c  goog_th_unison_cg_01_params.c
root@c9ab845ea55b:/usr/local/src/tts2/flite# make
making in flite ...
gcc -g -O2 -Wall      -I/usr/local/src/tools/flite/lang/cmu_th_lang -I/usr/local/src/tools/flite/lang/cmu_th_lex -I/usr/local/src/tools/flite/include  -c -o goog_th_unison.o goog_th_unison.c
goog_th_unison.c:45:25: fatal error: cmu_th_lang.h: No such file or directory
 #include "cmu_th_lang.h"
                         ^
compilation terminated.
<builtin>: recipe for target 'goog_th_unison.o' failed
make: *** [goog_th_unison.o] Error 1
root@c9ab845ea55b:/usr/local/src/tts2

wannaphong avatar Sep 18 '19 10:09 wannaphong

Now, I can build_lex but it has problems. Where is the lexicon.out file?

wannaphong avatar Sep 18 '19 10:09 wannaphong

I can't exactly remember, but it might go something like this. lexicon.out is the compiled version of lexicon.scm, The way you do it is,

  • take lexicon.scm remove the MNCL line from it (first line)
  • Copy the following to a file (compile_lexicon.scm)
  (lex.create "lexconth")
  (lex.set phoneset "goog_th")
  (PhoneSet.select "goog_th")
  (lex.compile "lexicon_without_mncl.scm" "lexicon_output.out")
  • then type festival from root of your festival project
  • run - ("compile_lexicon.scm")

This is what I vaguely remember

pasindud avatar Sep 18 '19 16:09 pasindud

@pasindud I have a question. Festival project is $OUTPUT_VOICE_FOLDER or ${FESTIVAL_SUIT_PATH}/flite/lang/cmu_th_lang/lex?

I apologize if there are any errors.

wannaphong avatar Sep 18 '19 17:09 wannaphong

In $OUTPUT_VOICE_FOLDER/Festival.

root@c9ab845ea55b:/usr/local/src/tts2/festival# ls
clunits  coeffs  disttabs  dur	f0  feats  lexicon_without_mncl.scm  phrbrk  trees  utts  utts_hmm
root@c9ab845ea55b:/usr/local/src/tts2/festival# festival $FLITEDIR/tools/make_phoneset.scm

Festival Speech Synthesis System 2.4:release December 2014
Copyright (C) University of Edinburgh, 1996-2010. All rights reserved.

festival> (lex.create "lexconth")
"lexconth"
festival> (lex.set phoneset "goog_th")
SIOD ERROR: unbound variable : lex.set
festival> (PhoneSet.select "goog_th")
Phoneset goog_th not defined
festival> (lex.compile "lexicon_without_mncl.scm" "lexicon_output.out")
SIOD ERROR: not a symbol or string : ((s uː n 4) 1)

wannaphong avatar Sep 18 '19 17:09 wannaphong

Now, It's working by festival $OUTPUT_VOICE_FOLDER/festvox/goog_th_unison_cg.scm $OUTPUT_VOICE_FOLDER/festvox/goog_th_unison_phoneset.scm in $OUTPUT_VOICE_FOLDER but PhoneSet.select not defined.

wannaphong avatar Sep 19 '19 06:09 wannaphong

> festival $OUTPUT_VOICE_FOLDER/festvox/goog_th_unison_cg.scm $OUTPUT_VOICE_FOLDER/festvox/goog_th_unison_phoneset.scm
festival> (lex.create "lexconth")
lexicon lexconth recreated
"lexconth"
festival> (lex.set.phoneset "goog_th")
"goog_th"
festival> (PhoneSet.select "th_ipa_phoneset")
"th_ipa_phoneset"
festival> (lex.compile "lexicon_without_mncl.scm" "lexicon_output.out")
SIOD ERROR: not a symbol or string : ((s uː n 4) 1)

wannaphong avatar Sep 19 '19 07:09 wannaphong

Can you show me the contents of $OUTPUT_VOICE_FOLDER/festvox/goog_th_unison_phoneset.scm

pasindud avatar Sep 19 '19 08:09 pasindud

@pasindud the contents of $OUTPUT_VOICE_FOLDER/festvox/goog_th_unison_phoneset.scm gist.github.com

wannaphong avatar Sep 19 '19 11:09 wannaphong

festival> (lex.list)                                                   
("english_poslex" "cmu" "goog_th" "lexconth")
festival> (PhoneSet.list)
(radio th_ipa_phoneset)

wannaphong avatar Sep 20 '19 04:09 wannaphong

can you also post about 20 lines from the lexicon

pasindud avatar Sep 24 '19 11:09 pasindud

Try the following - in build_lex update the following lines

LEXNAME=goog_th
LEXFILE="festvox/lexicon.scm"

Then run

./$FLITEDIR/tools/build_lex setup
./$FLITEDIR/tools/build_lex lex
./$FLITEDIR/tools/build_lex compresslex
./$FLITEDIR/tools/build_lex install

pasindud avatar Sep 24 '19 12:09 pasindud

lexicon

lexicon https://gist.github.com/wannaphongcom/eff7c81d7a3189f46ca4f0916f845c8c

wannaphong avatar Sep 24 '19 16:09 wannaphong

I found problems.

> cmu_th_lang/lex# ./build_lex install
cp: cannot stat ‘c/goog_th_lts_model.c’: No such file or directory
cp: cannot stat ‘c/goog_th_lts_model.h’: No such file or directory
cp: cannot stat ‘c/goog_th_lts_rules.c’: No such file or directory

wannaphong avatar Sep 24 '19 17:09 wannaphong

In that case try running

./$FLITEDIR/tools/build_lex lts
./$FLITEDIR/tools/build_lex lts2c

pasindud avatar Sep 24 '19 17:09 pasindud

File : https://drive.google.com/drive/folders/11dXZAtvAamQUzxkFEJ2V870zx4bMSCeg?usp=sharing

wannaphong avatar Sep 24 '19 17:09 wannaphong

It's not working.

root@cd2530aa7d54:/usr/local/src/tools/flite/lang/cmu_th_lang/lex# ./build_lex lts
/usr/local/src/tools/festival/bin/festival: argument for "--heap" not an int
Type -h for help on options.
cat: alllets.out: No such file or directory
cat: allphones.out: No such file or directory
cat: let2phones.out: No such file or directory
Find probabilities of letter-phone pairs
/usr/local/src/tools/festival/bin/festival: argument for "--heap" not an int
Type -h for help on options.
Align letter-phone pairs with best path
/usr/local/src/tools/festival/bin/festival: argument for "--heap" not an int
Type -h for help on options.
Build letter to phone CART trees
awk: cannot open lex.feats (No such file or directory)
awk: cannot open lex.feats (No such file or directory)
awk: cannot open lex.feats (No such file or directory)
awk: cannot open lex.feats (No such file or directory)
awk: cannot open lex.feats (No such file or directory)
awk: cannot open lex.feats (No such file or directory)
awk: cannot open lex.feats (No such file or directory)
awk: cannot open lex.feats (No such file or directory)
awk: cannot open lex.feats (No such file or directory)
awk: cannot open lex.feats (No such file or directory)
awk: cannot open lex.feats (No such file or directory)
awk: cannot open lex.feats (No such file or directory)
Build complete model
/usr/local/src/tools/festival/bin/festival: argument for "--heap" not an int
Type -h for help on options.
cp: cannot stat 'lts_scratch/lex_lts_rules.scm': No such file or directory
Test model
/usr/local/src/tools/festival/bin/festival: argument for "--heap" not an int
Type -h for help on options.
with ALL data -- no held out test set


root@cd2530aa7d54:/usr/local/src/tools/flite/lang/cmu_th_lang/lex# ./build_lex lts2c
SIOD ERROR: could not open file lts_scratch/lex_lts_rules.scm
SIOD ERROR: could not open file lts_scratch/lex_lts_rules.scm


root@cd2530aa7d54:/usr/local/src/tools/flite/lang/cmu_th_lang/lex# ./build_lex install
cp: cannot stat ‘c/goog_th_lts_model.c’: No such file or directory
cp: cannot stat ‘c/goog_th_lts_model.h’: No such file or directory
cp: cannot stat ‘c/goog_th_lts_rules.c’: No such file or directory

wannaphong avatar Sep 24 '19 17:09 wannaphong

Now, I can't do it. 😢

wannaphong avatar Jan 08 '20 03:01 wannaphong

after bit of poking around I figured out that it would be hard to do this with unicode phonemes, this is because festival to flite convertor generates c [1] files with the unicode phonemes which cannot be compiled [2].

[1] - https://github.com/kubo/flite/blob/4681a5fb82afb9036c6dd6a9303892f8dc7b8e69/tools/make_cart.scm#L192

[2] - https://gist.github.com/pasindud/81bbc62a3283e05a8a99a5ddf673a7a3

pasindud avatar Jan 28 '20 04:01 pasindud

@pasindud Now, I replaced unicode phonemes to text unicode and I re-train text to speech but it has error.

OUTPUT_VOICE_FOLDER : https://drive.google.com/file/d/1i5z8yjXKBDzfc3zbaJJhg9L2hE5f4byC/view?usp=sharing

New Rule : https://github.com/PyThaiNLP/tts-thai/tree/build2/th

wannaphong avatar Jan 29 '20 20:01 wannaphong

Log

root@33b0e8b46ba1:/usr/local/src/language-resources/tts# cd flite; make
making in flite ...
gcc -g -O2 -Wall      -I/usr/local/src/tools/flite/lang/cmu_th_lang -I/usr/local/src/tools/flite/lang/cmu_th_lex -I/usr/local/src/tools/flite/include  -c -o goog_th_unison_cg.o goog_th_unison_cg.c
gcc -g -O2 -Wall      -I/usr/local/src/tools/flite/lang/cmu_th_lang -I/usr/local/src/tools/flite/lang/cmu_th_lex -I/usr/local/src/tools/flite/include  -c -o goog_th_unison_cg_phonestate.o goog_th_unison_cg_phonestate.c
gcc -g -O2 -Wall      -I/usr/local/src/tools/flite/lang/cmu_th_lang -I/usr/local/src/tools/flite/lang/cmu_th_lex -I/usr/local/src/tools/flite/include  -c -o goog_th_unison_cg_01_f0_trees.o goog_th_unison_cg_01_f0_trees.c
gcc -g -O2 -Wall      -I/usr/local/src/tools/flite/lang/cmu_th_lang -I/usr/local/src/tools/flite/lang/cmu_th_lex -I/usr/local/src/tools/flite/include  -c -o goog_th_unison_cg_01_mcep_trees.o goog_th_unison_cg_01_mcep_trees.c
gcc -g -O2 -Wall      -I/usr/local/src/tools/flite/lang/cmu_th_lang -I/usr/local/src/tools/flite/lang/cmu_th_lex -I/usr/local/src/tools/flite/include  -c -o goog_th_unison_cg_01_params.o goog_th_unison_cg_01_params.c
gcc -g -O2 -Wall      -I/usr/local/src/tools/flite/lang/cmu_th_lang -I/usr/local/src/tools/flite/lang/cmu_th_lex -I/usr/local/src/tools/flite/include  -c -o goog_th_unison_cg_01_durmodel.o goog_th_unison_cg_01_durmodel.c
r - goog_th_unison_cg.o
r - goog_th_unison_cg_phonestate.o
r - goog_th_unison_cg_01_f0_trees.o
r - goog_th_unison_cg_01_mcep_trees.o
r - goog_th_unison_cg_01_params.o
r - goog_th_unison_cg_01_durmodel.o
gcc -g -O2 -Wall     -o flite_goog_th_unison flite_main.o flite_voice_list.o flite_lang_list.o -L . -lgoog_th_unison   -lflite_cmu_th_lang -lflite_cmu_th_lex -L/usr/local/src/tools/flite/build/x86_64-linux-gnu/lib -lflite   -lm  
/usr/bin/ld: cannot find -lflite_cmu_th_lang
/usr/bin/ld: cannot find -lflite_cmu_th_lex
collect2: error: ld returned 1 exit status
Makefile:108: recipe for target 'flite_goog_th_unison' failed
make: *** [flite_goog_th_unison] Error 1
root@33b0e8b46ba1:/usr/local/src/language-resources/tts/flite# ls
Makefile	    flite_voice_list.o		     goog_th_unison_cg_01_durmodel.o	goog_th_unison_cg_01_params.c	goog_th_unison_voice_feats.c
f0_params.scm	    goog_th_unison.c		     goog_th_unison_cg_01_f0_trees.c	goog_th_unison_cg_01_params.o	libgoog_th_unison.a
flite_lang_list.c   goog_th_unison.o		     goog_th_unison_cg_01_f0_trees.h	goog_th_unison_cg_f0_trees.c	paramfiles.mak
flite_lang_list.o   goog_th_unison_cg.c		     goog_th_unison_cg_01_f0_trees.o	goog_th_unison_cg_f0_trees.h	voxdefs.h
flite_main.c	    goog_th_unison_cg.o		     goog_th_unison_cg_01_mcep_trees.c	goog_th_unison_cg_f0_trees.o
flite_main.o	    goog_th_unison_cg_01_durmodel.c  goog_th_unison_cg_01_mcep_trees.h	goog_th_unison_cg_phonestate.c
flite_voice_list.c  goog_th_unison_cg_01_durmodel.h  goog_th_unison_cg_01_mcep_trees.o	goog_th_unison_cg_phonestate.o

wannaphong avatar Jan 31 '20 09:01 wannaphong

did you build the libraries ? /usr/bin/ld: cannot find -lflite_cmu_th_lang /usr/bin/ld: cannot find -lflite_cmu_th_lex
you musnt forget to go in the folders cmu_th_lang and cmu_th_lex and "make" them.

you also have to place them in thee correct folder ?

Shallowmallow avatar Feb 04 '20 08:02 Shallowmallow

@Shallowmallow I have not cmu_th_lang and cmu_th_lex.

wannaphong avatar Feb 04 '20 14:02 wannaphong

I can build flitevox but cmu_th.flitevox not working. :(

Segmentation fault (core dumped)

  • cmu_th.flitevox : https://github.com/wannaphong/flite/blob/master/cmu_th.flitevox
  • cmu_th_lang : https://github.com/wannaphong/flite/tree/master/lang/cmu_th_lang
  • cmu_th_lex : https://github.com/wannaphong/flite/tree/master/lang/cmu_th_lex

I follow this link.

root@37f447636f59:/usr/local/src/tools/flite/lang/cmu_th_lex/lex# ls
build_lex  cmu_th_lex.out
root@37f447636f59:/usr/local/src/tools/flite/lang/cmu_th_lex/lex# ./build_lex setup
SIOD ERROR: unexpected close paren 
closing a file left open: lts_scratch/lex_entries.out
closing a file left open: cmu_th_lex.out
root@cafa9b6b2893:/usr/local/src/tools/flite/lang/cmu_th_lex/lex# ./build_lex lts2c
SIOD ERROR: could not open file lts_scratch/lex_lts_rules.scm
SIOD ERROR: could not open file lts_scratch/lex_lts_rules.scm

wannaphong avatar Feb 15 '20 09:02 wannaphong