Merge lp:~logan/ubuntu/raring/festival/debian-merge into lp:ubuntu/raring/festival

Proposed by Logan Rosen
Status: Merged
Merged at revision: 32
Proposed branch: lp:~logan/ubuntu/raring/festival/debian-merge
Merge into: lp:ubuntu/raring/festival
Diff against target: 6678 lines (+4626/-1165)
109 files modified
.pc/.version (+1/-0)
debian/README.Debian (+35/-0)
debian/changelog (+61/-0)
debian/clean (+1/-0)
debian/compat (+1/-1)
debian/control (+12/-9)
debian/festival.install (+1/-0)
debian/patches/Makefile.diff (+1/-1)
debian/patches/config_config.diff (+2/-2)
debian/patches/config_config.in.diff (+1/-1)
debian/patches/config_make_system.mak.diff (+1/-1)
debian/patches/config_modules_editline.mak.diff (+1/-1)
debian/patches/config_project.mak.diff (+1/-1)
debian/patches/config_systems_default.mak.diff (+1/-1)
debian/patches/doc_Makefile.diff (+4/-3)
debian/patches/doc_doc.scm.diff (+2/-2)
debian/patches/doc_festival.head.diff (+1/-1)
debian/patches/doc_festival.texi.diff (+1/-1)
debian/patches/doc_festival_client.head.diff (+1/-1)
debian/patches/doc_text2wave.head.diff (+1/-1)
debian/patches/doc_text2wave.options.diff (+1/-1)
debian/patches/doc_text2wave.tail.diff (+1/-1)
debian/patches/examples_Makefile.diff (+1/-1)
debian/patches/examples_benchmark.diff (+1/-1)
debian/patches/examples_benchmark.text.diff (+1/-1)
debian/patches/examples_dumpfeats.sh.diff (+1/-1)
debian/patches/examples_durmeanstd.sh.diff (+1/-1)
debian/patches/examples_latest.sh.diff (+1/-1)
debian/patches/examples_make_utts.sh.diff (+1/-1)
debian/patches/examples_saytime.sh.diff (+1/-1)
debian/patches/examples_scfg_parse_text.sh.diff (+1/-1)
debian/patches/examples_text2pos.sh.diff (+1/-1)
debian/patches/examples_text2wave.sh.diff (+1/-1)
debian/patches/hts21compat.diff (+3642/-0)
debian/patches/languagespatch.diff (+743/-0)
debian/patches/lib_festdoc.scm.diff (+2/-2)
debian/patches/lib_festival.scm.diff (+4/-3)
debian/patches/lib_init.scm.diff (+3/-2)
debian/patches/lib_languages.scm.diff (+0/-105)
debian/patches/lib_lexicons.scm.diff (+1/-1)
debian/patches/lib_phrase.scm.diff (+1/-1)
debian/patches/lib_sable-mode.scm.diff (+1/-1)
debian/patches/lib_singing-mode.scm.diff (+1/-1)
debian/patches/lib_soleml-mode.scm.diff (+1/-1)
debian/patches/lib_synthesis.scm.diff (+1/-1)
debian/patches/lib_tts.scm.diff (+1/-1)
debian/patches/lib_voices.scm.diff (+1/-1)
debian/patches/lib_voices_english_kal_diphone_festvox_kal_diphone.scm.diff (+1/-1)
debian/patches/lintianspellpatch.diff (+27/-0)
debian/patches/russian_patch.diff (+0/-44)
debian/patches/series (+3/-46)
debian/patches/src_arch_festival_Makefile.diff (+1/-1)
debian/patches/src_arch_festival_ModuleDescription.cc.diff (+0/-16)
debian/patches/src_arch_festival_Phone.cc.diff (+0/-18)
debian/patches/src_arch_festival_audspio.cc.diff (+1/-11)
debian/patches/src_arch_festival_client.cc.diff (+0/-17)
debian/patches/src_arch_festival_features.cc.diff (+0/-17)
debian/patches/src_arch_festival_festival.cc.diff (+3/-10)
debian/patches/src_arch_festival_festivalP.h.diff (+0/-16)
debian/patches/src_arch_festival_ngram.cc.diff (+0/-17)
debian/patches/src_arch_festival_server.cc.diff (+0/-16)
debian/patches/src_arch_festival_utterance.cc.diff (+0/-18)
debian/patches/src_arch_festival_wagon_interp.cc.diff (+0/-18)
debian/patches/src_arch_festival_wave.cc.diff (+0/-17)
debian/patches/src_arch_festival_wfst.cc.diff (+0/-17)
debian/patches/src_include_Phone.h.diff (+0/-38)
debian/patches/src_include_festival.h.diff (+1/-10)
debian/patches/src_include_lexicon.h.diff (+0/-22)
debian/patches/src_main_audsp.cc.diff (+0/-17)
debian/patches/src_main_festival_client.cc.diff (+0/-17)
debian/patches/src_main_festival_main.cc.diff (+1/-20)
debian/patches/src_modules_Duration_Klatt.cc.diff (+0/-18)
debian/patches/src_modules_Duration_dur_aux.cc.diff (+0/-16)
debian/patches/src_modules_Duration_duration.cc.diff (+0/-16)
debian/patches/src_modules_Intonation_duffint.cc.diff (+0/-17)
debian/patches/src_modules_Intonation_gen_int.cc.diff (+0/-17)
debian/patches/src_modules_Intonation_int_tree.cc.diff (+0/-17)
debian/patches/src_modules_Intonation_simple.cc.diff (+0/-25)
debian/patches/src_modules_Lexicon_complex.cc.diff (+0/-16)
debian/patches/src_modules_Lexicon_lexicon.cc.diff (+0/-18)
debian/patches/src_modules_Lexicon_lts_rules.cc.diff (+0/-16)
debian/patches/src_modules_MultiSyn_path_fixes.diff (+1/-1)
debian/patches/src_modules_Text_text.cc.diff (+0/-17)
debian/patches/src_modules_Text_text_modes.cc.diff (+0/-17)
debian/patches/src_modules_Text_tok_ext.cc.diff (+0/-17)
debian/patches/src_modules_Text_xxml.cc.diff (+0/-17)
debian/patches/src_modules_UniSyn_diphone_UniSyn_diphone.cc.diff (+2/-35)
debian/patches/src_modules_UniSyn_diphone_us_diphone_unit.cc.diff (+0/-17)
debian/patches/src_modules_UniSyn_phonology_UniSyn_build.cc.diff (+0/-16)
debian/patches/src_modules_UniSyn_us_features.cc.diff (+0/-17)
debian/patches/src_modules_base_ff.cc.diff (+0/-17)
debian/patches/src_modules_base_modules.cc.diff (+0/-17)
debian/patches/src_modules_base_parameters.cc.diff (+0/-16)
debian/patches/src_modules_base_phrasify.cc.diff (+0/-17)
debian/patches/src_modules_base_phrinfo.cc.diff (+0/-17)
debian/patches/src_modules_base_pos.cc.diff (+0/-17)
debian/patches/src_modules_base_word.cc.diff (+0/-17)
debian/patches/src_modules_clunits_acost.cc.diff (+0/-16)
debian/patches/src_modules_clunits_cldb.cc.diff (+0/-16)
debian/patches/src_modules_clunits_clunits.cc.diff (+0/-17)
debian/patches/src_modules_diphone_di_io.cc.diff (+1/-1)
debian/patches/src_modules_diphone_diphone.cc.diff (+1/-1)
debian/patches/src_modules_diphone_diphone.h.diff (+1/-1)
debian/patches/src_modules_donovan_donovan.cc.diff (+0/-16)
debian/patches/src_modules_donovan_t2s.h.diff (+1/-1)
debian/patches/src_modules_rxp_ttsxml.cc.diff (+0/-17)
debian/patches/testsuite_data_modes.scm.diff (+1/-1)
debian/rules (+34/-45)
debian/source/format (+1/-1)
To merge this branch: bzr merge lp:~logan/ubuntu/raring/festival/debian-merge
Reviewer Review Type Date Requested Status
James Page Approve
Ubuntu branches Pending
Review via email: mp+138632@code.launchpad.net
To post a comment you must log in.
Revision history for this message
James Page (james-page) wrote :

