build_flite 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  1. #!/bin/sh
  2. ###########################################################################
  3. ## ##
  4. ## Language Technologies Institute ##
  5. ## Carnegie Mellon University ##
  6. ## Copyright (c) 2002-2009 ##
  7. ## All Rights Reserved. ##
  8. ## ##
  9. ## Permission is hereby granted, free of charge, to use and distribute ##
  10. ## this software and its documentation without restriction, including ##
  11. ## without limitation the rights to use, copy, modify, merge, publish, ##
  12. ## distribute, sublicense, and/or sell copies of this work, and to ##
  13. ## permit persons to whom this work is furnished to do so, subject to ##
  14. ## the following conditions: ##
  15. ## 1. The code must retain the above copyright notice, this list of ##
  16. ## conditions and the following disclaimer. ##
  17. ## 2. Any modifications must be clearly marked as such. ##
  18. ## 3. Original authors' names are not deleted. ##
  19. ## 4. The authors' names are not used to endorse or promote products ##
  20. ## derived from this software without specific prior written ##
  21. ## permission. ##
  22. ## ##
  23. ## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ##
  24. ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ##
  25. ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ##
  26. ## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ##
  27. ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ##
  28. ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ##
  29. ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ##
  30. ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ##
  31. ## THIS SOFTWARE. ##
  32. ## ##
  33. ###########################################################################
  34. ## ##
  35. ## Build a flite voice from a festvox voice ##
  36. ## ##
  37. ## C files are built into flite/ ##
  38. ## ##
  39. ###########################################################################
  40. FIND_STS=$FLITEDIR/bin/find_sts
  41. FESTIVAL=$ESTDIR/../festival/bin/festival
  42. if [ "$PROMPTFILE" = "" ]
  43. then
  44. if [ $# -ge 2 ]
  45. then
  46. export PROMPTFILE=$2
  47. else
  48. export PROMPTFILE=etc/txt.done.data
  49. fi
  50. fi
  51. if [ "$SIODHEAPSIZE" = "" ]
  52. then
  53. SIODHEAPSIZE=20000000
  54. export SIODHEAPSIZE
  55. fi
  56. HEAPSIZE=$SIODHEAPSIZE
  57. . ./etc/voice.defs
  58. if [ $# = 0 ]
  59. then
  60. if [ "$FV_TYPE" = "clunits" ]
  61. then
  62. $0 lpc
  63. $0 sts
  64. $0 mcep
  65. $0 clunits
  66. elif [ "$FV_TYPE" = "ldom" ]
  67. then
  68. $0 lpc
  69. $0 sts
  70. $0 mcep
  71. $0 clunits
  72. elif [ "$FV_TYPE" = "diphone" ]
  73. then
  74. $0 lpc
  75. $0 sts etc/txt.done.data g721
  76. $0 diphone
  77. elif [ "$FV_TYPE" = "cg" ]
  78. then
  79. $0 cg
  80. else
  81. echo $0 unsupported voicetype $FV_TYPE
  82. fi
  83. exit 0
  84. fi
  85. # Build lpc coefficients
  86. if [ "$1" = "lpc" ]
  87. then
  88. echo "Finding LPC coefficients"
  89. ./bin/make_lpc $PROMPTFILE
  90. echo "Finding LPC min, max and range"
  91. # make lpc.params file
  92. cat $PROMPTFILE |
  93. awk '{print $2}' |
  94. while read i
  95. do
  96. $ESTDIR/bin/ch_track -otype est_ascii lpc/$i.lpc |
  97. sed '1,/EST_Header_End/d'
  98. done |
  99. awk 'BEGIN {min=0; max=0;}
  100. {for (i=4; i<=NF; i++)
  101. {
  102. if ($i < min) min = $i;
  103. if ($i > max) max = $i;
  104. }
  105. }
  106. END {printf("LPC_MIN=%f\n",min);
  107. printf("LPC_MAX=%f\n",max);
  108. printf("LPC_RANGE=%f\n",max-min);
  109. }' >lpc/lpc.params
  110. exit 0
  111. fi
  112. # build sts files
  113. if [ "$1" = "sts" ]
  114. then
  115. echo "Finding STS files"
  116. if [ ! -d sts ]
  117. then
  118. mkdir sts
  119. fi
  120. . ./lpc/lpc.params
  121. CODEC=ulaw
  122. if [ "$#" = "3" ]
  123. then
  124. CODEC=$3
  125. fi
  126. cat $PROMPTFILE |
  127. awk '{print $2}' |
  128. while read i
  129. do
  130. fname=$i
  131. echo $fname STS
  132. if [ $CODEC = "g721vuv" -o $CODEC = "vuv" ]
  133. then
  134. $ESTDIR/bin/ch_track -itype ascii -otype est_binary -s 0.005 -o v.v v/$fname.v
  135. $FIND_STS -lpcmin $LPC_MIN -lpcrange $LPC_RANGE -lpc lpc/$fname.lpc -wave wav/$fname.wav -o sts/$fname.sts -codec $CODEC -vuv v.v
  136. else
  137. $FIND_STS -lpcmin $LPC_MIN -lpcrange $LPC_RANGE -lpc lpc/$fname.lpc -wave wav/$fname.wav -o sts/$fname.sts -codec $CODEC
  138. fi
  139. done
  140. echo $CODEC >flite/codec
  141. exit 0
  142. fi
  143. if [ "$1" = "voxdata" ]
  144. then # for clunits external data
  145. echo converting ${FV_VOICENAME}_ressize
  146. grep "^ " flite/${FV_VOICENAME}_ressize.c |
  147. tr -d "," |
  148. awk '{for (i=1; i<=NF; i++)
  149. {
  150. if ($i > 255)
  151. print 255;
  152. else
  153. print $i;}}' |
  154. $FLITEDIR/tools/a2byte.pl >flite/${FV_VOICENAME}_ressize.raw
  155. echo converting ${FV_VOICENAME}_lpc
  156. grep "^ " flite/${FV_VOICENAME}_lpcall.c |
  157. tr -d "," | sed 's/^ //;s/ */\n/g' |
  158. $FLITEDIR/tools/a2short.pl >flite/${FV_VOICENAME}_lpc.raw
  159. echo converting ${FV_VOICENAME}_mcep
  160. grep "^ " flite/${FV_VOICENAME}_mcepall.c |
  161. tr -d "," | sed 's/^ //;s/ */\n/g' |
  162. $FLITEDIR/tools/a2short.pl >flite/${FV_VOICENAME}_mcep.raw
  163. echo converting ${FV_VOICENAME}_residual
  164. grep "^ " flite/${FV_VOICENAME}_resall.c |
  165. tr -d "," | sed 's/^ //;s/ */\n/g' |
  166. $FLITEDIR/tools/a2byte.pl >flite/${FV_VOICENAME}_res.raw
  167. echo converting ${FV_VOICENAME}_residx
  168. grep "^ " flite/${FV_VOICENAME}_residx.c |
  169. tr -d "," | sed 's/^ *//;s/ */\n/g' |
  170. $FLITEDIR/tools/a2int.pl >flite/${FV_VOICENAME}_residx.raw
  171. wc flite/${FV_VOICENAME}_residx.raw \
  172. flite/${FV_VOICENAME}_lpc.raw \
  173. flite/${FV_VOICENAME}_mcep.raw \
  174. flite/${FV_VOICENAME}_res.raw \
  175. flite/${FV_VOICENAME}_ressize.raw
  176. printf "CMUFLITE\0" >flite/${FV_VOICENAME}.voxdata
  177. printf "%54s\0" ${FV_VOICENAME} >>flite/${FV_VOICENAME}.voxdata
  178. wc flite/${FV_VOICENAME}_residx.raw \
  179. flite/${FV_VOICENAME}_lpc.raw \
  180. flite/${FV_VOICENAME}_mcep.raw \
  181. flite/${FV_VOICENAME}_res.raw \
  182. flite/${FV_VOICENAME}_ressize.raw |
  183. awk '{if ($4 != "total") print $3}' |
  184. $FLITEDIR/tools/a2int.pl >>flite/${FV_VOICENAME}.voxdata
  185. # Order goes from 4 bytes, 2 bytes, 1 byte info to ensure alignment
  186. cat flite/${FV_VOICENAME}_residx.raw >>flite/${FV_VOICENAME}.voxdata
  187. cat flite/${FV_VOICENAME}_lpc.raw >>flite/${FV_VOICENAME}.voxdata
  188. cat flite/${FV_VOICENAME}_mcep.raw >>flite/${FV_VOICENAME}.voxdata
  189. cat flite/${FV_VOICENAME}_res.raw >>flite/${FV_VOICENAME}.voxdata
  190. cat flite/${FV_VOICENAME}_ressize.raw >>flite/${FV_VOICENAME}.voxdata
  191. exit 0
  192. fi
  193. # build mcep (params)
  194. if [ "$1" = "mcep" ]
  195. then
  196. echo "Finding MCEP min max and range"
  197. cat $PROMPTFILE |
  198. awk '{print $2}' |
  199. while read i
  200. do
  201. $ESTDIR/bin/ch_track -otype est_ascii mcep/$i.mcep |
  202. sed '1,/EST_Header_End/d'
  203. done |
  204. awk 'BEGIN {min=0; max=0;}
  205. {for (i=4; i<=NF; i++)
  206. {
  207. if ($i < min) min = $i;
  208. if ($i > max) max = $i;
  209. }
  210. }
  211. END {printf("(set! mcep_min %f)\n",min);
  212. printf("(set! mcep_max %f)\n",max);
  213. printf("(set! mcep_range %f)\n",max-min);
  214. }' >mcep/mcep.params.scm
  215. exit 0
  216. fi
  217. if [ "$1" = "cg_spam" ]
  218. then
  219. #Dump phrase tree
  220. $FESTIVAL --heap $HEAPSIZE -b \
  221. $FLITEDIR/tools/make_cg.scm \
  222. $FLITEDIR/tools/make_cart.scm \
  223. $FLITEDIR/tools/make_vallist.scm \
  224. festvox/${FV_VOICENAME}_cg.scm \
  225. '(begin
  226. (voice_'$FV_VOICENAME'_cg)
  227. (if cg:spamf0
  228. (begin
  229. (format t "cg_convert: Dumping spamf0 models\n")
  230. (set! current_node -1)
  231. (set! feat_nums nil)
  232. (set! val_table nil)
  233. (set! ptree (car (load "festival/trees/phrase.tree" t)))
  234. (set! ofd (fopen (format nil "flite/%s_spamf0_phrase.c" "'$FV_VOICENAME'") "w"))
  235. (set! ofdh (fopen (format nil "flite/%s_spamf0_phrase.h" "'$FV_VOICENAME'") "w"))
  236. (format ofd "/*****************************************************/\n")
  237. (format ofd "/** Autogenerated %s phrase carts */\n" "'$FV_VOICENAME'")
  238. (format ofd "/*****************************************************/\n")
  239. (format ofd "\n")
  240. (format ofd "#include \"cst_string.h\"\n")
  241. (format ofd "#include \"cst_cart.h\"\n")
  242. (format ofd "#include \"%s_spamf0_phrase.h\"\n" "'$FV_VOICENAME'")
  243. (do_carttoC ofd ofdh (format nil "%s_spamf0_phrase" "'$FV_VOICENAME'") ptree)
  244. (fclose ofd)
  245. (fclose ofdh)
  246. )))'
  247. #Dump accent tree
  248. $FESTIVAL --heap $HEAPSIZE -b \
  249. $FLITEDIR/tools/make_cg.scm \
  250. $FLITEDIR/tools/make_cart.scm \
  251. $FLITEDIR/tools/make_vallist.scm \
  252. festvox/${FV_VOICENAME}_cg.scm \
  253. '(begin
  254. (voice_'$FV_VOICENAME'_cg)
  255. (if cg:spamf0
  256. (begin
  257. (set! current_node -1)
  258. (set! feat_nums nil)
  259. (set! val_table nil)
  260. (set! acctree (car (load "festival/trees/acc.tree" t)))
  261. (set! ofd (fopen (format nil "flite/%s_spamf0_accent.c" "'$FV_VOICENAME'") "w"))
  262. (set! ofdh (fopen (format nil "flite/%s_spamf0_accent.h" "'$FV_VOICENAME'") "w"))
  263. (format ofd "/*****************************************************/\n")
  264. (format ofd "/** Autogenerated %s spam accent params */\n" "'$FV_VOICENAME'")
  265. (format ofd "/*****************************************************/\n")
  266. (format ofd "\n")
  267. (format ofd "#include \"cst_string.h\"\n")
  268. (format ofd "#include \"cst_cart.h\"\n")
  269. (format ofd "#include \"%s_spamf0_accent.h\"\n" "'$FV_VOICENAME'")
  270. (set! old_carttoC_extract_answer carttoC_extract_answer)
  271. (set! carttoC_extract_answer carttoC_extract_spectral_frame)
  272. (do_carttoC ofd ofdh (format nil "%s_spamf0_accent" "'$FV_VOICENAME'") acctree)
  273. (set! carttoC_extract_answer old_carttoC_extract_answer)
  274. (fclose ofd)
  275. (fclose ofdh)
  276. )))'
  277. #Dump accent params
  278. $FESTIVAL --heap $HEAPSIZE -b \
  279. $FLITEDIR/tools/make_cg.scm \
  280. $FLITEDIR/tools/make_cart.scm \
  281. $FLITEDIR/tools/make_vallist.scm \
  282. festvox/${FV_VOICENAME}_cg.scm \
  283. '(begin
  284. (voice_'$FV_VOICENAME'_cg)
  285. (if cg:spamf0
  286. (begin
  287. (set! current_node -1)
  288. (set! feat_nums nil)
  289. (set! val_table nil)
  290. (set! mfd (fopen (format nil "flite/%s_spamf0_accent_params.c" "'$FV_VOICENAME'") "w"))
  291. (set! acctrack (track.load "festival/trees/cb.params"))
  292. (format mfd "/*****************************************************/\n")
  293. (format mfd "/** Autogenerated Spam accent vectors for %s */\n" "'$FV_VOICENAME'")
  294. (format mfd "/*****************************************************/\n")
  295. (set! num_channels (track.num_channels acctrack))
  296. (set! num_frames (track.num_frames acctrack))
  297. (set! i 0)
  298. (while (< i num_frames)
  299. (output_accent_frame "'$FV_VOICENAME'" acctrack i mfd)
  300. (set! i (+ 1 i)))
  301. (format mfd "\n\n")
  302. (format mfd "const float * const %s_spamf0_accent_vectors[] = {\n" "'$FV_VOICENAME'" )
  303. (set! i 0)
  304. (while (< i num_frames)
  305. (format mfd " %s_spamf0_accent_frame_%d,\n" "'$FV_VOICENAME'" i)
  306. (set! i (+ 1 i)))
  307. (format mfd "};\n\n")
  308. (fclose mfd)
  309. )))'
  310. $0 cg
  311. exit 0
  312. fi
  313. if [ "$1" = "cg" ] # clustergen
  314. then
  315. # For smaller (and quicker) voices you can build with a reduced order
  316. # this seems to be ok for values down to 13
  317. RORDER=0
  318. if [ $# = 2 ]
  319. then
  320. RORDER=$2
  321. fi
  322. echo cg_convert: finding parameter ranges
  323. $ESTDIR/bin/ch_track -otype est_ascii festival/trees/${FV_VOICENAME}_mcep*.params |
  324. sed '1,/EST_Header_End/d' |
  325. awk 'BEGIN {nc=0;}
  326. {if (nc == 0) nc = NF;
  327. if (NF == nc )
  328. {
  329. for (i=3; i<=NF; i++)
  330. {
  331. if ((NR == 1) || ($i < min[i])) min[i] = $i;
  332. if ((NR == 1) || ($i > max[i])) max[i] = $i;
  333. }
  334. nc = NF;
  335. }
  336. }
  337. END {for (i=3; i<=nc; i++)
  338. {
  339. printf("( %f %f )\n",min[i],max[i]-min[i]);
  340. }
  341. }' >festival/trees/${FV_VOICENAME}_min_range.scm
  342. cat etc/f0.params |
  343. sed 's/=/ /' |
  344. head -2 |
  345. awk '{printf("(set! %s %s)\n",$1,$2)}' >flite/f0_params.scm
  346. $FESTIVAL --heap $HEAPSIZE -b \
  347. '(set! cg_reduced_order '$RORDER')' \
  348. flite/f0_params.scm \
  349. $FLITEDIR/tools/make_cg.scm \
  350. $FLITEDIR/tools/make_cart.scm \
  351. $FLITEDIR/tools/make_vallist.scm \
  352. '(cg_convert
  353. "'$FV_VOICENAME'"
  354. "."
  355. "flite/")'
  356. echo "flite_build cg complete. You can compile the generated voice by"
  357. echo " cd flite; make"
  358. exit 0
  359. fi
  360. if [ "$1" = "clunits" ] # clunits or ldom
  361. then
  362. echo "Building clunits/ldom index"
  363. sed '1,/EST_Header_End/d' festival/clunits/$FV_VOICENAME.catalogue |
  364. awk 'BEGIN {p="CLUNIT_NONE";}
  365. {if ((NR > 1) && (t != "0_0"))
  366. {
  367. n = split(t,bits,"_");
  368. unit_type = substr(t,1,length(t)-(length(bits[n])+1));
  369. unit_occur = bits[n];
  370. if ((t == "0_0") || (f != $2) || ($1 == "0_0"))
  371. printf("%s-%05d -- ( %s %s %s )\n",unit_type,unit_occur,line,p,"CLUNIT_NONE");
  372. else
  373. printf("%s-%05d -- ( %s %s unit_%s )\n",unit_type,unit_occur, line,p,$1);
  374. }
  375. line = $0;
  376. if ((t == "0_0") || (f != $2))
  377. p = "CLUNIT_NONE";
  378. else
  379. p=sprintf("unit_%s",t);
  380. t=$1;
  381. f=$2;
  382. }
  383. END { if (t != "0_0")
  384. {
  385. n = split(t,bits,"_");
  386. unit_type = substr(t,1,length(t)-(length(bits[n])+1));
  387. unit_occur = bits[n];
  388. printf("%s-%05d -- ( %s %s %s )\n", unit_type,unit_occur,line,p,"CLUNIT_NONE");
  389. } }' |
  390. cat >festival/clunits/$FV_VOICENAME.scm
  391. cat festival/clunits/$FV_VOICENAME.scm |
  392. $FLITEDIR/bin/flite_sort |
  393. sed 's/^.* -- //' >festival/clunits/$FV_VOICENAME.unitordered.scm
  394. cat festival/clunits/$FV_VOICENAME.scm |
  395. sed 's/^.* -- //' >festival/clunits/$FV_VOICENAME.fileordered.scm
  396. rm -f flite/$FV_VOICENAME"_lpc"*
  397. rm -f flite/$FV_VOICENAME"_mcep"*
  398. rm -f flite/$FV_VOICENAME"_res"*
  399. $FESTIVAL --heap $HEAPSIZE -b $FLITEDIR/tools/make_clunits.scm \
  400. $FLITEDIR/tools/make_cart.scm \
  401. $FLITEDIR/tools/make_vallist.scm \
  402. mcep/mcep.params.scm \
  403. '(clunits_convert "'$FV_VOICENAME'"
  404. "festival/clunits/'$FV_VOICENAME'.fileordered.scm"
  405. "festival/clunits/'$FV_VOICENAME'.unitordered.scm"
  406. "festival/trees/'$FV_VOICENAME'.tree"
  407. "."
  408. "flite/")'
  409. echo "flite_build complete. You can compile the generated voice by"
  410. echo " cd flite; make"
  411. exit 0
  412. fi
  413. if [ "$1" = "diphone" ]
  414. then
  415. echo "Building diphone index"
  416. # Not a good way to do this, to take the most recent
  417. idxfile=`ls -t dic/*.est | head -1`
  418. echo "Using "$idxfile
  419. sed '1,/EST_Header_End/d' $idxfile |
  420. awk '{printf("%s ( %s )\n",$1,$0)}' |
  421. $FLITEDIR/bin/flite_sort |
  422. sed 's/^.* (/(/' >dic/diphidx.scm
  423. $FESTIVAL --heap $HEAPSIZE -b $FLITEDIR/tools/make_didb2.scm \
  424. '(diphtoC "dic/diphidx.scm" "'$FV_VOICENAME'" "sts" "flite")'
  425. echo "flite_build complete. You can compile the generated voice by"
  426. echo " cd flite; make"
  427. exit 0
  428. fi
  429. # build index file
  430. if [ "$1" = "idx" ]
  431. then
  432. HEAPSIZE=100000000
  433. if [ "$FV_TYPE" != "diphone" ] # clunits or ldom
  434. then
  435. echo "Building clunits/ldom index"
  436. sed '1,/EST_Header_End/d' festival/clunits/$FV_VOICENAME.catalogue |
  437. awk 'BEGIN {p="CLUNIT_NONE";}
  438. {if ((NR > 1) && (t != "0_0"))
  439. {
  440. n = split(t,bits,"_");
  441. unit_type = substr(t,1,length(t)-(length(bits[n])+1));
  442. unit_occur = bits[n];
  443. if ((t == "0_0") || (f != $2) || ($1 == "0_0"))
  444. printf("%s_%05d -- ( %s %s %s )\n",unit_type,unit_occur,line,p,"CLUNIT_NONE");
  445. else
  446. printf("%s_%05d -- ( %s %s unit_%s )\n",unit_type,unit_occur, line,p,$1);
  447. }
  448. line = $0;
  449. if ((t == "0_0") || (f != $2))
  450. p = "CLUNIT_NONE";
  451. else
  452. p=sprintf("unit_%s",t);
  453. t=$1;
  454. f=$2;
  455. }
  456. END { if (t != "0_0")
  457. {
  458. n = split(t,bits,"_");
  459. unit_type = substr(t,1,length(t)-(length(bits[n])+1));
  460. unit_occur = bits[n];
  461. printf("%s_%05d -- ( %s %s %s )\n", unit_type,unit_occur,line,p,"CLUNIT_NONE");
  462. } }' |
  463. cat >festival/clunits/$FV_VOICENAME.scm
  464. cat festival/clunits/$FV_VOICENAME.scm |
  465. $FLITEDIR/bin/flite_sort |
  466. sed 's/^.* -- //' >festival/clunits/$FV_VOICENAME.unitordered.scm
  467. cat festival/clunits/$FV_VOICENAME.scm |
  468. sed 's/^.* -- //' >festival/clunits/$FV_VOICENAME.fileordered.scm
  469. rm -f flite/$FV_VOICENAME"_lpc"*
  470. rm -f flite/$FV_VOICENAME"_mcep"*
  471. rm -f flite/$FV_VOICENAME"_res"*
  472. $FESTIVAL --heap $HEAPSIZE -b $FLITEDIR/tools/make_clunits.scm \
  473. $FLITEDIR/tools/make_cart.scm \
  474. $FLITEDIR/tools/make_vallist.scm \
  475. mcep/mcep.params.scm \
  476. '(clunits_convert "'$FV_VOICENAME'"
  477. "festival/clunits/'$FV_VOICENAME'.fileordered.scm"
  478. "festival/clunits/'$FV_VOICENAME'.unitordered.scm"
  479. "festival/trees/'$FV_VOICENAME'.tree"
  480. "."
  481. "flite/")'
  482. fi
  483. if [ "$FV_TYPE" = "diphone" ]
  484. then
  485. echo "Building diphone index"
  486. # Not a good way to do this, to take the most recent
  487. idxfile=`ls -t dic/*.est | head -1`
  488. echo "Using "$idxfile
  489. sed '1,/EST_Header_End/d' $idxfile |
  490. awk '{printf("%s ( %s )\n",$1,$0)}' |
  491. $FLITEDIR/bin/flite_sort |
  492. sed 's/^.* (/(/' >dic/diphidx.scm
  493. $FESTIVAL --heap $HEAPSIZE -b $FLITEDIR/tools/make_didb.scm \
  494. '(diphtoC "dic/diphidx.scm" "'$FV_VOICENAME'" "sts" "flite")'
  495. fi
  496. echo "flite_build complete. You can compile the generated voice by"
  497. echo " cd flite; make"
  498. exit 0
  499. fi
  500. echo build_flite unknown arguments $*
  501. exit 1