LGTM; uploaded.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory '.pc'
2=== added file '.pc/.version'
3--- .pc/.version 1970-01-01 00:00:00 +0000
4+++ .pc/.version 2012-12-07 04:47:19 +0000
5@@ -0,0 +1,1 @@
6+2
7
8=== modified file 'debian/README.Debian'
9--- debian/README.Debian 2010-10-28 20:04:58 +0000
10+++ debian/README.Debian 2012-12-07 04:47:19 +0000
11@@ -6,6 +6,7 @@
12
13 - The standard .scm files are located in /usr/share/festival.
14 - DTDs and related files are in /usr/share/sgml/festival.
15+ - HTS 2.1 backward compatibility module s provided for festival.
16
17 Feel free to submit patches.
18
19@@ -64,3 +65,37 @@
20 as freebsd16audio, mplayeraudio etc.
21
22 -- Kumar Appaiah <akumar@debian.org>, Wed, 27 Oct 2010 09:07:45 -0500
23+
24+ Use of HTS 2.1 compatibility module:
25+ ------------------------------------
26+
27+ From festival 2.095 onward festival upstream no longer supports older
28+ HTS 2.1 version voices. The popularity of such voices is so large
29+ that for we provide a "forward ported" module from an earlier version of
30+ festival (version 1.96) to allow the use of these voices. In order to use
31+ the voice with the Debian provided compatibility module (known as the
32+ "hts21_engine") two slight changes must be made to the voice.
33+ These lines are in a file in the festvox directory of the voice but
34+ the name of the file changes from voice to voice. The lines to be replaced
35+ are the following:
36+
37+ (require 'hts)
38+
39+ must be replaced with:
40+
41+ (require 'hts21compat)
42+
43+ and the line:
44+
45+ (Parameter.set 'Synth_Method 'HTS)
46+
47+ must be replaced with:
48+
49+ (Parameter.set 'Synth_Method 'HTS21)
50+
51+ Please note the compatibility module is intended to operate separately
52+ and in parallel with the modern HTS engine known as "hts_engine".
53+ There is no need to modify newer HTS 2.1.1 voices. They use "hts_engine".
54+ We recommend that you move to newer voices when available as the
55+ "hts21_engine" may not be ported to future releases in Debian of festival.
56+
57
58=== modified file 'debian/changelog'
59--- debian/changelog 2012-09-24 20:00:04 +0000
60+++ debian/changelog 2012-12-07 04:47:19 +0000
61@@ -1,3 +1,64 @@
62+festival (1:2.1~release-5ubuntu1) raring; urgency=low
63+
64+ * Merge from Debian unstable. Remaining changes:
65+ - debian/control: Drop file-rc as an alternative to sysv-rc, as
66+ Ubuntu doesn't support it.
67+
68+ -- Logan Rosen <logatronico@gmail.com> Thu, 06 Dec 2012 23:35:31 -0500
69+
70+festival (1:2.1~release-5) unstable; urgency=low
71+
72+ [ Samuel Thibault ]
73+ * control: Bump Standards-Version to 3.9.3 (no changes).
74+
75+ [ Peter Drysdale ]
76+ * Change config to point to new location of multiarch speech_tools
77+ during compile process. (Fixes FTBS with multiarch enabled speech_tools).
78+ Build-depend on the multiarch-enabled version of speech_tools.
79+
80+ -- Samuel Thibault <sthibault@debian.org> Sat, 25 Feb 2012 17:37:01 +0100
81+
82+festival (1:2.1~release-4) unstable; urgency=low
83+
84+ [ Jean-Philippe MENGUAL ]
85+ * Added a new build-dep with libaudiofile-dev. Closes: #657597
86+
87+ [ Samuel Thibault ]
88+ * Add myself as uploader.
89+
90+ -- Jean-Philippe MENGUAL <texou@accelibreinfo.eu> Sat, 28 Jan 2012 23:27:39 +0100
91+
92+festival (1:2.1~release-3) unstable; urgency=low
93+
94+ [ Samuel Thibault ]
95+ * debian/rules: Fix clean rule again.
96+
97+ -- Jean-Philippe MENGUAL <texou@accelibreinfo.eu> Sun, 08 Jan 2012 03:07:32 +0100
98+
99+festival (1:2.1~release-2) unstable; urgency=low
100+
101+ [ Peter Drysdale ]
102+ * Commits from Jean-Philippe incorporated in master
103+ * Fix spelling and hyphen lintian problems
104+ * Move to dh style packaging
105+ * Remove parts of redundant namespace patching and individually title
106+ patches. Gcc version patching no longer needed (Closes: #592052)
107+ * Provide HTS compatibility module for HTS 2.1 voices (Closes: #589614)
108+ * General way of adding languages from Sergio Oller (Closes: #606173)
109+ * Include clustergen module which is on in 2.1 (Closes: #639648)
110+ * Add Peter Drysdale to uploaders
111+
112+ [ Samuel Thibault ]
113+ * debian/rules: fix clean rules.
114+ * debian/control: depend on quilt.
115+
116+ [ Jean-Philippe MENGUAL ]
117+ * New maintainer. Closes #601596
118+ * Bump Standards-Version to 3.9.2 (no change needed)
119+ * Fixed debian/patches/lib_festival.scm.diff (desplays replaced with displays)
120+
121+ -- Jean-Philippe MENGUAL <texou@accelibreinfo.eu> Tue, 16 Aug 2011 02:18:09 +0200
122+
123 festival (1:2.1~release-1ubuntu3) quantal; urgency=low
124
125 * Cherry-pick from 1:2.1~release-5 to fix FTBFS:
126
127=== added file 'debian/clean'
128--- debian/clean 1970-01-01 00:00:00 +0000
129+++ debian/clean 2012-12-07 04:47:19 +0000
130@@ -0,0 +1,1 @@
131+confdefs.h
132
133=== modified file 'debian/compat'
134--- debian/compat 2007-07-03 11:50:12 +0000
135+++ debian/compat 2012-12-07 04:47:19 +0000
136@@ -1,1 +1,1 @@
137-5
138+8
139
140=== modified file 'debian/control'
141--- debian/control 2012-09-24 20:00:04 +0000
142+++ debian/control 2012-12-07 04:47:19 +0000
143@@ -2,20 +2,23 @@
144 Section: sound
145 Priority: optional
146 Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
147-XSBC-Original-Maintainer: Kartik Mistry <kartik@debian.org>
148+XSBC-Original-Maintainer: Jean-Philippe MENGUAL <texou@accelibreinfo.eu>
149 Uploaders: Kumar Appaiah <akumar@debian.org>,
150- Jaldhar H. Vyas <jaldhar@debian.org>
151-Build-Depends: debhelper (>= 7.0.5~),
152+ Jaldhar H. Vyas <jaldhar@debian.org>,
153+ Peter Drysdale <drysdalepete@gmail.com>,
154+ Samuel Thibault <sthibault@debian.org>
155+Build-Depends: debhelper (>= 8),
156 autotools-dev,
157 libesd0-dev,
158 libestools2.1-dev (>= 1:2.1~release-4),
159 libncurses5-dev,
160- quilt (>= 0.40),
161- texinfo
162-Standards-Version: 3.9.1
163+ texinfo,
164+ quilt,
165+ libaudiofile-dev
166+Standards-Version: 3.9.3
167 Homepage: http://www.cstr.ed.ac.uk/projects/festival/
168-Vcs-Git: git://git.debian.org/git/collab-maint/festival.git
169-Vcs-Browser: http://git.debian.org/?p=collab-maint/festival.git
170+Vcs-Git: git://git.debian.org/git/tts/festival.git
171+Vcs-Browser: http://git.debian.org/?p=tts/festival.git
172
173 Package: festival
174 Architecture: any
175@@ -25,7 +28,7 @@
176 lsb-base (>= 3.0-10),
177 sysv-rc (>= 2.86.ds1)
178 Recommends: festvox-kallpc16k | festival-voice
179-Conflicts: festvox-rablpc8k (<< 1.4.0-2),
180+Breaks: festvox-rablpc8k (<< 1.4.0-2),
181 festvox-rablpc16k (<< 1.4.0-2),
182 festvox-kdlpc16k (<< 1.4.0-4),
183 festvox-kdlpc8k (<< 1.4.0-5),
184
185=== modified file 'debian/festival.install'
186--- debian/festival.install 2011-05-04 20:54:27 +0000
187+++ debian/festival.install 2012-12-07 04:47:19 +0000
188@@ -2,6 +2,7 @@
189 src/main/festival_client usr/bin
190 lib/etc/unknown_DebianGNULinux/audsp usr/lib/festival
191 lib/*.scm usr/share/festival
192+lib/languages/*.scm usr/share/festival/languages
193 lib/multisyn/*.scm usr/share/festival/multisyn
194 lib/sable-latin.ent usr/share/sgml/festival
195 lib/Sable.v0_2.dtd usr/share/sgml/festival
196
197=== modified file 'debian/patches/Makefile.diff'
198--- debian/patches/Makefile.diff 2009-06-19 14:28:07 +0000
199+++ debian/patches/Makefile.diff 2012-12-07 04:47:19 +0000
200@@ -1,5 +1,5 @@
201 This patch is part of a series of patches for festival for
202-Debian GNU/Linux, which primarily fix build errors with GCC 4.3 and newer.
203+Debian GNU/Linux, to provide Debian specific building for festival
204
205 Index: b/Makefile
206 ===================================================================
207
208=== modified file 'debian/patches/config_config.diff'
209--- debian/patches/config_config.diff 2009-06-19 14:28:07 +0000
210+++ debian/patches/config_config.diff 2012-12-07 04:47:19 +0000
211@@ -1,5 +1,5 @@
212 This patch is part of a series of patches for festival for
213-Debian GNU/Linux, which primarily fix build errors with GCC 4.3 and newer.
214+Debian GNU/Linux, to provide Debian specific building of festival
215
216 Index: b/config/config
217 ===================================================================
218@@ -63,7 +63,7 @@
219 +# ALSO_INCLUDE += UniSyn_phonology UniSyn_selection
220 +## Cluster unit selection code as described in "Building Voices in
221 +## Festival", again experimental and suitable for research purposes only.
222-+ALSO_INCLUDE += clunits hts_engine MultiSyn
223++ALSO_INCLUDE += clunits clustergen hts_engine hts21_engine MultiSyn
224 +
225 +## Old diphone code that will be delete, left in only for some
226 +## compatibility
227
228=== modified file 'debian/patches/config_config.in.diff'
229--- debian/patches/config_config.in.diff 2009-06-19 14:28:07 +0000
230+++ debian/patches/config_config.in.diff 2012-12-07 04:47:19 +0000
231@@ -1,5 +1,5 @@
232 This patch is part of a series of patches for festival for
233-Debian GNU/Linux, which primarily fix build errors with GCC 4.3 and newer.
234+Debian GNU/Linux, to provide Debian specific building of festival
235
236 Index: b/config/config.in
237 ===================================================================
238
239=== modified file 'debian/patches/config_make_system.mak.diff'
240--- debian/patches/config_make_system.mak.diff 2009-06-19 14:28:07 +0000
241+++ debian/patches/config_make_system.mak.diff 2012-12-07 04:47:19 +0000
242@@ -1,5 +1,5 @@
243 This patch is part of a series of patches for festival for
244-Debian GNU/Linux, which primarily fix build errors with GCC 4.3 and newer.
245+Debian GNU/Linux, to provide Debian specific building of festival
246
247 Index: b/config/make_system.mak
248 ===================================================================
249
250=== modified file 'debian/patches/config_modules_editline.mak.diff'
251--- debian/patches/config_modules_editline.mak.diff 2009-06-19 14:28:07 +0000
252+++ debian/patches/config_modules_editline.mak.diff 2012-12-07 04:47:19 +0000
253@@ -1,5 +1,5 @@
254 This patch is part of a series of patches for festival for
255-Debian GNU/Linux, which primarily fix build errors with GCC 4.3 and newer.
256+Debian GNU/Linux, to provide ncurses commandline editing for Debian
257
258 Index: b/config/modules/editline.mak
259 ===================================================================
260
261=== modified file 'debian/patches/config_project.mak.diff'
262--- debian/patches/config_project.mak.diff 2012-09-24 20:00:04 +0000
263+++ debian/patches/config_project.mak.diff 2012-12-07 04:47:19 +0000
264@@ -1,5 +1,5 @@
265 This patch is part of a series of patches for festival for
266-Debian GNU/Linux, which primarily fix build errors with GCC 4.3 and newer.
267+Debian GNU/Linux, to provide Debian specific building for festival
268
269 Index: b/config/project.mak
270 ===================================================================
271
272=== modified file 'debian/patches/config_systems_default.mak.diff'
273--- debian/patches/config_systems_default.mak.diff 2009-06-19 14:28:07 +0000
274+++ debian/patches/config_systems_default.mak.diff 2012-12-07 04:47:19 +0000
275@@ -1,5 +1,5 @@
276 This patch is part of a series of patches for festival for
277-Debian GNU/Linux, which primarily fix build errors with GCC 4.3 and newer.
278+Debian GNU/Linux, to provide Debian specific building for festival
279
280 Index: b/config/systems/default.mak
281 ===================================================================
282
283=== modified file 'debian/patches/doc_Makefile.diff'
284--- debian/patches/doc_Makefile.diff 2009-06-19 14:28:07 +0000
285+++ debian/patches/doc_Makefile.diff 2012-12-07 04:47:19 +0000
286@@ -1,5 +1,6 @@
287-This patch is part of a series of patches for festival for
288-Debian GNU/Linux, which primarily fix build errors with GCC 4.3 and newer.
289+This patch is for festival for Debian GNU/Linux, to add text2wave
290+man page, ensure man pages pass lintian hyphen test and are built
291+from correct directories for Debian filesystem layout
292
293 Index: b/doc/Makefile
294 ===================================================================
295@@ -38,7 +39,7 @@
296 cat $^ >$@
297 %.options : $(TOP)/src/main/%
298 - $(TOP)/bin/$* -man_options >$@
299-+ $(TOP)/src/main/$* -man_options >$@
300++ $(TOP)/src/main/$* -man_options |sed 's#--#\\-\\-#' >$@
301 %.options : $(TOP)/src/main/%.exe
302 - $(TOP)/bin/$* -man_options >$@
303 + $(TOP)/src/main/$* -man_options >$@
304
305=== modified file 'debian/patches/doc_doc.scm.diff'
306--- debian/patches/doc_doc.scm.diff 2009-06-19 14:28:07 +0000
307+++ debian/patches/doc_doc.scm.diff 2012-12-07 04:47:19 +0000
308@@ -1,5 +1,5 @@
309-This patch is part of a series of patches for festival for
310-Debian GNU/Linux, which primarily fix build errors with GCC 4.3 and newer.
311+This patch is for festival for Debian GNU/Linux, to make
312+documentation within Debian filesystem layout
313
314 Index: b/doc/doc.scm
315 ===================================================================
316
317=== modified file 'debian/patches/doc_festival.head.diff'
318--- debian/patches/doc_festival.head.diff 2009-06-19 14:28:07 +0000
319+++ debian/patches/doc_festival.head.diff 2012-12-07 04:47:19 +0000
320@@ -1,5 +1,5 @@
321 This patch is part of a series of patches for festival for
322-Debian GNU/Linux, which primarily fix build errors with GCC 4.3 and newer.
323+Debian GNU/Linux, to correct spelling
324
325 Index: b/doc/festival.head
326 ===================================================================
327
328=== modified file 'debian/patches/doc_festival.texi.diff'
329--- debian/patches/doc_festival.texi.diff 2009-06-19 14:28:07 +0000
330+++ debian/patches/doc_festival.texi.diff 2012-12-07 04:47:19 +0000
331@@ -1,5 +1,5 @@
332 This patch is part of a series of patches for festival for
333-Debian GNU/Linux, which primarily fix build errors with GCC 4.3 and newer.
334+Debian GNU/Linux, to provide Debian specific changes to documentation
335
336 Index: b/doc/festival.texi
337 ===================================================================
338
339=== modified file 'debian/patches/doc_festival_client.head.diff'
340--- debian/patches/doc_festival_client.head.diff 2009-06-19 14:28:07 +0000
341+++ debian/patches/doc_festival_client.head.diff 2012-12-07 04:47:19 +0000
342@@ -1,5 +1,5 @@
343 This patch is part of a series of patches for festival for
344-Debian GNU/Linux, which primarily fix build errors with GCC 4.3 and newer.
345+Debian GNU/Linux, to correct spelling
346
347 Index: b/doc/festival_client.head
348 ===================================================================
349
350=== modified file 'debian/patches/doc_text2wave.head.diff'
351--- debian/patches/doc_text2wave.head.diff 2009-06-19 14:28:07 +0000
352+++ debian/patches/doc_text2wave.head.diff 2012-12-07 04:47:19 +0000
353@@ -1,5 +1,5 @@
354 This patch is part of a series of patches for festival for
355-Debian GNU/Linux, which primarily fix build errors with GCC 4.3 and newer.
356+Debian GNU/Linux, to provide man page for text2wave
357
358 Index: b/doc/text2wave.head
359 ===================================================================
360
361=== modified file 'debian/patches/doc_text2wave.options.diff'
362--- debian/patches/doc_text2wave.options.diff 2009-06-19 14:28:07 +0000
363+++ debian/patches/doc_text2wave.options.diff 2012-12-07 04:47:19 +0000
364@@ -1,5 +1,5 @@
365 This patch is part of a series of patches for festival for
366-Debian GNU/Linux, which primarily fix build errors with GCC 4.3 and newer.
367+Debian GNU/Linux, to provide man page for text2wave
368
369 Index: b/doc/text2wave.options
370 ===================================================================
371
372=== modified file 'debian/patches/doc_text2wave.tail.diff'
373--- debian/patches/doc_text2wave.tail.diff 2009-06-19 14:28:07 +0000
374+++ debian/patches/doc_text2wave.tail.diff 2012-12-07 04:47:19 +0000
375@@ -1,5 +1,5 @@
376 This patch is part of a series of patches for festival for
377-Debian GNU/Linux, which primarily fix build errors with GCC 4.3 and newer.
378+Debian GNU/Linux, to provide man page for text2wave
379
380 Index: b/doc/text2wave.tail
381 ===================================================================
382
383=== modified file 'debian/patches/examples_Makefile.diff'
384--- debian/patches/examples_Makefile.diff 2009-06-19 14:28:07 +0000
385+++ debian/patches/examples_Makefile.diff 2012-12-07 04:47:19 +0000
386@@ -1,5 +1,5 @@
387 This patch is part of a series of patches for festival for
388-Debian GNU/Linux, which primarily fix build errors with GCC 4.3 and newer.
389+Debian GNU/Linux, to comply with Filesystem Hierarchy Standard
390
391 Index: b/examples/Makefile
392 ===================================================================
393
394=== modified file 'debian/patches/examples_benchmark.diff'
395--- debian/patches/examples_benchmark.diff 2009-06-19 14:28:07 +0000
396+++ debian/patches/examples_benchmark.diff 2012-12-07 04:47:19 +0000
397@@ -1,5 +1,5 @@
398 This patch is part of a series of patches for festival for
399-Debian GNU/Linux, which primarily fix build errors with GCC 4.3 and newer.
400+Debian GNU/Linux, to comply with Filesystem Hierarchy Standard
401
402 Index: b/examples/benchmark
403 ===================================================================
404
405=== modified file 'debian/patches/examples_benchmark.text.diff'
406--- debian/patches/examples_benchmark.text.diff 2009-06-19 14:28:07 +0000
407+++ debian/patches/examples_benchmark.text.diff 2012-12-07 04:47:19 +0000
408@@ -1,5 +1,5 @@
409 This patch is part of a series of patches for festival for
410-Debian GNU/Linux, which primarily fix build errors with GCC 4.3 and newer.
411+Debian GNU/Linux, to comply with Filesystem Hierarchy Standard
412
413 Index: b/examples/benchmark.text
414 ===================================================================
415
416=== modified file 'debian/patches/examples_dumpfeats.sh.diff'
417--- debian/patches/examples_dumpfeats.sh.diff 2009-06-19 14:28:07 +0000
418+++ debian/patches/examples_dumpfeats.sh.diff 2012-12-07 04:47:19 +0000
419@@ -1,5 +1,5 @@
420 This patch is part of a series of patches for festival for
421-Debian GNU/Linux, which primarily fix build errors with GCC 4.3 and newer.
422+Debian GNU/Linux, to comply with Filesystem Hierarchy Standard
423
424 Index: b/examples/dumpfeats.sh
425 ===================================================================
426
427=== modified file 'debian/patches/examples_durmeanstd.sh.diff'
428--- debian/patches/examples_durmeanstd.sh.diff 2009-06-19 14:28:07 +0000
429+++ debian/patches/examples_durmeanstd.sh.diff 2012-12-07 04:47:19 +0000
430@@ -1,5 +1,5 @@
431 This patch is part of a series of patches for festival for
432-Debian GNU/Linux, which primarily fix build errors with GCC 4.3 and newer.
433+Debian GNU/Linux, to comply with Filesystem Hierarchy Standard
434
435 Index: b/examples/durmeanstd.sh
436 ===================================================================
437
438=== modified file 'debian/patches/examples_latest.sh.diff'
439--- debian/patches/examples_latest.sh.diff 2009-06-19 14:28:07 +0000
440+++ debian/patches/examples_latest.sh.diff 2012-12-07 04:47:19 +0000
441@@ -1,5 +1,5 @@
442 This patch is part of a series of patches for festival for
443-Debian GNU/Linux, which primarily fix build errors with GCC 4.3 and newer.
444+Debian GNU/Linux, to comply with Filesystem Hierarchy Standard
445
446 Index: b/examples/latest.sh
447 ===================================================================
448
449=== modified file 'debian/patches/examples_make_utts.sh.diff'
450--- debian/patches/examples_make_utts.sh.diff 2009-06-19 14:28:07 +0000
451+++ debian/patches/examples_make_utts.sh.diff 2012-12-07 04:47:19 +0000
452@@ -1,5 +1,5 @@
453 This patch is part of a series of patches for festival for
454-Debian GNU/Linux, which primarily fix build errors with GCC 4.3 and newer.
455+Debian GNU/Linux, to comply with Filesystem Hierarchy Standard
456
457 Index: b/examples/make_utts.sh
458 ===================================================================
459
460=== modified file 'debian/patches/examples_saytime.sh.diff'
461--- debian/patches/examples_saytime.sh.diff 2009-06-19 14:28:07 +0000
462+++ debian/patches/examples_saytime.sh.diff 2012-12-07 04:47:19 +0000
463@@ -1,5 +1,5 @@
464 This patch is part of a series of patches for festival for
465-Debian GNU/Linux, which primarily fix build errors with GCC 4.3 and newer.
466+Debian GNU/Linux, to comply with Filesystem Hierarchy Standard
467
468 Index: b/examples/saytime.sh
469 ===================================================================
470
471=== modified file 'debian/patches/examples_scfg_parse_text.sh.diff'
472--- debian/patches/examples_scfg_parse_text.sh.diff 2009-06-19 14:28:07 +0000
473+++ debian/patches/examples_scfg_parse_text.sh.diff 2012-12-07 04:47:19 +0000
474@@ -1,5 +1,5 @@
475 This patch is part of a series of patches for festival for
476-Debian GNU/Linux, which primarily fix build errors with GCC 4.3 and newer.
477+Debian GNU/Linux, to comply with Filesystem Hierarchy Standard
478
479 Index: b/examples/scfg_parse_text.sh
480 ===================================================================
481
482=== modified file 'debian/patches/examples_text2pos.sh.diff'
483--- debian/patches/examples_text2pos.sh.diff 2009-06-19 14:28:07 +0000
484+++ debian/patches/examples_text2pos.sh.diff 2012-12-07 04:47:19 +0000
485@@ -1,5 +1,5 @@
486 This patch is part of a series of patches for festival for
487-Debian GNU/Linux, which primarily fix build errors with GCC 4.3 and newer.
488+Debian GNU/Linux, to comply with Filesystem Hierarchy Standard
489
490 Index: b/examples/text2pos.sh
491 ===================================================================
492
493=== modified file 'debian/patches/examples_text2wave.sh.diff'
494--- debian/patches/examples_text2wave.sh.diff 2009-06-19 14:28:07 +0000
495+++ debian/patches/examples_text2wave.sh.diff 2012-12-07 04:47:19 +0000
496@@ -1,5 +1,5 @@
497 This patch is part of a series of patches for festival for
498-Debian GNU/Linux, which primarily fix build errors with GCC 4.3 and newer.
499+Debian GNU/Linux, to allow alaw output (asterisk interoperability)
500
501 Index: b/examples/text2wave.sh
502 ===================================================================
503
504=== added file 'debian/patches/hts21compat.diff'
505--- debian/patches/hts21compat.diff 1970-01-01 00:00:00 +0000
506+++ debian/patches/hts21compat.diff 2012-12-07 04:47:19 +0000
507@@ -0,0 +1,3642 @@
508+Description: Fix backward compatibility for HTS 2.1 voices into festival
509+ This patch introduces a module hts21_engine which has backward compatibility
510+with older HTS 2.1 voices. As of Festival 2.095 beta festival defaults
511+to HTS2.1.1 voices which have a different API. To use festival with older
512+voices, this patch must be applied and a minor change to HTS 2.1 voices must
513+be made. Two lines in the older voice must be changed to point to the compatibility
514+module. These lines are in the festvox directory of the voice but the name of the file
515+changes from voice to voice. The lines to be replaced are the following:
516+
517+(require 'hts)
518+
519+must be replaced with:
520+
521+(require 'hts21compat)
522+
523+and the line:
524+
525+ (Parameter.set 'Synth_Method 'HTS)
526+
527+must be replaced with:
528+
529+ (Parameter.set 'Synth_Method 'HTS21)
530+
531+This patch is temporary. It is expected that as newer voices become more
532+available it will be removed from Debian festival.
533+
534+Author: Peter Drysdale <drysdalepete@gmail.com>
535+
536+---
537+
538+Origin: other
539+Bug-Debian: http://bugs.debian.org/589614
540+Forwarded: <not-needed>
541+Reviewed-By: Peter Drysdale <drysdalepete@gmail.com>
542+Last-Update: <2011-11-25>
543+
544+--- /dev/null
545++++ festival-2.1~release/src/modules/hts21_engine/model.cc
546+@@ -0,0 +1,225 @@
547++/* --------------------------------------------------------------- */
548++/* The HMM-Based Speech Synthesis System (HTS): version 1.1b */
549++/* HTS Working Group */
550++/* */
551++/* Department of Computer Science */
552++/* Nagoya Institute of Technology */
553++/* and */
554++/* Interdisciplinary Graduate School of Science and Engineering */
555++/* Tokyo Institute of Technology */
556++/* Copyright (c) 2001-2003 */
557++/* All Rights Reserved. */
558++/* */
559++/* Permission is hereby granted, free of charge, to use and */
560++/* distribute this software and its documentation without */
561++/* restriction, including without limitation the rights to use, */
562++/* copy, modify, merge, publish, distribute, sublicense, and/or */
563++/* sell copies of this work, and to permit persons to whom this */
564++/* work is furnished to do so, subject to the following conditions: */
565++/* */
566++/* 1. The code must retain the above copyright notice, this list */
567++/* of conditions and the following disclaimer. */
568++/* */
569++/* 2. Any modifications must be clearly marked as such. */
570++/* */
571++/* NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF TECHNOLOGY, */
572++/* HTS WORKING GROUP, AND THE CONTRIBUTORS TO THIS WORK DISCLAIM */
573++/* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */
574++/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
575++/* SHALL NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF */
576++/* TECHNOLOGY, HTS WORKING GROUP, NOR THE CONTRIBUTORS BE LIABLE */
577++/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY */
578++/* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, */
579++/* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS */
580++/* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR */
581++/* PERFORMANCE OF THIS SOFTWARE. */
582++/* */
583++/* --------------------------------------------------------------- */
584++/* model.c : read model and search pdf from models */
585++/* */
586++/* 2003/06/11 by Heiga Zen */
587++/* --------------------------------------------------------------- */
588++
589++#include <cstdio>
590++#include <cstring>
591++#include <cstdlib>
592++#include "festival.h"
593++
594++#include "defaults.h"
595++#include "misc.h"
596++#include "model.h"
597++#include "global.h"
598++
599++/* LoadModelFiles : load model files from files to pdf array */
600++void LoadModelFiles(ModelSet *ms)
601++{
602++ int i, j, k;
603++
604++ /*-------------------- load pdfs for duration --------------------*/
605++ /* read the number of states & the number of pdfs (leaf nodes) */
606++ fread(&ms->nstate, sizeof(int), 1, ms->fp[DUR]);
607++ if (EST_BIG_ENDIAN) ms->nstate = SWAPINT(ms->nstate);
608++ fread(&ms->ndurpdf, sizeof(int), 1, ms->fp[DUR]);
609++ if (EST_BIG_ENDIAN) ms->ndurpdf = SWAPINT(ms->ndurpdf);
610++
611++ ms->durpdf = walloc(float *,ms->ndurpdf+2);
612++
613++ /* read pdfs (mean & variance) */
614++ for (i=1; i<=ms->ndurpdf; i++) {
615++ ms->durpdf[i] = walloc(float,2*ms->nstate+2);
616++ fread(ms->durpdf[i]+2, sizeof(float), 2*ms->nstate, ms->fp[DUR]);
617++ if (EST_BIG_ENDIAN)
618++ swap_bytes_float(ms->durpdf[i]+2,2*ms->nstate);
619++ }
620++
621++ /*-------------------- load pdfs for mcep --------------------*/
622++ /* read vector size for spectrum */
623++ fread(&ms->mcepvsize, sizeof(int), 1, ms->fp[MCP]);
624++ if (EST_BIG_ENDIAN) ms->mcepvsize = SWAPINT(ms->mcepvsize);
625++ ms->nmceppdf = walloc(int,ms->nstate);
626++
627++ /* read the number of pdfs for each state position */
628++ fread(ms->nmceppdf, sizeof(int), ms->nstate, ms->fp[MCP]);
629++ if (EST_BIG_ENDIAN) swap_bytes_int(ms->nmceppdf,ms->nstate);
630++ ms->mceppdf = walloc(float **,ms->nstate+2);
631++
632++ /* read pdfs (mean, variance) */
633++ for (i=2; i<=ms->nstate+1; i++) {
634++ ms->mceppdf[i] = walloc(float *,ms->nmceppdf[i-2]+2);
635++ for (j=1; j<=ms->nmceppdf[i-2]; j++) {
636++ ms->mceppdf[i][j] = walloc(float,ms->mcepvsize*2);
637++ fread(ms->mceppdf[i][j], sizeof(float), ms->mcepvsize*2, ms->fp[MCP]);
638++ if (EST_BIG_ENDIAN)
639++ swap_bytes_float(ms->mceppdf[i][j],ms->mcepvsize*2);
640++ }
641++ }
642++
643++ /*-------------------- load pdfs for log F0 --------------------*/
644++ /* read the number of streams for f0 modeling */
645++ fread(&ms->lf0stream, sizeof(int), 1, ms->fp[LF0]);
646++ if (EST_BIG_ENDIAN) ms->lf0stream = SWAPINT(ms->lf0stream);
647++ ms->nlf0pdf = walloc(int,ms->nstate+2);
648++ /* read the number of pdfs for each state position */
649++ fread(ms->nlf0pdf, sizeof(int), ms->nstate, ms->fp[LF0]);
650++ if (EST_BIG_ENDIAN) swap_bytes_int(ms->nlf0pdf,ms->nstate);
651++ ms->lf0pdf = walloc(float ***,ms->nstate+3);
652++
653++ /* read pdfs (mean, variance & weight) */
654++ for (i=2; i<=ms->nstate+1; i++) {
655++ ms->lf0pdf[i] = walloc(float **,ms->nlf0pdf[i-2]+1);
656++ for (j=1; j<=ms->nlf0pdf[i-2]; j++) {
657++ ms->lf0pdf[i][j] = walloc(float *,ms->lf0stream+1);
658++ for (k=1; k<=ms->lf0stream; k++) {
659++ ms->lf0pdf[i][j][k] = walloc(float,4);
660++ fread(ms->lf0pdf[i][j][k], sizeof(float), 4, ms->fp[LF0]);
661++ if (EST_BIG_ENDIAN)
662++ swap_bytes_float(ms->lf0pdf[i][j][k],4);
663++ }
664++ }
665++ }
666++}
667++
668++/* FindDurPDF : find duration pdf from pdf array */
669++void FindDurPDF (Model *m, ModelSet *ms, float rho, int diffdur)
670++{
671++ float data, mean, variance;
672++ int s, idx;
673++
674++ idx = m->durpdf;
675++
676++ m->dur = walloc(int,ms->nstate+2);
677++ m->totaldur = 0;
678++
679++ for (s=2; s<=ms->nstate+1; s++) {
680++ mean = ms->durpdf[idx][s];
681++ variance = ms->durpdf[idx][ms->nstate+s];
682++ data = mean + rho*variance;
683++
684++ if (data < 0.0) data = 0.0;
685++
686++ m->dur[s] = (int) (data+diffdur+0.5);
687++ m->totaldur += m->dur[s];
688++ diffdur += (int)(data-(float)m->dur[s]);
689++ }
690++}
691++
692++/* FindLF0PDF : find required pdf for log F0 from pdf array */
693++void FindLF0PDF (int s, Model *m, ModelSet *ms, float uvthresh)
694++{
695++ int idx, stream;
696++ float *weight;
697++
698++ idx = m->lf0pdf[s];
699++
700++ if (m->lf0mean[s]) wfree(m->lf0mean[s]);
701++ m->lf0mean[s] = walloc(float,ms->lf0stream+1);
702++ if (m->lf0variance[s]) wfree(m->lf0variance[s]);
703++ m->lf0variance[s] = walloc(float,ms->lf0stream+1);
704++
705++ for (stream=1; stream<=ms->lf0stream; stream++) {
706++ m->lf0mean [s][stream] = ms->lf0pdf[s][idx][stream][0];
707++ m->lf0variance[s][stream] = ms->lf0pdf[s][idx][stream][1];
708++ weight = ms->lf0pdf[s][idx][stream]+2;
709++
710++ if (stream==1) {
711++ if (weight[0] > uvthresh)
712++ m->voiced[s] = 1;
713++ else
714++ m->voiced[s] = 0;
715++ }
716++ }
717++}
718++
719++/* FindMcpPDF : find pdf for mel-cepstrum from pdf array */
720++void FindMcpPDF (int s, Model *m, ModelSet *ms)
721++{
722++ int idx;
723++
724++ idx = m->mceppdf[s];
725++
726++ m->mcepmean[s] = ms->mceppdf[s][idx];
727++ m->mcepvariance[s] = ms->mceppdf[s][idx]+ms->mcepvsize;
728++}
729++
730++void InitModelSet (ModelSet *ms)
731++{
732++ ms->fp[DUR] = NULL;
733++ ms->fp[LF0] = NULL;
734++ ms->fp[MCP] = NULL;
735++
736++ return;
737++}
738++
739++void DeleteModelSet(ModelSet *ms)
740++{
741++ int i,j,k;
742++
743++ for (i=1; i<=ms->ndurpdf; i++)
744++ wfree(ms->durpdf[i]);
745++ wfree(ms->durpdf);
746++
747++ for (i=2; i<=ms->nstate+1; i++)
748++ {
749++ for (j=1; j<=ms->nmceppdf[i-2]; j++)
750++ wfree(ms->mceppdf[i][j]);
751++ wfree(ms->mceppdf[i]);
752++ }
753++ wfree(ms->nmceppdf);
754++ wfree(ms->mceppdf);
755++
756++ for (i=2; i<=ms->nstate+1; i++)
757++ {
758++ for (j=1; j<=ms->nlf0pdf[i-2]; j++)
759++ {
760++ for (k=1; k <=ms->lf0stream; k++)
761++ wfree(ms->lf0pdf[i][j][k]);
762++ wfree(ms->lf0pdf[i][j]);
763++ }
764++ wfree(ms->lf0pdf[i]);
765++ }
766++ wfree(ms->nlf0pdf);
767++ wfree(ms->lf0pdf);
768++}
769++
770++/* -------------------- End of "model.c" -------------------- */
771++
772+--- /dev/null
773++++ festival-2.1~release/src/modules/hts21_engine/mlpg.h
774+@@ -0,0 +1,82 @@
775++/* --------------------------------------------------------------- */
776++/* The HMM-Based Speech Synthesis System (HTS): version 1.1b */
777++/* HTS Working Group */
778++/* */
779++/* Department of Computer Science */
780++/* Nagoya Institute of Technology */
781++/* and */
782++/* Interdisciplinary Graduate School of Science and Engineering */
783++/* Tokyo Institute of Technology */
784++/* Copyright (c) 2001-2003 */
785++/* All Rights Reserved. */
786++/* */
787++/* Permission is hereby granted, free of charge, to use and */
788++/* distribute this software and its documentation without */
789++/* restriction, including without limitation the rights to use, */
790++/* copy, modify, merge, publish, distribute, sublicense, and/or */
791++/* sell copies of this work, and to permit persons to whom this */
792++/* work is furnished to do so, subject to the following conditions: */
793++/* */
794++/* 1. The code must retain the above copyright notice, this list */
795++/* of conditions and the following disclaimer. */
796++/* */
797++/* 2. Any modifications must be clearly marked as such. */
798++/* */
799++/* NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF TECHNOLOGY, */
800++/* HTS WORKING GROUP, AND THE CONTRIBUTORS TO THIS WORK DISCLAIM */
801++/* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */
802++/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
803++/* SHALL NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF */
804++/* TECHNOLOGY, HTS WORKING GROUP, NOR THE CONTRIBUTORS BE LIABLE */
805++/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY */
806++/* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, */
807++/* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS */
808++/* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR */
809++/* PERFORMANCE OF THIS SOFTWARE. */
810++/* */
811++/* --------------------------------------------------------------- */
812++/* mlpg.h : speech parameter generation from pdf sequence */
813++/* */
814++/* 2003/06/11 by Heiga Zen */
815++/* --------------------------------------------------------------- */
816++
817++#define INFTY ((double) 1.0e+38)
818++#define INFTY2 ((double) 1.0e+19)
819++#define INVINF ((double) 1.0e-38)
820++#define INVINF2 ((double) 1.0e-19)
821++
822++#define WLEFT 0
823++#define WRIGHT 1
824++
825++typedef struct _DWin {
826++ int num; /* number of static + deltas */
827++ char **fn; /* delta window coefficient file */
828++ int **width; /* width [0..num-1][0(left) 1(right)] */
829++ float **coef; /* coefficient [0..num-1][length[0]..length[1]] */
830++ float **coefr; /* pointers to the memory being allocated */
831++ int maxw[2]; /* max width [0(left) 1(right)] */
832++ int max_L;
833++} DWin;
834++
835++typedef struct _SMatrices {
836++ double **mseq; /* sequence of mean vector */
837++ double **ivseq; /* sequence of invarsed variance vector */
838++ double *g;
839++ double **R;
840++ double *r;
841++} SMatrices;
842++
843++typedef struct _PStream {
844++ int vSize;
845++ int order;
846++ int T;
847++ int width;
848++ DWin dw;
849++ float **par; /* output parameter vector */
850++ SMatrices sm;
851++} PStream;
852++
853++void pdf2speech(FILE *, FILE *, FILE *, PStream *, PStream *, globalP *, ModelSet *, UttModel *, VocoderSetup *);
854++void InitDWin (PStream *);
855++
856++/* -------------------- End of "mlpg.h" -------------------- */
857+--- /dev/null
858++++ festival-2.1~release/src/modules/hts21_engine/hts21_mlsa_resynthesis.cc
859+@@ -0,0 +1,863 @@
860++/* --------------------------------------------------------------- */
861++/* The HMM-Based Speech Synthesis System (HTS): version 1.1b */
862++/* HTS Working Group */
863++/* */
864++/* Department of Computer Science */
865++/* Nagoya Institute of Technology */
866++/* and */
867++/* Interdisciplinary Graduate School of Science and Engineering */
868++/* Tokyo Institute of Technology */
869++/* Copyright (c) 2001-2003 */
870++/* All Rights Reserved. */
871++/* */
872++/* Permission is hereby granted, free of charge, to use and */
873++/* distribute this software and its documentation without */
874++/* restriction, including without limitation the rights to use, */
875++/* copy, modify, merge, publish, distribute, sublicense, and/or */
876++/* sell copies of this work, and to permit persons to whom this */
877++/* work is furnished to do so, subject to the following conditions: */
878++/* */
879++/* 1. The code must retain the above copyright notice, this list */
880++/* of conditions and the following disclaimer. */
881++/* */
882++/* 2. Any modifications must be clearly marked as such. */
883++/* */
884++/* NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF TECHNOLOGY, */
885++/* HTS WORKING GROUP, AND THE CONTRIBUTORS TO THIS WORK DISCLAIM */
886++/* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */
887++/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
888++/* SHALL NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF */
889++/* TECHNOLOGY, HTS WORKING GROUP, NOR THE CONTRIBUTORS BE LIABLE */
890++/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY */
891++/* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, */
892++/* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS */
893++/* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR */
894++/* PERFORMANCE OF THIS SOFTWARE. */
895++/* */
896++/* --------------------------------------------------------------- */
897++/* This is Zen's MLSA filter as ported by Toda to fetvox vc */
898++/* and back ported into hts/festival so we can do MLSA filtering */
899++/* If I took more time I could probably make this use the same as */
900++/* as the other code in this directory -- awb@cs.cmu.edu 03JAN06 */
901++/* --------------------------------------------------------------- */
902++
903++/*********************************************************************/
904++/* */
905++/* Mel-cepstral vocoder (pulse/noise excitation & MLSA filter) */
906++/* 2003/12/26 by Heiga Zen */
907++/* */
908++/* Extracted from HTS and slightly modified */
909++/* by Tomoki Toda (tomoki@ics.nitech.ac.jp) */
910++/* June 2004 */
911++/* Integrate as a Voice Conversion module */
912++/* */
913++/*-------------------------------------------------------------------*/
914++
915++#include <stdio.h>
916++#include <stdlib.h>
917++#include <string.h>
918++#include <math.h>
919++#include <EST_walloc.h>
920++#include "festival.h"
921++
922++#include "hts21_mlsa_resynthesis.h"
923++
924++LISP hts21_mlsa_resynthesis(LISP ltrack)
925++{
926++ /* Resynthesizes a wave from given track */
927++ EST_Track *t;
928++ EST_Wave *wave = 0;
929++ DVECTOR w;
930++ DMATRIX mcep;
931++ DVECTOR f0v;
932++ int sr = 16000;
933++ int i,j;
934++ double shift;
935++
936++ if ((ltrack == NULL) ||
937++ (TYPEP(ltrack,tc_string) &&
938++ (streq(get_c_string(ltrack),"nil"))))
939++ return siod(new EST_Wave(0,1,sr));
940++
941++ t = track(ltrack);
942++
943++ f0v = xdvalloc(t->num_frames());
944++ mcep = xdmalloc(t->num_frames(),t->num_channels()-1);
945++
946++ for (i=0; i<t->num_frames(); i++)
947++ {
948++ f0v->data[i] = t->a(i,0);
949++ for (j=1; j<t->num_channels(); j++)
950++ mcep->data[i][j-1] = t->a(i,j);
951++ }
952++
953++ if (t->num_frames() > 1)
954++ shift = 1000.0*(t->t(1)-t->t(0));
955++ else
956++ shift = 5.0;
957++
958++ w = synthesis_body(mcep,f0v,NULL,sr,shift);
959++
960++ wave = new EST_Wave(w->length,1,sr);
961++
962++ for (i=0; i<w->length; i++)
963++ wave->a(i) = (short)w->data[i];
964++
965++ xdmfree(mcep);
966++ xdvfree(f0v);
967++ xdvfree(w);
968++
969++ return siod(wave);
970++}
971++
972++
973++DVECTOR synthesis_body(DMATRIX mcep, // input mel-cep sequence
974++ DVECTOR f0v, // input F0 sequence
975++ DVECTOR dpow, // input diff-pow sequence
976++ double fs, // sampling frequency (Hz)
977++ double framem) // FFT length
978++{
979++ long t, pos;
980++ int framel;
981++ double f0;
982++ VocoderSetup vs;
983++ DVECTOR xd = NODATA;
984++ DVECTOR syn = NODATA;
985++
986++ framel = (int)(framem * fs / 1000.0);
987++ init_vocoder(fs, framel, mcep->col - 1, &vs);
988++
989++ // synthesize waveforms by MLSA filter
990++ xd = xdvalloc(mcep->row * (framel + 2));
991++ for (t = 0, pos = 0; t < mcep->row; t++) {
992++ if (t >= f0v->length) f0 = 0.0;
993++ else f0 = f0v->data[t];
994++ if (dpow == NODATA)
995++ vocoder(f0, mcep->data[t], mcep->col - 1, ALPHA, 0.0, &vs,
996++ xd->data, &pos);
997++ else
998++ vocoder(f0, mcep->data[t], dpow->data[t], mcep->col - 1, ALPHA,
999++ 0.0, &vs, xd->data, &pos);
1000++ }
1001++ syn = xdvcut(xd, 0, pos);
1002++
1003++ // normalized amplitude
1004++ waveampcheck(syn, XFALSE);
1005++
1006++ // memory free
1007++ xdvfree(xd);
1008++ free_vocoder(&vs);
1009++
1010++ return syn;
1011++}
1012++
1013++#if 0
1014++static DVECTOR get_dpowvec(DMATRIX rmcep, DMATRIX cmcep)
1015++{
1016++ long t;
1017++ DVECTOR dpow = NODATA;
1018++ VocoderSetup pvs;
1019++
1020++ // error check
1021++ if (rmcep->col != cmcep->col) {
1022++ fprintf(stderr, "Error: Different number of dimensions\n");
1023++ exit(1);
1024++ }
1025++ if (rmcep->row != cmcep->row) {
1026++ fprintf(stderr, "Error: Different number of frames\n");
1027++ exit(1);
1028++ }
1029++
1030++ // memory allocation
1031++ dpow = xdvalloc(rmcep->row);
1032++ init_vocoder(16000.0, 80, rmcep->col - 1, &pvs);
1033++
1034++ // calculate differential power
1035++ for (t = 0; t < rmcep->row; t++)
1036++ dpow->data[t] = get_dpow(rmcep->data[t], cmcep->data[t],
1037++ rmcep->col - 1, ALPHA, &pvs);
1038++
1039++ // memory free
1040++ free_vocoder(&pvs);
1041++
1042++ return dpow;
1043++}
1044++#endif
1045++
1046++static void waveampcheck(DVECTOR wav, XBOOL msg_flag)
1047++{
1048++ double value;
1049++ int k;
1050++
1051++ value = MAX(FABS(dvmax(wav, NULL)), FABS(dvmin(wav, NULL)));
1052++ if (value >= 32000.0) {
1053++ if (msg_flag == XTRUE) {
1054++ fprintf(stderr, "amplitude is too big: %f\n", value);
1055++ fprintf(stderr, "execute normalization\n");
1056++ }
1057++ /* was dvscoper(wav, "*", 32000.0 / value); */
1058++ for (k = 0; k < wav->length; k++) {
1059++ wav->data[k] = wav->data[k] * (32000.0/value);
1060++ if (wav->imag != NULL) {
1061++ wav->imag[k] = wav->imag[k] * (32000.0/value);
1062++ }
1063++ }
1064++ }
1065++
1066++ return;
1067++}
1068++
1069++static void init_vocoder(double fs, int framel, int m, VocoderSetup *vs)
1070++{
1071++ // initialize global parameter
1072++ vs->fprd = framel;
1073++ vs->iprd = 1;
1074++ vs->seed = 1;
1075++ vs->pd = 5;
1076++
1077++ vs->next =1;
1078++ vs->gauss = MTRUE;
1079++
1080++ vs->pade[ 0]=1.0;
1081++ vs->pade[ 1]=1.0; vs->pade[ 2]=0.0;
1082++ vs->pade[ 3]=1.0; vs->pade[ 4]=0.0; vs->pade[ 5]=0.0;
1083++ vs->pade[ 6]=1.0; vs->pade[ 7]=0.0; vs->pade[ 8]=0.0; vs->pade[ 9]=0.0;
1084++ vs->pade[10]=1.0; vs->pade[11]=0.4999273; vs->pade[12]=0.1067005; vs->pade[13]=0.01170221; vs->pade[14]=0.0005656279;
1085++ vs->pade[15]=1.0; vs->pade[16]=0.4999391; vs->pade[17]=0.1107098; vs->pade[18]=0.01369984; vs->pade[19]=0.0009564853;
1086++ vs->pade[20]=0.00003041721;
1087++
1088++ vs->rate = fs;
1089++ vs->c = wcalloc(double,3 * (m + 1) + 3 * (vs->pd + 1) + vs->pd * (m + 2));
1090++
1091++ vs->p1 = -1;
1092++ vs->sw = 0;
1093++ vs->x = 0x55555555;
1094++
1095++ // for postfiltering
1096++ vs->mc = NULL;
1097++ vs->o = 0;
1098++ vs->d = NULL;
1099++ vs->irleng= 64;
1100++
1101++ return;
1102++}
1103++
1104++static void vocoder(double p, double *mc, int m, double a, double beta,
1105++ VocoderSetup *vs, double *wav, long *pos)
1106++{
1107++ double inc, x, e1, e2;
1108++ int i, j, k;
1109++
1110++ if (p != 0.0)
1111++ p = vs->rate / p; // f0 -> pitch
1112++
1113++ if (vs->p1 < 0) {
1114++ if (vs->gauss & (vs->seed != 1))
1115++ vs->next = srnd((unsigned)vs->seed);
1116++
1117++ vs->p1 = p;
1118++ vs->pc = vs->p1;
1119++ vs->cc = vs->c + m + 1;
1120++ vs->cinc = vs->cc + m + 1;
1121++ vs->d1 = vs->cinc + m + 1;
1122++
1123++ mc2b(mc, vs->c, m, a);
1124++
1125++ if (beta > 0.0 && m > 1) {
1126++ e1 = b2en(vs->c, m, a, vs);
1127++ vs->c[1] -= beta * a * mc[2];
1128++ for (k=2;k<=m;k++)
1129++ vs->c[k] *= (1.0 + beta);
1130++ e2 = b2en(vs->c, m, a, vs);
1131++ vs->c[0] += log(e1/e2)/2;
1132++ }
1133++
1134++ return;
1135++ }
1136++
1137++ mc2b(mc, vs->cc, m, a);
1138++ if (beta>0.0 && m > 1) {
1139++ e1 = b2en(vs->cc, m, a, vs);
1140++ vs->cc[1] -= beta * a * mc[2];
1141++ for (k = 2; k <= m; k++)
1142++ vs->cc[k] *= (1.0 + beta);
1143++ e2 = b2en(vs->cc, m, a, vs);
1144++ vs->cc[0] += log(e1 / e2) / 2.0;
1145++ }
1146++
1147++ for (k=0; k<=m; k++)
1148++ vs->cinc[k] = (vs->cc[k] - vs->c[k]) *
1149++ (double)vs->iprd / (double)vs->fprd;
1150++
1151++ if (vs->p1!=0.0 && p!=0.0) {
1152++ inc = (p - vs->p1) * (double)vs->iprd / (double)vs->fprd;
1153++ } else {
1154++ inc = 0.0;
1155++ vs->pc = p;
1156++ vs->p1 = 0.0;
1157++ }
1158++
1159++ for (j = vs->fprd, i = (vs->iprd + 1) / 2; j--;) {
1160++ if (vs->p1 == 0.0) {
1161++ if (vs->gauss)
1162++ x = (double) nrandom(vs);
1163++ else
1164++ x = mseq(vs);
1165++ } else {
1166++ if ((vs->pc += 1.0) >= vs->p1) {
1167++ x = sqrt (vs->p1);
1168++ vs->pc = vs->pc - vs->p1;
1169++ } else x = 0.0;
1170++ }
1171++
1172++ x *= exp(vs->c[0]);
1173++
1174++ x = mlsadf(x, vs->c, m, a, vs->pd, vs->d1, vs);
1175++
1176++ wav[*pos] = x;
1177++ *pos += 1;
1178++
1179++ if (!--i) {
1180++ vs->p1 += inc;
1181++ for (k = 0; k <= m; k++) vs->c[k] += vs->cinc[k];
1182++ i = vs->iprd;
1183++ }
1184++ }
1185++
1186++ vs->p1 = p;
1187++ memmove(vs->c,vs->cc,sizeof(double)*(m+1));
1188++
1189++ return;
1190++}
1191++
1192++static void vocoder(double p, double *mc, double dpow, int m, double a, double beta,
1193++ VocoderSetup *vs, double *wav, long *pos)
1194++{
1195++ double inc, x, e1, e2;
1196++ int i, j, k;
1197++
1198++ if (p != 0.0)
1199++ p = vs->rate / p; // f0 -> pitch
1200++
1201++ if (vs->p1 < 0) {
1202++ if (vs->gauss & (vs->seed != 1))
1203++ vs->next = srnd((unsigned)vs->seed);
1204++
1205++ vs->p1 = p;
1206++ vs->pc = vs->p1;
1207++ vs->cc = vs->c + m + 1;
1208++ vs->cinc = vs->cc + m + 1;
1209++ vs->d1 = vs->cinc + m + 1;
1210++
1211++ mc2b(mc, vs->c, m, a);
1212++ vs->c[0] += dpow;
1213++
1214++ if (beta > 0.0 && m > 1) {
1215++ e1 = b2en(vs->c, m, a, vs);
1216++ vs->c[1] -= beta * a * mc[2];
1217++ for (k=2;k<=m;k++)
1218++ vs->c[k] *= (1.0 + beta);
1219++ e2 = b2en(vs->c, m, a, vs);
1220++ vs->c[0] += log(e1/e2)/2;
1221++ }
1222++
1223++ return;
1224++ }
1225++
1226++ mc2b(mc, vs->cc, m, a);
1227++ vs->cc[0] += dpow;
1228++ if (beta>0.0 && m > 1) {
1229++ e1 = b2en(vs->cc, m, a, vs);
1230++ vs->cc[1] -= beta * a * mc[2];
1231++ for (k = 2; k <= m; k++)
1232++ vs->cc[k] *= (1.0 + beta);
1233++ e2 = b2en(vs->cc, m, a, vs);
1234++ vs->cc[0] += log(e1 / e2) / 2.0;
1235++ }
1236++
1237++ for (k=0; k<=m; k++)
1238++ vs->cinc[k] = (vs->cc[k] - vs->c[k]) *
1239++ (double)vs->iprd / (double)vs->fprd;
1240++
1241++ if (vs->p1!=0.0 && p!=0.0) {
1242++ inc = (p - vs->p1) * (double)vs->iprd / (double)vs->fprd;
1243++ } else {
1244++ inc = 0.0;
1245++ vs->pc = p;
1246++ vs->p1 = 0.0;
1247++ }
1248++
1249++ for (j = vs->fprd, i = (vs->iprd + 1) / 2; j--;) {
1250++ if (vs->p1 == 0.0) {
1251++ if (vs->gauss)
1252++ x = (double) nrandom(vs);
1253++ else
1254++ x = mseq(vs);
1255++ } else {
1256++ if ((vs->pc += 1.0) >= vs->p1) {
1257++ x = sqrt (vs->p1);
1258++ vs->pc = vs->pc - vs->p1;
1259++ } else x = 0.0;
1260++ }
1261++
1262++ x *= exp(vs->c[0]);
1263++
1264++ x = mlsadf(x, vs->c, m, a, vs->pd, vs->d1, vs);
1265++
1266++ wav[*pos] = x;
1267++ *pos += 1;
1268++
1269++ if (!--i) {
1270++ vs->p1 += inc;
1271++ for (k = 0; k <= m; k++) vs->c[k] += vs->cinc[k];
1272++ i = vs->iprd;
1273++ }
1274++ }
1275++
1276++ vs->p1 = p;
1277++ memmove(vs->c,vs->cc,sizeof(double)*(m+1));
1278++
1279++ return;
1280++}
1281++
1282++static double mlsadf(double x, double *b, int m, double a, int pd, double *d, VocoderSetup *vs)
1283++{
1284++
1285++ vs->ppade = &(vs->pade[pd*(pd+1)/2]);
1286++
1287++ x = mlsadf1 (x, b, m, a, pd, d, vs);
1288++ x = mlsadf2 (x, b, m, a, pd, &d[2*(pd+1)], vs);
1289++
1290++ return(x);
1291++}
1292++
1293++static double mlsadf1(double x, double *b, int m, double a, int pd, double *d, VocoderSetup *vs)
1294++{
1295++ double v, out = 0.0, *pt, aa;
1296++ register int i;
1297++
1298++ aa = 1 - a*a;
1299++ pt = &d[pd+1];
1300++
1301++ for (i=pd; i>=1; i--) {
1302++ d[i] = aa*pt[i-1] + a*d[i];
1303++ pt[i] = d[i] * b[1];
1304++ v = pt[i] * vs->ppade[i];
1305++ x += (1 & i) ? v : -v;
1306++ out += v;
1307++ }
1308++
1309++ pt[0] = x;
1310++ out += x;
1311++
1312++ return(out);
1313++}
1314++
1315++static double mlsadf2 (double x, double *b, int m, double a, int pd, double *d, VocoderSetup *vs)
1316++{
1317++ double v, out = 0.0, *pt, aa;
1318++ register int i;
1319++
1320++ aa = 1 - a*a;
1321++ pt = &d[pd * (m+2)];
1322++
1323++ for (i=pd; i>=1; i--) {
1324++ pt[i] = mlsafir (pt[i-1], b, m, a, &d[(i-1)*(m+2)]);
1325++ v = pt[i] * vs->ppade[i];
1326++
1327++ x += (1&i) ? v : -v;
1328++ out += v;
1329++ }
1330++
1331++ pt[0] = x;
1332++ out += x;
1333++
1334++ return(out);
1335++}
1336++
1337++static double mlsafir (double x, double *b, int m, double a, double *d)
1338++{
1339++ double y = 0.0;
1340++ double aa;
1341++ register int i;
1342++
1343++ aa = 1 - a*a;
1344++
1345++ d[0] = x;
1346++ d[1] = aa*d[0] + a*d[1];
1347++
1348++ for (i=2; i<=m; i++) {
1349++ d[i] = d[i] + a*(d[i+1]-d[i-1]);
1350++ y += d[i]*b[i];
1351++ }
1352++
1353++ for (i=m+1; i>1; i--)
1354++ d[i] = d[i-1];
1355++
1356++ return(y);
1357++}
1358++
1359++static double nrandom (VocoderSetup *vs)
1360++{
1361++ if (vs->sw == 0) {
1362++ vs->sw = 1;
1363++ do {
1364++ vs->r1 = 2.0 * rnd(&vs->next) - 1.0;
1365++ vs->r2 = 2.0 * rnd(&vs->next) - 1.0;
1366++ vs->s = vs->r1 * vs->r1 + vs->r2 * vs->r2;
1367++ } while (vs->s > 1 || vs->s == 0);
1368++
1369++ vs->s = sqrt (-2 * log(vs->s) / vs->s);
1370++
1371++ return(vs->r1*vs->s);
1372++ }
1373++ else {
1374++ vs->sw = 0;
1375++
1376++ return (vs->r2*vs->s);
1377++ }
1378++}
1379++
1380++static double rnd (unsigned long *next)
1381++{
1382++ double r;
1383++
1384++ *next = *next * 1103515245L + 12345;
1385++ r = (*next / 65536L) % 32768L;
1386++
1387++ return(r/RANDMAX);
1388++}
1389++
1390++static unsigned long srnd ( unsigned long seed )
1391++{
1392++ return(seed);
1393++}
1394++
1395++static int mseq (VocoderSetup *vs)
1396++{
1397++ register int x0, x28;
1398++
1399++ vs->x >>= 1;
1400++
1401++ if (vs->x & B0)
1402++ x0 = 1;
1403++ else
1404++ x0 = -1;
1405++
1406++ if (vs->x & B28)
1407++ x28 = 1;
1408++ else
1409++ x28 = -1;
1410++
1411++ if (x0 + x28)
1412++ vs->x &= B31_;
1413++ else
1414++ vs->x |= B31;
1415++
1416++ return(x0);
1417++}
1418++
1419++// mc2b : transform mel-cepstrum to MLSA digital fillter coefficients
1420++static void mc2b (double *mc, double *b, int m, double a)
1421++{
1422++ b[m] = mc[m];
1423++
1424++ for (m--; m>=0; m--)
1425++ b[m] = mc[m] - a * b[m+1];
1426++
1427++ return;
1428++}
1429++
1430++
1431++static double b2en (double *b, int m, double a, VocoderSetup *vs)
1432++{
1433++ double en;
1434++ int k;
1435++
1436++ if (vs->o<m) {
1437++ if (vs->mc != NULL)
1438++ wfree(vs->mc);
1439++
1440++ vs->mc = wcalloc(double,(m + 1) + 2 * vs->irleng);
1441++ vs->cep = vs->mc + m+1;
1442++ vs->ir = vs->cep + vs->irleng;
1443++ }
1444++
1445++ b2mc(b, vs->mc, m, a);
1446++ freqt(vs->mc, m, vs->cep, vs->irleng-1, -a, vs);
1447++ c2ir(vs->cep, vs->irleng, vs->ir, vs->irleng);
1448++ en = 0.0;
1449++
1450++ for (k=0;k<vs->irleng;k++)
1451++ en += vs->ir[k] * vs->ir[k];
1452++
1453++ return(en);
1454++}
1455++
1456++
1457++// b2bc : transform MLSA digital filter coefficients to mel-cepstrum
1458++static void b2mc (double *b, double *mc, int m, double a)
1459++{
1460++ double d, o;
1461++
1462++ d = mc[m] = b[m];
1463++ for (m--; m>=0; m--) {
1464++ o = b[m] + a * d;
1465++ d = b[m];
1466++ mc[m] = o;
1467++ }
1468++
1469++ return;
1470++}
1471++
1472++// freqt : frequency transformation
1473++static void freqt (double *c1, int m1, double *c2, int m2, double a, VocoderSetup *vs)
1474++{
1475++ register int i, j;
1476++ double b;
1477++
1478++ if (vs->d==NULL) {
1479++ vs->size = m2;
1480++ vs->d = wcalloc(double,vs->size + vs->size + 2);
1481++ vs->g = vs->d+vs->size+1;
1482++ }
1483++
1484++ if (m2>vs->size) {
1485++ wfree(vs->d);
1486++ vs->size = m2;
1487++ vs->d = wcalloc(double,vs->size + vs->size + 2);
1488++ vs->g = vs->d+vs->size+1;
1489++ }
1490++
1491++ b = 1-a*a;
1492++ for (i=0; i<m2+1; i++)
1493++ vs->g[i] = 0.0;
1494++
1495++ for (i=-m1; i<=0; i++) {
1496++ if (0 <= m2)
1497++ vs->g[0] = c1[-i]+a*(vs->d[0]=vs->g[0]);
1498++ if (1 <= m2)
1499++ vs->g[1] = b*vs->d[0]+a*(vs->d[1]=vs->g[1]);
1500++ for (j=2; j<=m2; j++)
1501++ vs->g[j] = vs->d[j-1]+a*((vs->d[j]=vs->g[j])-vs->g[j-1]);
1502++ }
1503++
1504++ memmove(c2,vs->g,sizeof(double)*(m2+1));
1505++
1506++ return;
1507++}
1508++
1509++// c2ir : The minimum phase impulse response is evaluated from the minimum phase cepstrum
1510++static void c2ir (double *c, int nc, double *h, int leng)
1511++{
1512++ register int n, k, upl;
1513++ double d;
1514++
1515++ h[0] = exp(c[0]);
1516++ for (n=1; n<leng; n++) {
1517++ d = 0;
1518++ upl = (n>=nc) ? nc-1 : n;
1519++ for (k=1; k<=upl; k++)
1520++ d += k*c[k]*h[n-k];
1521++ h[n] = d/n;
1522++ }
1523++
1524++ return;
1525++}
1526++
1527++#if 0
1528++static double get_dpow(double *rmcep, double *cmcep, int m, double a,
1529++ VocoderSetup *vs)
1530++{
1531++ double e1, e2, dpow;
1532++
1533++ if (vs->p1 < 0) {
1534++ vs->p1 = 1;
1535++ vs->cc = vs->c + m + 1;
1536++ vs->cinc = vs->cc + m + 1;
1537++ vs->d1 = vs->cinc + m + 1;
1538++ }
1539++
1540++ mc2b(rmcep, vs->c, m, a);
1541++ e1 = b2en(vs->c, m, a, vs);
1542++
1543++ mc2b(cmcep, vs->cc, m, a);
1544++ e2 = b2en(vs->cc, m, a, vs);
1545++
1546++ dpow = log(e1 / e2) / 2.0;
1547++
1548++ return dpow;
1549++}
1550++#endif
1551++
1552++static void free_vocoder(VocoderSetup *vs)
1553++{
1554++ wfree(vs->c);
1555++ wfree(vs->mc);
1556++ wfree(vs->d);
1557++
1558++ vs->c = NULL;
1559++ vs->mc = NULL;
1560++ vs->d = NULL;
1561++ vs->ppade = NULL;
1562++ vs->cc = NULL;
1563++ vs->cinc = NULL;
1564++ vs->d1 = NULL;
1565++ vs->g = NULL;
1566++ vs->cep = NULL;
1567++ vs->ir = NULL;
1568++
1569++ return;
1570++}
1571++
1572++/* from vector.cc */
1573++
1574++static DVECTOR xdvalloc(long length)
1575++{
1576++ DVECTOR x;
1577++
1578++ length = MAX(length, 0);
1579++ x = wcalloc(struct DVECTOR_STRUCT,1);
1580++ x->data = wcalloc(double,MAX(length, 1));
1581++ x->imag = NULL;
1582++ x->length = length;
1583++
1584++ return x;
1585++}
1586++
1587++static void xdvfree(DVECTOR x)
1588++{
1589++ if (x != NULL) {
1590++ if (x->data != NULL) {
1591++ wfree(x->data);
1592++ }
1593++ if (x->imag != NULL) {
1594++ wfree(x->imag);
1595++ }
1596++ wfree(x);
1597++ }
1598++
1599++ return;
1600++}
1601++
1602++static void dvialloc(DVECTOR x)
1603++{
1604++ if (x->imag != NULL) {
1605++ wfree(x->imag);
1606++ }
1607++ x->imag = wcalloc(double,x->length);
1608++
1609++ return;
1610++}
1611++
1612++static DVECTOR xdvcut(DVECTOR x, long offset, long length)
1613++{
1614++ long k;
1615++ long pos;
1616++ DVECTOR y;
1617++
1618++ y = xdvalloc(length);
1619++ if (x->imag != NULL) {
1620++ dvialloc(y);
1621++ }
1622++
1623++ for (k = 0; k < y->length; k++) {
1624++ pos = k + offset;
1625++ if (pos >= 0 && pos < x->length) {
1626++ y->data[k] = x->data[pos];
1627++ if (y->imag != NULL) {
1628++ y->imag[k] = x->imag[pos];
1629++ }
1630++ } else {
1631++ y->data[k] = 0.0;
1632++ if (y->imag != NULL) {
1633++ y->imag[k] = 0.0;
1634++ }
1635++ }
1636++ }
1637++
1638++ return y;
1639++}
1640++
1641++static DMATRIX xdmalloc(long row, long col)
1642++{
1643++ DMATRIX matrix;
1644++ int i;
1645++
1646++ matrix = wcalloc(struct DMATRIX_STRUCT,1);
1647++ matrix->data = wcalloc(double *,row);
1648++ for (i=0; i<row; i++)
1649++ matrix->data[i] = wcalloc(double,col);
1650++ matrix->imag = NULL;
1651++ matrix->row = row;
1652++ matrix->col = col;
1653++
1654++ return matrix;
1655++}
1656++
1657++void xdmfree(DMATRIX matrix)
1658++{
1659++ int i;
1660++
1661++ if (matrix != NULL) {
1662++ if (matrix->data != NULL) {
1663++ for (i=0; i<matrix->row; i++)
1664++ wfree(matrix->data[i]);
1665++ wfree(matrix->data);
1666++ }
1667++ if (matrix->imag != NULL) {
1668++ for (i=0; i<matrix->row; i++)
1669++ wfree(matrix->imag[i]);
1670++ wfree(matrix->imag);
1671++ }
1672++ wfree(matrix);
1673++ }
1674++
1675++ return;
1676++}
1677++
1678++
1679++/* from voperate.cc */
1680++static double dvmax(DVECTOR x, long *index)
1681++{
1682++ long k;
1683++ long ind;
1684++ double max;
1685++
1686++ ind = 0;
1687++ max = x->data[ind];
1688++ for (k = 1; k < x->length; k++) {
1689++ if (max < x->data[k]) {
1690++ ind = k;
1691++ max = x->data[k];
1692++ }
1693++ }
1694++
1695++ if (index != NULL) {
1696++ *index = ind;
1697++ }
1698++
1699++ return max;
1700++}
1701++
1702++static double dvmin(DVECTOR x, long *index)
1703++{
1704++ long k;
1705++ long ind;
1706++ double min;
1707++
1708++ ind = 0;
1709++ min = x->data[ind];
1710++ for (k = 1; k < x->length; k++) {
1711++ if (min > x->data[k]) {
1712++ ind = k;
1713++ min = x->data[k];
1714++ }
1715++ }
1716++
1717++ if (index != NULL) {
1718++ *index = ind;
1719++ }
1720++
1721++ return min;
1722++}
1723+--- /dev/null
1724++++ festival-2.1~release/src/modules/hts21_engine/Makefile
1725+@@ -0,0 +1,66 @@
1726++###########################################################################
1727++## ##
1728++## --------------------------------------------------------------- ##
1729++## The HMM-Based Speech Synthesis System (HTS): version 1.1b ##
1730++## HTS Working Group ##
1731++## ##
1732++## Department of Computer Science ##
1733++## Nagoya Institute of Technology ##
1734++## and ##
1735++## Interdisciplinary Graduate School of Science and Engineering ##
1736++## Tokyo Institute of Technology ##
1737++## Copyright (c) 2001-2003 ##
1738++## All Rights Reserved. ##
1739++## ##
1740++## Permission is hereby granted, free of charge, to use and ##
1741++## distribute this software and its documentation without ##
1742++## restriction, including without limitation the rights to use, ##
1743++## copy, modify, merge, publish, distribute, sublicense, and/or ##
1744++## sell copies of this work, and to permit persons to whom this ##
1745++## work is furnished to do so, subject to the following conditions: ##
1746++## ##
1747++## 1. The code must retain the above copyright notice, this list ##
1748++## of conditions and the following disclaimer. ##
1749++## ##
1750++## 2. Any modifications must be clearly marked as such. ##
1751++## ##
1752++## NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF TECHNOLOGY, ##
1753++## HTS WORKING GROUP, AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ##
1754++## ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL ##
1755++## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ##
1756++## SHALL NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF ##
1757++## TECHNOLOGY, HTS WORKING GROUP, NOR THE CONTRIBUTORS BE LIABLE ##
1758++## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY ##
1759++## DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, ##
1760++## WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ##
1761++## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR ##
1762++## PERFORMANCE OF THIS SOFTWARE. ##
1763++## ##
1764++###########################################################################
1765++## Nagoya Institute of Technology's HTS Engine ##
1766++## Integrated in the Festival tree to allow it to be more available ##
1767++## Alan W Black (awb@cs.cmu.edu)
1768++###########################################################################
1769++TOP=../../..
1770++DIRNAME=src/modules/hts_engine
1771++H = parser.h
1772++
1773++H = defaults.h global.h misc.h mlpg.h model.h tree.h vocoder.h \
1774++ hts21_mlsa_resynthesis.h
1775++CPPSRCS = hts_engine.cc misc.cc mlpg.cc model.cc tree.cc vocoder.cc \
1776++ hts21_mlsa_resynthesis.cc
1777++SRCS = $(CPPSRCS)
1778++
1779++OBJS = $(CPPSRCS:.cc=.o)
1780++
1781++FILES=Makefile $(SRCS) $(H)
1782++
1783++LOCAL_INCLUDES = -I../include
1784++
1785++INLIB = $(TOP)/src/lib/libFestival.a
1786++
1787++ALL = .buildlib
1788++
1789++include $(TOP)/config/common_make_rules
1790++
1791++
1792+--- /dev/null
1793++++ festival-2.1~release/src/modules/hts21_engine/hts21_mlsa_resynthesis.h
1794+@@ -0,0 +1,159 @@
1795++/*********************************************************************/
1796++/* */
1797++/* Nagoya Institute of Technology, Aichi, Japan, */
1798++/* Nara Institute of Science and Technology, Nara, Japan */
1799++/* and */
1800++/* Carnegie Mellon University, Pittsburgh, PA */
1801++/* Copyright (c) 2003-2004 */
1802++/* All Rights Reserved. */
1803++/* */
1804++/* Permission is hereby granted, free of charge, to use and */
1805++/* distribute this software and its documentation without */
1806++/* restriction, including without limitation the rights to use, */
1807++/* copy, modify, merge, publish, distribute, sublicense, and/or */
1808++/* sell copies of this work, and to permit persons to whom this */
1809++/* work is furnished to do so, subject to the following conditions: */
1810++/* */
1811++/* 1. The code must retain the above copyright notice, this list */
1812++/* of conditions and the following disclaimer. */
1813++/* 2. Any modifications must be clearly marked as such. */
1814++/* 3. Original authors' names are not deleted. */
1815++/* */
1816++/* NAGOYA INSTITUTE OF TECHNOLOGY, NARA INSTITUTE OF SCIENCE AND */
1817++/* TECHNOLOGY, CARNEGIE MELLON UNIVERSITY, AND THE CONTRIBUTORS TO */
1818++/* THIS WORK DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, */
1819++/* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, */
1820++/* IN NO EVENT SHALL NAGOYA INSTITUTE OF TECHNOLOGY, NARA */
1821++/* INSTITUTE OF SCIENCE AND TECHNOLOGY, CARNEGIE MELLON UNIVERSITY, */
1822++/* NOR THE CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR */
1823++/* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM */
1824++/* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, */
1825++/* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN */
1826++/* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
1827++/* */
1828++/*********************************************************************/
1829++/* */
1830++/* Author : Tomoki Toda (tomoki@ics.nitech.ac.jp) */
1831++/* Date : June 2004 */
1832++/* */
1833++/* Modified by Alan W Black (awb@cs.cmu.edu) Jan 2006 */
1834++/* taken from festvox/src/vc/ back into Festival */
1835++/*-------------------------------------------------------------------*/
1836++/* */
1837++/* Subroutine for Speech Synthesis */
1838++/* */
1839++/*-------------------------------------------------------------------*/
1840++
1841++#ifndef __MLSA_RESYNTHESIS_H
1842++#define __MLSA_RESYNTHESIS_H
1843++
1844++#define ALPHA 0.42
1845++
1846++typedef struct DVECTOR_STRUCT {
1847++ long length;
1848++ double *data;
1849++ double *imag;
1850++} *DVECTOR;
1851++
1852++typedef struct DMATRIX_STRUCT {
1853++ long row;
1854++ long col;
1855++ double **data;
1856++ double **imag;
1857++} *DMATRIX;
1858++
1859++#define XBOOL int
1860++#define XTRUE 1
1861++#define XFALSE 0
1862++
1863++#define NODATA NULL
1864++
1865++#define FABS(x) ((x) >= 0.0 ? (x) : -(x))
1866++#define MAX(a, b) ((a) > (b) ? (a) : (b))
1867++
1868++static DVECTOR xdvalloc(long length);
1869++static DVECTOR xdvcut(DVECTOR x, long offset, long length);
1870++static void xdvfree(DVECTOR vector);
1871++static double dvmax(DVECTOR x, long *index);
1872++static double dvmin(DVECTOR x, long *index);
1873++static DMATRIX xdmalloc(long row, long col);
1874++static void xdmfree(DMATRIX matrix);
1875++
1876++DVECTOR synthesis_body(DMATRIX mcep, DVECTOR f0v, DVECTOR dpow,
1877++ double fs, double framem);
1878++static void waveampcheck(DVECTOR wav, XBOOL msg_flag);
1879++
1880++#define RANDMAX 32767
1881++#define B0 0x00000001
1882++#define B28 0x10000000
1883++#define B31 0x80000000
1884++#define B31_ 0x7fffffff
1885++#define Z 0x00000000
1886++
1887++typedef enum {MFALSE, MTRUE} Boolean;
1888++
1889++typedef struct _VocoderSetup {
1890++
1891++ int fprd;
1892++ int iprd;
1893++ int seed;
1894++ int pd;
1895++ unsigned long next;
1896++ Boolean gauss;
1897++ double p1;
1898++ double pc;
1899++ double pj;
1900++ double pade[21];
1901++ double *ppade;
1902++ double *c, *cc, *cinc, *d1;
1903++ double rate;
1904++
1905++ int sw;
1906++ double r1, r2, s;
1907++
1908++ int x;
1909++
1910++ /* for postfiltering */
1911++ int size;
1912++ double *d;
1913++ double *g;
1914++ double *mc;
1915++ double *cep;
1916++ double *ir;
1917++ int o;
1918++ int irleng;
1919++
1920++} VocoderSetup;
1921++
1922++static void init_vocoder(double fs, int framel, int m, VocoderSetup *vs);
1923++static void vocoder(double p, double *mc, int m, double a, double beta,
1924++ VocoderSetup *vs, double *wav, long *pos);
1925++static void vocoder(double p, double *mc, double dpow, int m, double a,
1926++ double beta, VocoderSetup *vs, double *wav, long *pos);
1927++static double mlsadf(double x, double *b, int m, double a, int pd, double *d,
1928++ VocoderSetup *vs);
1929++static double mlsadf1(double x, double *b, int m, double a, int pd, double *d,
1930++ VocoderSetup *vs);
1931++static double mlsadf2(double x, double *b, int m, double a, int pd, double *d,
1932++ VocoderSetup *vs);
1933++static double mlsafir (double x, double *b, int m, double a, double *d);
1934++static double nrandom (VocoderSetup *vs);
1935++static double rnd (unsigned long *next);
1936++static unsigned long srnd (unsigned long seed);
1937++static int mseq (VocoderSetup *vs);
1938++static void mc2b (double *mc, double *b, int m, double a);
1939++static double b2en (double *b, int m, double a, VocoderSetup *vs);
1940++static void b2mc (double *b, double *mc, int m, double a);
1941++static void freqt (double *c1, int m1, double *c2, int m2, double a,
1942++ VocoderSetup *vs);
1943++static void c2ir (double *c, int nc, double *h, int leng);
1944++
1945++
1946++#if 0
1947++static DVECTOR get_dpowvec(DMATRIX rmcep, DMATRIX cmcep);
1948++static double get_dpow(double *rmcep, double *cmcep, int m, double a,
1949++ VocoderSetup *vs);
1950++#endif
1951++static void free_vocoder(VocoderSetup *vs);
1952++
1953++#endif /* __RESYNTHESIS_SUB_H */
1954+--- /dev/null
1955++++ festival-2.1~release/src/modules/hts21_engine/global.h
1956+@@ -0,0 +1,55 @@
1957++/* --------------------------------------------------------------- */
1958++/* The HMM-Based Speech Synthesis System (HTS): version 1.1b */
1959++/* HTS Working Group */
1960++/* */
1961++/* Department of Computer Science */
1962++/* Nagoya Institute of Technology */
1963++/* and */
1964++/* Interdisciplinary Graduate School of Science and Engineering */
1965++/* Tokyo Institute of Technology */
1966++/* Copyright (c) 2001-2003 */
1967++/* All Rights Reserved. */
1968++/* */
1969++/* Permission is hereby granted, free of charge, to use and */
1970++/* distribute this software and its documentation without */
1971++/* restriction, including without limitation the rights to use, */
1972++/* copy, modify, merge, publish, distribute, sublicense, and/or */
1973++/* sell copies of this work, and to permit persons to whom this */
1974++/* work is furnished to do so, subject to the following conditions: */
1975++/* */
1976++/* 1. The code must retain the above copyright notice, this list */
1977++/* of conditions and the following disclaimer. */
1978++/* */
1979++/* 2. Any modifications must be clearly marked as such. */
1980++/* */
1981++/* NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF TECHNOLOGY, */
1982++/* HTS WORKING GROUP, AND THE CONTRIBUTORS TO THIS WORK DISCLAIM */
1983++/* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */
1984++/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
1985++/* SHALL NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF */
1986++/* TECHNOLOGY, HTS WORKING GROUP, NOR THE CONTRIBUTORS BE LIABLE */
1987++/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY */
1988++/* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, */
1989++/* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS */
1990++/* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR */
1991++/* PERFORMANCE OF THIS SOFTWARE. */
1992++/* */
1993++/* --------------------------------------------------------------- */
1994++/* global.h : global variable for some functions */
1995++/* */
1996++/* 2003/06/11 by Heiga Zen */
1997++/* --------------------------------------------------------------- */
1998++
1999++typedef struct _globalP {
2000++ float RHO ; /* variable for speaking rate control */
2001++ float ALPHA ; /* variable for frequency warping parameter */
2002++ float F0_STD ; /* variable for f0 control */
2003++ float F0_MEAN ; /* variable for f0 control */
2004++ float UV ; /* variable for U/V threshold */
2005++ int LENGTH ; /* total number of frame for generated speech */
2006++ HTS_Boolean XIMERA ; /* output label and f0 for XIMERA */
2007++ HTS_Boolean algnst ; /* use state level alignment for duration */
2008++ HTS_Boolean algnph ; /* use phoneme level alignment for duration */
2009++} globalP;
2010++
2011++/* -------------------- End of "global.h" -------------------- */
2012+--- /dev/null
2013++++ festival-2.1~release/src/modules/hts21_engine/defaults.h
2014+@@ -0,0 +1,55 @@
2015++/* --------------------------------------------------------------- */
2016++/* The HMM-Based Speech Synthesis System (HTS): version 1.1b */
2017++/* HTS Working Group */
2018++/* */
2019++/* Department of Computer Science */
2020++/* Nagoya Institute of Technology */
2021++/* and */
2022++/* Interdisciplinary Graduate School of Science and Engineering */
2023++/* Tokyo Institute of Technology */
2024++/* Copyright (c) 2001-2003 */
2025++/* All Rights Reserved. */
2026++/* */
2027++/* Permission is hereby granted, free of charge, to use and */
2028++/* distribute this software and its documentation without */
2029++/* restriction, including without limitation the rights to use, */
2030++/* copy, modify, merge, publish, distribute, sublicense, and/or */
2031++/* sell copies of this work, and to permit persons to whom this */
2032++/* work is furnished to do so, subject to the following conditions: */
2033++/* */
2034++/* 1. The code must retain the above copyright notice, this list */
2035++/* of conditions and the following disclaimer. */
2036++/* */
2037++/* 2. Any modifications must be clearly marked as such. */
2038++/* */
2039++/* NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF TECHNOLOGY, */
2040++/* HTS WORKING GROUP, AND THE CONTRIBUTORS TO THIS WORK DISCLAIM */
2041++/* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */
2042++/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
2043++/* SHALL NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF */
2044++/* TECHNOLOGY, HTS WORKING GROUP, NOR THE CONTRIBUTORS BE LIABLE */
2045++/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY */
2046++/* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, */
2047++/* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS */
2048++/* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR */
2049++/* PERFORMANCE OF THIS SOFTWARE. */
2050++/* */
2051++/* --------------------------------------------------------------- */
2052++/* defaults.h : default value for some parameters */
2053++/* */
2054++/* 2003/06/11 by Heiga Zen */
2055++/* --------------------------------------------------------------- */
2056++
2057++#define FPERIOD 80
2058++#define IPERIOD 1
2059++#define SEED 1
2060++#define GAUSS 1
2061++#define B0 0x00000001
2062++#define B28 0x10000000
2063++#define B31 0x80000000
2064++#define B31_ 0x7fffffff
2065++#define Z 0x00000000
2066++#define PADEORDER 4
2067++#define RATE 16000
2068++
2069++/* -------------------- End of "defaults.h" -------------------- */
2070+--- /dev/null
2071++++ festival-2.1~release/src/modules/hts21_engine/vocoder.cc
2072+@@ -0,0 +1,303 @@
2073++/* --------------------------------------------------------------- */
2074++/* The HMM-Based Speech Synthesis System (HTS): version 1.1b */
2075++/* HTS Working Group */
2076++/* */
2077++/* Department of Computer Science */
2078++/* Nagoya Institute of Technology */
2079++/* and */
2080++/* Interdisciplinary Graduate School of Science and Engineering */
2081++/* Tokyo Institute of Technology */
2082++/* Copyright (c) 2001-2003 */
2083++/* All Rights Reserved. */
2084++/* */
2085++/* Permission is hereby granted, free of charge, to use and */
2086++/* distribute this software and its documentation without */
2087++/* restriction, including without limitation the rights to use, */
2088++/* copy, modify, merge, publish, distribute, sublicense, and/or */
2089++/* sell copies of this work, and to permit persons to whom this */
2090++/* work is furnished to do so, subject to the following conditions: */
2091++/* */
2092++/* 1. The code must retain the above copyright notice, this list */
2093++/* of conditions and the following disclaimer. */
2094++/* */
2095++/* 2. Any modifications must be clearly marked as such. */
2096++/* */
2097++/* NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF TECHNOLOGY, */
2098++/* HTS WORKING GROUP, AND THE CONTRIBUTORS TO THIS WORK DISCLAIM */
2099++/* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */
2100++/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
2101++/* SHALL NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF */
2102++/* TECHNOLOGY, HTS WORKING GROUP, NOR THE CONTRIBUTORS BE LIABLE */
2103++/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY */
2104++/* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, */
2105++/* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS */
2106++/* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR */
2107++/* PERFORMANCE OF THIS SOFTWARE. */
2108++/* */
2109++/* --------------------------------------------------------------- */
2110++/* vocoder.c : mel-cepstral vocoder */
2111++/* (pulse/noise excitation & MLSA filter) */
2112++/* */
2113++/* 2003/06/11 by Heiga Zen */
2114++/* --------------------------------------------------------------- */
2115++
2116++#include <cstdio>
2117++#include <cstdlib>
2118++#include <cmath>
2119++#include "EST_walloc.h"
2120++
2121++#include "misc.h"
2122++#include "model.h"
2123++#include "defaults.h"
2124++#include "global.h"
2125++#include "vocoder.h"
2126++
2127++void init_vocoder(int m, VocoderSetup *vs)
2128++{
2129++ vs->fprd = FPERIOD;
2130++ vs->iprd = IPERIOD;
2131++ vs->seed = SEED;
2132++ vs->pd = PADEORDER;
2133++
2134++ vs->next = SEED;
2135++ vs->gauss = GAUSS;
2136++
2137++ vs->pade[ 0]=1.0;
2138++ vs->pade[ 1]=1.0; vs->pade[ 2]=0.0;
2139++ vs->pade[ 3]=1.0; vs->pade[ 4]=0.0; vs->pade[ 5]=0.0;
2140++ vs->pade[ 6]=1.0; vs->pade[ 7]=0.0; vs->pade[ 8]=0.0; vs->pade[ 9]=0.0;
2141++ vs->pade[10]=1.0; vs->pade[11]=0.4999273; vs->pade[12]=0.1067005; vs->pade[13]=0.01170221; vs->pade[14]=0.0005656279;
2142++ vs->pade[15]=1.0; vs->pade[16]=0.4999391; vs->pade[17]=0.1107098; vs->pade[18]=0.01369984; vs->pade[19]=0.0009564853;
2143++ vs->pade[20]=0.00003041721;
2144++
2145++ vs->rate=RATE;
2146++
2147++ vs->c = walloc(double,3*(m+1)+3*(vs->pd+1)+vs->pd*(m+2));
2148++
2149++ vs->p1 = -1;
2150++ vs->sw = 0;
2151++ vs->x = 0x55555555;
2152++}
2153++
2154++void vocoder (double p, float *mc, int m, FILE *rawfp, globalP *gp, VocoderSetup *vs)
2155++{
2156++ double inc, x;
2157++ int i, j, k;
2158++ short xs;
2159++ double a = gp->ALPHA;
2160++
2161++ if (p!=0.0)
2162++ p = vs->rate / p; /* f0 -> pitch */
2163++
2164++ if (vs->p1 < 0) {
2165++ if (vs->gauss & (vs->seed != 1)) vs->next = srnd ((unsigned)vs->seed);
2166++
2167++ vs->p1 = p;
2168++ vs->pc = vs->p1;
2169++ vs->cc = vs->c + m + 1;
2170++ vs->cinc = vs->cc + m + 1;
2171++ vs->d1 = vs->cinc + m + 1;
2172++
2173++ mc2b(mc, vs->c, m, a);
2174++
2175++ return;
2176++ }
2177++
2178++ mc2b(mc, vs->cc, m, a);
2179++
2180++ for (k=0; k<=m; k++)
2181++ vs->cinc[k] = (vs->cc[k]-vs->c[k])*(double)vs->iprd/(double)vs->fprd;
2182++
2183++ if (vs->p1!=0.0 && p!=0.0) {
2184++ inc = (p-vs->p1)*(double)vs->iprd/(double)vs->fprd;
2185++ }
2186++ else {
2187++ inc = 0.0;
2188++ vs->pc = p;
2189++ vs->p1 = 0.0;
2190++ }
2191++
2192++ for (j=vs->fprd, i=(vs->iprd+1)/2; j--;) {
2193++ if (vs->p1 == 0.0) {
2194++ if (vs->gauss)
2195++ x = (double) nrandom(vs);
2196++ else
2197++ x = mseq(vs);
2198++ }
2199++ else {
2200++ if ((vs->pc += 1.0)>=vs->p1) {
2201++ x = sqrt (vs->p1);
2202++ vs->pc = vs->pc - vs->p1;
2203++ }
2204++ else
2205++ x = 0.0;
2206++ }
2207++
2208++ x *= exp(vs->c[0]);
2209++
2210++ x = mlsadf(x, vs->c, m, a, vs->pd, vs->d1, vs);
2211++ xs = (short) x;
2212++
2213++ fwrite(&xs, sizeof(short), 1, rawfp);
2214++
2215++ fflush(stdout);
2216++
2217++ if (!--i) {
2218++ vs->p1 += inc;
2219++ for (k=0;k<=m;k++) vs->c[k] += vs->cinc[k];
2220++ i = vs->iprd;
2221++ }
2222++ }
2223++
2224++ vs->p1 = p;
2225++ movem(vs->cc,vs->c,m+1);
2226++}
2227++
2228++double mlsafir (double x, double *b, int m, double a, double *d)
2229++{
2230++ double y = 0.0;
2231++ double aa;
2232++ register int i;
2233++
2234++ aa = 1 - a*a;
2235++
2236++ d[0] = x;
2237++ d[1] = aa*d[0] + a*d[1];
2238++
2239++ for (i=2; i<=m; i++) {
2240++ d[i] = d[i] + a*(d[i+1]-d[i-1]);
2241++ y += d[i]*b[i];
2242++ }
2243++
2244++ for (i=m+1; i>1; i--) d[i] = d[i-1];
2245++
2246++ return (y);
2247++}
2248++
2249++double mlsadf1(double x, double *b, int m, double a, int pd, double *d, VocoderSetup *vs)
2250++{
2251++ double v, out = 0.0, *pt, aa;
2252++ register int i;
2253++
2254++ aa = 1 - a*a;
2255++ pt = &d[pd+1];
2256++
2257++ for (i=pd; i>=1; i--) {
2258++ d[i] = aa*pt[i-1] + a*d[i];
2259++ pt[i] = d[i] * b[1];
2260++ v = pt[i] * vs->ppade[i];
2261++
2262++ x += (1 & i) ? v : -v;
2263++ out += v;
2264++ }
2265++
2266++ pt[0] = x;
2267++ out += x;
2268++
2269++ return(out);
2270++}
2271++
2272++double mlsadf2 (double x, double *b, int m, double a, int pd, double *d, VocoderSetup *vs)
2273++{
2274++ double v, out = 0.0, *pt, aa;
2275++ register int i;
2276++
2277++ aa = 1 - a*a;
2278++ pt = &d[pd * (m+2)];
2279++
2280++ for (i=pd; i>=1; i--) {
2281++ pt[i] = mlsafir (pt[i-1], b, m, a, &d[(i-1)*(m+2)]);
2282++ v = pt[i] * vs->ppade[i];
2283++
2284++ x += (1&i) ? v : -v;
2285++ out += v;
2286++ }
2287++
2288++ pt[0] = x;
2289++ out += x;
2290++
2291++ return(out);
2292++}
2293++
2294++double mlsadf(double x, double *b, int m, double a, int pd, double *d, VocoderSetup *vs)
2295++{
2296++
2297++ vs->ppade = &(vs->pade[pd*(pd+1)/2]);
2298++
2299++ x = mlsadf1 (x, b, m, a, pd, d, vs);
2300++ x = mlsadf2 (x, b, m, a, pd, &d[2*(pd+1)], vs);
2301++
2302++ return (x);
2303++}
2304++
2305++double nrandom (VocoderSetup *vs)
2306++{
2307++ unsigned long rr;
2308++ if (vs->sw == 0) {
2309++ vs->sw = 1;
2310++ do {
2311++ rr = vs->next;
2312++ vs->r1 = 2 * rnd(&rr) - 1;
2313++ vs->r2 = 2 * rnd(&rr) - 1;
2314++ vs->next = rr;
2315++ vs->s = vs->r1 * vs->r1 + vs->r2 * vs->r2;
2316++ } while (vs->s > 1 || vs->s == 0);
2317++
2318++ vs->s = sqrt (-2 * log(vs->s) / vs->s);
2319++ return ( vs->r1 * vs->s );
2320++ }
2321++ else {
2322++ vs->sw = 0;
2323++ return ( vs->r2 * vs->s );
2324++ }
2325++}
2326++
2327++double rnd (unsigned long *next)
2328++{
2329++ double r;
2330++
2331++ *next = *next * 1103515245L + 12345;
2332++ r = (*next / 65536L) % 32768L;
2333++
2334++ return ( r/RANDMAX );
2335++}
2336++
2337++unsigned long srnd ( unsigned long seed )
2338++{
2339++ return (seed);
2340++}
2341++
2342++
2343++int mseq (VocoderSetup *vs)
2344++{
2345++ register int x0, x28;
2346++
2347++ vs->x >>= 1;
2348++
2349++ if (vs->x & B0)
2350++ x0 = 1;
2351++ else
2352++ x0 = -1;
2353++
2354++ if (vs->x & B28)
2355++ x28 = 1;
2356++ else
2357++ x28 = -1;
2358++
2359++ if (x0 + x28)
2360++ vs->x &= B31_;
2361++ else
2362++ vs->x |= B31;
2363++
2364++ return (x0);
2365++}
2366++
2367++void mc2b( float *mc, double *b, int m, double a)
2368++{
2369++ b[m] = mc[m];
2370++
2371++ for (m--; m>=0; m--)
2372++ b[m] = mc[m] - a * b[m+1];
2373++}
2374++
2375++/* -------------------- End of "vocoder.c" -------------------- */
2376+--- /dev/null
2377++++ festival-2.1~release/src/modules/hts21_engine/tree.h
2378+@@ -0,0 +1,86 @@
2379++/* --------------------------------------------------------------- */
2380++/* The HMM-Based Speech Synthesis System (HTS): version 1.1b */
2381++/* HTS Working Group */
2382++/* */
2383++/* Department of Computer Science */
2384++/* Nagoya Institute of Technology */
2385++/* and */
2386++/* Interdisciplinary Graduate School of Science and Engineering */
2387++/* Tokyo Institute of Technology */
2388++/* Copyright (c) 2001-2003 */
2389++/* All Rights Reserved. */
2390++/* */
2391++/* Permission is hereby granted, free of charge, to use and */
2392++/* distribute this software and its documentation without */
2393++/* restriction, including without limitation the rights to use, */
2394++/* copy, modify, merge, publish, distribute, sublicense, and/or */
2395++/* sell copies of this work, and to permit persons to whom this */
2396++/* work is furnished to do so, subject to the following conditions: */
2397++/* */
2398++/* 1. The code must retain the above copyright notice, this list */
2399++/* of conditions and the following disclaimer. */
2400++/* */
2401++/* 2. Any modifications must be clearly marked as such. */
2402++/* */
2403++/* NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF TECHNOLOGY, */
2404++/* HTS WORKING GROUP, AND THE CONTRIBUTORS TO THIS WORK DISCLAIM */
2405++/* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */
2406++/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
2407++/* SHALL NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF */
2408++/* TECHNOLOGY, HTS WORKING GROUP, NOR THE CONTRIBUTORS BE LIABLE */
2409++/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY */
2410++/* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, */
2411++/* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS */
2412++/* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR */
2413++/* PERFORMANCE OF THIS SOFTWARE. */
2414++/* */
2415++/* --------------------------------------------------------------- */
2416++/* tree.h : decision tree definition */
2417++/* */
2418++/* 2003/06/11 by Heiga Zen */
2419++/* --------------------------------------------------------------- */
2420++
2421++typedef struct _Pattern{ /* pattern handler for question storage */
2422++ char *pat; /* pattern */
2423++ struct _Pattern *next; /* link to next pattern */
2424++} Pattern;
2425++
2426++typedef struct _Question { /* question storage */
2427++ char *qName; /* name of this question */
2428++ Pattern *phead; /* link to head of pattern list */
2429++ Pattern *ptail; /* link to tail of pattern list */
2430++ struct _Question *next; /* link to next question */
2431++} Question;
2432++
2433++typedef struct _Node { /* node of decision tree */
2434++ int idx; /* index of this node */
2435++ int pdf; /* index of pdf for this node ( leaf node only ) */
2436++ struct _Node *yes; /* link to child node (yes) */
2437++ struct _Node *no; /* link to child node (no) */
2438++ Question *quest; /* question applied at this node */
2439++} Node;
2440++
2441++typedef struct _Tree {
2442++ int state; /* state position of this tree */
2443++ struct _Tree *next; /* link to next tree */
2444++ Node *root; /* root node of this decision tree */
2445++} Tree;
2446++
2447++typedef struct _TreeSet {
2448++ Question *qhead[3];
2449++ Question *qtail[3];
2450++
2451++ Tree *thead[3];
2452++ Tree *ttail[3];
2453++
2454++ FILE *fp[3];
2455++
2456++} TreeSet;
2457++
2458++void LoadTreesFile (TreeSet *, Mtype);
2459++int SearchTree (char *, Node *);
2460++void InitTreeSet(TreeSet *);
2461++void FreeTrees(TreeSet *ts, Mtype type);
2462++
2463++/* -------------------- End of "tree.h" -------------------- */
2464++
2465+--- /dev/null
2466++++ festival-2.1~release/src/modules/hts21_engine/vocoder.h
2467+@@ -0,0 +1,79 @@
2468++/* --------------------------------------------------------------- */
2469++/* The HMM-Based Speech Synthesis System (HTS): version 1.1b */
2470++/* HTS Working Group */
2471++/* */
2472++/* Department of Computer Science */
2473++/* Nagoya Institute of Technology */
2474++/* and */
2475++/* Interdisciplinary Graduate School of Science and Engineering */
2476++/* Tokyo Institute of Technology */
2477++/* Copyright (c) 2001-2003 */
2478++/* All Rights Reserved. */
2479++/* */
2480++/* Permission is hereby granted, free of charge, to use and */
2481++/* distribute this software and its documentation without */
2482++/* restriction, including without limitation the rights to use, */
2483++/* copy, modify, merge, publish, distribute, sublicense, and/or */
2484++/* sell copies of this work, and to permit persons to whom this */
2485++/* work is furnished to do so, subject to the following conditions: */
2486++/* */
2487++/* 1. The code must retain the above copyright notice, this list */
2488++/* of conditions and the following disclaimer. */
2489++/* */
2490++/* 2. Any modifications must be clearly marked as such. */
2491++/* */
2492++/* NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF TECHNOLOGY, */
2493++/* HTS WORKING GROUP, AND THE CONTRIBUTORS TO THIS WORK DISCLAIM */
2494++/* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */
2495++/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
2496++/* SHALL NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF */
2497++/* TECHNOLOGY, HTS WORKING GROUP, NOR THE CONTRIBUTORS BE LIABLE */
2498++/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY */
2499++/* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, */
2500++/* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS */
2501++/* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR */
2502++/* PERFORMANCE OF THIS SOFTWARE. */
2503++/* */
2504++/* --------------------------------------------------------------- */
2505++/* vocoder.h : mel-cepstral vocoder */
2506++/* (pulse/noise excitation & MLSA filter) */
2507++/* */
2508++/* 2003/06/11 by Heiga Zen */
2509++/* --------------------------------------------------------------- */
2510++
2511++#define RANDMAX 32767
2512++
2513++typedef struct _VocoderSetup {
2514++
2515++ int fprd;
2516++ int iprd;
2517++ int seed;
2518++ int pd;
2519++ long next;
2520++ HTS_Boolean gauss;
2521++ double p1;
2522++ double pc;
2523++ double pj;
2524++ double pade[21];
2525++ double *ppade;
2526++ double *c, *cc, *cinc, *d1;
2527++ double rate;
2528++
2529++ int sw;
2530++ double r1, r2, s;
2531++
2532++ int x;
2533++
2534++} VocoderSetup;
2535++
2536++int mseq(VocoderSetup *);
2537++double rnd(unsigned long *);
2538++double nrandom (VocoderSetup *);
2539++unsigned long srnd(unsigned long );
2540++double mlsadf(double, double *, int, double, int, double *, VocoderSetup *);
2541++void mc2b(float *, double *, int, double );
2542++
2543++void init_vocoder(int m, VocoderSetup *vs);
2544++void vocoder (double p, float *mc, int m, FILE *rawfp, globalP *gp, VocoderSetup *vs);
2545++
2546++/* -------------------- End of "vocoder.h" -------------------- */
2547+--- /dev/null
2548++++ festival-2.1~release/src/modules/hts21_engine/hts_engine.cc
2549+@@ -0,0 +1,448 @@
2550++/* --------------------------------------------------------------- */
2551++/* The HMM-Based Speech Synthesis System (HTS): version 1.1b */
2552++/* HTS Working Group */
2553++/* */
2554++/* Department of Computer Science */
2555++/* Nagoya Institute of Technology */
2556++/* and */
2557++/* Interdisciplinary Graduate School of Science and Engineering */
2558++/* Tokyo Institute of Technology */
2559++/* Copyright (c) 2001-2003 */
2560++/* All Rights Reserved. */
2561++/* */
2562++/* Permission is hereby granted, free of charge, to use and */
2563++/* distribute this software and its documentation without */
2564++/* restriction, including without limitation the rights to use, */
2565++/* copy, modify, merge, publish, distribute, sublicense, and/or */
2566++/* sell copies of this work, and to permit persons to whom this */
2567++/* work is furnished to do so, subject to the following conditions: */
2568++/* */
2569++/* 1. The code must retain the above copyright notice, this list */
2570++/* of conditions and the following disclaimer. */
2571++/* */
2572++/* 2. Any modifications must be clearly marked as such. */
2573++/* */
2574++/* NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF TECHNOLOGY, */
2575++/* HTS WORKING GROUP, AND THE CONTRIBUTORS TO THIS WORK DISCLAIM */
2576++/* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */
2577++/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
2578++/* SHALL NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF */
2579++/* TECHNOLOGY, HTS WORKING GROUP, NOR THE CONTRIBUTORS BE LIABLE */
2580++/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY */
2581++/* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, */
2582++/* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS */
2583++/* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR */
2584++/* PERFORMANCE OF THIS SOFTWARE. */
2585++/* */
2586++/* --------------------------------------------------------------- */
2587++/* hts_engine.c : a compact HMM-based speech synthesis engine */
2588++/* */
2589++/* 2003/06/11 by Heiga Zen */
2590++/* --------------------------------------------------------------- */
2591++/* Modified by Alan W Black (awb@cs.cmu.edu) */
2592++/* April 2004 */
2593++/* Make it compile with c++ and integrate as a Festival module */
2594++/* --------------------------------------------------------------- */
2595++
2596++/* Standard C Libraries */
2597++#include <cstdio>
2598++#include <cstdlib>
2599++#include <cstring>
2600++#include <cctype>
2601++#include "festival.h"
2602++
2603++#include "misc.h"
2604++#include "tree.h"
2605++#include "model.h"
2606++#include "global.h"
2607++#include "vocoder.h"
2608++#include "mlpg.h"
2609++#include "defaults.h"
2610++
2611++void HTS21_Process ( FILE *, FILE *, FILE *, FILE *, PStream *, PStream *,
2612++ globalP *, ModelSet *, TreeSet *, VocoderSetup *);
2613++
2614++/* OutLabel : output label with frame number or time */
2615++void OutLabel (UttModel *um, HTS_Boolean XIMERA)
2616++{
2617++ Model *m;
2618++ char *tmp;
2619++ int nframe = 0;
2620++
2621++ for (m=um->mhead; m!=um->mtail; m=m->next) {
2622++ if (XIMERA) { /* in XIMERA format */
2623++ tmp = wstrdup(m->name);
2624++ tmp = strchr(tmp,'-')+1;
2625++ *(strchr(tmp,'+')) = '\0';
2626++ fprintf(stdout,"%1.3f %s\n", (((float)nframe)*FPERIOD)/((float)RATE), tmp);
2627++ }
2628++ else /* in HTK & HTS format */
2629++ fprintf(stdout, "%d %d %s\n", nframe, nframe+m->totaldur,m->name);
2630++
2631++ nframe += m->totaldur;
2632++ }
2633++
2634++ if (XIMERA) /* in XIMERA format */
2635++ fprintf(stdout,"%1.3f __END__\n", (((float)nframe)*FPERIOD)/((float)RATE));
2636++
2637++}
2638++
2639++void HTS21_Process ( FILE *labfp, FILE *rawfp, FILE *lf0fp, FILE *mcepfp,
2640++ PStream *mceppst, PStream *lf0pst, globalP *gp,
2641++ ModelSet *ms, TreeSet *ts, VocoderSetup *vs )
2642++{
2643++ char buf[1024];
2644++ Tree *tree;
2645++ int state, diffdur=0;
2646++ int start, end;
2647++ int rate, nf;
2648++ int i;
2649++ float f, mean, var;
2650++ HTS_Boolean hastime;
2651++ Model *m, *mm, *nm;
2652++ UttModel um;
2653++
2654++ rate = FPERIOD * 10000000 / RATE;
2655++
2656++ mean = var = 0.0;
2657++
2658++ m = walloc(Model,1);
2659++ um.mtail = um.mhead = m;
2660++ um.totalframe = um.nState = um.nModel = 0;
2661++ start = 0;
2662++ end = 0;
2663++
2664++ while (!feof(labfp)) {
2665++ GetToken (labfp,buf);
2666++ if (!isalnum(buf[0])) break;
2667++ if (isdigit(buf[0]))
2668++ hastime = TRUE;
2669++ else
2670++ hastime = FALSE;
2671++
2672++ if (hastime) {
2673++ if (gp->algnst) {
2674++ start = atoi(buf);
2675++ GetToken(labfp, buf);
2676++ end = atoi(buf);
2677++ GetToken(labfp, buf);
2678++ GetToken(labfp, buf);
2679++ }
2680++ else if (gp->algnph) {
2681++ start = atoi(buf);
2682++ GetToken(labfp, buf);
2683++ end = atoi(buf);
2684++ GetToken(labfp, buf);
2685++ }
2686++ else {
2687++ do {
2688++ GetToken(labfp, buf);
2689++ } while (isdigit(buf[0]));
2690++ }
2691++ }
2692++
2693++ m->name = wstrdup(buf);
2694++
2695++ if (hastime && gp->algnph) {
2696++ m->durpdf = SearchTree(m->name, ts->thead[DUR]->root);
2697++ FindDurPDF(m, ms, gp->RHO, diffdur);
2698++ nf = 0;
2699++ for (state=2; state<=ms->nstate+1; state++)
2700++ nf += m->dur[state];
2701++
2702++ fprintf(stderr, ">>>nf=%d %d\n", nf, (end-start)/rate);
2703++
2704++ f = (float)(end-start)/(rate*nf);
2705++ m->totaldur = 0;
2706++
2707++ for (state=2; state<=ms->nstate+1; state++) {
2708++ nf = (int)(f*m->dur[state]+0.5);
2709++ if (nf<=0) nf=1;
2710++ fprintf(stderr, "%d: %d %f %d\n", state, m->dur[state], f, nf);
2711++ m->dur[state] = nf;
2712++ m->totaldur += m->dur[state];
2713++ }
2714++ um.totalframe += m->totaldur;
2715++ }
2716++ else if (hastime && gp->algnst) {
2717++ m->dur = walloc(int,ms->nstate+2);
2718++ m->dur[2] = (end-start)/rate;
2719++ m->totaldur = m->dur[2];
2720++ um.totalframe += m->dur[2];
2721++
2722++ for (state=3; state<=ms->nstate+1; state++) {
2723++ GetToken(labfp, buf);
2724++ start = atoi(buf);
2725++ GetToken(labfp, buf);
2726++ end = atoi(buf);
2727++ GetToken(labfp, buf);
2728++ m->dur[state] = (end-start)/rate;
2729++ m->totaldur += m->dur[state];
2730++ um.totalframe += m->dur[state];
2731++ }
2732++ }
2733++ else {
2734++ m->durpdf = SearchTree(m->name, ts->thead[DUR]->root);
2735++ if (gp->LENGTH==0) {
2736++ FindDurPDF(m, ms, gp->RHO, diffdur);
2737++ um.totalframe += m->totaldur;
2738++ }
2739++ else { /* if total length of generated speech is specified */
2740++ for (state=2; state<=ms->nstate+1; state++) {
2741++ mean += ms->durpdf[m->durpdf][state];
2742++ var += ms->durpdf[m->durpdf][state+ms->nstate];
2743++ }
2744++ }
2745++ }
2746++
2747++ /* for excitation */
2748++ m->lf0pdf = walloc(int,ms->nstate+2);
2749++ m->lf0mean = walloc(float *,ms->nstate+2);
2750++ m->lf0variance = walloc(float *,ms->nstate+2);
2751++ m->voiced = walloc(HTS_Boolean, ms->nstate);
2752++
2753++ for (tree=ts->thead[LF0],state=2; tree!=ts->ttail[LF0]; tree=tree->next,state++) {
2754++ m->lf0pdf[state] = SearchTree(m->name, tree->root);
2755++ FindLF0PDF(state, m, ms, gp->UV);
2756++ }
2757++
2758++ /* for spectrum */
2759++ m->mceppdf = walloc(int,ms->nstate+2);
2760++ m->mcepmean = walloc(float *,ms->nstate+2);
2761++ m->mcepvariance = walloc(float *,ms->nstate+2);
2762++
2763++/* m->mceppdf -= 2; m->mcepmean -= 2; m->mcepvariance -= 2; */
2764++
2765++ for (tree=ts->thead[MCP],state=2; tree!=ts->ttail[MCP]; tree=tree->next,state++) {
2766++ m->mceppdf[state] = SearchTree(m->name, tree->root);
2767++ FindMcpPDF(state, m, ms);
2768++ }
2769++
2770++ m->next = walloc(Model,1);
2771++ m = um.mtail = m->next;
2772++
2773++ um.nModel++;
2774++ um.nState+=ms->nstate;
2775++ }
2776++
2777++ if (gp->LENGTH > 0 && gp->LENGTH < um.nState) {
2778++ fprintf(stderr, "Specified length of generated speech is too short ! (this sentence HMM is composed from %d states)\n", um.nState);
2779++ fprintf(stderr, "Please specify more than %.1f seconds.\n", (float)(um.nState*FPERIOD)/RATE);
2780++ festival_error();
2781++ }
2782++
2783++ /* if total length of generated speech is specified */
2784++ /* compute RHO */
2785++ if (gp->LENGTH>0) {
2786++ gp->RHO = (gp->LENGTH - mean)/var;
2787++ /* compute state duration for each state */
2788++ for (m=um.mhead; m!=um.mtail; m=m->next) {
2789++ FindDurPDF(m, ms, gp->RHO, diffdur);
2790++ um.totalframe += m->totaldur;
2791++ }
2792++ }
2793++
2794++ /* Output label information */
2795++ /* OutLabel(&um, gp->XIMERA); */
2796++
2797++ pdf2speech(rawfp, lf0fp, mcepfp, mceppst, lf0pst, gp, ms, &um, vs);
2798++
2799++ /* Tidy up memory */
2800++ for (mm=um.mhead; mm; mm=nm)
2801++ {
2802++ nm = mm->next;
2803++ for (i=0; i<ms->nstate+2; i++)
2804++ {
2805++ if (mm->lf0mean) wfree(mm->lf0mean[i]);
2806++ if (mm->lf0variance) wfree(mm->lf0variance[i]);
2807++ }
2808++ wfree(mm->mcepvariance);
2809++ wfree(mm->mcepmean);
2810++ wfree(mm->mceppdf);
2811++ wfree(mm->voiced);
2812++ wfree(mm->lf0variance);
2813++ wfree(mm->lf0mean);
2814++ wfree(mm->lf0pdf);
2815++ wfree(mm->dur);
2816++ wfree(mm->name);
2817++ wfree(mm);
2818++ }
2819++}
2820++
2821++static FILE *do_fopen(const char *fname,const char *mode)
2822++{
2823++ FILE *fd;
2824++
2825++ fd = fopen(fname,mode);
2826++ if (fd == NULL)
2827++ {
2828++ cerr << "hts_engine: failed to open " << fname << endl;
2829++ festival_error();
2830++ }
2831++ return fd;
2832++}
2833++
2834++LISP HTS21_Synthesize_Utt(LISP utt)
2835++{
2836++ EST_Utterance *u = get_c_utt(utt);
2837++ EST_Item *item = 0;
2838++ LISP hts_engine_params = NIL;
2839++ LISP hts_output_params = NIL;
2840++ FILE *labfp=NULL;
2841++ FILE *lf0fp=NULL, *mcepfp=NULL, *rawfp=NULL;
2842++
2843++ ModelSet ms;
2844++ TreeSet ts;
2845++ PStream mceppst, lf0pst;
2846++ globalP gp;
2847++ VocoderSetup vs;
2848++
2849++ /* default value for control parameter */
2850++ gp.RHO = 0.0;
2851++ gp.ALPHA = 0.42;
2852++ gp.F0_STD = 1.0;
2853++ gp.F0_MEAN = 0.0;
2854++ gp.UV = 0.5;
2855++ gp.LENGTH = 0;
2856++ gp.algnst = FALSE;
2857++ gp.algnph = FALSE;
2858++ gp.XIMERA = FALSE;
2859++
2860++ /* Get voice specific params */
2861++ hts_engine_params = siod_get_lval("hts_engine_params",
2862++ "HTS_ENGINE: no parameters set for module");
2863++ /* We should be internalize these ones more */
2864++ hts_output_params = siod_get_lval("hts_output_params",
2865++ "HTS_ENGINE: no output parameters set for module");
2866++
2867++ /* initialise TreeSet and ModelSet */
2868++ InitTreeSet (&ts);
2869++ InitModelSet(&ms);
2870++
2871++ /* delta window handler for log f0 */
2872++ lf0pst.dw.fn = walloc(char *,20);
2873++ lf0pst.dw.num = 1;
2874++
2875++ /* delta window handler for mel-cepstrum */
2876++ mceppst.dw.fn = walloc(char *,20);
2877++ mceppst.dw.num = 1;
2878++
2879++ /* Load parameters */
2880++ mceppst.dw.fn[1] = (char *)get_param_str("-dm1",hts_engine_params,
2881++ "hts/mcep_dyn.win");
2882++ mceppst.dw.fn[2] = (char *)get_param_str("-dm2",hts_engine_params,
2883++ "hts/mcep_acc.win");
2884++ mceppst.dw.num = 3;
2885++
2886++ lf0pst.dw.fn[1] = (char *)get_param_str("-df1",hts_engine_params,
2887++ "hts/lf0_dyn.win");
2888++ lf0pst.dw.fn[2] = (char *)get_param_str("-df2",hts_engine_params,
2889++ "hts/lf0_acc.win");
2890++ lf0pst.dw.num = 3;
2891++
2892++ ts.fp[DUR]=do_fopen(get_param_str("-td",hts_engine_params,
2893++ "hts/trees-dur.inf"),"r");
2894++ ts.fp[LF0]=do_fopen(get_param_str("-tf",hts_engine_params,
2895++ "hts/trees-lf0.inf"), "r");
2896++ ts.fp[MCP]=do_fopen(get_param_str("-tm",hts_engine_params,
2897++ "hts/trees-mcep.inf"), "r");
2898++ ms.fp[DUR]=do_fopen(get_param_str("-md",hts_engine_params,
2899++ "hts/duration.pdf"),"rb");
2900++ ms.fp[LF0]=do_fopen(get_param_str("-mf",hts_engine_params,
2901++ "hts/lf0.pdf"), "rb");
2902++ ms.fp[MCP]=do_fopen(get_param_str("-mm",hts_engine_params,
2903++ "hts/mcep.pdf"), "rb");
2904++
2905++ rawfp = do_fopen(get_param_str("-or",hts_output_params,
2906++ "tmp.raw"), "wb");
2907++ lf0fp = do_fopen(get_param_str("-of",hts_output_params,
2908++ "tmp.f0"), "wb");
2909++ mcepfp = do_fopen(get_param_str("-om",hts_output_params,
2910++ "tmp.mcep"), "wb");
2911++ labfp = do_fopen(get_param_str("-labelfile",hts_output_params,
2912++ "utt.feats"), "r");
2913++
2914++ gp.RHO = get_param_float("-r",hts_engine_params,0.0);
2915++ gp.ALPHA = get_param_float("-a",hts_engine_params,0.42);
2916++ gp.F0_STD = get_param_float("-fs",hts_engine_params,1.0);
2917++ gp.F0_MEAN = get_param_float("-fm",hts_engine_params,0.0);
2918++ gp.UV = get_param_float("-u",hts_engine_params,0.5);
2919++ gp.LENGTH = (int)get_param_float("-l",hts_engine_params,0.0);
2920++
2921++ /* do what needs to be done */
2922++ LoadTreesFile(&ts, DUR);
2923++ LoadTreesFile(&ts, LF0);
2924++ LoadTreesFile(&ts, MCP);
2925++
2926++ /* load model files for duration, log f0 and mel-cepstrum */
2927++ LoadModelFiles(&ms);
2928++
2929++ /* if the name of output speech file is not specified, waveform generation won't be generated */
2930++ if (rawfp!=NULL)
2931++ init_vocoder(ms.mcepvsize-1, &vs);
2932++
2933++ /* check the number of window */
2934++ if (lf0pst.dw.num != ms.lf0stream)
2935++ {
2936++ cerr << "Festival: HTS: dynamic window for f0 is illegal\n";
2937++ festival_error();
2938++ }
2939++ if (ms.mcepvsize % mceppst.dw.num != 0 )
2940++ {
2941++ cerr << "Festival: HTS: dynamic window for mcep is illegal\n";
2942++ festival_error();
2943++ }
2944++
2945++ /* generate speech */
2946++ if (u->relation("Segment")->first()) /* only if there segments */
2947++ HTS21_Process(labfp, rawfp, lf0fp, mcepfp,
2948++ &mceppst, &lf0pst, &gp, &ms, &ts, &vs);
2949++
2950++ /* Load back in the waveform */
2951++ EST_Wave *w = new EST_Wave;
2952++
2953++ fclose(ts.fp[DUR]);
2954++ fclose(ts.fp[LF0]);
2955++ fclose(ts.fp[MCP]);
2956++ fclose(ms.fp[DUR]);
2957++ fclose(ms.fp[LF0]);
2958++ fclose(ms.fp[MCP]);
2959++ fclose(rawfp);
2960++ fclose(lf0fp);
2961++ fclose(mcepfp);
2962++ fclose(labfp);
2963++
2964++ wfree(vs.c);
2965++ wfree(lf0pst.dw.fn);
2966++ wfree(mceppst.dw.fn);
2967++ FreeTrees(&ts, DUR);
2968++ FreeTrees(&ts, LF0);
2969++ FreeTrees(&ts, MCP);
2970++ DeleteModelSet(&ms);
2971++
2972++ if (u->relation("Segment")->first()) /* only if there segments */
2973++ w->load_file(get_param_str("-or",hts_output_params,"tmp.raw"),
2974++ "raw", 16000,
2975++ "short", str_to_bo("native"), 1);
2976++
2977++ item = u->create_relation("Wave")->append();
2978++ item->set_val("wave",est_val(w));
2979++
2980++ return utt;
2981++}
2982++
2983++LISP hts21_mlsa_resynthesis(LISP ltrack);
2984++
2985++void festival_hts21_engine_init(void)
2986++{
2987++ proclaim_module("hts21_engine");
2988++
2989++ festival_def_utt_module("HTS21_Synthesize",HTS21_Synthesize_Utt,
2990++ "(HTS21_Synthesis UTT)\n\
2991++ Synthesize a waveform using the HTS 2.1 Engine and the current models");
2992++ init_subr_1("hts21_mlsa_resynthesis",hts21_mlsa_resynthesis,
2993++ "(hts21_mlsa_resynthesis TRACK)\n\
2994++ Return a WAVE synthesized from the F0/MCEP TRACK.");
2995++}
2996++
2997++/* -------------------- End of "hts_engine.c" -------------------- */
2998+--- /dev/null
2999++++ festival-2.1~release/src/modules/hts21_engine/model.h
3000+@@ -0,0 +1,87 @@
3001++/* --------------------------------------------------------------- */
3002++/* The HMM-Based Speech Synthesis System (HTS): version 1.1b */
3003++/* HTS Working Group */
3004++/* */
3005++/* Department of Computer Science */
3006++/* Nagoya Institute of Technology */
3007++/* and */
3008++/* Interdisciplinary Graduate School of Science and Engineering */
3009++/* Tokyo Institute of Technology */
3010++/* Copyright (c) 2001-2003 */
3011++/* All Rights Reserved. */
3012++/* */
3013++/* Permission is hereby granted, free of charge, to use and */
3014++/* distribute this software and its documentation without */
3015++/* restriction, including without limitation the rights to use, */
3016++/* copy, modify, merge, publish, distribute, sublicense, and/or */
3017++/* sell copies of this work, and to permit persons to whom this */
3018++/* work is furnished to do so, subject to the following conditions: */
3019++/* */
3020++/* 1. The code must retain the above copyright notice, this list */
3021++/* of conditions and the following disclaimer. */
3022++/* */
3023++/* 2. Any modifications must be clearly marked as such. */
3024++/* */
3025++/* NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF TECHNOLOGY, */
3026++/* HTS WORKING GROUP, AND THE CONTRIBUTORS TO THIS WORK DISCLAIM */
3027++/* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */
3028++/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
3029++/* SHALL NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF */
3030++/* TECHNOLOGY, HTS WORKING GROUP, NOR THE CONTRIBUTORS BE LIABLE */
3031++/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY */
3032++/* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, */
3033++/* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS */
3034++/* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR */
3035++/* PERFORMANCE OF THIS SOFTWARE. */
3036++/* */
3037++/* --------------------------------------------------------------- */
3038++/* model.h : model definition */
3039++/* */
3040++/* 2003/06/11 by Heiga Zen */
3041++/* --------------------------------------------------------------- */
3042++
3043++typedef struct _Model { /* HMM handler */
3044++ char *name; /* the name of this HMM */
3045++ int durpdf; /* duration pdf index for this HMM */
3046++ int *lf0pdf; /* mel-cepstrum pdf indexes for each state of this HMM */
3047++ int *mceppdf; /* log f0 pdf indexes for each state of this HMM */
3048++ int *dur; /* duration for each state of this HMM */
3049++ int totaldur; /* total duration of this HMM */
3050++ float **lf0mean; /* mean vector of log f0 pdfs for each state of this HMM */
3051++ float **lf0variance; /* variance (diag) elements of log f0 for each state of this HMM */
3052++ float **mcepmean; /* mean vector of mel-cepstrum pdfs for each state of this HMM */
3053++ float **mcepvariance; /* variance (diag) elements of mel-cepstrum for each state of this HMM */
3054++ HTS_Boolean *voiced; /* voiced/unvoiced decision for each state of this HMM */
3055++ struct _Model *next; /* pointer to next HMM */
3056++} Model;
3057++
3058++
3059++typedef struct _UttModel { /* Utterance model handler */
3060++ Model *mhead;
3061++ Model *mtail;
3062++ int nModel;
3063++ int nState;
3064++ int totalframe;
3065++} UttModel;
3066++
3067++
3068++typedef struct _ModelSet { /* HMM set handler */
3069++ int nstate;
3070++ int lf0stream;
3071++ int mcepvsize;
3072++ int ndurpdf;
3073++ int *nmceppdf;
3074++ int *nlf0pdf;
3075++ float **durpdf,***mceppdf,****lf0pdf;
3076++ FILE *fp[3];
3077++} ModelSet;
3078++
3079++
3080++void LoadModelFiles (ModelSet *);
3081++void FindDurPDF (Model *, ModelSet *, float, int );
3082++void FindLF0PDF (int, Model *, ModelSet *, float);
3083++void FindMcpPDF (int, Model *, ModelSet *);
3084++void InitModelSet (ModelSet *);
3085++void DeleteModelSet(ModelSet *ms);
3086++
3087++/* -------------------- End of "model.h" -------------------- */
3088+--- /dev/null
3089++++ festival-2.1~release/src/modules/hts21_engine/misc.cc
3090+@@ -0,0 +1,114 @@
3091++/* --------------------------------------------------------------- */
3092++/* The HMM-Based Speech Synthesis System (HTS): version 1.1b */
3093++/* HTS Working Group */
3094++/* */
3095++/* Department of Computer Science */
3096++/* Nagoya Institute of Technology */
3097++/* and */
3098++/* Interdisciplinary Graduate School of Science and Engineering */
3099++/* Tokyo Institute of Technology */
3100++/* Copyright (c) 2001-2003 */
3101++/* All Rights Reserved. */
3102++/* */
3103++/* Permission is hereby granted, free of charge, to use and */
3104++/* distribute this software and its documentation without */
3105++/* restriction, including without limitation the rights to use, */
3106++/* copy, modify, merge, publish, distribute, sublicense, and/or */
3107++/* sell copies of this work, and to permit persons to whom this */
3108++/* work is furnished to do so, subject to the following conditions: */
3109++/* */
3110++/* 1. The code must retain the above copyright notice, this list */
3111++/* of conditions and the following disclaimer. */
3112++/* */
3113++/* 2. Any modifications must be clearly marked as such. */
3114++/* */
3115++/* NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF TECHNOLOGY, */
3116++/* HTS WORKING GROUP, AND THE CONTRIBUTORS TO THIS WORK DISCLAIM */
3117++/* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */
3118++/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
3119++/* SHALL NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF */
3120++/* TECHNOLOGY, HTS WORKING GROUP, NOR THE CONTRIBUTORS BE LIABLE */
3121++/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY */
3122++/* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, */
3123++/* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS */
3124++/* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR */
3125++/* PERFORMANCE OF THIS SOFTWARE. */
3126++/* */
3127++/* --------------------------------------------------------------- */
3128++/* misc.c : miscellaneous functions (from SPTK) */
3129++/* */
3130++/* 2003/06/11 by Heiga Zen */
3131++/* --------------------------------------------------------------- */
3132++
3133++#include <cstdio>
3134++#include <cstdlib>
3135++#include <cstring>
3136++#include <cctype>
3137++#include "festival.h"
3138++#include "misc.h"
3139++
3140++FILE *getfp (char *name, char *opt)
3141++{
3142++ FILE *fp;
3143++
3144++ if ((fp=fopen(name, opt)) == NULL) {
3145++ fprintf (stderr, "Can't open '%s'!\n", name);
3146++ festival_error();
3147++ }
3148++ return (fp);
3149++}
3150++
3151++void GetToken (FILE *fp, char *buff)
3152++{
3153++ char c;
3154++ int i;
3155++ HTS_Boolean squote = 0;
3156++ HTS_Boolean dquote = 0;
3157++
3158++ c = fgetc (fp);
3159++
3160++ while (isspace(c))
3161++ c = fgetc (fp);
3162++
3163++ if (c=='\'') { /* single quote case */
3164++ c = fgetc (fp);
3165++ squote = 1;
3166++ }
3167++
3168++ if (c=='\"') { /*double quote case */
3169++ c = fgetc (fp);
3170++ dquote = 1;
3171++ }
3172++
3173++ if (c==',') { /*special character ',' */
3174++ strcpy (buff, ",");
3175++ return;
3176++ }
3177++
3178++ i = 0;
3179++ while (1) {
3180++ buff[i++] = c;
3181++ c = fgetc (fp);
3182++ if (squote && c == '\'') break;
3183++ if (dquote && c == '\"') break;
3184++ if (!(squote || dquote || isgraph(c)) ) break;
3185++ }
3186++
3187++ buff[i]=0;
3188++}
3189++
3190++void movem (double *a, double *b, int nitem)
3191++{
3192++ register long i;
3193++
3194++ i = nitem;
3195++
3196++ if (a>b)
3197++ while (i--) *b++ = *a++;
3198++ else {
3199++ a += i; b += i;
3200++ while (i--) *--b = *--a;
3201++ }
3202++}
3203++
3204++/* -------------------- End of "misc.c" -------------------- */
3205+--- /dev/null
3206++++ festival-2.1~release/src/modules/hts21_engine/misc.h
3207+@@ -0,0 +1,50 @@
3208++/* --------------------------------------------------------------- */
3209++/* The HMM-Based Speech Synthesis System (HTS): version 1.1b */
3210++/* HTS Working Group */
3211++/* */
3212++/* Department of Computer Science */
3213++/* Nagoya Institute of Technology */
3214++/* and */
3215++/* Interdisciplinary Graduate School of Science and Engineering */
3216++/* Tokyo Institute of Technology */
3217++/* Copyright (c) 2001-2003 */
3218++/* All Rights Reserved. */
3219++/* */
3220++/* Permission is hereby granted, free of charge, to use and */
3221++/* distribute this software and its documentation without */
3222++/* restriction, including without limitation the rights to use, */
3223++/* copy, modify, merge, publish, distribute, sublicense, and/or */
3224++/* sell copies of this work, and to permit persons to whom this */
3225++/* work is furnished to do so, subject to the following conditions: */
3226++/* */
3227++/* 1. The code must retain the above copyright notice, this list */
3228++/* of conditions and the following disclaimer. */
3229++/* */
3230++/* 2. Any modifications must be clearly marked as such. */
3231++/* */
3232++/* NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF TECHNOLOGY, */
3233++/* HTS WORKING GROUP, AND THE CONTRIBUTORS TO THIS WORK DISCLAIM */
3234++/* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */
3235++/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
3236++/* SHALL NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF */
3237++/* TECHNOLOGY, HTS WORKING GROUP, NOR THE CONTRIBUTORS BE LIABLE */
3238++/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY */
3239++/* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, */
3240++/* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS */
3241++/* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR */
3242++/* PERFORMANCE OF THIS SOFTWARE. */
3243++/* */
3244++/* --------------------------------------------------------------- */
3245++/* misc.h : miscellaneous functions (from SPTK) */
3246++/* */
3247++/* 2003/06/11 by Heiga Zen */
3248++/* --------------------------------------------------------------- */
3249++
3250++FILE *getfp (char *, char *);
3251++void GetToken (FILE *,char *);
3252++void movem (double *, double *, int);
3253++
3254++typedef bool HTS_Boolean;
3255++typedef enum {DUR, LF0, MCP} Mtype;
3256++
3257++/* -------------------- End of "misc.h" -------------------- */
3258+--- /dev/null
3259++++ festival-2.1~release/src/modules/hts21_engine/mlpg.cc
3260+@@ -0,0 +1,483 @@
3261++/* --------------------------------------------------------------- */
3262++/* The HMM-Based Speech Synthesis System (HTS): version 1.1b */
3263++/* HTS Working Group */
3264++/* */
3265++/* Department of Computer Science */
3266++/* Nagoya Institute of Technology */
3267++/* and */
3268++/* Interdisciplinary Graduate School of Science and Engineering */
3269++/* Tokyo Institute of Technology */
3270++/* Copyright (c) 2001-2003 */
3271++/* All Rights Reserved. */
3272++/* */
3273++/* Permission is hereby granted, free of charge, to use and */
3274++/* distribute this software and its documentation without */
3275++/* restriction, including without limitation the rights to use, */
3276++/* copy, modify, merge, publish, distribute, sublicense, and/or */
3277++/* sell copies of this work, and to permit persons to whom this */
3278++/* work is furnished to do so, subject to the following conditions: */
3279++/* */
3280++/* 1. The code must retain the above copyright notice, this list */
3281++/* of conditions and the following disclaimer. */
3282++/* */
3283++/* 2. Any modifications must be clearly marked as such. */
3284++/* */
3285++/* NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF TECHNOLOGY, */
3286++/* HTS WORKING GROUP, AND THE CONTRIBUTORS TO THIS WORK DISCLAIM */
3287++/* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */
3288++/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
3289++/* SHALL NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF */
3290++/* TECHNOLOGY, HTS WORKING GROUP, NOR THE CONTRIBUTORS BE LIABLE */
3291++/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY */
3292++/* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, */
3293++/* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS */
3294++/* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR */
3295++/* PERFORMANCE OF THIS SOFTWARE. */
3296++/* */
3297++/* --------------------------------------------------------------- */
3298++/* mlpg.c : speech parameter generation from pdf sequence */
3299++/* */
3300++/* 2003/06/11 by Heiga Zen */
3301++/* --------------------------------------------------------------- */
3302++
3303++#include <cstdio>
3304++#include <cstdlib>
3305++#include <cstring>
3306++#include <cctype>
3307++#include <cmath>
3308++#include "festival.h"
3309++
3310++#include "defaults.h"
3311++#include "misc.h"
3312++#include "model.h"
3313++#include "global.h"
3314++#include "vocoder.h"
3315++#include "mlpg.h"
3316++
3317++double finv (double x)
3318++{
3319++ if (x >= INFTY2) return 0.0;
3320++ if (x <= -INFTY2) return 0.0;
3321++ if (x <= INVINF2 && x >= 0) return INFTY;
3322++ if (x >= -INVINF2 && x < 0) return -INFTY;
3323++
3324++ return 1.0/x;
3325++}
3326++
3327++double *dcalloc(int x)
3328++{
3329++ return walloc(double,x);
3330++}
3331++
3332++double **ddcalloc(int x, int y)
3333++{
3334++ register int i;
3335++ double **ptr;
3336++
3337++ ptr = walloc(double *,x);
3338++
3339++ for (i=0; i<x; i++)
3340++ ptr[i] = dcalloc(y);
3341++
3342++ return(ptr);
3343++}
3344++
3345++float *fcalloc(int x)
3346++{
3347++ return walloc(float,x);
3348++}
3349++
3350++float **ffcalloc(int x, int y)
3351++{
3352++ register int i;
3353++ float **ptr;
3354++
3355++ ptr = walloc(float *,x);
3356++
3357++ for (i=0; i<x; i++)
3358++ ptr[i] = fcalloc(y);
3359++
3360++ return(ptr);
3361++}
3362++
3363++int str2farray (char *c, float **x)
3364++{
3365++ int i, size, sp;
3366++ char *p, *buf;
3367++
3368++ while (isspace(*c))
3369++ c++;
3370++
3371++ if (*c == '\0') {
3372++ *x = NULL;
3373++ return (0);
3374++ }
3375++
3376++ size = 1;
3377++ sp = 0;
3378++
3379++ for (p = c; *p != '\0'; p++) {
3380++ if (!isspace (*p)) {
3381++ if (sp == 1) {
3382++ size++;
3383++ sp = 0;
3384++ }
3385++ }
3386++ else
3387++ sp = 1;
3388++ }
3389++
3390++ buf = walloc(char,strlen(c));
3391++
3392++ *x = walloc(float,size);
3393++
3394++ for (i=0; i<size; i++)
3395++ (*x)[i] = (float)strtod (c, &c);
3396++
3397++ return (size);
3398++}
3399++
3400++/*----------------------------------------------------------------
3401++ matrix calcuration functions
3402++----------------------------------------------------------------*/
3403++
3404++/* calc_R_and_r : calcurate R=W'U^{-1}W and r=W'U^{-1}M */
3405++void calc_R_and_r(PStream *pst, int m)
3406++{
3407++ register int i, j, k, l, n;
3408++ double wu;
3409++
3410++ for (i=0; i<pst->T; i++) {
3411++ pst->sm.r[i] = pst->sm.ivseq[i][m] * pst->sm.mseq[i][m];
3412++ pst->sm.R[i][0] = pst->sm.ivseq[i][m];
3413++
3414++ for (j=1; j<pst->width; j++)
3415++ pst->sm.R[i][j]=0.0;
3416++
3417++ for (j=1; j<pst->dw.num; j++)
3418++ for (k=pst->dw.width[j][0]; k<=pst->dw.width[j][1]; k++) {
3419++ n = i+k;
3420++ if ( (n>=0) && (n<pst->T) && (pst->dw.coef[j][-k]!=0.0) ) {
3421++ l = j*(pst->order+1)+m;
3422++ wu = pst->dw.coef[j][-k] * pst->sm.ivseq[n][l];
3423++ pst->sm.r[i] += wu*pst->sm.mseq[n][l];
3424++
3425++ for (l=0; l<pst->width; l++) {
3426++ n = l-k;
3427++ if ( (n<=pst->dw.width[j][1]) && (i+l<pst->T) && (pst->dw.coef[j][n] != 0.0) )
3428++ pst->sm.R[i][l] += wu * pst->dw.coef[j][n];
3429++ }
3430++ }
3431++ }
3432++ }
3433++}
3434++
3435++/* Cholesky : Cholesky factorization of Matrix R */
3436++void Cholesky(PStream *pst)
3437++{
3438++ register int i, j, k;
3439++
3440++ pst->sm.R[0][0] = sqrt(pst->sm.R[0][0]);
3441++
3442++ for (i=1; i<pst->width; i++)
3443++ pst->sm.R[0][i] /= pst->sm.R[0][0];
3444++
3445++ for (i=1; i<pst->T; i++) {
3446++ for (j=1; j<pst->width; j++)
3447++ if (i-j >= 0)
3448++ pst->sm.R[i][0] -= pst->sm.R[i-j][j] * pst->sm.R[i-j][j];
3449++
3450++ pst->sm.R[i][0] = sqrt(pst->sm.R[i][0]);
3451++
3452++ for (j=1; j<pst->width; j++) {
3453++ for (k=0; k<pst->dw.max_L; k++)
3454++ if (j!=pst->width-1)
3455++ pst->sm.R[i][j] -= pst->sm.R[i-k-1][j-k]*pst->sm.R[i-k-1][j+1];
3456++
3457++ pst->sm.R[i][j] /= pst->sm.R[i][0];
3458++ }
3459++ }
3460++}
3461++
3462++/* Cholesky_forward : forward substitution to solve linear equations */
3463++void Cholesky_forward(PStream *pst)
3464++{
3465++ register int i, j;
3466++ double hold;
3467++
3468++ pst->sm.g[0] = pst->sm.r[0] / pst->sm.R[0][0];
3469++
3470++ for (i=1; i<pst->T; i++) {
3471++ hold = 0.0;
3472++ for (j=1; j<pst->width; j++) {
3473++ if (i-j >= 0)
3474++ hold += pst->sm.R[i-j][j]*pst->sm.g[i-j];
3475++ }
3476++ pst->sm.g[i] = (pst->sm.r[i]-hold)/pst->sm.R[i][0];
3477++ }
3478++}
3479++
3480++/* Cholesky_backward : backward substitution to solve linear equations */
3481++void Cholesky_backward(PStream *pst, int m)
3482++{
3483++ register int i, j;
3484++ double hold;
3485++
3486++ pst->par[pst->T-1][m] = pst->sm.g[pst->T-1] / pst->sm.R[pst->T-1][0];
3487++
3488++ for (i=pst->T-2; i>=0; i--) {
3489++ hold = 0.0;
3490++ for (j=1; j<pst->width; j++) {
3491++ if (pst->sm.R[i][j] != 0.0)
3492++ hold += pst->sm.R[i][j]*pst->par[i+j][m];
3493++ }
3494++ pst->par[i][m] = (float)((pst->sm.g[i] - hold) / pst->sm.R[i][0]);
3495++ }
3496++}
3497++
3498++/* generate parameter sequence from pdf sequence */
3499++void mlpg(PStream *pst)
3500++{
3501++ int m;
3502++
3503++ for (m=0; m<=pst->order; m++) {
3504++ calc_R_and_r(pst,m);
3505++ Cholesky(pst);
3506++ Cholesky_forward(pst);
3507++ Cholesky_backward(pst,m);
3508++ }
3509++}
3510++
3511++
3512++/* InitPStream : Initialise PStream for parameter generation */
3513++void InitPStream(PStream *pst)
3514++{
3515++ pst->width = pst->dw.max_L*2+1; /* band width of R */
3516++
3517++ pst->sm.mseq = ddcalloc(pst->T, pst->vSize);
3518++ pst->sm.ivseq = ddcalloc(pst->T, pst->vSize);
3519++ pst->sm.g = dcalloc (pst->T);
3520++ pst->sm.R = ddcalloc(pst->T, pst->width);
3521++ pst->sm.r = dcalloc (pst->T);
3522++ pst->par = ffcalloc(pst->T,pst->order+1);
3523++}
3524++
3525++/* FreePStream : Free PStream */
3526++void FreePStream(PStream *pst)
3527++{
3528++ register int t;
3529++
3530++ for (t=0; t<pst->T; t++) {
3531++ wfree(pst->sm.mseq[t]);
3532++ wfree(pst->sm.ivseq[t]);
3533++ wfree(pst->sm.R[t]);
3534++ wfree(pst->par[t]);
3535++ }
3536++
3537++ for (t=0; t<pst->dw.num; t++)
3538++ wfree(pst->dw.width[t]);
3539++ wfree(pst->dw.width);
3540++ wfree(pst->dw.coefr[0]);
3541++ for (t=1; t<pst->dw.num; t++)
3542++ wfree(pst->dw.coefr[t]);
3543++ wfree(pst->dw.coefr);
3544++ wfree(pst->dw.coef);
3545++
3546++ wfree(pst->sm.mseq);
3547++ wfree(pst->sm.ivseq);
3548++ wfree(pst->sm.R);
3549++ wfree(pst->sm.g);
3550++ wfree(pst->sm.r);
3551++ wfree(pst->par);
3552++}
3553++
3554++/* pdf2speech : parameter generation from pdf sequence */
3555++void pdf2speech( FILE *rawfp, FILE *lf0fp, FILE *mcepfp,
3556++ PStream *mceppst, PStream *lf0pst, globalP *gp, ModelSet *ms, UttModel *um, VocoderSetup *vs)
3557++{
3558++ int frame, mcepframe, lf0frame;
3559++ int state, lw, rw, k, n;
3560++ Model *m;
3561++ HTS_Boolean nobound, *voiced;
3562++
3563++ float f0;
3564++
3565++ lf0pst->vSize = ms->lf0stream;
3566++ lf0pst->order = 0;
3567++ mceppst->vSize = ms->mcepvsize;
3568++ mceppst->order = mceppst->vSize / mceppst->dw.num - 1;
3569++
3570++ InitDWin(lf0pst);
3571++ InitDWin(mceppst);
3572++
3573++ mcepframe = 0;
3574++ lf0frame = 0;
3575++
3576++ voiced = walloc(HTS_Boolean,um->totalframe+1);
3577++
3578++ for (m=um->mhead; m!=um->mtail ; m=m->next) {
3579++ for (state=2; state<=ms->nstate+1; state++) {
3580++ for (frame=1; frame<=m->dur[state]; frame++) {
3581++ voiced[mcepframe++] = m->voiced[state];
3582++ if (m->voiced[state]) {
3583++ lf0frame++;
3584++ }
3585++ }
3586++ }
3587++ }
3588++
3589++ mceppst->T = mcepframe;
3590++ lf0pst->T = lf0frame;
3591++
3592++ InitPStream(mceppst);
3593++ InitPStream(lf0pst);
3594++
3595++ mcepframe = 0;
3596++ lf0frame = 0;
3597++
3598++ for (m=um->mhead; m!=um->mtail; m=m->next) {
3599++ for (state=2; state<=ms->nstate+1; state++) {
3600++ for (frame=1; frame<=m->dur[state]; frame++) {
3601++ for (k=0; k<ms->mcepvsize; k++) {
3602++ mceppst->sm.mseq[mcepframe][k] = m->mcepmean[state][k];
3603++ mceppst->sm.ivseq[mcepframe][k] = finv(m->mcepvariance[state][k]);
3604++ }
3605++ for (k=0; k<ms->lf0stream; k++) {
3606++ lw = lf0pst->dw.width[k][WLEFT];
3607++ rw = lf0pst->dw.width[k][WRIGHT];
3608++ nobound = (HTS_Boolean)1;
3609++
3610++ for (n=lw; n<=rw;n++)
3611++ if (mcepframe+n<0 || um->totalframe<mcepframe+n)
3612++ nobound = (HTS_Boolean)0;
3613++ else
3614++ nobound = (HTS_Boolean)((int)nobound & voiced[mcepframe+n]);
3615++
3616++ if (voiced[mcepframe]) {
3617++ lf0pst->sm.mseq[lf0frame][k] = m->lf0mean[state][k+1];
3618++ if (nobound || k==0)
3619++ lf0pst->sm.ivseq[lf0frame][k] = finv(m->lf0variance[state][k+1]);
3620++ else
3621++ lf0pst->sm.ivseq[lf0frame][k] = 0.0;
3622++ }
3623++ }
3624++ if (voiced[mcepframe])
3625++ lf0frame++;
3626++ mcepframe++;
3627++ }
3628++ }
3629++ }
3630++
3631++ mlpg(mceppst);
3632++
3633++ if (lf0frame>0)
3634++ mlpg(lf0pst);
3635++
3636++ lf0frame = 0;
3637++
3638++ if (gp->XIMERA && lf0fp!=NULL)
3639++ fprintf(lf0fp, "# FrameShift=%dms\n", (FPERIOD*1000)/RATE);
3640++
3641++ for (mcepframe=0; mcepframe<mceppst->T; mcepframe++) {
3642++ if (voiced[mcepframe])
3643++ f0 = gp->F0_STD * exp(lf0pst->par[lf0frame++][0]) + gp->F0_MEAN;
3644++ else
3645++ f0 = 0.0;
3646++
3647++ if (mcepfp != NULL)
3648++ fwrite(mceppst->par[mcepframe], sizeof(float), mceppst->order+1, mcepfp);
3649++ if (lf0fp != NULL) {
3650++ if (gp->XIMERA)
3651++ fprintf(lf0fp, "%.1f 1\n", f0);
3652++ else
3653++ fwrite(&f0, sizeof(double), 1, lf0fp);
3654++ }
3655++
3656++ if (rawfp!=NULL)
3657++ vocoder(f0, mceppst->par[mcepframe], mceppst->order, rawfp, gp, vs);
3658++ }
3659++
3660++ FreePStream(mceppst);
3661++ FreePStream(lf0pst);
3662++ wfree(voiced);
3663++}
3664++
3665++/* InitDWin : Initialise dynamic window */
3666++void InitDWin(PStream *pst)
3667++{
3668++ int i;
3669++ int fsize, leng, fpos;
3670++ FILE *fp;
3671++
3672++ /* memory allocation */
3673++ pst->dw.width = walloc(int *,pst->dw.num);
3674++
3675++ for (i=0; i<pst->dw.num; i++) {
3676++ pst->dw.width[i] = walloc(int,2);
3677++ }
3678++
3679++ pst->dw.coef= walloc(float *,pst->dw.num);
3680++ /* because the pointers are moved, keep an original of the memory
3681++ being allocated */
3682++ pst->dw.coefr= walloc(float *,pst->dw.num);
3683++
3684++ /* window for static parameter */
3685++ pst->dw.width[0][WLEFT] = pst->dw.width[0][WRIGHT] = 0;
3686++ pst->dw.coef[0] = fcalloc (1);
3687++ pst->dw.coefr[0] = pst->dw.coef[0];
3688++ pst->dw.coef[0][0] = 1;
3689++
3690++ /* set delta coefficients */
3691++ for (i=1; i<pst->dw.num; i++) {
3692++ if (pst->dw.fn[i][0] == ' ')
3693++ fsize = str2farray(pst->dw.fn[i], &(pst->dw.coef[i]));
3694++ else { /* read from file */
3695++ if ((fp = fopen (pst->dw.fn[i], "r")) == NULL) {
3696++ fprintf(stderr, "file %s not found\n", pst->dw.fn[i]);
3697++ festival_error();
3698++ }
3699++
3700++ /* check the number of coefficients */
3701++ fseek(fp, 0L, 2);
3702++ fpos = (int)ftell(fp);
3703++ fsize = fpos/sizeof (float);
3704++ fseek(fp, 0L, 0);
3705++
3706++ /* read coefficients */
3707++ pst->dw.coef[i] = fcalloc (fsize);
3708++ pst->dw.coefr[i] = pst->dw.coef[i];
3709++ fread(pst->dw.coef[i], sizeof(float), fsize, fp);
3710++ if (EST_BIG_ENDIAN)
3711++ swap_bytes_float(pst->dw.coef[i],fsize);
3712++
3713++ fclose(fp);
3714++ }
3715++
3716++ /* set pointer */
3717++ leng = fsize / 2;
3718++ pst->dw.coef[i] += leng;
3719++ pst->dw.width[i][WLEFT] = -leng;
3720++ pst->dw.width[i][WRIGHT] = leng;
3721++
3722++ if (fsize % 2 == 0)
3723++ pst->dw.width[i][WRIGHT]--;
3724++ }
3725++
3726++ pst->dw.maxw[WLEFT] = pst->dw.maxw[WRIGHT] = 0;
3727++
3728++ for (i=0; i<pst->dw.num; i++) {
3729++ if (pst->dw.maxw[WLEFT] > pst->dw.width[i][WLEFT])
3730++ pst->dw.maxw[WLEFT] = pst->dw.width[i][WLEFT];
3731++ if (pst->dw.maxw[WRIGHT] < pst->dw.width[i][WRIGHT])
3732++ pst->dw.maxw[WRIGHT] = pst->dw.width[i][WRIGHT];
3733++ }
3734++
3735++ /* calcurate max_L to determine size of band matrix */
3736++ if ( pst->dw.maxw[WLEFT] >= pst->dw.maxw[WRIGHT] )
3737++ pst->dw.max_L = pst->dw.maxw[WLEFT];
3738++ else
3739++ pst->dw.max_L = pst->dw.maxw[WRIGHT];
3740++
3741++}
3742++
3743++/* -------------------- End of "mlpg.c" -------------------- */
3744+--- /dev/null
3745++++ festival-2.1~release/src/modules/hts21_engine/tree.cc
3746+@@ -0,0 +1,325 @@
3747++/* --------------------------------------------------------------- */
3748++/* The HMM-Based Speech Synthesis System (HTS): version 1.1b */
3749++/* HTS Working Group */
3750++/* */
3751++/* Department of Computer Science */
3752++/* Nagoya Institute of Technology */
3753++/* and */
3754++/* Interdisciplinary Graduate School of Science and Engineering */
3755++/* Tokyo Institute of Technology */
3756++/* Copyright (c) 2001-2003 */
3757++/* All Rights Reserved. */
3758++/* */
3759++/* Permission is hereby granted, free of charge, to use and */
3760++/* distribute this software and its documentation without */
3761++/* restriction, including without limitation the rights to use, */
3762++/* copy, modify, merge, publish, distribute, sublicense, and/or */
3763++/* sell copies of this work, and to permit persons to whom this */
3764++/* work is furnished to do so, subject to the following conditions: */
3765++/* */
3766++/* 1. The code must retain the above copyright notice, this list */
3767++/* of conditions and the following disclaimer. */
3768++/* */
3769++/* 2. Any modifications must be clearly marked as such. */
3770++/* */
3771++/* NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF TECHNOLOGY, */
3772++/* HTS WORKING GROUP, AND THE CONTRIBUTORS TO THIS WORK DISCLAIM */
3773++/* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */
3774++/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
3775++/* SHALL NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF */
3776++/* TECHNOLOGY, HTS WORKING GROUP, NOR THE CONTRIBUTORS BE LIABLE */
3777++/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY */
3778++/* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, */
3779++/* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS */
3780++/* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR */
3781++/* PERFORMANCE OF THIS SOFTWARE. */
3782++/* */
3783++/* --------------------------------------------------------------- */
3784++/* tree.c : decision trees handling functions */
3785++/* */
3786++/* 2003/06/11 by Heiga Zen */
3787++/* --------------------------------------------------------------- */
3788++
3789++#include <cstdio>
3790++#include <cstring>
3791++#include <cstdlib>
3792++#include <cctype>
3793++#include "festival.h"
3794++
3795++#include "misc.h"
3796++#include "tree.h"
3797++
3798++HTS_Boolean DPMatch (char *str, char *pat, int pos, int max)
3799++{
3800++ if (pos > max) return 0;
3801++ if (*str == '\0' && *pat == '\0') return 1;
3802++
3803++ if (*pat == '*') {
3804++ if ( DPMatch(str+1, pat, pos+1, max)==1 )
3805++ return 1;
3806++ else
3807++ return DPMatch(str+1, pat+1, pos+1, max);
3808++ }
3809++ if (*str == *pat || *pat == '?') {
3810++ if ( DPMatch(str+1, pat+1, pos+1, max+1)==1 )
3811++ return 1;
3812++
3813++ else
3814++ if (*(pat + 1) == '*')
3815++ return DPMatch(str+1, pat+2, pos+1, max+1);
3816++ }
3817++
3818++ return 0;
3819++}
3820++
3821++HTS_Boolean PMatch (char *str, char *pat)
3822++{
3823++ int i, max = 0;
3824++ for(i=0; i < (int)strlen(pat); i++)
3825++ if (pat[i] != '*') max++;
3826++
3827++ return DPMatch(str, pat, 0, strlen(str)-max);
3828++}
3829++
3830++HTS_Boolean QMatch (char *str, Question *q)
3831++{
3832++ HTS_Boolean flag = 0;
3833++ Pattern *p;
3834++
3835++ for (p=q->phead; p!=q->ptail; p=p->next) {
3836++ flag = PMatch(str, p->pat);
3837++ if (flag)
3838++ return 1;
3839++ }
3840++
3841++ return 0;
3842++}
3843++
3844++int SearchTree (char *str, Node *node)
3845++{
3846++ HTS_Boolean answer = QMatch(str, node->quest);
3847++
3848++ if (answer) {
3849++ if (node->yes->pdf>0)
3850++ return node->yes->pdf;
3851++ else
3852++ return SearchTree(str, node->yes);
3853++ }
3854++ else {
3855++ if (node->no->pdf>0)
3856++ return node->no->pdf;
3857++ else
3858++ return SearchTree (str, node->no);
3859++ }
3860++
3861++ return -1;
3862++}
3863++
3864++void LoadQuestions(FILE *fp, Question *q, Mtype type)
3865++{
3866++ char buf[1024];
3867++
3868++ GetToken(fp, buf);
3869++ q->qName = wstrdup(buf);
3870++ q->phead = q->ptail = walloc(Pattern,1);
3871++
3872++ GetToken(fp,buf);
3873++ if (strcmp(buf, "{")==0) {
3874++ while (strcmp(buf,"}")!=0) {
3875++ GetToken (fp, buf);
3876++ q->ptail->pat = wstrdup(buf);
3877++ q->ptail->next = walloc(Pattern,1);
3878++ q->ptail = q->ptail->next;
3879++ GetToken (fp, buf);
3880++ }
3881++ }
3882++}
3883++
3884++HTS_Boolean IsTree (Tree *tree, char *buf)
3885++{
3886++ char *s,*l,*r;
3887++
3888++ s = buf;
3889++ if ( ((l = strchr(s, '[')) == NULL) || ((r = strrchr(s, ']'))==NULL) ) {
3890++ return 0;
3891++ }
3892++ else {
3893++ *r = '\0';
3894++ s = l+1;
3895++ tree->state = atoi(s);
3896++ }
3897++
3898++ return 1;
3899++}
3900++
3901++HTS_Boolean IsNum (char *buf)
3902++{
3903++ int i;
3904++
3905++ for (i=0; i<(int)strlen(buf); i++)
3906++ if (! (isdigit(buf[i]) || (buf[i] == '-')))
3907++ return 0;
3908++
3909++ return 1;
3910++}
3911++
3912++Question *FindQuestion(TreeSet *ts, Mtype type, char *buf)
3913++{
3914++ Question *q;
3915++
3916++ for (q=ts->qhead[type];q!=ts->qtail[type];q=q->next)
3917++ if (strcmp(buf, q->qName)==0)
3918++ return q;
3919++
3920++ printf(" Error ! Cannot find question %s ! \n",buf);
3921++ festival_error();
3922++
3923++ return 0;
3924++}
3925++
3926++int name2num(char *buf)
3927++{
3928++ return (atoi(strrchr(buf,'_')+1));
3929++}
3930++
3931++Node *FindNode (Node *node, int num)
3932++{
3933++ Node *dest;
3934++
3935++ if (node->idx==num) return node;
3936++ else {
3937++ if (node->yes != NULL) {
3938++ dest = FindNode(node->yes, num);
3939++ if (dest) return dest;
3940++ }
3941++ if (node->no != NULL) {
3942++ dest = FindNode(node->no, num);
3943++ if (dest) return dest;
3944++ }
3945++ }
3946++ return NULL;
3947++}
3948++
3949++void LoadTree (TreeSet *ts, FILE *fp, Tree *tree, Mtype type)
3950++{
3951++ char buf[1024];
3952++ Node *node;
3953++
3954++ GetToken(fp, buf);
3955++ node = walloc(Node,1);
3956++ tree->root = node;
3957++
3958++ if ( strcmp(buf,"{") == 0 ) {
3959++ while ( GetToken(fp,buf),strcmp(buf,"}")!= 0 ) {
3960++ node = FindNode(tree->root, atoi(buf));
3961++ GetToken (fp, buf); /* load a question applied at this node */
3962++
3963++ node->quest = FindQuestion(ts, type, buf);
3964++ node->yes = walloc(Node,1);
3965++ node->no = walloc(Node,1);
3966++
3967++ GetToken (fp, buf);
3968++ if (IsNum(buf)) {
3969++ node->no->idx = atoi(buf);
3970++ }
3971++ else {
3972++ node->no->pdf = name2num(buf);
3973++ }
3974++
3975++ GetToken(fp, buf);
3976++ if (IsNum(buf)) {
3977++ node->yes->idx = atoi(buf);
3978++ }
3979++ else {
3980++ node->yes->pdf = name2num(buf);
3981++ }
3982++ }
3983++ }
3984++ else {
3985++ node->pdf = name2num(buf);
3986++ }
3987++}
3988++
3989++void LoadTreesFile(TreeSet *ts, Mtype type)
3990++{
3991++ char buf[1024];
3992++ Question *q;
3993++ Tree *t;
3994++ FILE *fp = ts->fp[type];
3995++
3996++ q = walloc(Question,1);
3997++ ts->qhead[type] = q; ts->qtail[type] = NULL;
3998++
3999++ t = walloc(Tree,1);
4000++ ts->thead[type] = t; ts->ttail[type] = NULL;
4001++
4002++ while (!feof(fp)) {
4003++ GetToken(fp, buf);
4004++ if (strcmp(buf, "QS") == 0) {
4005++ LoadQuestions(fp, q, type);
4006++ q->next = walloc(Question,1);
4007++ q = ts->qtail[type] = q->next;
4008++ q->next = NULL;
4009++ }
4010++ if (IsTree(t, buf)) {
4011++ LoadTree(ts, fp, t, type);
4012++ t->next = walloc(Tree,1);
4013++ t = ts->ttail[type] = t->next;
4014++ t->next = NULL;
4015++ }
4016++ }
4017++}
4018++
4019++void InitTreeSet(TreeSet *ts)
4020++{
4021++ ts->fp[DUR] = NULL;
4022++ ts->fp[LF0] = NULL;
4023++ ts->fp[MCP] = NULL;
4024++
4025++ return;
4026++}
4027++
4028++static void delete_tree_nodes(Node *node)
4029++{
4030++ if (!node)
4031++ return;
4032++ if (node->yes)
4033++ delete_tree_nodes(node->yes);
4034++ if (node->no)
4035++ delete_tree_nodes(node->no);
4036++ wfree(node);
4037++}
4038++
4039++void FreeTrees(TreeSet *ts, Mtype type)
4040++{
4041++ Question *nq, *qq;
4042++ Pattern *pp, *np;
4043++ Tree *tt, *nt;
4044++
4045++ for (qq = ts->qhead[type]; qq; qq = nq)
4046++ {
4047++ nq = qq->next;
4048++
4049++ wfree(qq->qName);
4050++ for (pp = qq->phead; pp; pp = np)
4051++ {
4052++ np = pp->next;
4053++ wfree(pp->pat);
4054++ wfree(pp);
4055++ }
4056++ wfree(qq);
4057++ }
4058++
4059++ for (tt = ts->thead[type]; tt; tt = nt)
4060++ {
4061++ nt = tt->next;
4062++
4063++ delete_tree_nodes(tt->root);
4064++
4065++ wfree(tt);
4066++ }
4067++
4068++
4069++}
4070++
4071++/* -------------------- End of "tree.c" -------------------- */
4072+--- /dev/null
4073++++ festival-2.1~release/lib/hts21compat.scm
4074+@@ -0,0 +1,75 @@
4075++;; ---------------------------------------------------------------- ;;
4076++;; Nagoya Institute of Technology and ;;
4077++;; Carnegie Mellon University ;;
4078++;; Copyright (c) 2002 ;;
4079++;; All Rights Reserved. ;;
4080++;; ;;
4081++;; Permission is hereby granted, free of charge, to use and ;;
4082++;; distribute this software and its documentation without ;;
4083++;; restriction, including without limitation the rights to use, ;;
4084++;; copy, modify, merge, publish, distribute, sublicense, and/or ;;
4085++;; sell copies of this work, and to permit persons to whom this ;;
4086++;; work is furnished to do so, subject to the following conditions: ;;
4087++;; ;;
4088++;; 1. The code must retain the above copyright notice, this list ;;
4089++;; of conditions and the following disclaimer. ;;
4090++;; ;;
4091++;; 2. Any modifications must be clearly marked as such. ;;
4092++;; ;;
4093++;; 3. Original authors' names are not deleted. ;;
4094++;; ;;
4095++;; 4. The authors' names are not used to endorse or promote ;;
4096++;; products derived from this software without specific prior ;;
4097++;; written permission. ;;
4098++;; ;;
4099++;; NAGOYA INSTITUTE OF TECHNOLOGY, CARNEGIE MELLON UNIVERSITY AND ;;
4100++;; THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH ;;
4101++;; REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF ;;
4102++;; MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NAGOYA INSTITUTE ;;
4103++;; OF TECHNOLOGY, CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS ;;
4104++;; BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ;;
4105++;; ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR ;;
4106++;; PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER ;;
4107++;; TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR ;;
4108++;; PERFORMANCE OF THIS SOFTWARE. ;;
4109++;; ;;
4110++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4111++;; HTS 2.1 support code ;;
4112++;; Copyright is assigned by author to above ;;
4113++;; on condition it is licensed as above ;;
4114++;; Author : Peter M Drysdale <drysdalepete@gmail.com> ;;
4115++;; Date : November 2011 ;;
4116++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4117++
4118++(require 'hts)
4119++(require_module 'hts21_engine)
4120++
4121++(defSynthType HTS21
4122++ (let ((featfile (make_tmp_filename))
4123++ (mcepfile (make_tmp_filename))
4124++ (f0file (make_tmp_filename))
4125++ (wavfile (make_tmp_filename)))
4126++
4127++ (apply_hooks hts_synth_pre_hooks utt)
4128++
4129++ (set! hts_output_params
4130++ (list
4131++ (list "-labelfile" featfile)
4132++ (list "-om" mcepfile)
4133++ (list "-of" f0file)
4134++ (list "-or" wavfile)))
4135++
4136++ (hts_dump_feats utt hts_feats_list featfile)
4137++
4138++ (HTS21_Synthesize utt)
4139++
4140++ (delete-file featfile)
4141++ (delete-file mcepfile)
4142++ (delete-file f0file)
4143++ (delete-file wavfile)
4144++
4145++ (apply_hooks hts_synth_post_hooks utt)
4146++ utt)
4147++)
4148++
4149++(provide 'hts21compat)
4150
4151=== added file 'debian/patches/languagespatch.diff'
4152--- debian/patches/languagespatch.diff 1970-01-01 00:00:00 +0000
4153+++ debian/patches/languagespatch.diff 2012-12-07 04:47:19 +0000
4154@@ -0,0 +1,743 @@
4155+Provide a general method for adding additional languages in festival
4156+This general method in this patch was written by Sergio Oller and
4157+merged with earlier patches of lib_languages.scm and russianpatch.diff.
4158+The russianpatch.diff was written by Sergey B Kirpichev.
4159+The merging was performed by Peter Drysdale.
4160+
4161+--- festival-2.1~release.orig/src/main/festival_main.cc
4162++++ festival-2.1~release/src/main/festival_main.cc
4163+@@ -105,7 +105,7 @@ static void festival_main(int argc, char
4164+ " are printed (default if stdin not a tty)\n"+
4165+ "--language <string>\n"+
4166+ " Run in named language, default is\n"+
4167+- " english, spanish and welsh are available\n"+
4168++ " english, spanish, russian, welsh and others are available\n"+
4169+ "--server Run in server mode waiting for clients\n"+
4170+ " of server_port (1314)\n"+
4171+ "--script <ifile>\n"+
4172+--- festival-2.1~release.orig/lib/languages.scm
4173++++ festival-2.1~release/lib/languages.scm
4174+@@ -2,7 +2,7 @@
4175+ ;;; ;;
4176+ ;;; Centre for Speech Technology Research ;;
4177+ ;;; University of Edinburgh, UK ;;
4178+-;;; Copyright (c) 1996,1997 ;;
4179++;;; Copyright (c) 1996,2010 ;;
4180+ ;;; All Rights Reserved. ;;
4181+ ;;; ;;
4182+ ;;; Permission is hereby granted, free of charge, to use and distribute ;;
4183+@@ -31,90 +31,145 @@
4184+ ;;; ;;
4185+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4186+ ;;;
4187+-;;; Specification of voices and some major choices of synthesis
4188++;;; Author: Sergio Oller
4189++;;; Date: January 2010
4190+ ;;;
4191+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4192+ ;;;
4193+-;;; This should use some sort of database description for voices so
4194+-;;; new voices will become automatically available.
4195++;;; Language definitions, now it works similar to voice definitions.
4196+ ;;;
4197+
4198+-(define (language_british_english)
4199+-"(language_british_english)
4200+-Set up language parameters for British English."
4201+- (require 'voices)
4202+- ;; Will get more elaborate, with different choices of voices in language
4203+-
4204+- (set! male1 voice_rab_diphone)
4205+- (set! male2 voice_don_diphone)
4206+- (if (symbol-bound? 'voice_gsw_diphone)
4207+- (set! male3 voice_gsw_diphone))
4208+- (if (symbol-bound? 'voice_gsw_450)
4209+- (set! male4 voice_gsw_450))
4210+
4211+- (male1)
4212+- (Parameter.set 'Language 'britishenglish)
4213+-)
4214+-
4215+-(define (language_american_english)
4216+-"(language_american_english)
4217+-Set up language parameters for Aemerican English."
4218+-
4219+- (if (symbol-bound? 'voice_kal_diphone)
4220+- (set! female1 voice_kal_diphone))
4221+- (set! male1 voice_ked_diphone)
4222++(defvar system-language-path '("/usr/share/festival/languages/"))
4223+
4224+- (male1)
4225+- (Parameter.set 'Language 'americanenglish)
4226++(defvar language-path
4227++ (remove-duplicates
4228++ (append (mapcar (lambda (d) (path-append d "languages/")) load-path)
4229++ (mapcar (lambda (d) (path-as-directory d)) system-language-path)
4230++ ))
4231++
4232++ "language-path
4233++ List of places to look for languages. If not set it is initialised from
4234++ load-path by appending \"languages/\" to each directory with
4235++ system-language-path appended.")
4236++
4237++(defvar language-locations ()
4238++ "language-locations
4239++ Association list recording where languages were found.")
4240++
4241++(defvar language-location-trace nil
4242++ "language-location-trace
4243++ Set t to print language locations as they are found")
4244++
4245++(defvar Language_aliases nil
4246++ "Internal variable containing an association of language name
4247++ aliases such as english-> british_english.")
4248++
4249++(define (language.names.add language aliases)
4250++"(language.names.add LANGUAGE ALIASES)
4251++Describe a language to the systen. LANGUAGE should be atomic name, that
4252++conventionally will have language_ prepended to name the basic selection
4253++function. ALIASES is a list of names for that language."
4254++ (let (alias nil)
4255++
4256++ (while aliases
4257++ (set! alias (car aliases))
4258++ (cond ( (not (assoc alias Language_aliases) nil)
4259++ (set! Language_aliases (cons (cons alias language) Language_aliases))
4260++ )
4261++ (t
4262++ (set-cdr! (assoc alias Language_aliases) language)
4263++ )
4264++ )
4265++ (set! aliases (cdr aliases))
4266++ )
4267++ )
4268+ )
4269+
4270+-(define (language_scots_gaelic)
4271+-"(language_scots_gaelic)
4272+-Set up language parameters for Scots Gaelic."
4273+- (error "Scots Gaelic not yet supported.")
4274+-
4275+- (Parameter.set 'Language 'scotsgaelic)
4276++(define (language-location name dir doc)
4277++ "(language-location NAME DIR DOCSTRING)
4278++ Record the location of a language. Called for each language found on language-path.
4279++ Can be called in site-init or .festivalrc for additional languages which
4280++ exist elsewhere."
4281++ (let ((func_name (intern name))
4282++ )
4283++
4284++ (set! name (intern name))
4285++ (set! language-locations (cons (cons name dir) language-locations))
4286++ (eval (list 'autoload func_name dir doc))
4287++ (if language-location-trace
4288++ (format t "Language: %s %s.scm\n" name dir)
4289++ )
4290++ )
4291++ )
4292++
4293++
4294++(define (language.list)
4295++"(language.list)
4296++List of all (potential) languages in the system. This checks the language-location
4297++list of potential languages found be scanning the language-path at start up time."
4298++ (mapcar car Language_aliases))
4299++
4300++(define (language.select name)
4301++"(language.select LANG)
4302++Call function to set up language LANG. This is normally done by
4303++prepending language_ to LANG and call it as a function."
4304++ (set! lang (cdr(assoc name Language_aliases)))
4305++ (if (string-equal lang nil)
4306++ (set! lang name)
4307++ )
4308++ (cond
4309++ ((boundp (intern(string-append "language_" lang))) ;;if function "language_lang" exists, evaluate it
4310++ (eval (list (intern (string-append "language_" lang))))
4311++ )
4312++ ((string-matches lang "klingon")
4313++ (print "Klingon is not supported yet, using English:")
4314++ (language.select 'english)
4315++ )
4316++ (t ;;else, print a message with available languages
4317++ (print "Language not installed. The installed languages are:")
4318++ (language.list)
4319++ )
4320++ )
4321++nil
4322+ )
4323+
4324+-(define (language_welsh)
4325+-"(language_welsh)
4326+-Set up language parameters for Welsh."
4327+
4328+- (set! male1 voice_welsh_hl)
4329+-
4330+- (male1)
4331+- (Parameter.set 'Language 'welsh)
4332+-)
4333++(define (search-for-languages)
4334++ "(search-for-languages)
4335++ Search down language-path to locate languages."
4336++
4337++ (let ((dirs language-path)
4338++ (dir nil)
4339++ languages language
4340++ name
4341++ )
4342++ (while dirs
4343++ (set! dir (car dirs))
4344++ (setq languages (directory-entries dir t))
4345++ (while languages
4346++ (set! language (car languages))
4347++ (if (string-matches language "language_.*scm$")
4348++ (begin
4349++ (load (path-append dir language))
4350++ (language-location (path-basename language) (path-append dir (path-basename language)) "language found")
4351++ )
4352++ )
4353++ (set! languages (cdr languages))
4354++ )
4355++ (set! dirs (cdr dirs))
4356++ )
4357++ )
4358++ )
4359+
4360+-(define (language_castillian_spanish)
4361+-"(language_spanish)
4362+-Set up language parameters for Castillian Spanish."
4363+-
4364+- (voice_el_diphone)
4365+- (set! male1 voice_el_diphone)
4366+-
4367+- (Parameter.set 'Language 'spanish)
4368++(define (select_language language)
4369++"(select_language LANG)
4370++Chooses language."
4371++ (language.select language)
4372+ )
4373+
4374+-(define (select_language language)
4375+- (cond
4376+- ((or (equal? language 'britishenglish)
4377+- (equal? language 'english)) ;; we all know its the *real* English
4378+- (language_british_english))
4379+- ((equal? language 'americanenglish)
4380+- (language_american_english))
4381+- ((equal? language 'scotsgaelic)
4382+- (language_scots_gaelic))
4383+- ((equal? language 'welsh)
4384+- (language_welsh))
4385+- ((equal? language 'spanish)
4386+- (language_castillian_spanish))
4387+- ((equal? language 'klingon)
4388+- (language_klingon))
4389+- (t
4390+- (print "Unsupported language, using English")
4391+- (language_british_english))))
4392++(search-for-languages)
4393+
4394+-(defvar language_default language_british_english)
4395++(defvar language_default 'english)
4396+
4397+ (provide 'languages)
4398+--- /dev/null
4399++++ festival-2.1~release/lib/languages/language_czech.scm
4400+@@ -0,0 +1,50 @@
4401++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4402++;;; ;;
4403++;;; Centre for Speech Technology Research ;;
4404++;;; University of Edinburgh, UK ;;
4405++;;; Copyright (c) 2002 ;;
4406++;;; All Rights Reserved. ;;
4407++;;; ;;
4408++;;; Permission is hereby granted, free of charge, to use and distribute ;;
4409++;;; this software and its documentation without restriction, including ;;
4410++;;; without limitation the rights to use, copy, modify, merge, publish, ;;
4411++;;; distribute, sublicense, and/or sell copies of this work, and to ;;
4412++;;; permit persons to whom this work is furnished to do so, subject to ;;
4413++;;; the following conditions: ;;
4414++;;; 1. The code must retain the above copyright notice, this list of ;;
4415++;;; conditions and the following disclaimer. ;;
4416++;;; 2. Any modifications must be clearly marked as such. ;;
4417++;;; 3. Original authors' names are not deleted. ;;
4418++;;; 4. The authors' names are not used to endorse or promote products ;;
4419++;;; derived from this software without specific prior written ;;
4420++;;; permission. ;;
4421++;;; ;;
4422++;;; THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ;;
4423++;;; DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ;;
4424++;;; ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ;;
4425++;;; SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ;;
4426++;;; FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ;;
4427++;;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ;;
4428++;;; AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ;;
4429++;;; ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ;;
4430++;;; THIS SOFTWARE. ;;
4431++;;; ;;
4432++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4433++;;; Author:
4434++;;; Date:
4435++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4436++;;
4437++;; Czech language description
4438++;;
4439++;;
4440++
4441++(define (language_czech)
4442++"(language_czech)
4443++Set up language parameters for Czech."
4444++ (set! male1 (lambda () (voice_czech_ph)))
4445++ (male1)
4446++ (Parameter.set 'Language 'czech)
4447++nil
4448++)
4449++
4450++(language.names.add 'czech (list 'czech ))
4451+--- /dev/null
4452++++ festival-2.1~release/lib/languages/language_russian.scm
4453+@@ -0,0 +1,49 @@
4454++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4455++;;; ;;
4456++;;; Centre for Speech Technology Research ;;
4457++;;; University of Edinburgh, UK ;;
4458++;;; Copyright (c) 2002 ;;
4459++;;; All Rights Reserved. ;;
4460++;;; ;;
4461++;;; Permission is hereby granted, free of charge, to use and distribute ;;
4462++;;; this software and its documentation without restriction, including ;;
4463++;;; without limitation the rights to use, copy, modify, merge, publish, ;;
4464++;;; distribute, sublicense, and/or sell copies of this work, and to ;;
4465++;;; permit persons to whom this work is furnished to do so, subject to ;;
4466++;;; the following conditions: ;;
4467++;;; 1. The code must retain the above copyright notice, this list of ;;
4468++;;; conditions and the following disclaimer. ;;
4469++;;; 2. Any modifications must be clearly marked as such. ;;
4470++;;; 3. Original authors' names are not deleted. ;;
4471++;;; 4. The authors' names are not used to endorse or promote products ;;
4472++;;; derived from this software without specific prior written ;;
4473++;;; permission. ;;
4474++;;; ;;
4475++;;; THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ;;
4476++;;; DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ;;
4477++;;; ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ;;
4478++;;; SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ;;
4479++;;; FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ;;
4480++;;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ;;
4481++;;; AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ;;
4482++;;; ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ;;
4483++;;; THIS SOFTWARE. ;;
4484++;;; ;;
4485++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4486++;;; Author:
4487++;;; Date:
4488++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4489++;;
4490++;; Czech language description
4491++;;
4492++;;
4493++
4494++(define (language_russian)
4495++"(language_russian)
4496++Set up language parameters for Russian."
4497++ (set! male1 voice_msu_ru_nsh_clunits)
4498++ (male1)
4499++ (Parameter.set 'Language 'russian)
4500++)
4501++
4502++(language.names.add 'czech (list 'czech ))
4503+--- /dev/null
4504++++ festival-2.1~release/lib/languages/language_italian.scm
4505+@@ -0,0 +1,53 @@
4506++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4507++;;; ;;
4508++;;; Centre for Speech Technology Research ;;
4509++;;; University of Edinburgh, UK ;;
4510++;;; Copyright (c) 2002 ;;
4511++;;; All Rights Reserved. ;;
4512++;;; ;;
4513++;;; Permission is hereby granted, free of charge, to use and distribute ;;
4514++;;; this software and its documentation without restriction, including ;;
4515++;;; without limitation the rights to use, copy, modify, merge, publish, ;;
4516++;;; distribute, sublicense, and/or sell copies of this work, and to ;;
4517++;;; permit persons to whom this work is furnished to do so, subject to ;;
4518++;;; the following conditions: ;;
4519++;;; 1. The code must retain the above copyright notice, this list of ;;
4520++;;; conditions and the following disclaimer. ;;
4521++;;; 2. Any modifications must be clearly marked as such. ;;
4522++;;; 3. Original authors' names are not deleted. ;;
4523++;;; 4. The authors' names are not used to endorse or promote products ;;
4524++;;; derived from this software without specific prior written ;;
4525++;;; permission. ;;
4526++;;; ;;
4527++;;; THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ;;
4528++;;; DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ;;
4529++;;; ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ;;
4530++;;; SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ;;
4531++;;; FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ;;
4532++;;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ;;
4533++;;; AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ;;
4534++;;; ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ;;
4535++;;; THIS SOFTWARE. ;;
4536++;;; ;;
4537++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4538++;;; Author:
4539++;;; Date:
4540++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4541++;;
4542++;; Italian language description
4543++;;
4544++;;
4545++
4546++(define (language_italian)
4547++"(language_italian)
4548++Set up language parameters for Italian."
4549++
4550++ (if (symbol-bound? 'voice_lp_diphone)
4551++ (set! female1 (lambda () (voice_lp_diphone))))
4552++ (set! male1 (lambda () (voice_pc_diphone)))
4553++
4554++ (male1)
4555++ (Parameter.set 'Language 'italian)
4556++)
4557++
4558++(language.names.add 'italian (list 'italian ))
4559+--- /dev/null
4560++++ festival-2.1~release/lib/languages/language_american_english.scm
4561+@@ -0,0 +1,55 @@
4562++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4563++;;; ;;
4564++;;; Centre for Speech Technology Research ;;
4565++;;; University of Edinburgh, UK ;;
4566++;;; Copyright (c) 2002 ;;
4567++;;; All Rights Reserved. ;;
4568++;;; ;;
4569++;;; Permission is hereby granted, free of charge, to use and distribute ;;
4570++;;; this software and its documentation without restriction, including ;;
4571++;;; without limitation the rights to use, copy, modify, merge, publish, ;;
4572++;;; distribute, sublicense, and/or sell copies of this work, and to ;;
4573++;;; permit persons to whom this work is furnished to do so, subject to ;;
4574++;;; the following conditions: ;;
4575++;;; 1. The code must retain the above copyright notice, this list of ;;
4576++;;; conditions and the following disclaimer. ;;
4577++;;; 2. Any modifications must be clearly marked as such. ;;
4578++;;; 3. Original authors' names are not deleted. ;;
4579++;;; 4. The authors' names are not used to endorse or promote products ;;
4580++;;; derived from this software without specific prior written ;;
4581++;;; permission. ;;
4582++;;; ;;
4583++;;; THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ;;
4584++;;; DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ;;
4585++;;; ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ;;
4586++;;; SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ;;
4587++;;; FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ;;
4588++;;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ;;
4589++;;; AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ;;
4590++;;; ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ;;
4591++;;; THIS SOFTWARE. ;;
4592++;;; ;;
4593++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4594++;;; Author:
4595++;;; Date:
4596++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4597++;;
4598++;; American English language description
4599++;;
4600++;;
4601++
4602++(define (language_american_english)
4603++"(language_american_english)
4604++Set up language parameters for Aemerican English."
4605++
4606++ (if (symbol-bound? 'voice_kal_diphone)
4607++ (set! female1 (lambda () (voice_kal_diphone))))
4608++ (set! male1 (lambda () (voice_ked_diphone)))
4609++
4610++ (male1)
4611++ (Parameter.set 'Language 'americanenglish)
4612++nil
4613++)
4614++
4615++
4616++(language.names.add 'american_english (list 'americanenglish ))
4617+--- /dev/null
4618++++ festival-2.1~release/lib/languages/language_scots_gaelic.scm
4619+@@ -0,0 +1,49 @@
4620++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4621++;;; ;;
4622++;;; Centre for Speech Technology Research ;;
4623++;;; University of Edinburgh, UK ;;
4624++;;; Copyright (c) 2002 ;;
4625++;;; All Rights Reserved. ;;
4626++;;; ;;
4627++;;; Permission is hereby granted, free of charge, to use and distribute ;;
4628++;;; this software and its documentation without restriction, including ;;
4629++;;; without limitation the rights to use, copy, modify, merge, publish, ;;
4630++;;; distribute, sublicense, and/or sell copies of this work, and to ;;
4631++;;; permit persons to whom this work is furnished to do so, subject to ;;
4632++;;; the following conditions: ;;
4633++;;; 1. The code must retain the above copyright notice, this list of ;;
4634++;;; conditions and the following disclaimer. ;;
4635++;;; 2. Any modifications must be clearly marked as such. ;;
4636++;;; 3. Original authors' names are not deleted. ;;
4637++;;; 4. The authors' names are not used to endorse or promote products ;;
4638++;;; derived from this software without specific prior written ;;
4639++;;; permission. ;;
4640++;;; ;;
4641++;;; THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ;;
4642++;;; DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ;;
4643++;;; ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ;;
4644++;;; SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ;;
4645++;;; FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ;;
4646++;;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ;;
4647++;;; AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ;;
4648++;;; ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ;;
4649++;;; THIS SOFTWARE. ;;
4650++;;; ;;
4651++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4652++;;; Author:
4653++;;; Date:
4654++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4655++;;
4656++;; Scots Gaelic language description
4657++;;
4658++;;
4659++
4660++(define (language_scots_gaelic)
4661++"(language_scots_gaelic)
4662++Set up language parameters for Scots Gaelic."
4663++ (error "Scots Gaelic not yet supported.")
4664++
4665++ (Parameter.set 'Language 'scotsgaelic)
4666++)
4667++
4668++(language.names.add 'scotsgaelic (list 'scotsgaelic ))
4669+--- /dev/null
4670++++ festival-2.1~release/lib/languages/language_british_english.scm
4671+@@ -0,0 +1,58 @@
4672++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4673++;;; ;;
4674++;;; Centre for Speech Technology Research ;;
4675++;;; University of Edinburgh, UK ;;
4676++;;; Copyright (c) 2002 ;;
4677++;;; All Rights Reserved. ;;
4678++;;; ;;
4679++;;; Permission is hereby granted, free of charge, to use and distribute ;;
4680++;;; this software and its documentation without restriction, including ;;
4681++;;; without limitation the rights to use, copy, modify, merge, publish, ;;
4682++;;; distribute, sublicense, and/or sell copies of this work, and to ;;
4683++;;; permit persons to whom this work is furnished to do so, subject to ;;
4684++;;; the following conditions: ;;
4685++;;; 1. The code must retain the above copyright notice, this list of ;;
4686++;;; conditions and the following disclaimer. ;;
4687++;;; 2. Any modifications must be clearly marked as such. ;;
4688++;;; 3. Original authors' names are not deleted. ;;
4689++;;; 4. The authors' names are not used to endorse or promote products ;;
4690++;;; derived from this software without specific prior written ;;
4691++;;; permission. ;;
4692++;;; ;;
4693++;;; THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ;;
4694++;;; DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ;;
4695++;;; ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ;;
4696++;;; SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ;;
4697++;;; FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ;;
4698++;;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ;;
4699++;;; AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ;;
4700++;;; ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ;;
4701++;;; THIS SOFTWARE. ;;
4702++;;; ;;
4703++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4704++;;; Author:
4705++;;; Date:
4706++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4707++;;
4708++;; British English language description
4709++;;
4710++;;
4711++
4712++(define (language_british_english)
4713++"(language_british_english)
4714++Set up language parameters for British English."
4715++ (require 'voices)
4716++ ;; Will get more elaborate, with different choices of voices in language
4717++
4718++ (set! male1 (lambda () (voice_rab_diphone)))
4719++ (set! male2 (lambda () (voice_don_diphone)))
4720++ (if (symbol-bound? 'voice_gsw_diphone)
4721++ (set! male3 voice_gsw_diphone))
4722++ (if (symbol-bound? 'voice_gsw_450)
4723++ (set! male4 voice_gsw_450))
4724++
4725++ (male1)
4726++ (Parameter.set 'Language 'britishenglish)
4727++)
4728++
4729++(language.names.add 'british_english (list 'britishenglish 'english));; we all know its the *real* English
4730+--- /dev/null
4731++++ festival-2.1~release/lib/languages/language_finnish.scm
4732+@@ -0,0 +1,56 @@
4733++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4734++;;; ;;
4735++;;; Centre for Speech Technology Research ;;
4736++;;; University of Edinburgh, UK ;;
4737++;;; Copyright (c) 2002 ;;
4738++;;; All Rights Reserved. ;;
4739++;;; ;;
4740++;;; Permission is hereby granted, free of charge, to use and distribute ;;
4741++;;; this software and its documentation without restriction, including ;;
4742++;;; without limitation the rights to use, copy, modify, merge, publish, ;;
4743++;;; distribute, sublicense, and/or sell copies of this work, and to ;;
4744++;;; permit persons to whom this work is furnished to do so, subject to ;;
4745++;;; the following conditions: ;;
4746++;;; 1. The code must retain the above copyright notice, this list of ;;
4747++;;; conditions and the following disclaimer. ;;
4748++;;; 2. Any modifications must be clearly marked as such. ;;
4749++;;; 3. Original authors' names are not deleted. ;;
4750++;;; 4. The authors' names are not used to endorse or promote products ;;
4751++;;; derived from this software without specific prior written ;;
4752++;;; permission. ;;
4753++;;; ;;
4754++;;; THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ;;
4755++;;; DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ;;
4756++;;; ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ;;
4757++;;; SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ;;
4758++;;; FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ;;
4759++;;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ;;
4760++;;; AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ;;
4761++;;; ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ;;
4762++;;; THIS SOFTWARE. ;;
4763++;;; ;;
4764++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4765++;;; Author:
4766++;;; Date:
4767++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4768++;;
4769++;; Finnish language description
4770++;;
4771++;;
4772++
4773++
4774++(define (language_finnish)
4775++"(language_finnish)
4776++Set up language parameters for Finnish."
4777++ (if (symbol-bound? 'voice_suo_fi_lj_diphone)
4778++ (set! female1 (lambda () (voice_suo_fi_lj_diphone))))
4779++ (set! male1 (lambda () (voice_hy_fi_mv_diphone)))
4780++
4781++ (male1)
4782++ (Parameter.set 'Language 'finnish)
4783++nil
4784++)
4785++
4786++
4787++
4788++(language.names.add 'finnish (list 'finnish ))
4789+--- /dev/null
4790++++ festival-2.1~release/lib/languages/language_welsh.scm
4791+@@ -0,0 +1,52 @@
4792++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4793++;;; ;;
4794++;;; Centre for Speech Technology Research ;;
4795++;;; University of Edinburgh, UK ;;
4796++;;; Copyright (c) 2002 ;;
4797++;;; All Rights Reserved. ;;
4798++;;; ;;
4799++;;; Permission is hereby granted, free of charge, to use and distribute ;;
4800++;;; this software and its documentation without restriction, including ;;
4801++;;; without limitation the rights to use, copy, modify, merge, publish, ;;
4802++;;; distribute, sublicense, and/or sell copies of this work, and to ;;
4803++;;; permit persons to whom this work is furnished to do so, subject to ;;
4804++;;; the following conditions: ;;
4805++;;; 1. The code must retain the above copyright notice, this list of ;;
4806++;;; conditions and the following disclaimer. ;;
4807++;;; 2. Any modifications must be clearly marked as such. ;;
4808++;;; 3. Original authors' names are not deleted. ;;
4809++;;; 4. The authors' names are not used to endorse or promote products ;;
4810++;;; derived from this software without specific prior written ;;
4811++;;; permission. ;;
4812++;;; ;;
4813++;;; THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ;;
4814++;;; DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ;;
4815++;;; ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ;;
4816++;;; SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ;;
4817++;;; FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ;;
4818++;;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ;;
4819++;;; AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ;;
4820++;;; ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ;;
4821++;;; THIS SOFTWARE. ;;
4822++;;; ;;
4823++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4824++;;; Author:
4825++;;; Date:
4826++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4827++;;
4828++;; Welsh language description
4829++;;
4830++;;
4831++
4832++(define (language_welsh)
4833++"(language_welsh)
4834++Set up language parameters for Welsh."
4835++
4836++ (set! male1 (lambda () (voice_welsh_hl)))
4837++
4838++ (male1)
4839++ (Parameter.set 'Language 'welsh)
4840++)
4841++
4842++
4843++(language.names.add 'welsh (list 'welsh ))
4844+--- /dev/null
4845++++ festival-2.1~release/lib/languages/language_castillian_spanish.scm
4846+@@ -0,0 +1,51 @@
4847++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4848++;;; ;;
4849++;;; Centre for Speech Technology Research ;;
4850++;;; University of Edinburgh, UK ;;
4851++;;; Copyright (c) 2002 ;;
4852++;;; All Rights Reserved. ;;
4853++;;; ;;
4854++;;; Permission is hereby granted, free of charge, to use and distribute ;;
4855++;;; this software and its documentation without restriction, including ;;
4856++;;; without limitation the rights to use, copy, modify, merge, publish, ;;
4857++;;; distribute, sublicense, and/or sell copies of this work, and to ;;
4858++;;; permit persons to whom this work is furnished to do so, subject to ;;
4859++;;; the following conditions: ;;
4860++;;; 1. The code must retain the above copyright notice, this list of ;;
4861++;;; conditions and the following disclaimer. ;;
4862++;;; 2. Any modifications must be clearly marked as such. ;;
4863++;;; 3. Original authors' names are not deleted. ;;
4864++;;; 4. The authors' names are not used to endorse or promote products ;;
4865++;;; derived from this software without specific prior written ;;
4866++;;; permission. ;;
4867++;;; ;;
4868++;;; THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ;;
4869++;;; DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ;;
4870++;;; ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ;;
4871++;;; SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ;;
4872++;;; FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ;;
4873++;;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ;;
4874++;;; AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ;;
4875++;;; ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ;;
4876++;;; THIS SOFTWARE. ;;
4877++;;; ;;
4878++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4879++;;; Author:
4880++;;; Date:
4881++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4882++;;
4883++;; Castillian Spanish language description
4884++;;
4885++;;
4886++
4887++(define (language_castillian_spanish)
4888++"(language_spanish)
4889++Set up language parameters for Castillian Spanish."
4890++
4891++ (voice_el_diphone)
4892++ (set! male1 (lambda () (voice_el_diphone)))
4893++
4894++ (Parameter.set 'Language 'spanish)
4895++)
4896++
4897++(language.names.add 'castillian_spanish (list 'spanish 'castellano))
4898
4899=== modified file 'debian/patches/lib_festdoc.scm.diff'
4900--- debian/patches/lib_festdoc.scm.diff 2009-06-19 14:28:07 +0000
4901+++ debian/patches/lib_festdoc.scm.diff 2012-12-07 04:47:19 +0000
4902@@ -1,5 +1,5 @@
4903-This patch is part of a series of patches for festival for
4904-Debian GNU/Linux, which primarily fix build errors with GCC 4.3 and newer.
4905+This patch is for festival for Debian GNU/Linux, to ensure
4906+manual includes functions/variables from festival library
4907
4908 Index: b/lib/festdoc.scm
4909 ===================================================================
4910
4911=== modified file 'debian/patches/lib_festival.scm.diff'
4912--- debian/patches/lib_festival.scm.diff 2010-11-11 12:16:57 +0000
4913+++ debian/patches/lib_festival.scm.diff 2012-12-07 04:47:19 +0000
4914@@ -1,5 +1,6 @@
4915-This patch is part of a series of patches for festival for
4916-Debian GNU/Linux, which primarily fix build errors with GCC 4.3 and newer.
4917+This patch is for festival for Debian GNU/Linux, it adjusts server
4918+access list, corrects spelling, ensures compliance with Filesystem
4919+Hierarchy Standard and sets default audio backend to ALSA
4920
4921 Index: b/lib/festival.scm
4922 ===================================================================
4923@@ -16,7 +17,7 @@
4924 from which clients may access the server. This is a list of REGEXs
4925 @@ -494,7 +494,7 @@
4926 (If compiled with editline)
4927- M-h desplays help on current symbol
4928+ M-h displays help on current symbol
4929 M-s speaks help on current symbol
4930 - M-m displays relevant manula page in local netscape
4931 + M-m displays relevant manual page in local netscape
4932
4933=== modified file 'debian/patches/lib_init.scm.diff'
4934--- debian/patches/lib_init.scm.diff 2009-06-19 14:28:07 +0000
4935+++ debian/patches/lib_init.scm.diff 2012-12-07 04:47:19 +0000
4936@@ -1,5 +1,6 @@
4937-This patch is part of a series of patches for festival for
4938-Debian GNU/Linux, which primarily fix build errors with GCC 4.3 and newer.
4939+This patch for festival for Debian GNU/Linux, implements a Debian
4940+specific system initalization and changes order of default audio method
4941+assignment
4942
4943 Index: b/lib/init.scm
4944 ===================================================================
4945
4946=== removed file 'debian/patches/lib_languages.scm.diff'
4947--- debian/patches/lib_languages.scm.diff 2009-06-19 14:28:07 +0000
4948+++ debian/patches/lib_languages.scm.diff 1970-01-01 00:00:00 +0000
4949@@ -1,105 +0,0 @@
4950-This patch is part of a series of patches for festival for
4951-Debian GNU/Linux, which primarily fix build errors with GCC 4.3 and newer.
4952-
4953-Index: b/lib/languages.scm
4954-===================================================================
4955---- a/lib/languages.scm
4956-+++ b/lib/languages.scm
4957-@@ -45,8 +45,8 @@
4958- (require 'voices)
4959- ;; Will get more elaborate, with different choices of voices in language
4960-
4961-- (set! male1 voice_rab_diphone)
4962-- (set! male2 voice_don_diphone)
4963-+ (set! male1 (lambda () (voice_rab_diphone)))
4964-+ (set! male2 (lambda () (voice_don_diphone)))
4965- (if (symbol-bound? 'voice_gsw_diphone)
4966- (set! male3 voice_gsw_diphone))
4967- (if (symbol-bound? 'voice_gsw_450)
4968-@@ -56,18 +56,51 @@
4969- (Parameter.set 'Language 'britishenglish)
4970- )
4971-
4972-+
4973-+(define (language_italian)
4974-+"(language_italian)
4975-+Set up language parameters for Italian."
4976-+
4977-+ (if (symbol-bound? 'voice_lp_diphone)
4978-+ (set! female1 (lambda () (voice_lp_diphone))))
4979-+ (set! male1 (lambda () (voice_pc_diphone)))
4980-+
4981-+ (male1)
4982-+ (Parameter.set 'Language 'italian)
4983-+)
4984-+
4985-+
4986- (define (language_american_english)
4987- "(language_american_english)
4988- Set up language parameters for Aemerican English."
4989-
4990- (if (symbol-bound? 'voice_kal_diphone)
4991-- (set! female1 voice_kal_diphone))
4992-- (set! male1 voice_ked_diphone)
4993-+ (set! female1 (lambda () (voice_kal_diphone))))
4994-+ (set! male1 (lambda () (voice_ked_diphone)))
4995-
4996- (male1)
4997- (Parameter.set 'Language 'americanenglish)
4998- )
4999-
5000-+(define (language_finnish)
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: