summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app-accessibility/festival-hts/ChangeLog10
-rw-r--r--app-accessibility/festival-hts/Manifest9
-rw-r--r--app-accessibility/festival-hts/festival-hts-2.1-r1.ebuild37
-rw-r--r--app-accessibility/festival-hts/metadata.xml9
-rw-r--r--app-accessibility/festival/ChangeLog535
-rw-r--r--app-accessibility/festival/Manifest26
-rw-r--r--app-accessibility/festival/festival-2.1-r1.ebuild124
-rw-r--r--app-accessibility/festival/files/festival-1.96_beta-gcc43.patch12
-rw-r--r--app-accessibility/festival/files/festival-1.96_beta-hts-voices.patch100
-rw-r--r--app-accessibility/festival/files/festival-1.96_beta-init-scm.patch24
-rw-r--r--app-accessibility/festival/files/festival-2.0.95_beta-init-scm.patch24
-rw-r--r--app-accessibility/festival/files/festival-2.1-gentoo-system.patch124
-rw-r--r--app-accessibility/festival/files/festival-2.1-hts21compat-config.patch10
-rw-r--r--app-accessibility/festival/files/festival-2.1-hts21compat-config.patch.save5
-rw-r--r--app-accessibility/festival/files/festival-2.1-hts21compat.patch3642
-rw-r--r--app-accessibility/festival/files/festival-2.1-init-scm.patch24
-rw-r--r--app-accessibility/festival/files/festival-2.1-ldflags.patch12
-rw-r--r--app-accessibility/festival/files/festival.rc22
-rw-r--r--app-accessibility/festival/files/server.scm20
-rw-r--r--app-accessibility/festival/files/speech-tools-1.2.96_beta-gcc43-include.patch22
-rw-r--r--app-accessibility/festival/files/voice_rms.patch20
-rw-r--r--app-accessibility/festival/hts21compat-howto4
-rw-r--r--app-accessibility/festival/metadata.xml12
-rwxr-xr-x[-rw-r--r--]app-text/calibre/files/calibre-server.conf0
-rwxr-xr-xgnome-extra/nautilus-image-converter/Manifest2
-rwxr-xr-xgnome-extra/nautilus-image-converter/nautilus-image-converter-0.3.0.ebuild21
26 files changed, 4850 insertions, 0 deletions
diff --git a/app-accessibility/festival-hts/ChangeLog b/app-accessibility/festival-hts/ChangeLog
new file mode 100644
index 0000000..c2a232e
--- /dev/null
+++ b/app-accessibility/festival-hts/ChangeLog
@@ -0,0 +1,10 @@
+# ChangeLog for app-accessibility/festival-hts
+# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/app-accessibility/festival-hts/ChangeLog,v 1.1 2010/06/30 16:29:41 neurogeek Exp $
+
+*festival-hts-2.1 (30 Jun 2010)
+
+ 30 Jun 2010; Jesus Rivero <neurogeek@gentoo.org> +festival-hts-2.1.ebuild,
+ +metadata.xml:
+ Initial commit.
+
diff --git a/app-accessibility/festival-hts/Manifest b/app-accessibility/festival-hts/Manifest
new file mode 100644
index 0000000..a1add17
--- /dev/null
+++ b/app-accessibility/festival-hts/Manifest
@@ -0,0 +1,9 @@
+DIST festvox_nitech_us_awb_arctic_hts-2.1.tar.bz2 1636752 RMD160 f9d13c37c470c4c584389f2493401b08cb50deab SHA1 4cb86b7baea9036893194e2f5a51768e8db8f31a SHA256 7aea67674661d29ee8686b45af38f4f090204e101abaead04aa731bdb7635569
+DIST festvox_nitech_us_bdl_arctic_hts-2.1.tar.bz2 1855093 RMD160 4354b7282b4a4de41f48ea4cddfa9a31e5cd3427 SHA1 62264fe413f2fd953eae9462c4e690eb52113cb9 SHA256 5133aebf7a620e577f01a5e7669c7da95fb527071902eb8364d0b40f0be47835
+DIST festvox_nitech_us_clb_arctic_hts-2.1.tar.bz2 2201989 RMD160 acd8aa08a95bbf2f0c52d573d0583a8b70902701 SHA1 e422b7f01aa896e4cbee3a1a15bd1a4a672d8cec SHA256 4cf35b17d2db5b92498a0a371ed61330ce57d57b97f40803653fee8a77e2b338
+DIST festvox_nitech_us_jmk_arctic_hts-2.1.tar.bz2 1607055 RMD160 3df0bf3cb42fe4dcd0dc0da89cbd3d6c07188842 SHA1 237989152a409c6158e3112be9bcb1431c8ca0fa SHA256 e86e57c8a8361693671343473f68790160a3b69ccc7b906eb2cd1f5855d35ce3
+DIST festvox_nitech_us_rms_arctic_hts-2.1.tar.bz2 1829779 RMD160 b37c69509c0d5744732f4be840b564796ecdb0cc SHA1 b192c9d9302a81b3c8531c58be90029e81d1b2c2 SHA256 845ae4ff9d7afed0b8270ab71d0709136f4a648ba67b66caecdb71d9bf1e993c
+DIST festvox_nitech_us_slt_arctic_hts-2.1.tar.bz2 1865263 RMD160 4d34a4af26e26066a45e7d3446a97739795d5fb4 SHA1 1dfff7cc1cc74f6551dfecfeae287261e322dfa4 SHA256 0aff67531eb9575f3204ad516a1fa81fe2356873e3567d0ee3dba94565eea47d
+EBUILD festival-hts-2.1-r1.ebuild 1254 RMD160 4b606f977d4abd343dba37d45ad9ddc390df3944 SHA1 82d981ce7d94b650462f1b864e14a3cd0a10f616 SHA256 709b68f21c6304bad8d90b94c2249a5d8a45105e588c01f3d3deeffad9072886
+MISC ChangeLog 382 RMD160 ce96cbd5c3ec3d9420e861c8f5a6656e17c3b71c SHA1 233f85ebde55208e8e5397f7f2499983d9bb5716 SHA256 b8e8a02fdd9faaabdd5f54f161d1714219fc39f5647ac0d7acac69b261fda419
+MISC metadata.xml 249 RMD160 aed6037ec3b7f4d54caf1bcdde787d210e66bb39 SHA1 2ea096f7050fab58b8f37d31dbdf5662e4221124 SHA256 fd33f80767dca15f4f24eac223d4c5bb07ec855e06b6c3841898ca14feaf98cc
diff --git a/app-accessibility/festival-hts/festival-hts-2.1-r1.ebuild b/app-accessibility/festival-hts/festival-hts-2.1-r1.ebuild
new file mode 100644
index 0000000..5d1d73d
--- /dev/null
+++ b/app-accessibility/festival-hts/festival-hts-2.1-r1.ebuild
@@ -0,0 +1,37 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-accessibility/festival-hts/festival-hts-2.1.ebuild,v 1.1 2010/06/30 16:29:41 neurogeek Exp $
+
+EAPI=2
+
+DESCRIPTION="HTS voices for Festival"
+HOMEPAGE="http://hts.sp.nitech.ac.jp/"
+SITE="http://hts.sp.nitech.ac.jp/archives/${PV}"
+SRC_URI="${SITE}/festvox_nitech_us_awb_arctic_hts-${PV}.tar.bz2
+ ${SITE}/festvox_nitech_us_bdl_arctic_hts-${PV}.tar.bz2
+ ${SITE}/festvox_nitech_us_clb_arctic_hts-${PV}.tar.bz2
+ ${SITE}/festvox_nitech_us_jmk_arctic_hts-${PV}.tar.bz2
+ ${SITE}/festvox_nitech_us_rms_arctic_hts-${PV}.tar.bz2
+ ${SITE}/festvox_nitech_us_slt_arctic_hts-${PV}.tar.bz2"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="x86 amd64"
+IUSE=""
+
+DEPEND=">=app-accessibility/festival-2.1"
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+ for voice in awb bdl clb jmk rms slt
+ do
+ voicefile=lib/voices/us/nitech_us_${voice}_arctic_hts/festvox/nitech_us_${voice}_arctic_hts.scm
+ sed "s@(require 'hts)@(require 'hts21compat)@g" ${voicefile} -i
+ sed "s@(Parameter.set 'Synth_Method 'HTS)@(Parameter.set 'Synth_Method 'HTS21)@g" ${voicefile} -i
+ done
+}
+
+src_install() {
+ insinto /usr/share/festival/voices/
+ doins -r lib/voices/*
+}
diff --git a/app-accessibility/festival-hts/metadata.xml b/app-accessibility/festival-hts/metadata.xml
new file mode 100644
index 0000000..be48b59
--- /dev/null
+++ b/app-accessibility/festival-hts/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer>
+ <email>neurogeek@gentoo.org</email>
+</maintainer>
+<herd>accessibility</herd>
+<herd>sound</herd>
+</pkgmetadata>
diff --git a/app-accessibility/festival/ChangeLog b/app-accessibility/festival/ChangeLog
new file mode 100644
index 0000000..3a397ef
--- /dev/null
+++ b/app-accessibility/festival/ChangeLog
@@ -0,0 +1,535 @@
+# ChangeLog for app-accessibility/festival
+# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/app-accessibility/festival/ChangeLog,v 1.105 2012/05/31 02:14:16 zmedico Exp $
+
+ 31 May 2012; Zac Medico <zmedico@gentoo.org> festival-1.96_beta-r1.ebuild,
+ festival-1.96_beta.ebuild, festival-2.0.95_beta.ebuild, festival-2.1.ebuild:
+ inherit multilib for get_libdir
+
+ 23 May 2012; Mike Frysinger <vapier@gentoo.org> festival-1.96_beta-r1.ebuild,
+ festival-1.96_beta.ebuild, festival-2.0.95_beta.ebuild, festival-2.1.ebuild:
+ Inherit user eclass for enewuser/etc...
+
+ 17 Apr 2012; Jesus Rivero <neurogeek@gentoo.org> festival-2.1.ebuild:
+ Dropped alsa-lib support as speech-tools already handles it. Closes bug
+ #380501
+
+ 29 Dec 2011; Mark Loeser <halcy0n@gentoo.org> festival-2.1.ebuild:
+ Stable for ppc/ppc64; bug #380775
+
+ 24 Sep 2011; Raúl Porcel <armin76@gentoo.org> festival-2.1.ebuild:
+ alpha/ia64/sparc stable wrt #380775
+
+ 04 Sep 2011; Markus Meier <maekke@gentoo.org> festival-2.1.ebuild:
+ x86 stable, bug #380775
+
+ 01 Sep 2011; Jeroen Roovers <jer@gentoo.org> festival-2.1.ebuild:
+ Stable for HPPA (bug #380775).
+
+ 27 Aug 2011; Markos Chandras <hwoarang@gentoo.org> festival-2.1.ebuild:
+ Stable on amd64 wrt bug #380775
+
+ 26 Aug 2011; Jesus Rivero <neurogeek@gentoo.org> festival-2.1.ebuild:
+ Changes to DEPEND wrt bug #380501 thanks to Michael. Added fix for prefix
+ wrt bug #309983
+
+ 22 Mar 2011; Jesus Rivero <neurogeek@gentoo.org>
+ festival-1.96_beta.ebuild, festival-1.96_beta-r1.ebuild:
+ Minor change in mbrola dep.
+
+ 22 Mar 2011; Jesus Rivero <neurogeek@gentoo.org> festival-2.1.ebuild:
+ Quoted LDFLAGS per bugs #340317 and #359723
+
+ 17 Mar 2011; Jesus Rivero <neurogeek@gentoo.org> festival-2.1.ebuild:
+ Readded siteinit.scm instructions
+
+*festival-2.1 (16 Mar 2011)
+
+ 16 Mar 2011; Jesus Rivero <neurogeek@gentoo.org> +festival-2.1.ebuild,
+ +files/festival-2.1-gentoo-system.patch,
+ +files/festival-2.1-init-scm.patch, +files/festival-2.1-ldflags.patch:
+ Version bump. Closes bug #340317 and #357381.
+
+ 04 Mar 2011; William Hubbs <williamh@gentoo.org> festival-1.96_beta.ebuild,
+ festival-1.96_beta-r1.ebuild, festival-2.0.95_beta.ebuild:
+ fix dependencies on speech-tools for bug #357251.
+
+ 13 Jul 2010; Jesus Rivero <neurogeek@gentoo.org>
+ festival-2.0.95_beta.ebuild:
+ Reverted change to emake -j1. Parallel make does not work. Closes bug
+ #326453
+
+*festival-2.0.95_beta (30 Jun 2010)
+
+ 30 Jun 2010; Jesus Rivero <neurogeek@gentoo.org>
+ +festival-2.0.95_beta.ebuild, +files/festival-2.0.95_beta-init-scm.patch:
+ Version bump.
+
+ 30 Jun 2010; Jesus Rivero <neurogeek@gentoo.org>
+ festival-1.96_beta.ebuild, festival-1.96_beta-r1.ebuild:
+ Changed DEPS on app-accessibility/speech-tools to prepare for the new
+ speech-tools/festival versions.
+
+ 19 May 2010; Jesus Rivero <neurogeek@gentoo.org>
+ festival-1.96_beta-r1.ebuild:
+ Fixed SRC_URI
+
+ 08 Jul 2009; William Hubbs <williamh@gentoo.org> metadata.xml:
+ Added neurogeek back as maintainer.
+
+ 15 Mar 2009; William Hubbs <williamh@gentoo.org> metadata.xml:
+ Adding neurogeek as maintainer.
+
+ 09 Feb 2009; William Hubbs <williamh@gentoo.org>
+ festival-1.96_beta-r1.ebuild:
+ Fixed the gcc 4.3 patch order for bug #205401.
+
+*festival-1.96_beta-r1 (09 Feb 2009)
+
+ 09 Feb 2009; William Hubbs <williamh@gentoo.org>
+ +files/speech-tools-1.2.96_beta-gcc43-include.patch,
+ +files/festival-1.96_beta-hts-voices.patch, +festival-1.96_beta-r1.ebuild:
+ Add back the HTS voices, thanks to garlicbread@ntlworld.com for the patch.
+ Also add back the MultiSyn engine.
+ This closes bug #211214.
+
+ 23 Nov 2008; Patrick Lauer <patrick@gentoo.org> festival-1.96_beta.ebuild:
+ Fixing homepage to point directly at the actual project page.
+
+ 10 Aug 2008; William Hubbs <williamh@gentoo.org>
+ festival-1.96_beta.ebuild:
+ Closes bug 220285 (alsa support), thanks to solar. Also, this adds back
+ the speech synthesis engines needed by bug 211214. Again, thanks to solar.
+
+ 15 Jul 2008; Doug Goldstein <cardoe@gentoo.org> metadata.xml:
+ add GLEP 56 USE flag desc from use.local.desc
+
+ 20 Mar 2008; William Hubbs <williamh@gentoo.org>
+ -files/festival-1.4.3-asterisk.patch,
+ -files/festival-1.95_beta-asterisk.patch,
+ -files/festival-1.95_beta-fbsd.patch,
+ -files/festival-1.95_beta-gcc41-amd64-int-pointer.patch,
+ -files/festival-1.95_beta-gcc41-amd64.patch,
+ -files/festival-1.95_beta-gcc41.patch, -files/festival-gcc3.3.diff,
+ -files/festival-1.95_beta-init-scm.patch, -festival-1.4.3-r3.ebuild,
+ -festival-1.4.3-r4.ebuild, -festival-1.95_beta.ebuild,
+ -festival-1.95_beta-r1.ebuild, -festival-1.95_beta-r2.ebuild,
+ -festival-1.95_beta-r3.ebuild, -festival-1.95_beta-r4.ebuild:
+ Removed old versions.
+
+ 13 Mar 2008; William Hubbs <williamh@gentoo.org>
+ festival-1.96_beta.ebuild:
+ Adding back the ~x86-fbsd keyword; I'm not sure why it was dropped.
+
+ 07 Mar 2008; William Hubbs <williamh@gentoo.org>
+ festival-1.96_beta.ebuild:
+ I am adding back the mips keyword since I'm the maintainer and I'm not sure
+ how it got dropped. This closes #209077.
+
+ 03 Mar 2008; Raúl Porcel <armin76@gentoo.org> festival-1.96_beta.ebuild:
+ alpha/ia64/sparc stable wrt #209081
+
+ 10 Feb 2008; Tobias Scherbaum <dertobi123@gentoo.org>
+ festival-1.96_beta.ebuild:
+ ppc stable, bug #209081
+
+ 07 Feb 2008; Jeroen Roovers <jer@gentoo.org> festival-1.96_beta.ebuild:
+ Stable for HPPA (bug #209081).
+
+ 07 Feb 2008; Brent Baude <ranger@gentoo.org> festival-1.96_beta.ebuild:
+ stable ppc64, bug 209081
+
+ 06 Feb 2008; Christian Faulhammer <opfer@gentoo.org>
+ festival-1.96_beta.ebuild:
+ stable x86 amd64, bug 209081
+
+ 12 Jan 2008; William Hubbs <williamh@gentoo.org>
+ +files/festival-1.96_beta-gcc43.patch, festival-1.96_beta.ebuild:
+ Fixed dependencies for bug #199886.
+ Applied a gcc 4.3 patch for bug #205401 -- thanks to dirtyepic@gentoo.org.
+
+ 29 Aug 2007; William Hubbs <williamh@gentoo.org>
+ +files/festival-1.96_beta-init-scm.patch:
+ Fixed patch bug #190619.
+
+*festival-1.96_beta (28 Aug 2007)
+
+ 28 Aug 2007; William Hubbs <williamh@gentoo.org>
+ +festival-1.96_beta.ebuild:
+ Version bump #188821.
+ Also, I have been able to re-enstate the dependency on speech-tools.
+
+ 06 Jul 2007; Roy Marples <uberlord@gentoo.org>
+ +files/festival-1.95_beta-fbsd.patch, festival-1.95_beta-r4.ebuild:
+ Add patch to build on fbsd, #183686 thanks to Nathan Smith.
+ Keyworded ~x86-fbsd.
+
+ 11 Jun 2007; Gustavo Zacarias <gustavoz@gentoo.org>
+ festival-1.95_beta-r4.ebuild:
+ Stable on sparc wrt security #170477
+
+ 10 Jun 2007; Raúl Porcel <armin76@gentoo.org>
+ festival-1.95_beta-r4.ebuild:
+ x86 stable wrt security #170477
+
+ 09 Jun 2007; Wulf C. Krueger <philantrop@gentoo.org>
+ festival-1.95_beta-r4.ebuild:
+ Marked stable on amd64 as per bug 170477.
+
+ 09 Jun 2007; Jose Luis Rivero <yoswink@gentoo.org>
+ festival-1.95_beta-r4.ebuild:
+ Stable on alpha wrt security bug #170477. Thanks to Brian Evans (grknight)
+ for testing.
+
+ 09 Jun 2007; Markus Rothe <corsair@gentoo.org>
+ festival-1.95_beta-r4.ebuild:
+ Stable on ppc64; bug #170477
+
+ 09 Jun 2007; Jeroen Roovers <jer@gentoo.org> festival-1.95_beta-r4.ebuild:
+ Stable for HPPA (bug #170477).
+
+ 09 Jun 2007; Tobias Scherbaum <dertobi123@gentoo.org>
+ festival-1.95_beta-r4.ebuild:
+ ppc stable, bug #170477
+
+*festival-1.95_beta-r4 (09 Jun 2007)
+
+ 09 Jun 2007; William Hubbs <williamh@gentoo.org> files/festival.rc,
+ files/server.scm, +festival-1.95_beta-r4.ebuild:
+ Fix for security bug #170477.
+ Thanks to solar for the patch.
+
+ 28 Apr 2007; Sven Wegener <swegener@gentoo.org> festival-1.4.3-r3.ebuild,
+ festival-1.4.3-r4.ebuild, festival-1.95_beta.ebuild,
+ festival-1.95_beta-r1.ebuild, festival-1.95_beta-r2.ebuild,
+ festival-1.95_beta-r3.ebuild:
+ Fix *initd, *confd and *envd calls (#173884, #174266)
+
+*festival-1.95_beta-r3 (06 Nov 2006)
+
+ 06 Nov 2006; William Hubbs <williamh@gentoo.org>
+ +festival-1.95_beta-r3.ebuild:
+ Did a rev bump to install the multisyn code.
+
+*festival-1.95_beta-r2 (04 Nov 2006)
+
+ 04 Nov 2006; William Hubbs <williamh@gentoo.org> files/server.scm,
+ +festival-1.95_beta-r2.ebuild:
+ This revision fixes bug #118404, now libfestival.a will be installed.
+ Also, I revised server.scm so that it only contains server settings.
+
+ 19 Oct 2006; Bryan Østergaard <kloeri@gentoo.org>
+ festival-1.95_beta-r1.ebuild:
+ Stable on Alpha.
+
+ 15 Oct 2006; Bryan Østergaard <kloeri@gentoo.org>
+ festival-1.95_beta-r1.ebuild:
+ Stable on ia64.
+
+ 12 Oct 2006; Guy Martin <gmsoft@gentoo.org> festival-1.95_beta-r1.ebuild:
+ Stable on hppa.
+
+ 26 Sep 2006; Jason Wever <weeve@gentoo.org> festival-1.95_beta-r1.ebuild:
+ Stable the right one for SPARC wrt bug #146897.
+
+ 26 Sep 2006; Jason Wever <weeve@gentoo.org> festival-1.95_beta.ebuild:
+ Stable on SPARC wrt bug #146897.
+
+ 24 Sep 2006; Michael Hanselmann <hansmi@gentoo.org>
+ festival-1.95_beta-r1.ebuild:
+ Stable on ppc.
+
+ 22 Sep 2006; Michael Cummings <mcummings@gentoo.org>
+ festival-1.95_beta-r1.ebuild:
+ Keywording amd64, bug 146897
+
+ 21 Sep 2006; <ticho@gentoo.org> festival-1.95_beta-r1.ebuild:
+ Stable on x86, bug #146897.
+
+ 21 Sep 2006; Markus Rothe <corsair@gentoo.org>
+ festival-1.95_beta-r1.ebuild:
+ Stable on ppc64; bug #146897
+
+*festival-1.95_beta-r1 (21 Sep 2006)
+
+ 21 Sep 2006; William Hubbs <williamh@gentoo.org>
+ +files/festival-1.95_beta-init-scm.patch, festival-1.4.3-r3.ebuild,
+ festival-1.4.3-r4.ebuild, +festival-1.95_beta-r1.ebuild:
+ This revision fixes dependencies for X and esd use flags.
+ It also makes it possible to configure siteinit.scm and sitevars.scm by
+ moving them to /etc/festival.
+ The dependency between festival and speech-tools has been broken because
+ festival now directly includes source files from speech-tools.
+ I added a blocker so that old versions of festival cannot be installed with
+ the new speech-tools.
+ This is for bug #146897.
+
+ 20 Sep 2006; <blubb@gentoo.org> festival-1.95_beta.ebuild:
+ stable on amd64
+
+ 09 Sep 2006; <nixnut@gentoo.org> festival-1.95_beta.ebuild:
+ Stable on ppc wrt bug 146897
+
+ 08 Aug 2006; William Hubbs <williamh@gentoo.org>
+ +files/festival-1.95_beta-gcc41-amd64-int-pointer.patch,
+ festival-1.95_beta.ebuild:
+ Added another amd64 patch. Thanks again Ed.
+
+ 20 Jul 2006; William Hubbs <williamh@gentoo.org>
+ +files/festival-1.95_beta-gcc41-amd64.patch,
+ +files/festival-1.95_beta-gcc41.patch, festival-1.95_beta.ebuild:
+ Added Ed Catmur's patches so this will compile under gcc 4.1.
+ This is for bug #116030.
+
+ 19 Jul 2006; <psi29a@gentoo.org> festival-1.4.3-r3.ebuild,
+ festival-1.4.3-r4.ebuild:
+ stable on mips
+
+ 16 Jun 2006; Jon Hood <squinky86@gentoo.org> festival-1.4.3-r4.ebuild,
+ festival-1.95_beta.ebuild:
+ Add linguas_es IUSE wrt #136953.
+
+ 05 Jun 2006; Jeremy Huddleston <eradicator@gentoo.org>
+ festival-1.4.3-r4.ebuild:
+ Stable amd64 and sparc.
+
+*festival-1.95_beta (16 May 2006)
+
+ 16 May 2006; William Hubbs <williamh@gentoo.org>
+ +files/festival-1.95_beta-asterisk.patch, +festival-1.95_beta.ebuild:
+ Version Bump.
+
+ 18 Apr 2006; William Hubbs <williamh@gentoo.org> metadata.xml:
+ Updated metadata.
+
+ 26 Oct 2005; Jeremy Huddleston <eradicator@gentoo.org>
+ festival-1.4.3-r4.ebuild:
+ Don't do the prerm deletion of the symlinks because they get removed during
+ subsequent emerges.
+
+ 09 Sep 2005; Aron Griffis <agriffis@gentoo.org> festival-1.4.3-r3.ebuild:
+ Mark 1.4.3-r3 stable on alpha
+
+ 24 Aug 2005; Aron Griffis <agriffis@gentoo.org> festival-1.4.3-r4.ebuild:
+ add ~alpha ~ia64 #100083
+
+ 23 Aug 2005; Aron Griffis <agriffis@gentoo.org> festival-1.4.3-r3.ebuild:
+ stable on ia64
+
+ 01 Aug 2005; Jeremy Huddleston <eradicator@gentoo.org>
+ festival-1.4.3-r3.ebuild:
+ Properly create the /usr/lib/festival symlink.
+
+ 30 Jul 2005; Jeremy Huddleston <eradicator@gentoo.org>
+ -files/festival-1.4.2.patch, files/server.scm, -festival-1.4.3-r2.ebuild,
+ festival-1.4.3-r3.ebuild, festival-1.4.3-r4.ebuild:
+ -r3 stable ppc per JoseJX. Finally cleaning out crufty old versions.
+
+ 27 Jul 2005; Guy Martin <gmsoft@gentoo.org> festival-1.4.3-r3.ebuild,
+ festival-1.4.3-r4.ebuild:
+ Stable on hppa.
+
+ 24 Jul 2005; Jeremy Huddleston <eradicator@gentoo.org>
+ festival-1.4.3-r4.ebuild:
+ Changing tts USE flags to linguas_.
+
+*festival-1.4.3-r4 (24 Jul 2005)
+
+ 24 Jul 2005; Jeremy Huddleston <eradicator@gentoo.org>
+ +festival-1.4.3-r4.ebuild:
+ Revision bump with cleanups thanks to Vincent Poinot
+ <vincent.poinot@wanadoo.fr>. Also, it now uses the correct toolchain
+ compiler.
+
+ 21 Jul 2005; Jeremy Huddleston <eradicator@gentoo.org>
+ -festival-1.4.3-r1.ebuild, festival-1.4.3-r3.ebuild:
+ Stable amd64, sparc, x86.
+
+ 04 Jul 2005; Bryan Østergaard <kloeri@gentoo.org>
+ festival-1.4.3-r3.ebuild:
+ Add ~alpha keyword.
+
+ 09 Jun 2005; Markus Rothe <corsair@gentoo.org> festival-1.4.3-r3.ebuild:
+ Stable on ppc64
+
+ 11 May 2005; Aron Griffis <agriffis@gentoo.org> festival-1.4.3-r3.ebuild:
+ add ~ia64
+
+ 27 Apr 2005; Markus Rothe <corsair@gentoo.org> festival-1.4.3-r3.ebuild:
+ Added ~ppc64 to KEYWORDS
+
+ 27 Mar 2005; Michael Hanselmann <hansmi@gentoo.org>
+ festival-1.4.3-r2.ebuild:
+ Stable on ppc.
+
+*festival-1.4.3-r3 (09 Feb 2005)
+
+ 09 Feb 2005; Jeremy Huddleston <eradicator@gentoo.org>
+ +festival-1.4.3-r3.ebuild:
+ Move to /usr/share/festival as that's the proper place for us.
+
+ 05 Jan 2005; Jeremy Huddleston <eradicator@gentoo.org>
+ festival-1.4.3-r1.ebuild, festival-1.4.3-r2.ebuild:
+ Fix compilation problems with not finding speech-tools... closes bug #76810.
+
+ 18 Dec 2004; Jeremy Huddleston <eradicator@gentoo.org>
+ festival-1.4.3-r2.ebuild:
+ Stable amd64, sparc, x86.
+
+*festival-1.4.3-r2 (19 Oct 2004)
+
+ 19 Oct 2004; Jeremy Huddleston <eradicator@gentoo.org>
+ +festival-1.4.3-r2.ebuild, -festival-1.4.3.ebuild:
+ get_libdir updates. Now installs header files to close bug #64504.
+
+ 05 Oct 2004; Pieter Van den Abeele <pvdabeel@gentoo.org>
+ festival-1.4.3-r1.ebuild, festival-1.4.3.ebuild:
+ Masked festival-1.4.3.ebuild stable for ppc
+
+ 05 Oct 2004; Pieter Van den Abeele <pvdabeel@gentoo.org>
+ festival-1.4.3-r1.ebuild:
+ Masked festival-1.4.3-r1.ebuild stable for ppc
+
+ 28 Jun 2004; Aron Griffis <agriffis@gentoo.org> festival-1.4.3.ebuild:
+ sync IUSE (+doc)
+
+ 28 Jun 2004; Aron Griffis <agriffis@gentoo.org> festival-1.4.3.ebuild:
+ QA - fix use invocation, econf || die, sync IUSE, glibc -> libc
+
+ 25 Apr 2004; Aron Griffis <agriffis@gentoo.org> festival-1.4.3.ebuild:
+ Add die following econf
+
+ 20 Apr 2004; Jeremy Huddleston <eradicator@gentoo.org>
+ festival-1.4.3-r1.ebuild, festival-1.4.3.ebuild:
+ Removed unneccessary GCCPV to close bug #48383.
+
+ 30 Mar 2004; Todd Sunderlin <todd@gentoo.org> festival-1.4.3-r1.ebuild:
+ set stable on sparc
+
+ 25 Mar 2004; Gustavo Zacarias <gustavoz@gentoo.org>
+ festival-1.4.3-r1.ebuild, festival-1.4.3.ebuild:
+ ~sparced, closes #41330
+
+ 24 Mar 2004; Jeremy Huddleston <eradicator@gentoo.org> festival-1.4.3.ebuild:
+ inherit eutils. doc in IUSE
+
+ 21 Mar 2004; Jeremy Huddleston <eradicator@gentoo.org> files/server.scm:
+ Fixed voice selection in server.scm
+
+ 21 Mar 2004; Jeremy Huddleston <eradicator@gentoo.org>
+ festival-1.4.3-r1.ebuild:
+ Massive ebuild cleanup.
+
+ 16 Mar 2004; Jeremy Huddleston <eradicator@gentoo.org>
+ festival-1.4.3-r1.ebuild, festival-1.4.3.ebuild:
+ speech-tools is in app-accessibility.
+
+ 16 Mar 2004; Jeremy Huddleston <eradicator@gentoo.org>
+ festival-1.4.3-r1.ebuild, festival-1.4.3.ebuild, metadata.xml,
+ files/festival-1.4.2.patch, files/festival-1.4.3-asterisk.patch,
+ files/festival-gcc3.3.diff, files/festival.rc, files/server.scm:
+ Moved from media-sound/festival to app-accessibility/festival.
+
+ 13 Mar 2004; Jeremy Huddleston <eradicator@gentoo.org> files/server.scm:
+ fixed sticky keyboard typo. bug #44557.
+
+ 13 Mar 2004; Jeremy Huddleston <eradicator@gentoo.org>
+ festival-1.4.2-r3.ebuild:
+ Removing borked ebuild to fix bug #41228.
+
+*festival-1.4.3-r1 (12 Mar 2004)
+
+ 12 Mar 2004; Jeremy Huddleston <eradicator@gentoo.org>
+ festival-1.4.3-r1.ebuild, files/festival.rc, files/server.scm:
+ Adding init script and configuration to use festival server... part of the fix
+ for bug #43374.
+
+ 25 Feb 2004; Sven Blumenstein <bazik@gentoo.org> festival-1.4.3.ebuild:
+ DEPEND media-sounds/speech-tools is broken on sparc, see bug #41329.
+
+ 18 Feb 2004; <augustus@gentoo.org> festival-1.4.3.ebuild:
+ Added amd64 to keywords. festival works fine on AMD64. Marked stable since
+ it's the only release.
+
+ 12 Feb 2004; Jeremy Huddleston <eradicator@gentoo.org>
+ festival-1.4.3.ebuild:
+ Fixed RDEPEND/DEPEND to close bug #41412
+
+ 11 Feb 2004; Jeremy Huddleston <eradicator@gentoo.org>
+ festival-1.4.2-r1.ebuild, festival-1.4.2-r2.ebuild,
+ festival-1.4.2-r3.ebuild, festival-1.4.2.ebuild, festival-1.4.3.ebuild:
+ Removing crusty ebuilds.
+
+ 10 Feb 2004; Jeremy Huddleston <eradicator@gentoo.org>
+ festival-1.4.3.ebuild, metadata.xml, files/festival-1.4.3-asterisk.patch:
+ Added optional patch that adds a new command named tts_textasterisk that is
+ required by Asterisk to communicate with the Festival server. Submitted by Ray
+ Russell Reese III <anti@gentoo.org> in bug #30456.
+
+ 25 Jan 2004; <carpaski@gentoo.org> festival-1.4.2*: Fixed all references
+ to $T as that is a portage variable and yields AccessViolations when set
+ incorrectly.
+
+ 08 Jan 2004; <gustavoz@gentoo.org> festival-1.4.2-r3.ebuild:
+ the parrot is stable on sparc
+
+ 10 Nov 2003; Ciaran McCreesh <ciaranm@gentoo.org> festival-1.4.2-r3.ebuild:
+ Moving to ~sparc, thanks to gust4voz in #gentoo-sparc
+
+*festival-1.4.3 (20 Jul 2003)
+
+ 20 Jul 2003; jje <jje@gentoo.org> festival-1.4.3.ebuild:
+ Version bump. Speech-tools is now split out into a seperate build.
+
+ Submitted by: Paul Giordano <giordano@covad.net>
+
+*festival-1.4.2-r3 (01 Dec 2002)
+
+ 01 Dec 2002; Matt Keadle <mkeadle@gentoo.org> festival-1.4.2-r3.ebuild
+ files/digest-festival-1.4.2-r3 ChangeLog
+
+ -r2 was an attempt at building for all arch types, but it just didn't cut it.
+ Thanks to J Robert Ray and his wicked CyrixIII/VIA-C3/VIA-C5 processor for
+ pointing this out.
+
+*festival-1.4.2-r2 (16 Nov 2002)
+
+ 16 Nov 2002; Matt Keadle <mkeadle@gentoo.org> festival-1.4.2-r2.ebuild
+ files/digest-festival-1.4.2-r2 ChangeLog
+
+ -r1 was hardcoded to i686. This build should check your arch type and build
+ accordingly. Also added IUSE="" for completeness.
+
+*festival-1.4.2-r1 (16 Nov 2002)
+
+ 16 Nov 2002; Sascha Schwabbauer <cybersystem@gentoo.org> festival-1.4.2-r1.ebuild, festival-1.4.2.ebuild :
+
+ Added -ppc to keywords.
+
+*festivial-1.4.2-r1 (14 Nov 2002)
+
+ John P. Davis <zhen@gentoo.org>
+ I changed emake to make in the top of the src_compile function. (it is commented)
+ This change is made to force festival to use -jX where X <=2.
+
+*festival-1.4.2-r1 (23 Oct 2002)
+
+ 23 Oct 2002; Matt Keadle <mkeadle@gentoo.org> festival-1.4.2-r1.ebuild
+ files/digest-festival-1.4.2-r1 files/festival-1.4.2.patch
+
+ This should take care of issues with gcc3.2, killing bug #8280. Thanks to
+ Paul Thompson, Rigo Ketelings, Tom Ribbens, Julian J., Chris Bruner,
+ Paul Oswald and Michal Maruska for all the comments made and support and
+ testing provided.
+
+*festival-1.4.2 (24 Aug 2002)
+
+ 24 Aug 2002; Sascha Schwabbauer <cybersystem@gentoo.org> festival-1.4.2.ebuild :
+
+ Added ppc to keywords.
+
+*festival-1.4.2.ebuild (28 May 2002)
+
+ 28 May 2002; Michael Nazaroff <naz@gentoo.org> Initial release of festival
+ package, requires patch's to install and build properly on a our system.
+
diff --git a/app-accessibility/festival/Manifest b/app-accessibility/festival/Manifest
new file mode 100644
index 0000000..f0cd7ee
--- /dev/null
+++ b/app-accessibility/festival/Manifest
@@ -0,0 +1,26 @@
+AUX festival-1.96_beta-gcc43.patch 547 RMD160 e5842ef3e8cd40e6af85a48b60e3b012efb213a6 SHA1 3dc6b811919db2f636435f9ca78a83b276f40755 SHA256 2bb1b1355e60636efb5e66dc5c00330343f01cc9702ac920f87b062185f03216
+AUX festival-1.96_beta-hts-voices.patch 5315 RMD160 1c09bf3fbb0e1af7c6f7eaf0d76b2434cadd5578 SHA1 55121cc6704ff74f438e9e43e89caba9033fe359 SHA256 dab29e024d70674bb7736f9b4f8202bdc2f25b1953ec842c2a2ea6df3ea07ebb
+AUX festival-1.96_beta-init-scm.patch 856 RMD160 442150175506a5ec0732ff81d685b6bb5d2bf891 SHA1 11ca7d2eb3f9e8f92fac542d3779e18c5d5c2f5b SHA256 71bc918dffd72adb21b8cd7394358929e23aa1e32849a4c7f0aa85aa6d4cba40
+AUX festival-2.0.95_beta-init-scm.patch 856 RMD160 442150175506a5ec0732ff81d685b6bb5d2bf891 SHA1 11ca7d2eb3f9e8f92fac542d3779e18c5d5c2f5b SHA256 71bc918dffd72adb21b8cd7394358929e23aa1e32849a4c7f0aa85aa6d4cba40
+AUX festival-2.1-gentoo-system.patch 7736 RMD160 1047902bfe364538f8e62be121963bc930692f8f SHA1 d7001ed3b4a86b2556f6905f3c7b5f4034430aef SHA256 bf595e5bda12ac753265a7630b8ba3042951191f180e08ed375955d76cab2d4b
+AUX festival-2.1-hts21compat-config.patch 366 RMD160 8d3dbf19f4dfce63c318eff5ef3942f0539a6518 SHA1 f13fb27896229176bb264bf495c34e418f0414de SHA256 eae70a5e2820c849c77dcbaa7a417b3666368a1826d9ec7efc231a4644421c6b
+AUX festival-2.1-hts21compat-config.patch.save 183 RMD160 84d30c8119a3ff40039a254c72a0c0faf25ea798 SHA1 4042ddd4891e0940669b2a6d37ea1ff628faa7f1 SHA256 6a21de5a480b0497bd82b7407663024f1e7d019205ea8c4467e2ddfab70f3fb0
+AUX festival-2.1-hts21compat.patch 125362 RMD160 5c290fc5f23036b011e5bd87ee8863c304797edc SHA1 5e31cbe70dd4d6cdadb8fb1737864491a4f8bdb0 SHA256 2b6ec73aa8eaca68fb3b78180c263cfff7a381b14d51e87e6f465765a9d9d9a1
+AUX festival-2.1-init-scm.patch 856 RMD160 442150175506a5ec0732ff81d685b6bb5d2bf891 SHA1 11ca7d2eb3f9e8f92fac542d3779e18c5d5c2f5b SHA256 71bc918dffd72adb21b8cd7394358929e23aa1e32849a4c7f0aa85aa6d4cba40
+AUX festival-2.1-ldflags.patch 438 RMD160 9aee57fad81e7ec679a6280bfada6fdedb59287d SHA1 0bf3780a8f120ecd74313da9546a5e8ab9fe716c SHA256 4242057ced3647a0f0c9ba3047b290ae498d30d26a0436a95237fc9a653941b2
+AUX festival.rc 633 RMD160 d169d56ecc82b3c76b9cf492b5f8a2e6ed8cf68e SHA1 54681eae7c313197b5571cc05b01d67885637749 SHA256 78ae79b864964c5f850def024d24fee467384c7f5989fb3d0b3beb9a426d40aa
+AUX server.scm 466 RMD160 78e65ec53638c588018534be55ce0d3180444dc7 SHA1 5da0a34d36a072289ffa48bb850af2465e9edce6 SHA256 47fdb50da65813547cef61d44040373e8c0d8f83adddc0e82e10502a1a9b6c3d
+AUX speech-tools-1.2.96_beta-gcc43-include.patch 878 RMD160 fb89c84949548cfdc49ddff50a7129ea63dc9b2d SHA1 afb2ecfacc123411acb7e82ae9b7c707bd32b922 SHA256 dd050d6556b484ecd494dd080c8b917fcc08c264260c4850d5392986f492febe
+DIST festival-2.1-release.tar.gz 787313 RMD160 b3c646ecc532e4e05f846db06bbab12a13ec1d6b SHA1 f0c5a4282667898c584516e3605742835f59cb77 SHA256 06f3dcbad9d26e27443fc66947a0faf0c6679482220df4b5f42a261adf758080
+DIST festlex_CMU.tar.gz 1697709 RMD160 852a007b5d50ff32d098a4dbd303a4d9c63a1802 SHA1 968f0007c4cd7d92ce0a786840b6dc64628776b7 SHA256 b485c1e8e8e265e335aa99f083963496fa64b34a314050b10d589e942e10c963
+DIST festlex_OALD.tar.gz 1472516 RMD160 d3fc4c549626dcc2a0d5d37fee7d8ebb3bf89c20 SHA1 53c9470d62da9754db85b11c2c82a3dd6b5ddc71 SHA256 61afc02c4b9dee6322412958ea8be477ee451c3cdab789b88c4907e3e377ccd5
+DIST festlex_POSLEX.tar.gz 242914 RMD160 d52d6cf4f4300751598facf1b6ff7985a8210b09 SHA1 cb7f7a3643c1af95d82144a342397cc118605f73 SHA256 5ef8cc5d35e9f2141b5a0a4774df82dc9731fe7e9800eb09ecf264f2f8503e7b
+DIST festvox_cmu_us_awb_cg.tar.gz 4452760 RMD160 02c34c8fbedecf51046e02e9c582729ebc3d0fae SHA1 1e13ec225a7f9313633c238b7bc300ae139c6dc0 SHA256 f6010538b3e2f32152cc75741a62b8c7eecfaa3e51153c9db735723002807264
+DIST festvox_cmu_us_rms_cg.tar.gz 5222226 RMD160 dceae44e699a64b75104f44b373fc20cddaf90c8 SHA1 bef75ac5657c5d23bc7fa1f69e6010a12fef47b6 SHA256 5f0ffc3181df76b63f3c13db3cdc6e67e02639a3982c6b6fa55bbbd2fe1cbc30
+DIST festvox_cmu_us_slt_arctic_hts.tar.gz 955706 RMD160 541cc0959305c656bc4af4b848c666a707671fe3 SHA1 3e8224f46be9aa04e576b8ab9d218753bf5c80fb SHA256 adcc187fc7db39e17c119811936be57f0b788908f06c3d9b330856ad8357b128
+DIST festvox_kallpc16k.tar.gz 4104056 RMD160 f8be814267359ac9d4fa5d0bcade18e15b64beb2 SHA1 ad18502ae0fd10bdc3db189fa9afa8a167eceebb SHA256 9eb6336f35c202c8069d37e489fb009a7e9fd8539cd47644329db1e92c6aba83
+DIST festvox_rablpc16k.tar.gz 5369001 RMD160 d98cc1df3e922fe9894cf51e5913f8bfd0b99889 SHA1 164983d46df6a09b07a5550f4613047f94b1764a SHA256 54835837ca734e62c0210c0f9dd27380d2ad89819ae91ec6e8cfab4e515b7bdc
+DIST speech_tools-2.1-release.tar.gz 1681999 RMD160 59831fbe607f05308f339a3cfb3af53d7337328b SHA1 bbf43b259de8bb91e0c5e8a1defc6e45a10e60f9 SHA256 ff6167cd929a88e2f91b47191c6c4dae87c9c06ba39fccc4465af9d79e9b2be9
+EBUILD festival-2.1-r1.ebuild 3790 RMD160 bf7ce870f12e82a51390b3a49576b0acf93e4375 SHA1 fe62f964ef40e7fec5a1ffbc5af4d2be943a8692 SHA256 fad9b71616a591118f576e5bf452d3bb69ff85c18d5ea35ba8d14e23d55265a0
+MISC ChangeLog 19575 RMD160 b69049f882b8dbf37094f86144a30e26c404b4fc SHA1 06f00e11c66ada132774d4a7b8ca05aed2452bbb SHA256 85c880992b0f55dbc2935170e0fbe02412017df2455cbe2ff74d7fb412eeb300
+MISC metadata.xml 321 RMD160 85d595924e5c87d59427af1f743c76c62cb08eb1 SHA1 f1b34f3b131295eda78d168d1fcebecf3d1d0ada SHA256 54fb73517995daec7601b063031a9021800c7d8fdcc73d969060b7447f0ce6d7
diff --git a/app-accessibility/festival/festival-2.1-r1.ebuild b/app-accessibility/festival/festival-2.1-r1.ebuild
new file mode 100644
index 0000000..9fe0fd7
--- /dev/null
+++ b/app-accessibility/festival/festival-2.1-r1.ebuild
@@ -0,0 +1,124 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-accessibility/festival/festival-2.1.ebuild,v 1.12 2012/05/31 02:14:16 zmedico Exp $
+
+EAPI="2"
+inherit eutils multilib toolchain-funcs user
+
+MY_PV="${PV}-release"
+MY_P=${PN}-${MY_PV}
+
+DESCRIPTION="Festival Text to Speech engine"
+HOMEPAGE="http://www.cstr.ed.ac.uk/projects/festival/"
+SITE="http://www.festvox.org/packed/${PN}/${PV}"
+SRC_URI="${SITE}/${MY_P}.tar.gz
+ ${SITE}/festlex_CMU.tar.gz
+ ${SITE}/festlex_OALD.tar.gz
+ ${SITE}/festlex_POSLEX.tar.gz
+ ${SITE}/festvox_cmu_us_awb_cg.tar.gz
+ ${SITE}/festvox_cmu_us_rms_cg.tar.gz
+ ${SITE}/festvox_cmu_us_slt_arctic_hts.tar.gz
+ ${SITE}/festvox_rablpc16k.tar.gz
+ ${SITE}/festvox_kallpc16k.tar.gz
+ ${SITE}/speech_tools-${MY_PV}.tar.gz"
+
+LICENSE="FESTIVAL BSD as-is"
+SLOT="0"
+KEYWORDS="alpha amd64 hppa ia64 ~mips ppc ppc64 sparc x86 ~x86-fbsd"
+IUSE=""
+
+DEPEND="~app-accessibility/speech-tools-2.1
+ >=sys-libs/ncurses-5.6-r2"
+RDEPEND="${DEPEND}"
+
+S=${WORKDIR}/festival
+
+pkg_setup() {
+ enewuser festival -1 -1 -1 audio
+}
+
+src_prepare() {
+ # tell festival to use the speech-tools we have installed.
+ sed -i -e "s:\(EST=\).*:\1${EPREFIX}/usr/share/speech-tools:" "${S}"/config/config.in
+ sed -i -e "s:\$(EST)/lib:/usr/$(get_libdir):" "${S}"/config/project.mak
+
+ # fix the reference to /usr/lib/festival
+ sed -i -e "s:\(FTLIBDIR.*=.*\)\$.*:\1${EPREFIX}/usr/share/festival:" "${S}"/config/project.mak
+
+ # Fix path for examples in festival.scm
+ sed -i -e "s:\.\./examples/:${EPREFIX}/usr/share/doc/${PF}/examples/:" "${S}"/lib/festival.scm
+
+ epatch "${FILESDIR}/${P}-ldflags.patch"
+ epatch "${FILESDIR}/${P}-init-scm.patch"
+ epatch "${FILESDIR}/${P}-gentoo-system.patch"
+ epatch "${FILESDIR}/${P}-hts21compat.patch"
+ epatch "${FILESDIR}/${P}-hts21compat-config.patch"
+ # copy what we need for MultiSyn from speech_tools.
+ cp -pr "${WORKDIR}"/speech_tools/base_class "${S}"/src/modules/MultiSyn
+
+ echo "(Parameter.set 'Audio_Command \"aplay -q -c 1 -t raw -f s16 -r \$SR \$FILE\")" >> "${S}"/lib/siteinit.scm
+ echo "(Parameter.set 'Audio_Method 'Audio_Command)" >> "${S}"/lib/siteinit.scm
+}
+
+src_configure() {
+ econf || die "econf failed"
+}
+
+src_compile() {
+ emake -j1 PROJECT_LIBDEPS="" REQUIRED_LIBDEPS="" LOCAL_LIBDEPS="" \
+ OPTIMISE_CXXFLAGS="${CXXFLAGS}" OPTIMISE_CCFLAGS="${CFLAGS}" \
+ LDFLAGS="${LDFLAGS}" \
+ CC="$(tc-getCC)" CXX="$(tc-getCXX)" || die "emake failed"
+}
+
+src_install() {
+ # Install the binaries
+ dobin src/main/festival
+ dobin lib/etc/*Linux*/audsp
+ dolib.a src/lib/libFestival.a
+
+ # Install the main libraries
+ insinto /usr/share/festival
+ doins -r lib/*
+
+ # Install the examples
+ insinto /usr/share/doc/${PF}
+ doins -r examples
+
+ # Need to fix saytime, etc. to look for festival in the correct spot
+ for ex in "${D}"/usr/share/doc/${PF}/examples/*.sh; do
+ exnoext=${ex%%.sh}
+ chmod a+x "${exnoext}"
+ dosed "s:${S}/bin/festival:/usr/bin/festival:" "${exnoext##$D}"
+ done
+
+ # Install the header files
+ insinto /usr/include/festival
+ doins src/include/*.h
+
+ insinto /etc/festival
+ doins lib/site*
+
+ # Install the docs
+ dodoc "${S}"/{ACKNOWLEDGMENTS,NEWS,README}
+ doman "${S}"/doc/{festival.1,festival_client.1}
+
+ # create the directory where our log file will go.
+ diropts -m 0755 -o festival -g audio
+ keepdir /var/log/festival
+
+}
+
+pkg_postinst() {
+ elog
+ elog " Useful examples include saytime, text2wave. For example, try:"
+ elog " \"/usr/share/doc/${PF}/examples/saytime\""
+ elog
+ elog " Or for something more fun:"
+ elog ' "echo "Gentoo can speak" | festival --tts"'
+ elog
+ elog "This version also allows configuration of site specific"
+ elog "initialization in /etc/festival/siteinit.scm and"
+ elog "variables in /etc/festival/sitevars.scm."
+ elog
+}
diff --git a/app-accessibility/festival/files/festival-1.96_beta-gcc43.patch b/app-accessibility/festival/files/festival-1.96_beta-gcc43.patch
new file mode 100644
index 0000000..d4f0120
--- /dev/null
+++ b/app-accessibility/festival/files/festival-1.96_beta-gcc43.patch
@@ -0,0 +1,12 @@
+diff -Naur festival-orig/src/modules/Text/text_modes.cc festival/src/modules/Text/text_modes.cc
+--- festival-orig/src/modules/Text/text_modes.cc 2004-09-30 07:04:18.000000000 -0600
++++ festival/src/modules/Text/text_modes.cc 2008-01-07 22:32:44.000000000 -0600
+@@ -60,7 +60,7 @@
+ {
+
+ volatile EST_String tmpname = make_tmp_filename();
+- volatile EST_String inname = get_c_string(filename);
++ volatile EST_String inname(get_c_string(filename));
+ volatile EST_String filter;
+ volatile EST_TokenStream ts;
+ volatile LISP func;
diff --git a/app-accessibility/festival/files/festival-1.96_beta-hts-voices.patch b/app-accessibility/festival/files/festival-1.96_beta-hts-voices.patch
new file mode 100644
index 0000000..9ed1ac3
--- /dev/null
+++ b/app-accessibility/festival/files/festival-1.96_beta-hts-voices.patch
@@ -0,0 +1,100 @@
+diff -Naur festival.orig/lib/voices/us/cmu_us_awb_arctic_hts/festvox/cmu_us_awb_arctic_f0model.scm festival/lib/voices/us/cmu_us_awb_arctic_hts/festvox/cmu_us_awb_arctic_f0model.scm
+--- festival.orig/lib/voices/us/cmu_us_awb_arctic_hts/festvox/cmu_us_awb_arctic_f0model.scm 2003-08-01 15:12:59.000000000 +0100
++++ festival/lib/voices/us/cmu_us_awb_arctic_hts/festvox/cmu_us_awb_arctic_f0model.scm 2009-01-28 21:34:30.000000000 +0000
+@@ -35,7 +35,7 @@
+ ;;;
+
+ ;;; Load any necessary files here
+-;(require 'f2bf0lr)
++(require 'f2bf0lr)
+ (require 'cmu_us_awb_arctic_f0clunits)
+
+ (set! cmu_us_awb_arctic_int_lr_params
+diff -Naur festival.orig/lib/voices/us/cmu_us_awb_arctic_hts/festvox/cmu_us_awb_arctic_hts.scm festival/lib/voices/us/cmu_us_awb_arctic_hts/festvox/cmu_us_awb_arctic_hts.scm
+--- festival.orig/lib/voices/us/cmu_us_awb_arctic_hts/festvox/cmu_us_awb_arctic_hts.scm 2004-06-07 08:50:56.000000000 +0100
++++ festival/lib/voices/us/cmu_us_awb_arctic_hts/festvox/cmu_us_awb_arctic_hts.scm 2009-01-28 21:33:58.000000000 +0000
+@@ -115,12 +115,12 @@
+ (list "-md" (path-append hts_data_dir "duration.pdf"))
+ (list "-mm" (path-append hts_data_dir "mcep.pdf"))
+ (list "-mf" (path-append hts_data_dir "lf0.pdf"))
+- '("-a" " 0.420000")
+- '("-r" " 0.000000")
+- '("-fs" "1.000000")
+- '("-fm" "0.000000")
+- '("-u" " 0.500000")
+- '("-l" " 0.000000")
++ '("-a" 0.420000)
++ '("-r" 0.000000)
++ '("-fs" 1.000000)
++ '("-fm" 0.000000)
++ '("-u" 0.500000)
++ '("-l" 0.000000)
+ ))
+
+ ;; This function is called to setup a voice. It will typically
+diff -Naur festival.orig/lib/voices/us/cmu_us_bdl_arctic_hts/festvox/cmu_us_bdl_arctic_hts.scm festival/lib/voices/us/cmu_us_bdl_arctic_hts/festvox/cmu_us_bdl_arctic_hts.scm
+--- festival.orig/lib/voices/us/cmu_us_bdl_arctic_hts/festvox/cmu_us_bdl_arctic_hts.scm 2004-06-07 07:29:03.000000000 +0100
++++ festival/lib/voices/us/cmu_us_bdl_arctic_hts/festvox/cmu_us_bdl_arctic_hts.scm 2009-01-28 21:33:58.000000000 +0000
+@@ -115,12 +115,12 @@
+ (list "-md" (path-append hts_data_dir "duration.pdf"))
+ (list "-mm" (path-append hts_data_dir "mcep.pdf"))
+ (list "-mf" (path-append hts_data_dir "lf0.pdf"))
+- '("-a" " 0.420000")
+- '("-r" " 0.000000")
+- '("-fs" "1.000000")
+- '("-fm" "0.000000")
+- '("-u" " 0.500000")
+- '("-l" " 0.000000")
++ '("-a" 0.420000)
++ '("-r" 0.000000)
++ '("-fs" 1.000000)
++ '("-fm" 0.000000)
++ '("-u" 0.500000)
++ '("-l" 0.000000)
+ ))
+
+ ;; This function is called to setup a voice. It will typically
+diff -Naur festival.orig/lib/voices/us/cmu_us_jmk_arctic_hts/festvox/cmu_us_jmk_arctic_hts.scm festival/lib/voices/us/cmu_us_jmk_arctic_hts/festvox/cmu_us_jmk_arctic_hts.scm
+--- festival.orig/lib/voices/us/cmu_us_jmk_arctic_hts/festvox/cmu_us_jmk_arctic_hts.scm 2004-06-07 06:59:22.000000000 +0100
++++ festival/lib/voices/us/cmu_us_jmk_arctic_hts/festvox/cmu_us_jmk_arctic_hts.scm 2009-01-28 21:33:58.000000000 +0000
+@@ -115,12 +115,12 @@
+ (list "-md" (path-append hts_data_dir "duration.pdf"))
+ (list "-mm" (path-append hts_data_dir "mcep.pdf"))
+ (list "-mf" (path-append hts_data_dir "lf0.pdf"))
+- '("-a" " 0.420000")
+- '("-r" " 0.000000")
+- '("-fs" "1.000000")
+- '("-fm" "0.000000")
+- '("-u" " 0.500000")
+- '("-l" " 0.000000")
++ '("-a" 0.420000)
++ '("-r" 0.000000)
++ '("-fs" 1.000000)
++ '("-fm" 0.000000)
++ '("-u" 0.500000)
++ '("-l" 0.000000)
+ ))
+
+ ;; This function is called to setup a voice. It will typically
+diff -Naur festival.orig/lib/voices/us/cmu_us_slt_arctic_hts/festvox/cmu_us_slt_arctic_hts.scm festival/lib/voices/us/cmu_us_slt_arctic_hts/festvox/cmu_us_slt_arctic_hts.scm
+--- festival.orig/lib/voices/us/cmu_us_slt_arctic_hts/festvox/cmu_us_slt_arctic_hts.scm 2004-06-07 04:54:46.000000000 +0100
++++ festival/lib/voices/us/cmu_us_slt_arctic_hts/festvox/cmu_us_slt_arctic_hts.scm 2009-01-28 21:33:58.000000000 +0000
+@@ -115,12 +115,12 @@
+ (list "-md" (path-append hts_data_dir "duration.pdf"))
+ (list "-mm" (path-append hts_data_dir "mcep.pdf"))
+ (list "-mf" (path-append hts_data_dir "lf0.pdf"))
+- '("-a" " 0.420000")
+- '("-r" " 0.000000")
+- '("-fs" "1.000000")
+- '("-fm" "0.000000")
+- '("-u" " 0.500000")
+- '("-l" " 0.000000")
++ '("-a" 0.420000)
++ '("-r" 0.000000)
++ '("-fs" 1.000000)
++ '("-fm" 0.000000)
++ '("-u" 0.500000)
++ '("-l" 0.000000)
+ ))
+
+ ;; This function is called to setup a voice. It will typically
diff --git a/app-accessibility/festival/files/festival-1.96_beta-init-scm.patch b/app-accessibility/festival/files/festival-1.96_beta-init-scm.patch
new file mode 100644
index 0000000..efe575b
--- /dev/null
+++ b/app-accessibility/festival/files/festival-1.96_beta-init-scm.patch
@@ -0,0 +1,24 @@
+--- festival/lib/init.scm 2006-09-15 01:34:32.000000000 -0500
++++ festival/lib/init.scm 2006-09-15 01:50:30.000000000 -0500
+@@ -52,8 +52,8 @@
+
+ ;;; A chance to set various variables to a local setting e.g.
+ ;;; lexdir, voices_dir audio etc etc.
+-(if (probe_file (path-append libdir "sitevars.scm"))
+- (load (path-append libdir "sitevars.scm")))
++(if (probe_file "/etc/festival/sitevars.scm")
++ (load "/etc/festival/sitevars.scm"))
+
+ ;;; CSTR siod extensions
+ (require 'cstr)
+@@ -133,8 +133,8 @@
+ ;;;
+ ;;; Local site initialization, if the file exists load it
+ ;;;
+-(if (probe_file (path-append libdir "siteinit.scm"))
+- (load (path-append libdir "siteinit.scm")))
++(if (probe_file "/etc/festival/siteinit.scm")
++ (load "/etc/festival/siteinit.scm"))
+
+ ;;; User initialization, if a user has a personal customization
+ ;;; file loaded it
diff --git a/app-accessibility/festival/files/festival-2.0.95_beta-init-scm.patch b/app-accessibility/festival/files/festival-2.0.95_beta-init-scm.patch
new file mode 100644
index 0000000..efe575b
--- /dev/null
+++ b/app-accessibility/festival/files/festival-2.0.95_beta-init-scm.patch
@@ -0,0 +1,24 @@
+--- festival/lib/init.scm 2006-09-15 01:34:32.000000000 -0500
++++ festival/lib/init.scm 2006-09-15 01:50:30.000000000 -0500
+@@ -52,8 +52,8 @@
+
+ ;;; A chance to set various variables to a local setting e.g.
+ ;;; lexdir, voices_dir audio etc etc.
+-(if (probe_file (path-append libdir "sitevars.scm"))
+- (load (path-append libdir "sitevars.scm")))
++(if (probe_file "/etc/festival/sitevars.scm")
++ (load "/etc/festival/sitevars.scm"))
+
+ ;;; CSTR siod extensions
+ (require 'cstr)
+@@ -133,8 +133,8 @@
+ ;;;
+ ;;; Local site initialization, if the file exists load it
+ ;;;
+-(if (probe_file (path-append libdir "siteinit.scm"))
+- (load (path-append libdir "siteinit.scm")))
++(if (probe_file "/etc/festival/siteinit.scm")
++ (load "/etc/festival/siteinit.scm"))
+
+ ;;; User initialization, if a user has a personal customization
+ ;;; file loaded it
diff --git a/app-accessibility/festival/files/festival-2.1-gentoo-system.patch b/app-accessibility/festival/files/festival-2.1-gentoo-system.patch
new file mode 100644
index 0000000..a09e137
--- /dev/null
+++ b/app-accessibility/festival/files/festival-2.1-gentoo-system.patch
@@ -0,0 +1,124 @@
+diff -uNr festival.orig/config/systems/GentooLinux.mak festival/config/systems/GentooLinux.mak
+--- festival.orig/config/systems/GentooLinux.mak 1969-12-31 19:00:00.000000000 -0500
++++ festival/config/systems/GentooLinux.mak 2011-02-09 10:43:28.000000000 -0500
+@@ -0,0 +1,42 @@
++ ###########################################################################
++ ## ##
++ ## Centre for Speech Technology Research ##
++ ## University of Edinburgh, UK ##
++ ## Copyright (c) 1996 ##
++ ## All Rights Reserved. ##
++ ## ##
++ ## Permission is hereby granted, free of charge, to use and distribute ##
++ ## this software and its documentation without restriction, including ##
++ ## without limitation the rights to use, copy, modify, merge, publish, ##
++ ## distribute, sublicense, and/or sell copies of this work, and to ##
++ ## permit persons to whom this work is furnished to do so, subject to ##
++ ## the following conditions: ##
++ ## 1. The code must retain the above copyright notice, this list of ##
++ ## conditions and the following disclaimer. ##
++ ## 2. Any modifications must be clearly marked as such. ##
++ ## 3. Original authors' names are not deleted. ##
++ ## 4. The authors' names are not used to endorse or promote products ##
++ ## derived from this software without specific prior written ##
++ ## permission. ##
++ ## ##
++ ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ##
++ ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ##
++ ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ##
++ ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ##
++ ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ##
++ ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ##
++ ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ##
++ ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ##
++ ## THIS SOFTWARE. ##
++ ## ##
++ ###########################################################################
++ ## ##
++ ## Author: William Hubbs <williamh@gentoo.org> ##
++ ## -------------------------------------------------------------------- ##
++ ## Settings for Gentoo Linux distributions. ##
++ ## ##
++ ###########################################################################
++
++MANDIR=$(INSTALL_PREFIX)/share/man
++# Gentoo does not use termcap
++OS_LIBS = $(LDFLAGS) -ldl -lncurses
+diff -uNr festival.orig/config/systems/Makefile festival/config/systems/Makefile
+--- festival.orig/config/systems/Makefile 2011-02-09 10:41:01.000000000 -0500
++++ festival/config/systems/Makefile 2011-02-09 10:44:22.000000000 -0500
+@@ -41,6 +41,7 @@
+ Linux.mak \
+ RedHatLinux.mak \
+ DebianGNULinux.mak \
++ GentooLinux.mak \
+ alpha_Linux.mak \
+ alpha_OSF1V4.0.mak \
+ alpha_RedHatLinux.mak \
+@@ -94,6 +95,7 @@
+ sparc_SunOS5.8.mak \
+ sparc_SunOS5.mak \
+ unknown_DebianGNULinux.mak \
++ unknown_GentooLinux.mak \
+ unknown_Linux.mak \
+ unknown_RedHatLinux.mak \
+ power_macintosh_Darwin.mak \
+diff -uNr festival.orig/config/systems/unknown_GentooLinux.mak festival/config/systems/unknown_GentooLinux.mak
+--- festival.orig/config/systems/unknown_GentooLinux.mak 1969-12-31 19:00:00.000000000 -0500
++++ festival/config/systems/unknown_GentooLinux.mak 2011-02-09 10:45:34.000000000 -0500
+@@ -0,0 +1,41 @@
++###########################################################################
++## ##
++## Centre for Speech Technology Research ##
++## University of Edinburgh, UK ##
++## Copyright (c) 1996 ##
++## All Rights Reserved. ##
++## ##
++## Permission is hereby granted, free of charge, to use and distribute ##
++## this software and its documentation without restriction, including ##
++## without limitation the rights to use, copy, modify, merge, publish, ##
++## distribute, sublicense, and/or sell copies of this work, and to ##
++## permit persons to whom this work is furnished to do so, subject to ##
++## the following conditions: ##
++## 1. The code must retain the above copyright notice, this list of ##
++## conditions and the following disclaimer. ##
++## 2. Any modifications must be clearly marked as such. ##
++## 3. Original authors' names are not deleted. ##
++## 4. The authors' names are not used to endorse or promote products ##
++## derived from this software without specific prior written ##
++## permission. ##
++## ##
++## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ##
++## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ##
++## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ##
++## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ##
++## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ##
++## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ##
++## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ##
++## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ##
++## THIS SOFTWARE. ##
++## ##
++###########################################################################
++## ##
++## Author: William Hubbs <williamh@gentoo.org> ##
++## -------------------------------------------------------------------- ##
++## Settings for Gentoo Linux distributions. ##
++## ##
++###########################################################################
++
++include $(EST)/config/systems/Linux.mak
++include $(EST)/config/systems/GentooLinux.mak
+diff -uNr festival.orig/config/system.sh festival/config/system.sh
+--- festival.orig/config/system.sh 2011-02-09 10:41:01.000000000 -0500
++++ festival/config/system.sh 2011-02-09 10:42:10.000000000 -0500
+@@ -70,6 +70,10 @@
+ then
+ OSTYPE=DebianGNULinux
+ OSREV=`cat /etc/debian_version`
++ elif [ -f "/etc/gentoo-release" ]
++ then
++ OSTYPE=GentooLinux
++ OSREV=""
+ else
+ # Generic unknown GNU/Linux system.
+ OSTYPE=Linux
diff --git a/app-accessibility/festival/files/festival-2.1-hts21compat-config.patch b/app-accessibility/festival/files/festival-2.1-hts21compat-config.patch
new file mode 100644
index 0000000..773ee83
--- /dev/null
+++ b/app-accessibility/festival/files/festival-2.1-hts21compat-config.patch
@@ -0,0 +1,10 @@
+--- config/config.in.old 2012-07-17 11:41:46.632232556 +0700
++++ config/config.in 2012-07-17 11:45:03.928241975 +0700
+@@ -58,6 +58,7 @@
+ ALSO_INCLUDE += clunits clustergen MultiSyn
+
+ ## NITECH and Tokyo Institute of Technologies HTS support
++ALSO_INCLUDE += hts21_engine
+ ALSO_INCLUDE += hts_engine
+
+ ## Old diphone code that will be delete, left in only for some
diff --git a/app-accessibility/festival/files/festival-2.1-hts21compat-config.patch.save b/app-accessibility/festival/files/festival-2.1-hts21compat-config.patch.save
new file mode 100644
index 0000000..89ca532
--- /dev/null
+++ b/app-accessibility/festival/files/festival-2.1-hts21compat-config.patch.save
@@ -0,0 +1,5 @@
+ ## NITECH and Tokyo Institute of Technologies HTS support
++ALSO_INCLUDE += hts21_engine
+ ALSO_INCLUDE += hts_engine
+
+ ## Old diphone code that will be delete, left in only for some
diff --git a/app-accessibility/festival/files/festival-2.1-hts21compat.patch b/app-accessibility/festival/files/festival-2.1-hts21compat.patch
new file mode 100644
index 0000000..acbc2c4
--- /dev/null
+++ b/app-accessibility/festival/files/festival-2.1-hts21compat.patch
@@ -0,0 +1,3642 @@
+Description: Fix backward compatibility for HTS 2.1 voices into festival
+ This patch introduces a module hts21_engine which has backward compatibility
+with older HTS 2.1 voices. As of Festival 2.095 beta festival defaults
+to HTS2.1.1 voices which have a different API. To use festival with older
+voices, this patch must be applied and a minor change to HTS 2.1 voices must
+be made. Two lines in the older voice must be changed to point to the compatibility
+module. These lines are in the festvox directory of the voice but the name of the file
+changes from voice to voice. The lines to be replaced are the following:
+
+(require 'hts)
+
+must be replaced with:
+
+(require 'hts21compat)
+
+and the line:
+
+ (Parameter.set 'Synth_Method 'HTS)
+
+must be replaced with:
+
+ (Parameter.set 'Synth_Method 'HTS21)
+
+This patch is temporary. It is expected that as newer voices become more
+available it will be removed from Debian festival.
+
+Author: Peter Drysdale <drysdalepete@gmail.com>
+
+---
+
+Origin: other
+Bug-Debian: http://bugs.debian.org/589614
+Forwarded: <not-needed>
+Reviewed-By: Peter Drysdale <drysdalepete@gmail.com>
+Last-Update: <2011-11-25>
+
+--- /dev/null
++++ src/modules/hts21_engine/model.cc
+@@ -0,0 +1,225 @@
++/* --------------------------------------------------------------- */
++/* The HMM-Based Speech Synthesis System (HTS): version 1.1b */
++/* HTS Working Group */
++/* */
++/* Department of Computer Science */
++/* Nagoya Institute of Technology */
++/* and */
++/* Interdisciplinary Graduate School of Science and Engineering */
++/* Tokyo Institute of Technology */
++/* Copyright (c) 2001-2003 */
++/* All Rights Reserved. */
++/* */
++/* Permission is hereby granted, free of charge, to use and */
++/* distribute this software and its documentation without */
++/* restriction, including without limitation the rights to use, */
++/* copy, modify, merge, publish, distribute, sublicense, and/or */
++/* sell copies of this work, and to permit persons to whom this */
++/* work is furnished to do so, subject to the following conditions: */
++/* */
++/* 1. The code must retain the above copyright notice, this list */
++/* of conditions and the following disclaimer. */
++/* */
++/* 2. Any modifications must be clearly marked as such. */
++/* */
++/* NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF TECHNOLOGY, */
++/* HTS WORKING GROUP, AND THE CONTRIBUTORS TO THIS WORK DISCLAIM */
++/* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */
++/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
++/* SHALL NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF */
++/* TECHNOLOGY, HTS WORKING GROUP, NOR THE CONTRIBUTORS BE LIABLE */
++/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY */
++/* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, */
++/* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS */
++/* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR */
++/* PERFORMANCE OF THIS SOFTWARE. */
++/* */
++/* --------------------------------------------------------------- */
++/* model.c : read model and search pdf from models */
++/* */
++/* 2003/06/11 by Heiga Zen */
++/* --------------------------------------------------------------- */
++
++#include <cstdio>
++#include <cstring>
++#include <cstdlib>
++#include "festival.h"
++
++#include "defaults.h"
++#include "misc.h"
++#include "model.h"
++#include "global.h"
++
++/* LoadModelFiles : load model files from files to pdf array */
++void LoadModelFiles(ModelSet *ms)
++{
++ int i, j, k;
++
++ /*-------------------- load pdfs for duration --------------------*/
++ /* read the number of states & the number of pdfs (leaf nodes) */
++ fread(&ms->nstate, sizeof(int), 1, ms->fp[DUR]);
++ if (EST_BIG_ENDIAN) ms->nstate = SWAPINT(ms->nstate);
++ fread(&ms->ndurpdf, sizeof(int), 1, ms->fp[DUR]);
++ if (EST_BIG_ENDIAN) ms->ndurpdf = SWAPINT(ms->ndurpdf);
++
++ ms->durpdf = walloc(float *,ms->ndurpdf+2);
++
++ /* read pdfs (mean & variance) */
++ for (i=1; i<=ms->ndurpdf; i++) {
++ ms->durpdf[i] = walloc(float,2*ms->nstate+2);
++ fread(ms->durpdf[i]+2, sizeof(float), 2*ms->nstate, ms->fp[DUR]);
++ if (EST_BIG_ENDIAN)
++ swap_bytes_float(ms->durpdf[i]+2,2*ms->nstate);
++ }
++
++ /*-------------------- load pdfs for mcep --------------------*/
++ /* read vector size for spectrum */
++ fread(&ms->mcepvsize, sizeof(int), 1, ms->fp[MCP]);
++ if (EST_BIG_ENDIAN) ms->mcepvsize = SWAPINT(ms->mcepvsize);
++ ms->nmceppdf = walloc(int,ms->nstate);
++
++ /* read the number of pdfs for each state position */
++ fread(ms->nmceppdf, sizeof(int), ms->nstate, ms->fp[MCP]);
++ if (EST_BIG_ENDIAN) swap_bytes_int(ms->nmceppdf,ms->nstate);
++ ms->mceppdf = walloc(float **,ms->nstate+2);
++
++ /* read pdfs (mean, variance) */
++ for (i=2; i<=ms->nstate+1; i++) {
++ ms->mceppdf[i] = walloc(float *,ms->nmceppdf[i-2]+2);
++ for (j=1; j<=ms->nmceppdf[i-2]; j++) {
++ ms->mceppdf[i][j] = walloc(float,ms->mcepvsize*2);
++ fread(ms->mceppdf[i][j], sizeof(float), ms->mcepvsize*2, ms->fp[MCP]);
++ if (EST_BIG_ENDIAN)
++ swap_bytes_float(ms->mceppdf[i][j],ms->mcepvsize*2);
++ }
++ }
++
++ /*-------------------- load pdfs for log F0 --------------------*/
++ /* read the number of streams for f0 modeling */
++ fread(&ms->lf0stream, sizeof(int), 1, ms->fp[LF0]);
++ if (EST_BIG_ENDIAN) ms->lf0stream = SWAPINT(ms->lf0stream);
++ ms->nlf0pdf = walloc(int,ms->nstate+2);
++ /* read the number of pdfs for each state position */
++ fread(ms->nlf0pdf, sizeof(int), ms->nstate, ms->fp[LF0]);
++ if (EST_BIG_ENDIAN) swap_bytes_int(ms->nlf0pdf,ms->nstate);
++ ms->lf0pdf = walloc(float ***,ms->nstate+3);
++
++ /* read pdfs (mean, variance & weight) */
++ for (i=2; i<=ms->nstate+1; i++) {
++ ms->lf0pdf[i] = walloc(float **,ms->nlf0pdf[i-2]+1);
++ for (j=1; j<=ms->nlf0pdf[i-2]; j++) {
++ ms->lf0pdf[i][j] = walloc(float *,ms->lf0stream+1);
++ for (k=1; k<=ms->lf0stream; k++) {
++ ms->lf0pdf[i][j][k] = walloc(float,4);
++ fread(ms->lf0pdf[i][j][k], sizeof(float), 4, ms->fp[LF0]);
++ if (EST_BIG_ENDIAN)
++ swap_bytes_float(ms->lf0pdf[i][j][k],4);
++ }
++ }
++ }
++}
++
++/* FindDurPDF : find duration pdf from pdf array */
++void FindDurPDF (Model *m, ModelSet *ms, float rho, int diffdur)
++{
++ float data, mean, variance;
++ int s, idx;
++
++ idx = m->durpdf;
++
++ m->dur = walloc(int,ms->nstate+2);
++ m->totaldur = 0;
++
++ for (s=2; s<=ms->nstate+1; s++) {
++ mean = ms->durpdf[idx][s];
++ variance = ms->durpdf[idx][ms->nstate+s];
++ data = mean + rho*variance;
++
++ if (data < 0.0) data = 0.0;
++
++ m->dur[s] = (int) (data+diffdur+0.5);
++ m->totaldur += m->dur[s];
++ diffdur += (int)(data-(float)m->dur[s]);
++ }
++}
++
++/* FindLF0PDF : find required pdf for log F0 from pdf array */
++void FindLF0PDF (int s, Model *m, ModelSet *ms, float uvthresh)
++{
++ int idx, stream;
++ float *weight;
++
++ idx = m->lf0pdf[s];
++
++ if (m->lf0mean[s]) wfree(m->lf0mean[s]);
++ m->lf0mean[s] = walloc(float,ms->lf0stream+1);
++ if (m->lf0variance[s]) wfree(m->lf0variance[s]);
++ m->lf0variance[s] = walloc(float,ms->lf0stream+1);
++
++ for (stream=1; stream<=ms->lf0stream; stream++) {
++ m->lf0mean [s][stream] = ms->lf0pdf[s][idx][stream][0];
++ m->lf0variance[s][stream] = ms->lf0pdf[s][idx][stream][1];
++ weight = ms->lf0pdf[s][idx][stream]+2;
++
++ if (stream==1) {
++ if (weight[0] > uvthresh)
++ m->voiced[s] = 1;
++ else
++ m->voiced[s] = 0;
++ }
++ }
++}
++
++/* FindMcpPDF : find pdf for mel-cepstrum from pdf array */
++void FindMcpPDF (int s, Model *m, ModelSet *ms)
++{
++ int idx;
++
++ idx = m->mceppdf[s];
++
++ m->mcepmean[s] = ms->mceppdf[s][idx];
++ m->mcepvariance[s] = ms->mceppdf[s][idx]+ms->mcepvsize;
++}
++
++void InitModelSet (ModelSet *ms)
++{
++ ms->fp[DUR] = NULL;
++ ms->fp[LF0] = NULL;
++ ms->fp[MCP] = NULL;
++
++ return;
++}
++
++void DeleteModelSet(ModelSet *ms)
++{
++ int i,j,k;
++
++ for (i=1; i<=ms->ndurpdf; i++)
++ wfree(ms->durpdf[i]);
++ wfree(ms->durpdf);
++
++ for (i=2; i<=ms->nstate+1; i++)
++ {
++ for (j=1; j<=ms->nmceppdf[i-2]; j++)
++ wfree(ms->mceppdf[i][j]);
++ wfree(ms->mceppdf[i]);
++ }
++ wfree(ms->nmceppdf);
++ wfree(ms->mceppdf);
++
++ for (i=2; i<=ms->nstate+1; i++)
++ {
++ for (j=1; j<=ms->nlf0pdf[i-2]; j++)
++ {
++ for (k=1; k <=ms->lf0stream; k++)
++ wfree(ms->lf0pdf[i][j][k]);
++ wfree(ms->lf0pdf[i][j]);
++ }
++ wfree(ms->lf0pdf[i]);
++ }
++ wfree(ms->nlf0pdf);
++ wfree(ms->lf0pdf);
++}
++
++/* -------------------- End of "model.c" -------------------- */
++
+--- /dev/null
++++ src/modules/hts21_engine/mlpg.h
+@@ -0,0 +1,82 @@
++/* --------------------------------------------------------------- */
++/* The HMM-Based Speech Synthesis System (HTS): version 1.1b */
++/* HTS Working Group */
++/* */
++/* Department of Computer Science */
++/* Nagoya Institute of Technology */
++/* and */
++/* Interdisciplinary Graduate School of Science and Engineering */
++/* Tokyo Institute of Technology */
++/* Copyright (c) 2001-2003 */
++/* All Rights Reserved. */
++/* */
++/* Permission is hereby granted, free of charge, to use and */
++/* distribute this software and its documentation without */
++/* restriction, including without limitation the rights to use, */
++/* copy, modify, merge, publish, distribute, sublicense, and/or */
++/* sell copies of this work, and to permit persons to whom this */
++/* work is furnished to do so, subject to the following conditions: */
++/* */
++/* 1. The code must retain the above copyright notice, this list */
++/* of conditions and the following disclaimer. */
++/* */
++/* 2. Any modifications must be clearly marked as such. */
++/* */
++/* NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF TECHNOLOGY, */
++/* HTS WORKING GROUP, AND THE CONTRIBUTORS TO THIS WORK DISCLAIM */
++/* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */
++/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
++/* SHALL NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF */
++/* TECHNOLOGY, HTS WORKING GROUP, NOR THE CONTRIBUTORS BE LIABLE */
++/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY */
++/* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, */
++/* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS */
++/* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR */
++/* PERFORMANCE OF THIS SOFTWARE. */
++/* */
++/* --------------------------------------------------------------- */
++/* mlpg.h : speech parameter generation from pdf sequence */
++/* */
++/* 2003/06/11 by Heiga Zen */
++/* --------------------------------------------------------------- */
++
++#define INFTY ((double) 1.0e+38)
++#define INFTY2 ((double) 1.0e+19)
++#define INVINF ((double) 1.0e-38)
++#define INVINF2 ((double) 1.0e-19)
++
++#define WLEFT 0
++#define WRIGHT 1
++
++typedef struct _DWin {
++ int num; /* number of static + deltas */
++ char **fn; /* delta window coefficient file */
++ int **width; /* width [0..num-1][0(left) 1(right)] */
++ float **coef; /* coefficient [0..num-1][length[0]..length[1]] */
++ float **coefr; /* pointers to the memory being allocated */
++ int maxw[2]; /* max width [0(left) 1(right)] */
++ int max_L;
++} DWin;
++
++typedef struct _SMatrices {
++ double **mseq; /* sequence of mean vector */
++ double **ivseq; /* sequence of invarsed variance vector */
++ double *g;
++ double **R;
++ double *r;
++} SMatrices;
++
++typedef struct _PStream {
++ int vSize;
++ int order;
++ int T;
++ int width;
++ DWin dw;
++ float **par; /* output parameter vector */
++ SMatrices sm;
++} PStream;
++
++void pdf2speech(FILE *, FILE *, FILE *, PStream *, PStream *, globalP *, ModelSet *, UttModel *, VocoderSetup *);
++void InitDWin (PStream *);
++
++/* -------------------- End of "mlpg.h" -------------------- */
+--- /dev/null
++++ src/modules/hts21_engine/hts21_mlsa_resynthesis.cc
+@@ -0,0 +1,863 @@
++/* --------------------------------------------------------------- */
++/* The HMM-Based Speech Synthesis System (HTS): version 1.1b */
++/* HTS Working Group */
++/* */
++/* Department of Computer Science */
++/* Nagoya Institute of Technology */
++/* and */
++/* Interdisciplinary Graduate School of Science and Engineering */
++/* Tokyo Institute of Technology */
++/* Copyright (c) 2001-2003 */
++/* All Rights Reserved. */
++/* */
++/* Permission is hereby granted, free of charge, to use and */
++/* distribute this software and its documentation without */
++/* restriction, including without limitation the rights to use, */
++/* copy, modify, merge, publish, distribute, sublicense, and/or */
++/* sell copies of this work, and to permit persons to whom this */
++/* work is furnished to do so, subject to the following conditions: */
++/* */
++/* 1. The code must retain the above copyright notice, this list */
++/* of conditions and the following disclaimer. */
++/* */
++/* 2. Any modifications must be clearly marked as such. */
++/* */
++/* NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF TECHNOLOGY, */
++/* HTS WORKING GROUP, AND THE CONTRIBUTORS TO THIS WORK DISCLAIM */
++/* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */
++/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
++/* SHALL NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF */
++/* TECHNOLOGY, HTS WORKING GROUP, NOR THE CONTRIBUTORS BE LIABLE */
++/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY */
++/* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, */
++/* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS */
++/* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR */
++/* PERFORMANCE OF THIS SOFTWARE. */
++/* */
++/* --------------------------------------------------------------- */
++/* This is Zen's MLSA filter as ported by Toda to fetvox vc */
++/* and back ported into hts/festival so we can do MLSA filtering */
++/* If I took more time I could probably make this use the same as */
++/* as the other code in this directory -- awb@cs.cmu.edu 03JAN06 */
++/* --------------------------------------------------------------- */
++
++/*********************************************************************/
++/* */
++/* Mel-cepstral vocoder (pulse/noise excitation & MLSA filter) */
++/* 2003/12/26 by Heiga Zen */
++/* */
++/* Extracted from HTS and slightly modified */
++/* by Tomoki Toda (tomoki@ics.nitech.ac.jp) */
++/* June 2004 */
++/* Integrate as a Voice Conversion module */
++/* */
++/*-------------------------------------------------------------------*/
++
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#include <math.h>
++#include <EST_walloc.h>
++#include "festival.h"
++
++#include "hts21_mlsa_resynthesis.h"
++
++LISP hts21_mlsa_resynthesis(LISP ltrack)
++{
++ /* Resynthesizes a wave from given track */
++ EST_Track *t;
++ EST_Wave *wave = 0;
++ DVECTOR w;
++ DMATRIX mcep;
++ DVECTOR f0v;
++ int sr = 16000;
++ int i,j;
++ double shift;
++
++ if ((ltrack == NULL) ||
++ (TYPEP(ltrack,tc_string) &&
++ (streq(get_c_string(ltrack),"nil"))))
++ return siod(new EST_Wave(0,1,sr));
++
++ t = track(ltrack);
++
++ f0v = xdvalloc(t->num_frames());
++ mcep = xdmalloc(t->num_frames(),t->num_channels()-1);
++
++ for (i=0; i<t->num_frames(); i++)
++ {
++ f0v->data[i] = t->a(i,0);
++ for (j=1; j<t->num_channels(); j++)
++ mcep->data[i][j-1] = t->a(i,j);
++ }
++
++ if (t->num_frames() > 1)
++ shift = 1000.0*(t->t(1)-t->t(0));
++ else
++ shift = 5.0;
++
++ w = synthesis_body(mcep,f0v,NULL,sr,shift);
++
++ wave = new EST_Wave(w->length,1,sr);
++
++ for (i=0; i<w->length; i++)
++ wave->a(i) = (short)w->data[i];
++
++ xdmfree(mcep);
++ xdvfree(f0v);
++ xdvfree(w);
++
++ return siod(wave);
++}
++
++
++DVECTOR synthesis_body(DMATRIX mcep, // input mel-cep sequence
++ DVECTOR f0v, // input F0 sequence
++ DVECTOR dpow, // input diff-pow sequence
++ double fs, // sampling frequency (Hz)
++ double framem) // FFT length
++{
++ long t, pos;
++ int framel;
++ double f0;
++ VocoderSetup vs;
++ DVECTOR xd = NODATA;
++ DVECTOR syn = NODATA;
++
++ framel = (int)(framem * fs / 1000.0);
++ init_vocoder(fs, framel, mcep->col - 1, &vs);
++
++ // synthesize waveforms by MLSA filter
++ xd = xdvalloc(mcep->row * (framel + 2));
++ for (t = 0, pos = 0; t < mcep->row; t++) {
++ if (t >= f0v->length) f0 = 0.0;
++ else f0 = f0v->data[t];
++ if (dpow == NODATA)
++ vocoder(f0, mcep->data[t], mcep->col - 1, ALPHA, 0.0, &vs,
++ xd->data, &pos);
++ else
++ vocoder(f0, mcep->data[t], dpow->data[t], mcep->col - 1, ALPHA,
++ 0.0, &vs, xd->data, &pos);
++ }
++ syn = xdvcut(xd, 0, pos);
++
++ // normalized amplitude
++ waveampcheck(syn, XFALSE);
++
++ // memory free
++ xdvfree(xd);
++ free_vocoder(&vs);
++
++ return syn;
++}
++
++#if 0
++static DVECTOR get_dpowvec(DMATRIX rmcep, DMATRIX cmcep)
++{
++ long t;
++ DVECTOR dpow = NODATA;
++ VocoderSetup pvs;
++
++ // error check
++ if (rmcep->col != cmcep->col) {
++ fprintf(stderr, "Error: Different number of dimensions\n");
++ exit(1);
++ }
++ if (rmcep->row != cmcep->row) {
++ fprintf(stderr, "Error: Different number of frames\n");
++ exit(1);
++ }
++
++ // memory allocation
++ dpow = xdvalloc(rmcep->row);
++ init_vocoder(16000.0, 80, rmcep->col - 1, &pvs);
++
++ // calculate differential power
++ for (t = 0; t < rmcep->row; t++)
++ dpow->data[t] = get_dpow(rmcep->data[t], cmcep->data[t],
++ rmcep->col - 1, ALPHA, &pvs);
++
++ // memory free
++ free_vocoder(&pvs);
++
++ return dpow;
++}
++#endif
++
++static void waveampcheck(DVECTOR wav, XBOOL msg_flag)
++{
++ double value;
++ int k;
++
++ value = MAX(FABS(dvmax(wav, NULL)), FABS(dvmin(wav, NULL)));
++ if (value >= 32000.0) {
++ if (msg_flag == XTRUE) {
++ fprintf(stderr, "amplitude is too big: %f\n", value);
++ fprintf(stderr, "execute normalization\n");
++ }
++ /* was dvscoper(wav, "*", 32000.0 / value); */
++ for (k = 0; k < wav->length; k++) {
++ wav->data[k] = wav->data[k] * (32000.0/value);
++ if (wav->imag != NULL) {
++ wav->imag[k] = wav->imag[k] * (32000.0/value);
++ }
++ }
++ }
++
++ return;
++}
++
++static void init_vocoder(double fs, int framel, int m, VocoderSetup *vs)
++{
++ // initialize global parameter
++ vs->fprd = framel;
++ vs->iprd = 1;
++ vs->seed = 1;
++ vs->pd = 5;
++
++ vs->next =1;
++ vs->gauss = MTRUE;
++
++ vs->pade[ 0]=1.0;
++ vs->pade[ 1]=1.0; vs->pade[ 2]=0.0;
++ vs->pade[ 3]=1.0; vs->pade[ 4]=0.0; vs->pade[ 5]=0.0;
++ vs->pade[ 6]=1.0; vs->pade[ 7]=0.0; vs->pade[ 8]=0.0; vs->pade[ 9]=0.0;
++ 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;
++ 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;
++ vs->pade[20]=0.00003041721;
++
++ vs->rate = fs;
++ vs->c = wcalloc(double,3 * (m + 1) + 3 * (vs->pd + 1) + vs->pd * (m + 2));
++
++ vs->p1 = -1;
++ vs->sw = 0;
++ vs->x = 0x55555555;
++
++ // for postfiltering
++ vs->mc = NULL;
++ vs->o = 0;
++ vs->d = NULL;
++ vs->irleng= 64;
++
++ return;
++}
++
++static void vocoder(double p, double *mc, int m, double a, double beta,
++ VocoderSetup *vs, double *wav, long *pos)
++{
++ double inc, x, e1, e2;
++ int i, j, k;
++
++ if (p != 0.0)
++ p = vs->rate / p; // f0 -> pitch
++
++ if (vs->p1 < 0) {
++ if (vs->gauss & (vs->seed != 1))
++ vs->next = srnd((unsigned)vs->seed);
++
++ vs->p1 = p;
++ vs->pc = vs->p1;
++ vs->cc = vs->c + m + 1;
++ vs->cinc = vs->cc + m + 1;
++ vs->d1 = vs->cinc + m + 1;
++
++ mc2b(mc, vs->c, m, a);
++
++ if (beta > 0.0 && m > 1) {
++ e1 = b2en(vs->c, m, a, vs);
++ vs->c[1] -= beta * a * mc[2];
++ for (k=2;k<=m;k++)
++ vs->c[k] *= (1.0 + beta);
++ e2 = b2en(vs->c, m, a, vs);
++ vs->c[0] += log(e1/e2)/2;
++ }
++
++ return;
++ }
++
++ mc2b(mc, vs->cc, m, a);
++ if (beta>0.0 && m > 1) {
++ e1 = b2en(vs->cc, m, a, vs);
++ vs->cc[1] -= beta * a * mc[2];
++ for (k = 2; k <= m; k++)
++ vs->cc[k] *= (1.0 + beta);
++ e2 = b2en(vs->cc, m, a, vs);
++ vs->cc[0] += log(e1 / e2) / 2.0;
++ }
++
++ for (k=0; k<=m; k++)
++ vs->cinc[k] = (vs->cc[k] - vs->c[k]) *
++ (double)vs->iprd / (double)vs->fprd;
++
++ if (vs->p1!=0.0 && p!=0.0) {
++ inc = (p - vs->p1) * (double)vs->iprd / (double)vs->fprd;
++ } else {
++ inc = 0.0;
++ vs->pc = p;
++ vs->p1 = 0.0;
++ }
++
++ for (j = vs->fprd, i = (vs->iprd + 1) / 2; j--;) {
++ if (vs->p1 == 0.0) {
++ if (vs->gauss)
++ x = (double) nrandom(vs);
++ else
++ x = mseq(vs);
++ } else {
++ if ((vs->pc += 1.0) >= vs->p1) {
++ x = sqrt (vs->p1);
++ vs->pc = vs->pc - vs->p1;
++ } else x = 0.0;
++ }
++
++ x *= exp(vs->c[0]);
++
++ x = mlsadf(x, vs->c, m, a, vs->pd, vs->d1, vs);
++
++ wav[*pos] = x;
++ *pos += 1;
++
++ if (!--i) {
++ vs->p1 += inc;
++ for (k = 0; k <= m; k++) vs->c[k] += vs->cinc[k];
++ i = vs->iprd;
++ }
++ }
++
++ vs->p1 = p;
++ memmove(vs->c,vs->cc,sizeof(double)*(m+1));
++
++ return;
++}
++
++static void vocoder(double p, double *mc, double dpow, int m, double a, double beta,
++ VocoderSetup *vs, double *wav, long *pos)
++{
++ double inc, x, e1, e2;
++ int i, j, k;
++
++ if (p != 0.0)
++ p = vs->rate / p; // f0 -> pitch
++
++ if (vs->p1 < 0) {
++ if (vs->gauss & (vs->seed != 1))
++ vs->next = srnd((unsigned)vs->seed);
++
++ vs->p1 = p;
++ vs->pc = vs->p1;
++ vs->cc = vs->c + m + 1;
++ vs->cinc = vs->cc + m + 1;
++ vs->d1 = vs->cinc + m + 1;
++
++ mc2b(mc, vs->c, m, a);
++ vs->c[0] += dpow;
++
++ if (beta > 0.0 && m > 1) {
++ e1 = b2en(vs->c, m, a, vs);
++ vs->c[1] -= beta * a * mc[2];
++ for (k=2;k<=m;k++)
++ vs->c[k] *= (1.0 + beta);
++ e2 = b2en(vs->c, m, a, vs);
++ vs->c[0] += log(e1/e2)/2;
++ }
++
++ return;
++ }
++
++ mc2b(mc, vs->cc, m, a);
++ vs->cc[0] += dpow;
++ if (beta>0.0 && m > 1) {
++ e1 = b2en(vs->cc, m, a, vs);
++ vs->cc[1] -= beta * a * mc[2];
++ for (k = 2; k <= m; k++)
++ vs->cc[k] *= (1.0 + beta);
++ e2 = b2en(vs->cc, m, a, vs);
++ vs->cc[0] += log(e1 / e2) / 2.0;
++ }
++
++ for (k=0; k<=m; k++)
++ vs->cinc[k] = (vs->cc[k] - vs->c[k]) *
++ (double)vs->iprd / (double)vs->fprd;
++
++ if (vs->p1!=0.0 && p!=0.0) {
++ inc = (p - vs->p1) * (double)vs->iprd / (double)vs->fprd;
++ } else {
++ inc = 0.0;
++ vs->pc = p;
++ vs->p1 = 0.0;
++ }
++
++ for (j = vs->fprd, i = (vs->iprd + 1) / 2; j--;) {
++ if (vs->p1 == 0.0) {
++ if (vs->gauss)
++ x = (double) nrandom(vs);
++ else
++ x = mseq(vs);
++ } else {
++ if ((vs->pc += 1.0) >= vs->p1) {
++ x = sqrt (vs->p1);
++ vs->pc = vs->pc - vs->p1;
++ } else x = 0.0;
++ }
++
++ x *= exp(vs->c[0]);
++
++ x = mlsadf(x, vs->c, m, a, vs->pd, vs->d1, vs);
++
++ wav[*pos] = x;
++ *pos += 1;
++
++ if (!--i) {
++ vs->p1 += inc;
++ for (k = 0; k <= m; k++) vs->c[k] += vs->cinc[k];
++ i = vs->iprd;
++ }
++ }
++
++ vs->p1 = p;
++ memmove(vs->c,vs->cc,sizeof(double)*(m+1));
++
++ return;
++}
++
++static double mlsadf(double x, double *b, int m, double a, int pd, double *d, VocoderSetup *vs)
++{
++
++ vs->ppade = &(vs->pade[pd*(pd+1)/2]);
++
++ x = mlsadf1 (x, b, m, a, pd, d, vs);
++ x = mlsadf2 (x, b, m, a, pd, &d[2*(pd+1)], vs);
++
++ return(x);
++}
++
++static double mlsadf1(double x, double *b, int m, double a, int pd, double *d, VocoderSetup *vs)
++{
++ double v, out = 0.0, *pt, aa;
++ register int i;
++
++ aa = 1 - a*a;
++ pt = &d[pd+1];
++
++ for (i=pd; i>=1; i--) {
++ d[i] = aa*pt[i-1] + a*d[i];
++ pt[i] = d[i] * b[1];
++ v = pt[i] * vs->ppade[i];
++ x += (1 & i) ? v : -v;
++ out += v;
++ }
++
++ pt[0] = x;
++ out += x;
++
++ return(out);
++}
++
++static double mlsadf2 (double x, double *b, int m, double a, int pd, double *d, VocoderSetup *vs)
++{
++ double v, out = 0.0, *pt, aa;
++ register int i;
++
++ aa = 1 - a*a;
++ pt = &d[pd * (m+2)];
++
++ for (i=pd; i>=1; i--) {
++ pt[i] = mlsafir (pt[i-1], b, m, a, &d[(i-1)*(m+2)]);
++ v = pt[i] * vs->ppade[i];
++
++ x += (1&i) ? v : -v;
++ out += v;
++ }
++
++ pt[0] = x;
++ out += x;
++
++ return(out);
++}
++
++static double mlsafir (double x, double *b, int m, double a, double *d)
++{
++ double y = 0.0;
++ double aa;
++ register int i;
++
++ aa = 1 - a*a;
++
++ d[0] = x;
++ d[1] = aa*d[0] + a*d[1];
++
++ for (i=2; i<=m; i++) {
++ d[i] = d[i] + a*(d[i+1]-d[i-1]);
++ y += d[i]*b[i];
++ }
++
++ for (i=m+1; i>1; i--)
++ d[i] = d[i-1];
++
++ return(y);
++}
++
++static double nrandom (VocoderSetup *vs)
++{
++ if (vs->sw == 0) {
++ vs->sw = 1;
++ do {
++ vs->r1 = 2.0 * rnd(&vs->next) - 1.0;
++ vs->r2 = 2.0 * rnd(&vs->next) - 1.0;
++ vs->s = vs->r1 * vs->r1 + vs->r2 * vs->r2;
++ } while (vs->s > 1 || vs->s == 0);
++
++ vs->s = sqrt (-2 * log(vs->s) / vs->s);
++
++ return(vs->r1*vs->s);
++ }
++ else {
++ vs->sw = 0;
++
++ return (vs->r2*vs->s);
++ }
++}
++
++static double rnd (unsigned long *next)
++{
++ double r;
++
++ *next = *next * 1103515245L + 12345;
++ r = (*next / 65536L) % 32768L;
++
++ return(r/RANDMAX);
++}
++
++static unsigned long srnd ( unsigned long seed )
++{
++ return(seed);
++}
++
++static int mseq (VocoderSetup *vs)
++{
++ register int x0, x28;
++
++ vs->x >>= 1;
++
++ if (vs->x & B0)
++ x0 = 1;
++ else
++ x0 = -1;
++
++ if (vs->x & B28)
++ x28 = 1;
++ else
++ x28 = -1;
++
++ if (x0 + x28)
++ vs->x &= B31_;
++ else
++ vs->x |= B31;
++
++ return(x0);
++}
++
++// mc2b : transform mel-cepstrum to MLSA digital fillter coefficients
++static void mc2b (double *mc, double *b, int m, double a)
++{
++ b[m] = mc[m];
++
++ for (m--; m>=0; m--)
++ b[m] = mc[m] - a * b[m+1];
++
++ return;
++}
++
++
++static double b2en (double *b, int m, double a, VocoderSetup *vs)
++{
++ double en;
++ int k;
++
++ if (vs->o<m) {
++ if (vs->mc != NULL)
++ wfree(vs->mc);
++
++ vs->mc = wcalloc(double,(m + 1) + 2 * vs->irleng);
++ vs->cep = vs->mc + m+1;
++ vs->ir = vs->cep + vs->irleng;
++ }
++
++ b2mc(b, vs->mc, m, a);
++ freqt(vs->mc, m, vs->cep, vs->irleng-1, -a, vs);
++ c2ir(vs->cep, vs->irleng, vs->ir, vs->irleng);
++ en = 0.0;
++
++ for (k=0;k<vs->irleng;k++)
++ en += vs->ir[k] * vs->ir[k];
++
++ return(en);
++}
++
++
++// b2bc : transform MLSA digital filter coefficients to mel-cepstrum
++static void b2mc (double *b, double *mc, int m, double a)
++{
++ double d, o;
++
++ d = mc[m] = b[m];
++ for (m--; m>=0; m--) {
++ o = b[m] + a * d;
++ d = b[m];
++ mc[m] = o;
++ }
++
++ return;
++}
++
++// freqt : frequency transformation
++static void freqt (double *c1, int m1, double *c2, int m2, double a, VocoderSetup *vs)
++{
++ register int i, j;
++ double b;
++
++ if (vs->d==NULL) {
++ vs->size = m2;
++ vs->d = wcalloc(double,vs->size + vs->size + 2);
++ vs->g = vs->d+vs->size+1;
++ }
++
++ if (m2>vs->size) {
++ wfree(vs->d);
++ vs->size = m2;
++ vs->d = wcalloc(double,vs->size + vs->size + 2);
++ vs->g = vs->d+vs->size+1;
++ }
++
++ b = 1-a*a;
++ for (i=0; i<m2+1; i++)
++ vs->g[i] = 0.0;
++
++ for (i=-m1; i<=0; i++) {
++ if (0 <= m2)
++ vs->g[0] = c1[-i]+a*(vs->d[0]=vs->g[0]);
++ if (1 <= m2)
++ vs->g[1] = b*vs->d[0]+a*(vs->d[1]=vs->g[1]);
++ for (j=2; j<=m2; j++)
++ vs->g[j] = vs->d[j-1]+a*((vs->d[j]=vs->g[j])-vs->g[j-1]);
++ }
++
++ memmove(c2,vs->g,sizeof(double)*(m2+1));
++
++ return;
++}
++
++// c2ir : The minimum phase impulse response is evaluated from the minimum phase cepstrum
++static void c2ir (double *c, int nc, double *h, int leng)
++{
++ register int n, k, upl;
++ double d;
++
++ h[0] = exp(c[0]);
++ for (n=1; n<leng; n++) {
++ d = 0;
++ upl = (n>=nc) ? nc-1 : n;
++ for (k=1; k<=upl; k++)
++ d += k*c[k]*h[n-k];
++ h[n] = d/n;
++ }
++
++ return;
++}
++
++#if 0
++static double get_dpow(double *rmcep, double *cmcep, int m, double a,
++ VocoderSetup *vs)
++{
++ double e1, e2, dpow;
++
++ if (vs->p1 < 0) {
++ vs->p1 = 1;
++ vs->cc = vs->c + m + 1;
++ vs->cinc = vs->cc + m + 1;
++ vs->d1 = vs->cinc + m + 1;
++ }
++
++ mc2b(rmcep, vs->c, m, a);
++ e1 = b2en(vs->c, m, a, vs);
++
++ mc2b(cmcep, vs->cc, m, a);
++ e2 = b2en(vs->cc, m, a, vs);
++
++ dpow = log(e1 / e2) / 2.0;
++
++ return dpow;
++}
++#endif
++
++static void free_vocoder(VocoderSetup *vs)
++{
++ wfree(vs->c);
++ wfree(vs->mc);
++ wfree(vs->d);
++
++ vs->c = NULL;
++ vs->mc = NULL;
++ vs->d = NULL;
++ vs->ppade = NULL;
++ vs->cc = NULL;
++ vs->cinc = NULL;
++ vs->d1 = NULL;
++ vs->g = NULL;
++ vs->cep = NULL;
++ vs->ir = NULL;
++
++ return;
++}
++
++/* from vector.cc */
++
++static DVECTOR xdvalloc(long length)
++{
++ DVECTOR x;
++
++ length = MAX(length, 0);
++ x = wcalloc(struct DVECTOR_STRUCT,1);
++ x->data = wcalloc(double,MAX(length, 1));
++ x->imag = NULL;
++ x->length = length;
++
++ return x;
++}
++
++static void xdvfree(DVECTOR x)
++{
++ if (x != NULL) {
++ if (x->data != NULL) {
++ wfree(x->data);
++ }
++ if (x->imag != NULL) {
++ wfree(x->imag);
++ }
++ wfree(x);
++ }
++
++ return;
++}
++
++static void dvialloc(DVECTOR x)
++{
++ if (x->imag != NULL) {
++ wfree(x->imag);
++ }
++ x->imag = wcalloc(double,x->length);
++
++ return;
++}
++
++static DVECTOR xdvcut(DVECTOR x, long offset, long length)
++{
++ long k;
++ long pos;
++ DVECTOR y;
++
++ y = xdvalloc(length);
++ if (x->imag != NULL) {
++ dvialloc(y);
++ }
++
++ for (k = 0; k < y->length; k++) {
++ pos = k + offset;
++ if (pos >= 0 && pos < x->length) {
++ y->data[k] = x->data[pos];
++ if (y->imag != NULL) {
++ y->imag[k] = x->imag[pos];
++ }
++ } else {
++ y->data[k] = 0.0;
++ if (y->imag != NULL) {
++ y->imag[k] = 0.0;
++ }
++ }
++ }
++
++ return y;
++}
++
++static DMATRIX xdmalloc(long row, long col)
++{
++ DMATRIX matrix;
++ int i;
++
++ matrix = wcalloc(struct DMATRIX_STRUCT,1);
++ matrix->data = wcalloc(double *,row);
++ for (i=0; i<row; i++)
++ matrix->data[i] = wcalloc(double,col);
++ matrix->imag = NULL;
++ matrix->row = row;
++ matrix->col = col;
++
++ return matrix;
++}
++
++void xdmfree(DMATRIX matrix)
++{
++ int i;
++
++ if (matrix != NULL) {
++ if (matrix->data != NULL) {
++ for (i=0; i<matrix->row; i++)
++ wfree(matrix->data[i]);
++ wfree(matrix->data);
++ }
++ if (matrix->imag != NULL) {
++ for (i=0; i<matrix->row; i++)
++ wfree(matrix->imag[i]);
++ wfree(matrix->imag);
++ }
++ wfree(matrix);
++ }
++
++ return;
++}
++
++
++/* from voperate.cc */
++static double dvmax(DVECTOR x, long *index)
++{
++ long k;
++ long ind;
++ double max;
++
++ ind = 0;
++ max = x->data[ind];
++ for (k = 1; k < x->length; k++) {
++ if (max < x->data[k]) {
++ ind = k;
++ max = x->data[k];
++ }
++ }
++
++ if (index != NULL) {
++ *index = ind;
++ }
++
++ return max;
++}
++
++static double dvmin(DVECTOR x, long *index)
++{
++ long k;
++ long ind;
++ double min;
++
++ ind = 0;
++ min = x->data[ind];
++ for (k = 1; k < x->length; k++) {
++ if (min > x->data[k]) {
++ ind = k;
++ min = x->data[k];
++ }
++ }
++
++ if (index != NULL) {
++ *index = ind;
++ }
++
++ return min;
++}
+--- /dev/null
++++ src/modules/hts21_engine/Makefile
+@@ -0,0 +1,66 @@
++###########################################################################
++## ##
++## --------------------------------------------------------------- ##
++## The HMM-Based Speech Synthesis System (HTS): version 1.1b ##
++## HTS Working Group ##
++## ##
++## Department of Computer Science ##
++## Nagoya Institute of Technology ##
++## and ##
++## Interdisciplinary Graduate School of Science and Engineering ##
++## Tokyo Institute of Technology ##
++## Copyright (c) 2001-2003 ##
++## All Rights Reserved. ##
++## ##
++## Permission is hereby granted, free of charge, to use and ##
++## distribute this software and its documentation without ##
++## restriction, including without limitation the rights to use, ##
++## copy, modify, merge, publish, distribute, sublicense, and/or ##
++## sell copies of this work, and to permit persons to whom this ##
++## work is furnished to do so, subject to the following conditions: ##
++## ##
++## 1. The code must retain the above copyright notice, this list ##
++## of conditions and the following disclaimer. ##
++## ##
++## 2. Any modifications must be clearly marked as such. ##
++## ##
++## NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF TECHNOLOGY, ##
++## HTS WORKING GROUP, AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ##
++## ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL ##
++## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ##
++## SHALL NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF ##
++## TECHNOLOGY, HTS WORKING GROUP, NOR THE CONTRIBUTORS BE LIABLE ##
++## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY ##
++## DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, ##
++## WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ##
++## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR ##
++## PERFORMANCE OF THIS SOFTWARE. ##
++## ##
++###########################################################################
++## Nagoya Institute of Technology's HTS Engine ##
++## Integrated in the Festival tree to allow it to be more available ##
++## Alan W Black (awb@cs.cmu.edu)
++###########################################################################
++TOP=../../..
++DIRNAME=src/modules/hts_engine
++H = parser.h
++
++H = defaults.h global.h misc.h mlpg.h model.h tree.h vocoder.h \
++ hts21_mlsa_resynthesis.h
++CPPSRCS = hts_engine.cc misc.cc mlpg.cc model.cc tree.cc vocoder.cc \
++ hts21_mlsa_resynthesis.cc
++SRCS = $(CPPSRCS)
++
++OBJS = $(CPPSRCS:.cc=.o)
++
++FILES=Makefile $(SRCS) $(H)
++
++LOCAL_INCLUDES = -I../include
++
++INLIB = $(TOP)/src/lib/libFestival.a
++
++ALL = .buildlib
++
++include $(TOP)/config/common_make_rules
++
++
+--- /dev/null
++++ src/modules/hts21_engine/hts21_mlsa_resynthesis.h
+@@ -0,0 +1,159 @@
++/*********************************************************************/
++/* */
++/* Nagoya Institute of Technology, Aichi, Japan, */
++/* Nara Institute of Science and Technology, Nara, Japan */
++/* and */
++/* Carnegie Mellon University, Pittsburgh, PA */
++/* Copyright (c) 2003-2004 */
++/* All Rights Reserved. */
++/* */
++/* Permission is hereby granted, free of charge, to use and */
++/* distribute this software and its documentation without */
++/* restriction, including without limitation the rights to use, */
++/* copy, modify, merge, publish, distribute, sublicense, and/or */
++/* sell copies of this work, and to permit persons to whom this */
++/* work is furnished to do so, subject to the following conditions: */
++/* */
++/* 1. The code must retain the above copyright notice, this list */
++/* of conditions and the following disclaimer. */
++/* 2. Any modifications must be clearly marked as such. */
++/* 3. Original authors' names are not deleted. */
++/* */
++/* NAGOYA INSTITUTE OF TECHNOLOGY, NARA INSTITUTE OF SCIENCE AND */
++/* TECHNOLOGY, CARNEGIE MELLON UNIVERSITY, AND THE CONTRIBUTORS TO */
++/* THIS WORK DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, */
++/* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, */
++/* IN NO EVENT SHALL NAGOYA INSTITUTE OF TECHNOLOGY, NARA */
++/* INSTITUTE OF SCIENCE AND TECHNOLOGY, CARNEGIE MELLON UNIVERSITY, */
++/* NOR THE CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR */
++/* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM */
++/* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, */
++/* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN */
++/* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
++/* */
++/*********************************************************************/
++/* */
++/* Author : Tomoki Toda (tomoki@ics.nitech.ac.jp) */
++/* Date : June 2004 */
++/* */
++/* Modified by Alan W Black (awb@cs.cmu.edu) Jan 2006 */
++/* taken from festvox/src/vc/ back into Festival */
++/*-------------------------------------------------------------------*/
++/* */
++/* Subroutine for Speech Synthesis */
++/* */
++/*-------------------------------------------------------------------*/
++
++#ifndef __MLSA_RESYNTHESIS_H
++#define __MLSA_RESYNTHESIS_H
++
++#define ALPHA 0.42
++
++typedef struct DVECTOR_STRUCT {
++ long length;
++ double *data;
++ double *imag;
++} *DVECTOR;
++
++typedef struct DMATRIX_STRUCT {
++ long row;
++ long col;
++ double **data;
++ double **imag;
++} *DMATRIX;
++
++#define XBOOL int
++#define XTRUE 1
++#define XFALSE 0
++
++#define NODATA NULL
++
++#define FABS(x) ((x) >= 0.0 ? (x) : -(x))
++#define MAX(a, b) ((a) > (b) ? (a) : (b))
++
++static DVECTOR xdvalloc(long length);
++static DVECTOR xdvcut(DVECTOR x, long offset, long length);
++static void xdvfree(DVECTOR vector);
++static double dvmax(DVECTOR x, long *index);
++static double dvmin(DVECTOR x, long *index);
++static DMATRIX xdmalloc(long row, long col);
++static void xdmfree(DMATRIX matrix);
++
++DVECTOR synthesis_body(DMATRIX mcep, DVECTOR f0v, DVECTOR dpow,
++ double fs, double framem);
++static void waveampcheck(DVECTOR wav, XBOOL msg_flag);
++
++#define RANDMAX 32767
++#define B0 0x00000001
++#define B28 0x10000000
++#define B31 0x80000000
++#define B31_ 0x7fffffff
++#define Z 0x00000000
++
++typedef enum {MFALSE, MTRUE} Boolean;
++
++typedef struct _VocoderSetup {
++
++ int fprd;
++ int iprd;
++ int seed;
++ int pd;
++ unsigned long next;
++ Boolean gauss;
++ double p1;
++ double pc;
++ double pj;
++ double pade[21];
++ double *ppade;
++ double *c, *cc, *cinc, *d1;
++ double rate;
++
++ int sw;
++ double r1, r2, s;
++
++ int x;
++
++ /* for postfiltering */
++ int size;
++ double *d;
++ double *g;
++ double *mc;
++ double *cep;
++ double *ir;
++ int o;
++ int irleng;
++
++} VocoderSetup;
++
++static void init_vocoder(double fs, int framel, int m, VocoderSetup *vs);
++static void vocoder(double p, double *mc, int m, double a, double beta,
++ VocoderSetup *vs, double *wav, long *pos);
++static void vocoder(double p, double *mc, double dpow, int m, double a,
++ double beta, VocoderSetup *vs, double *wav, long *pos);
++static double mlsadf(double x, double *b, int m, double a, int pd, double *d,
++ VocoderSetup *vs);
++static double mlsadf1(double x, double *b, int m, double a, int pd, double *d,
++ VocoderSetup *vs);
++static double mlsadf2(double x, double *b, int m, double a, int pd, double *d,
++ VocoderSetup *vs);
++static double mlsafir (double x, double *b, int m, double a, double *d);
++static double nrandom (VocoderSetup *vs);
++static double rnd (unsigned long *next);
++static unsigned long srnd (unsigned long seed);
++static int mseq (VocoderSetup *vs);
++static void mc2b (double *mc, double *b, int m, double a);
++static double b2en (double *b, int m, double a, VocoderSetup *vs);
++static void b2mc (double *b, double *mc, int m, double a);
++static void freqt (double *c1, int m1, double *c2, int m2, double a,
++ VocoderSetup *vs);
++static void c2ir (double *c, int nc, double *h, int leng);
++
++
++#if 0
++static DVECTOR get_dpowvec(DMATRIX rmcep, DMATRIX cmcep);
++static double get_dpow(double *rmcep, double *cmcep, int m, double a,
++ VocoderSetup *vs);
++#endif
++static void free_vocoder(VocoderSetup *vs);
++
++#endif /* __RESYNTHESIS_SUB_H */
+--- /dev/null
++++ src/modules/hts21_engine/global.h
+@@ -0,0 +1,55 @@
++/* --------------------------------------------------------------- */
++/* The HMM-Based Speech Synthesis System (HTS): version 1.1b */
++/* HTS Working Group */
++/* */
++/* Department of Computer Science */
++/* Nagoya Institute of Technology */
++/* and */
++/* Interdisciplinary Graduate School of Science and Engineering */
++/* Tokyo Institute of Technology */
++/* Copyright (c) 2001-2003 */
++/* All Rights Reserved. */
++/* */
++/* Permission is hereby granted, free of charge, to use and */
++/* distribute this software and its documentation without */
++/* restriction, including without limitation the rights to use, */
++/* copy, modify, merge, publish, distribute, sublicense, and/or */
++/* sell copies of this work, and to permit persons to whom this */
++/* work is furnished to do so, subject to the following conditions: */
++/* */
++/* 1. The code must retain the above copyright notice, this list */
++/* of conditions and the following disclaimer. */
++/* */
++/* 2. Any modifications must be clearly marked as such. */
++/* */
++/* NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF TECHNOLOGY, */
++/* HTS WORKING GROUP, AND THE CONTRIBUTORS TO THIS WORK DISCLAIM */
++/* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */
++/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
++/* SHALL NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF */
++/* TECHNOLOGY, HTS WORKING GROUP, NOR THE CONTRIBUTORS BE LIABLE */
++/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY */
++/* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, */
++/* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS */
++/* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR */
++/* PERFORMANCE OF THIS SOFTWARE. */
++/* */
++/* --------------------------------------------------------------- */
++/* global.h : global variable for some functions */
++/* */
++/* 2003/06/11 by Heiga Zen */
++/* --------------------------------------------------------------- */
++
++typedef struct _globalP {
++ float RHO ; /* variable for speaking rate control */
++ float ALPHA ; /* variable for frequency warping parameter */
++ float F0_STD ; /* variable for f0 control */
++ float F0_MEAN ; /* variable for f0 control */
++ float UV ; /* variable for U/V threshold */
++ int LENGTH ; /* total number of frame for generated speech */
++ HTS_Boolean XIMERA ; /* output label and f0 for XIMERA */
++ HTS_Boolean algnst ; /* use state level alignment for duration */
++ HTS_Boolean algnph ; /* use phoneme level alignment for duration */
++} globalP;
++
++/* -------------------- End of "global.h" -------------------- */
+--- /dev/null
++++ src/modules/hts21_engine/defaults.h
+@@ -0,0 +1,55 @@
++/* --------------------------------------------------------------- */
++/* The HMM-Based Speech Synthesis System (HTS): version 1.1b */
++/* HTS Working Group */
++/* */
++/* Department of Computer Science */
++/* Nagoya Institute of Technology */
++/* and */
++/* Interdisciplinary Graduate School of Science and Engineering */
++/* Tokyo Institute of Technology */
++/* Copyright (c) 2001-2003 */
++/* All Rights Reserved. */
++/* */
++/* Permission is hereby granted, free of charge, to use and */
++/* distribute this software and its documentation without */
++/* restriction, including without limitation the rights to use, */
++/* copy, modify, merge, publish, distribute, sublicense, and/or */
++/* sell copies of this work, and to permit persons to whom this */
++/* work is furnished to do so, subject to the following conditions: */
++/* */
++/* 1. The code must retain the above copyright notice, this list */
++/* of conditions and the following disclaimer. */
++/* */
++/* 2. Any modifications must be clearly marked as such. */
++/* */
++/* NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF TECHNOLOGY, */
++/* HTS WORKING GROUP, AND THE CONTRIBUTORS TO THIS WORK DISCLAIM */
++/* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */
++/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
++/* SHALL NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF */
++/* TECHNOLOGY, HTS WORKING GROUP, NOR THE CONTRIBUTORS BE LIABLE */
++/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY */
++/* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, */
++/* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS */
++/* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR */
++/* PERFORMANCE OF THIS SOFTWARE. */
++/* */
++/* --------------------------------------------------------------- */
++/* defaults.h : default value for some parameters */
++/* */
++/* 2003/06/11 by Heiga Zen */
++/* --------------------------------------------------------------- */
++
++#define FPERIOD 80
++#define IPERIOD 1
++#define SEED 1
++#define GAUSS 1
++#define B0 0x00000001
++#define B28 0x10000000
++#define B31 0x80000000
++#define B31_ 0x7fffffff
++#define Z 0x00000000
++#define PADEORDER 4
++#define RATE 16000
++
++/* -------------------- End of "defaults.h" -------------------- */
+--- /dev/null
++++ src/modules/hts21_engine/vocoder.cc
+@@ -0,0 +1,303 @@
++/* --------------------------------------------------------------- */
++/* The HMM-Based Speech Synthesis System (HTS): version 1.1b */
++/* HTS Working Group */
++/* */
++/* Department of Computer Science */
++/* Nagoya Institute of Technology */
++/* and */
++/* Interdisciplinary Graduate School of Science and Engineering */
++/* Tokyo Institute of Technology */
++/* Copyright (c) 2001-2003 */
++/* All Rights Reserved. */
++/* */
++/* Permission is hereby granted, free of charge, to use and */
++/* distribute this software and its documentation without */
++/* restriction, including without limitation the rights to use, */
++/* copy, modify, merge, publish, distribute, sublicense, and/or */
++/* sell copies of this work, and to permit persons to whom this */
++/* work is furnished to do so, subject to the following conditions: */
++/* */
++/* 1. The code must retain the above copyright notice, this list */
++/* of conditions and the following disclaimer. */
++/* */
++/* 2. Any modifications must be clearly marked as such. */
++/* */
++/* NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF TECHNOLOGY, */
++/* HTS WORKING GROUP, AND THE CONTRIBUTORS TO THIS WORK DISCLAIM */
++/* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */
++/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
++/* SHALL NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF */
++/* TECHNOLOGY, HTS WORKING GROUP, NOR THE CONTRIBUTORS BE LIABLE */
++/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY */
++/* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, */
++/* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS */
++/* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR */
++/* PERFORMANCE OF THIS SOFTWARE. */
++/* */
++/* --------------------------------------------------------------- */
++/* vocoder.c : mel-cepstral vocoder */
++/* (pulse/noise excitation & MLSA filter) */
++/* */
++/* 2003/06/11 by Heiga Zen */
++/* --------------------------------------------------------------- */
++
++#include <cstdio>
++#include <cstdlib>
++#include <cmath>
++#include "EST_walloc.h"
++
++#include "misc.h"
++#include "model.h"
++#include "defaults.h"
++#include "global.h"
++#include "vocoder.h"
++
++void init_vocoder(int m, VocoderSetup *vs)
++{
++ vs->fprd = FPERIOD;
++ vs->iprd = IPERIOD;
++ vs->seed = SEED;
++ vs->pd = PADEORDER;
++
++ vs->next = SEED;
++ vs->gauss = GAUSS;
++
++ vs->pade[ 0]=1.0;
++ vs->pade[ 1]=1.0; vs->pade[ 2]=0.0;
++ vs->pade[ 3]=1.0; vs->pade[ 4]=0.0; vs->pade[ 5]=0.0;
++ vs->pade[ 6]=1.0; vs->pade[ 7]=0.0; vs->pade[ 8]=0.0; vs->pade[ 9]=0.0;
++ 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;
++ 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;
++ vs->pade[20]=0.00003041721;
++
++ vs->rate=RATE;
++
++ vs->c = walloc(double,3*(m+1)+3*(vs->pd+1)+vs->pd*(m+2));
++
++ vs->p1 = -1;
++ vs->sw = 0;
++ vs->x = 0x55555555;
++}
++
++void vocoder (double p, float *mc, int m, FILE *rawfp, globalP *gp, VocoderSetup *vs)
++{
++ double inc, x;
++ int i, j, k;
++ short xs;
++ double a = gp->ALPHA;
++
++ if (p!=0.0)
++ p = vs->rate / p; /* f0 -> pitch */
++
++ if (vs->p1 < 0) {
++ if (vs->gauss & (vs->seed != 1)) vs->next = srnd ((unsigned)vs->seed);
++
++ vs->p1 = p;
++ vs->pc = vs->p1;
++ vs->cc = vs->c + m + 1;
++ vs->cinc = vs->cc + m + 1;
++ vs->d1 = vs->cinc + m + 1;
++
++ mc2b(mc, vs->c, m, a);
++
++ return;
++ }
++
++ mc2b(mc, vs->cc, m, a);
++
++ for (k=0; k<=m; k++)
++ vs->cinc[k] = (vs->cc[k]-vs->c[k])*(double)vs->iprd/(double)vs->fprd;
++
++ if (vs->p1!=0.0 && p!=0.0) {
++ inc = (p-vs->p1)*(double)vs->iprd/(double)vs->fprd;
++ }
++ else {
++ inc = 0.0;
++ vs->pc = p;
++ vs->p1 = 0.0;
++ }
++
++ for (j=vs->fprd, i=(vs->iprd+1)/2; j--;) {
++ if (vs->p1 == 0.0) {
++ if (vs->gauss)
++ x = (double) nrandom(vs);
++ else
++ x = mseq(vs);
++ }
++ else {
++ if ((vs->pc += 1.0)>=vs->p1) {
++ x = sqrt (vs->p1);
++ vs->pc = vs->pc - vs->p1;
++ }
++ else
++ x = 0.0;
++ }
++
++ x *= exp(vs->c[0]);
++
++ x = mlsadf(x, vs->c, m, a, vs->pd, vs->d1, vs);
++ xs = (short) x;
++
++ fwrite(&xs, sizeof(short), 1, rawfp);
++
++ fflush(stdout);
++
++ if (!--i) {
++ vs->p1 += inc;
++ for (k=0;k<=m;k++) vs->c[k] += vs->cinc[k];
++ i = vs->iprd;
++ }
++ }
++
++ vs->p1 = p;
++ movem(vs->cc,vs->c,m+1);
++}
++
++double mlsafir (double x, double *b, int m, double a, double *d)
++{
++ double y = 0.0;
++ double aa;
++ register int i;
++
++ aa = 1 - a*a;
++
++ d[0] = x;
++ d[1] = aa*d[0] + a*d[1];
++
++ for (i=2; i<=m; i++) {
++ d[i] = d[i] + a*(d[i+1]-d[i-1]);
++ y += d[i]*b[i];
++ }
++
++ for (i=m+1; i>1; i--) d[i] = d[i-1];
++
++ return (y);
++}
++
++double mlsadf1(double x, double *b, int m, double a, int pd, double *d, VocoderSetup *vs)
++{
++ double v, out = 0.0, *pt, aa;
++ register int i;
++
++ aa = 1 - a*a;
++ pt = &d[pd+1];
++
++ for (i=pd; i>=1; i--) {
++ d[i] = aa*pt[i-1] + a*d[i];
++ pt[i] = d[i] * b[1];
++ v = pt[i] * vs->ppade[i];
++
++ x += (1 & i) ? v : -v;
++ out += v;
++ }
++
++ pt[0] = x;
++ out += x;
++
++ return(out);
++}
++
++double mlsadf2 (double x, double *b, int m, double a, int pd, double *d, VocoderSetup *vs)
++{
++ double v, out = 0.0, *pt, aa;
++ register int i;
++
++ aa = 1 - a*a;
++ pt = &d[pd * (m+2)];
++
++ for (i=pd; i>=1; i--) {
++ pt[i] = mlsafir (pt[i-1], b, m, a, &d[(i-1)*(m+2)]);
++ v = pt[i] * vs->ppade[i];
++
++ x += (1&i) ? v : -v;
++ out += v;
++ }
++
++ pt[0] = x;
++ out += x;
++
++ return(out);
++}
++
++double mlsadf(double x, double *b, int m, double a, int pd, double *d, VocoderSetup *vs)
++{
++
++ vs->ppade = &(vs->pade[pd*(pd+1)/2]);
++
++ x = mlsadf1 (x, b, m, a, pd, d, vs);
++ x = mlsadf2 (x, b, m, a, pd, &d[2*(pd+1)], vs);
++
++ return (x);
++}
++
++double nrandom (VocoderSetup *vs)
++{
++ unsigned long rr;
++ if (vs->sw == 0) {
++ vs->sw = 1;
++ do {
++ rr = vs->next;
++ vs->r1 = 2 * rnd(&rr) - 1;
++ vs->r2 = 2 * rnd(&rr) - 1;
++ vs->next = rr;
++ vs->s = vs->r1 * vs->r1 + vs->r2 * vs->r2;
++ } while (vs->s > 1 || vs->s == 0);
++
++ vs->s = sqrt (-2 * log(vs->s) / vs->s);
++ return ( vs->r1 * vs->s );
++ }
++ else {
++ vs->sw = 0;
++ return ( vs->r2 * vs->s );
++ }
++}
++
++double rnd (unsigned long *next)
++{
++ double r;
++
++ *next = *next * 1103515245L + 12345;
++ r = (*next / 65536L) % 32768L;
++
++ return ( r/RANDMAX );
++}
++
++unsigned long srnd ( unsigned long seed )
++{
++ return (seed);
++}
++
++
++int mseq (VocoderSetup *vs)
++{
++ register int x0, x28;
++
++ vs->x >>= 1;
++
++ if (vs->x & B0)
++ x0 = 1;
++ else
++ x0 = -1;
++
++ if (vs->x & B28)
++ x28 = 1;
++ else
++ x28 = -1;
++
++ if (x0 + x28)
++ vs->x &= B31_;
++ else
++ vs->x |= B31;
++
++ return (x0);
++}
++
++void mc2b( float *mc, double *b, int m, double a)
++{
++ b[m] = mc[m];
++
++ for (m--; m>=0; m--)
++ b[m] = mc[m] - a * b[m+1];
++}
++
++/* -------------------- End of "vocoder.c" -------------------- */
+--- /dev/null
++++ src/modules/hts21_engine/tree.h
+@@ -0,0 +1,86 @@
++/* --------------------------------------------------------------- */
++/* The HMM-Based Speech Synthesis System (HTS): version 1.1b */
++/* HTS Working Group */
++/* */
++/* Department of Computer Science */
++/* Nagoya Institute of Technology */
++/* and */
++/* Interdisciplinary Graduate School of Science and Engineering */
++/* Tokyo Institute of Technology */
++/* Copyright (c) 2001-2003 */
++/* All Rights Reserved. */
++/* */
++/* Permission is hereby granted, free of charge, to use and */
++/* distribute this software and its documentation without */
++/* restriction, including without limitation the rights to use, */
++/* copy, modify, merge, publish, distribute, sublicense, and/or */
++/* sell copies of this work, and to permit persons to whom this */
++/* work is furnished to do so, subject to the following conditions: */
++/* */
++/* 1. The code must retain the above copyright notice, this list */
++/* of conditions and the following disclaimer. */
++/* */
++/* 2. Any modifications must be clearly marked as such. */
++/* */
++/* NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF TECHNOLOGY, */
++/* HTS WORKING GROUP, AND THE CONTRIBUTORS TO THIS WORK DISCLAIM */
++/* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */
++/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
++/* SHALL NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF */
++/* TECHNOLOGY, HTS WORKING GROUP, NOR THE CONTRIBUTORS BE LIABLE */
++/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY */
++/* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, */
++/* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS */
++/* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR */
++/* PERFORMANCE OF THIS SOFTWARE. */
++/* */
++/* --------------------------------------------------------------- */
++/* tree.h : decision tree definition */
++/* */
++/* 2003/06/11 by Heiga Zen */
++/* --------------------------------------------------------------- */
++
++typedef struct _Pattern{ /* pattern handler for question storage */
++ char *pat; /* pattern */
++ struct _Pattern *next; /* link to next pattern */
++} Pattern;
++
++typedef struct _Question { /* question storage */
++ char *qName; /* name of this question */
++ Pattern *phead; /* link to head of pattern list */
++ Pattern *ptail; /* link to tail of pattern list */
++ struct _Question *next; /* link to next question */
++} Question;
++
++typedef struct _Node { /* node of decision tree */
++ int idx; /* index of this node */
++ int pdf; /* index of pdf for this node ( leaf node only ) */
++ struct _Node *yes; /* link to child node (yes) */
++ struct _Node *no; /* link to child node (no) */
++ Question *quest; /* question applied at this node */
++} Node;
++
++typedef struct _Tree {
++ int state; /* state position of this tree */
++ struct _Tree *next; /* link to next tree */
++ Node *root; /* root node of this decision tree */
++} Tree;
++
++typedef struct _TreeSet {
++ Question *qhead[3];
++ Question *qtail[3];
++
++ Tree *thead[3];
++ Tree *ttail[3];
++
++ FILE *fp[3];
++
++} TreeSet;
++
++void LoadTreesFile (TreeSet *, Mtype);
++int SearchTree (char *, Node *);
++void InitTreeSet(TreeSet *);
++void FreeTrees(TreeSet *ts, Mtype type);
++
++/* -------------------- End of "tree.h" -------------------- */
++
+--- /dev/null
++++ src/modules/hts21_engine/vocoder.h
+@@ -0,0 +1,79 @@
++/* --------------------------------------------------------------- */
++/* The HMM-Based Speech Synthesis System (HTS): version 1.1b */
++/* HTS Working Group */
++/* */
++/* Department of Computer Science */
++/* Nagoya Institute of Technology */
++/* and */
++/* Interdisciplinary Graduate School of Science and Engineering */
++/* Tokyo Institute of Technology */
++/* Copyright (c) 2001-2003 */
++/* All Rights Reserved. */
++/* */
++/* Permission is hereby granted, free of charge, to use and */
++/* distribute this software and its documentation without */
++/* restriction, including without limitation the rights to use, */
++/* copy, modify, merge, publish, distribute, sublicense, and/or */
++/* sell copies of this work, and to permit persons to whom this */
++/* work is furnished to do so, subject to the following conditions: */
++/* */
++/* 1. The code must retain the above copyright notice, this list */
++/* of conditions and the following disclaimer. */
++/* */
++/* 2. Any modifications must be clearly marked as such. */
++/* */
++/* NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF TECHNOLOGY, */
++/* HTS WORKING GROUP, AND THE CONTRIBUTORS TO THIS WORK DISCLAIM */
++/* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */
++/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
++/* SHALL NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF */
++/* TECHNOLOGY, HTS WORKING GROUP, NOR THE CONTRIBUTORS BE LIABLE */
++/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY */
++/* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, */
++/* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS */
++/* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR */
++/* PERFORMANCE OF THIS SOFTWARE. */
++/* */
++/* --------------------------------------------------------------- */
++/* vocoder.h : mel-cepstral vocoder */
++/* (pulse/noise excitation & MLSA filter) */
++/* */
++/* 2003/06/11 by Heiga Zen */
++/* --------------------------------------------------------------- */
++
++#define RANDMAX 32767
++
++typedef struct _VocoderSetup {
++
++ int fprd;
++ int iprd;
++ int seed;
++ int pd;
++ long next;
++ HTS_Boolean gauss;
++ double p1;
++ double pc;
++ double pj;
++ double pade[21];
++ double *ppade;
++ double *c, *cc, *cinc, *d1;
++ double rate;
++
++ int sw;
++ double r1, r2, s;
++
++ int x;
++
++} VocoderSetup;
++
++int mseq(VocoderSetup *);
++double rnd(unsigned long *);
++double nrandom (VocoderSetup *);
++unsigned long srnd(unsigned long );
++double mlsadf(double, double *, int, double, int, double *, VocoderSetup *);
++void mc2b(float *, double *, int, double );
++
++void init_vocoder(int m, VocoderSetup *vs);
++void vocoder (double p, float *mc, int m, FILE *rawfp, globalP *gp, VocoderSetup *vs);
++
++/* -------------------- End of "vocoder.h" -------------------- */
+--- /dev/null
++++ src/modules/hts21_engine/hts_engine.cc
+@@ -0,0 +1,448 @@
++/* --------------------------------------------------------------- */
++/* The HMM-Based Speech Synthesis System (HTS): version 1.1b */
++/* HTS Working Group */
++/* */
++/* Department of Computer Science */
++/* Nagoya Institute of Technology */
++/* and */
++/* Interdisciplinary Graduate School of Science and Engineering */
++/* Tokyo Institute of Technology */
++/* Copyright (c) 2001-2003 */
++/* All Rights Reserved. */
++/* */
++/* Permission is hereby granted, free of charge, to use and */
++/* distribute this software and its documentation without */
++/* restriction, including without limitation the rights to use, */
++/* copy, modify, merge, publish, distribute, sublicense, and/or */
++/* sell copies of this work, and to permit persons to whom this */
++/* work is furnished to do so, subject to the following conditions: */
++/* */
++/* 1. The code must retain the above copyright notice, this list */
++/* of conditions and the following disclaimer. */
++/* */
++/* 2. Any modifications must be clearly marked as such. */
++/* */
++/* NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF TECHNOLOGY, */
++/* HTS WORKING GROUP, AND THE CONTRIBUTORS TO THIS WORK DISCLAIM */
++/* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */
++/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
++/* SHALL NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF */
++/* TECHNOLOGY, HTS WORKING GROUP, NOR THE CONTRIBUTORS BE LIABLE */
++/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY */
++/* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, */
++/* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS */
++/* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR */
++/* PERFORMANCE OF THIS SOFTWARE. */
++/* */
++/* --------------------------------------------------------------- */
++/* hts_engine.c : a compact HMM-based speech synthesis engine */
++/* */
++/* 2003/06/11 by Heiga Zen */
++/* --------------------------------------------------------------- */
++/* Modified by Alan W Black (awb@cs.cmu.edu) */
++/* April 2004 */
++/* Make it compile with c++ and integrate as a Festival module */
++/* --------------------------------------------------------------- */
++
++/* Standard C Libraries */
++#include <cstdio>
++#include <cstdlib>
++#include <cstring>
++#include <cctype>
++#include "festival.h"
++
++#include "misc.h"
++#include "tree.h"
++#include "model.h"
++#include "global.h"
++#include "vocoder.h"
++#include "mlpg.h"
++#include "defaults.h"
++
++void HTS21_Process ( FILE *, FILE *, FILE *, FILE *, PStream *, PStream *,
++ globalP *, ModelSet *, TreeSet *, VocoderSetup *);
++
++/* OutLabel : output label with frame number or time */
++void OutLabel (UttModel *um, HTS_Boolean XIMERA)
++{
++ Model *m;
++ char *tmp;
++ int nframe = 0;
++
++ for (m=um->mhead; m!=um->mtail; m=m->next) {
++ if (XIMERA) { /* in XIMERA format */
++ tmp = wstrdup(m->name);
++ tmp = strchr(tmp,'-')+1;
++ *(strchr(tmp,'+')) = '\0';
++ fprintf(stdout,"%1.3f %s\n", (((float)nframe)*FPERIOD)/((float)RATE), tmp);
++ }
++ else /* in HTK & HTS format */
++ fprintf(stdout, "%d %d %s\n", nframe, nframe+m->totaldur,m->name);
++
++ nframe += m->totaldur;
++ }
++
++ if (XIMERA) /* in XIMERA format */
++ fprintf(stdout,"%1.3f __END__\n", (((float)nframe)*FPERIOD)/((float)RATE));
++
++}
++
++void HTS21_Process ( FILE *labfp, FILE *rawfp, FILE *lf0fp, FILE *mcepfp,
++ PStream *mceppst, PStream *lf0pst, globalP *gp,
++ ModelSet *ms, TreeSet *ts, VocoderSetup *vs )
++{
++ char buf[1024];
++ Tree *tree;
++ int state, diffdur=0;
++ int start, end;
++ int rate, nf;
++ int i;
++ float f, mean, var;
++ HTS_Boolean hastime;
++ Model *m, *mm, *nm;
++ UttModel um;
++
++ rate = FPERIOD * 10000000 / RATE;
++
++ mean = var = 0.0;
++
++ m = walloc(Model,1);
++ um.mtail = um.mhead = m;
++ um.totalframe = um.nState = um.nModel = 0;
++ start = 0;
++ end = 0;
++
++ while (!feof(labfp)) {
++ GetToken (labfp,buf);
++ if (!isalnum(buf[0])) break;
++ if (isdigit(buf[0]))
++ hastime = TRUE;
++ else
++ hastime = FALSE;
++
++ if (hastime) {
++ if (gp->algnst) {
++ start = atoi(buf);
++ GetToken(labfp, buf);
++ end = atoi(buf);
++ GetToken(labfp, buf);
++ GetToken(labfp, buf);
++ }
++ else if (gp->algnph) {
++ start = atoi(buf);
++ GetToken(labfp, buf);
++ end = atoi(buf);
++ GetToken(labfp, buf);
++ }
++ else {
++ do {
++ GetToken(labfp, buf);
++ } while (isdigit(buf[0]));
++ }
++ }
++
++ m->name = wstrdup(buf);
++
++ if (hastime && gp->algnph) {
++ m->durpdf = SearchTree(m->name, ts->thead[DUR]->root);
++ FindDurPDF(m, ms, gp->RHO, diffdur);
++ nf = 0;
++ for (state=2; state<=ms->nstate+1; state++)
++ nf += m->dur[state];
++
++ fprintf(stderr, ">>>nf=%d %d\n", nf, (end-start)/rate);
++
++ f = (float)(end-start)/(rate*nf);
++ m->totaldur = 0;
++
++ for (state=2; state<=ms->nstate+1; state++) {
++ nf = (int)(f*m->dur[state]+0.5);
++ if (nf<=0) nf=1;
++ fprintf(stderr, "%d: %d %f %d\n", state, m->dur[state], f, nf);
++ m->dur[state] = nf;
++ m->totaldur += m->dur[state];
++ }
++ um.totalframe += m->totaldur;
++ }
++ else if (hastime && gp->algnst) {
++ m->dur = walloc(int,ms->nstate+2);
++ m->dur[2] = (end-start)/rate;
++ m->totaldur = m->dur[2];
++ um.totalframe += m->dur[2];
++
++ for (state=3; state<=ms->nstate+1; state++) {
++ GetToken(labfp, buf);
++ start = atoi(buf);
++ GetToken(labfp, buf);
++ end = atoi(buf);
++ GetToken(labfp, buf);
++ m->dur[state] = (end-start)/rate;
++ m->totaldur += m->dur[state];
++ um.totalframe += m->dur[state];
++ }
++ }
++ else {
++ m->durpdf = SearchTree(m->name, ts->thead[DUR]->root);
++ if (gp->LENGTH==0) {
++ FindDurPDF(m, ms, gp->RHO, diffdur);
++ um.totalframe += m->totaldur;
++ }
++ else { /* if total length of generated speech is specified */
++ for (state=2; state<=ms->nstate+1; state++) {
++ mean += ms->durpdf[m->durpdf][state];
++ var += ms->durpdf[m->durpdf][state+ms->nstate];
++ }
++ }
++ }
++
++ /* for excitation */
++ m->lf0pdf = walloc(int,ms->nstate+2);
++ m->lf0mean = walloc(float *,ms->nstate+2);
++ m->lf0variance = walloc(float *,ms->nstate+2);
++ m->voiced = walloc(HTS_Boolean, ms->nstate);
++
++ for (tree=ts->thead[LF0],state=2; tree!=ts->ttail[LF0]; tree=tree->next,state++) {
++ m->lf0pdf[state] = SearchTree(m->name, tree->root);
++ FindLF0PDF(state, m, ms, gp->UV);
++ }
++
++ /* for spectrum */
++ m->mceppdf = walloc(int,ms->nstate+2);
++ m->mcepmean = walloc(float *,ms->nstate+2);
++ m->mcepvariance = walloc(float *,ms->nstate+2);
++
++/* m->mceppdf -= 2; m->mcepmean -= 2; m->mcepvariance -= 2; */
++
++ for (tree=ts->thead[MCP],state=2; tree!=ts->ttail[MCP]; tree=tree->next,state++) {
++ m->mceppdf[state] = SearchTree(m->name, tree->root);
++ FindMcpPDF(state, m, ms);
++ }
++
++ m->next = walloc(Model,1);
++ m = um.mtail = m->next;
++
++ um.nModel++;
++ um.nState+=ms->nstate;
++ }
++
++ if (gp->LENGTH > 0 && gp->LENGTH < um.nState) {
++ fprintf(stderr, "Specified length of generated speech is too short ! (this sentence HMM is composed from %d states)\n", um.nState);
++ fprintf(stderr, "Please specify more than %.1f seconds.\n", (float)(um.nState*FPERIOD)/RATE);
++ festival_error();
++ }
++
++ /* if total length of generated speech is specified */
++ /* compute RHO */
++ if (gp->LENGTH>0) {
++ gp->RHO = (gp->LENGTH - mean)/var;
++ /* compute state duration for each state */
++ for (m=um.mhead; m!=um.mtail; m=m->next) {
++ FindDurPDF(m, ms, gp->RHO, diffdur);
++ um.totalframe += m->totaldur;
++ }
++ }
++
++ /* Output label information */
++ /* OutLabel(&um, gp->XIMERA); */
++
++ pdf2speech(rawfp, lf0fp, mcepfp, mceppst, lf0pst, gp, ms, &um, vs);
++
++ /* Tidy up memory */
++ for (mm=um.mhead; mm; mm=nm)
++ {
++ nm = mm->next;
++ for (i=0; i<ms->nstate+2; i++)
++ {
++ if (mm->lf0mean) wfree(mm->lf0mean[i]);
++ if (mm->lf0variance) wfree(mm->lf0variance[i]);
++ }
++ wfree(mm->mcepvariance);
++ wfree(mm->mcepmean);
++ wfree(mm->mceppdf);
++ wfree(mm->voiced);
++ wfree(mm->lf0variance);
++ wfree(mm->lf0mean);
++ wfree(mm->lf0pdf);
++ wfree(mm->dur);
++ wfree(mm->name);
++ wfree(mm);
++ }
++}
++
++static FILE *do_fopen(const char *fname,const char *mode)
++{
++ FILE *fd;
++
++ fd = fopen(fname,mode);
++ if (fd == NULL)
++ {
++ cerr << "hts_engine: failed to open " << fname << endl;
++ festival_error();
++ }
++ return fd;
++}
++
++LISP HTS21_Synthesize_Utt(LISP utt)
++{
++ EST_Utterance *u = get_c_utt(utt);
++ EST_Item *item = 0;
++ LISP hts_engine_params = NIL;
++ LISP hts_output_params = NIL;
++ FILE *labfp=NULL;
++ FILE *lf0fp=NULL, *mcepfp=NULL, *rawfp=NULL;
++
++ ModelSet ms;
++ TreeSet ts;
++ PStream mceppst, lf0pst;
++ globalP gp;
++ VocoderSetup vs;
++
++ /* default value for control parameter */
++ gp.RHO = 0.0;
++ gp.ALPHA = 0.42;
++ gp.F0_STD = 1.0;
++ gp.F0_MEAN = 0.0;
++ gp.UV = 0.5;
++ gp.LENGTH = 0;
++ gp.algnst = FALSE;
++ gp.algnph = FALSE;
++ gp.XIMERA = FALSE;
++
++ /* Get voice specific params */
++ hts_engine_params = siod_get_lval("hts_engine_params",
++ "HTS_ENGINE: no parameters set for module");
++ /* We should be internalize these ones more */
++ hts_output_params = siod_get_lval("hts_output_params",
++ "HTS_ENGINE: no output parameters set for module");
++
++ /* initialise TreeSet and ModelSet */
++ InitTreeSet (&ts);
++ InitModelSet(&ms);
++
++ /* delta window handler for log f0 */
++ lf0pst.dw.fn = walloc(char *,20);
++ lf0pst.dw.num = 1;
++
++ /* delta window handler for mel-cepstrum */
++ mceppst.dw.fn = walloc(char *,20);
++ mceppst.dw.num = 1;
++
++ /* Load parameters */
++ mceppst.dw.fn[1] = (char *)get_param_str("-dm1",hts_engine_params,
++ "hts/mcep_dyn.win");
++ mceppst.dw.fn[2] = (char *)get_param_str("-dm2",hts_engine_params,
++ "hts/mcep_acc.win");
++ mceppst.dw.num = 3;
++
++ lf0pst.dw.fn[1] = (char *)get_param_str("-df1",hts_engine_params,
++ "hts/lf0_dyn.win");
++ lf0pst.dw.fn[2] = (char *)get_param_str("-df2",hts_engine_params,
++ "hts/lf0_acc.win");
++ lf0pst.dw.num = 3;
++
++ ts.fp[DUR]=do_fopen(get_param_str("-td",hts_engine_params,
++ "hts/trees-dur.inf"),"r");
++ ts.fp[LF0]=do_fopen(get_param_str("-tf",hts_engine_params,
++ "hts/trees-lf0.inf"), "r");
++ ts.fp[MCP]=do_fopen(get_param_str("-tm",hts_engine_params,
++ "hts/trees-mcep.inf"), "r");
++ ms.fp[DUR]=do_fopen(get_param_str("-md",hts_engine_params,
++ "hts/duration.pdf"),"rb");
++ ms.fp[LF0]=do_fopen(get_param_str("-mf",hts_engine_params,
++ "hts/lf0.pdf"), "rb");
++ ms.fp[MCP]=do_fopen(get_param_str("-mm",hts_engine_params,
++ "hts/mcep.pdf"), "rb");
++
++ rawfp = do_fopen(get_param_str("-or",hts_output_params,
++ "tmp.raw"), "wb");
++ lf0fp = do_fopen(get_param_str("-of",hts_output_params,
++ "tmp.f0"), "wb");
++ mcepfp = do_fopen(get_param_str("-om",hts_output_params,
++ "tmp.mcep"), "wb");
++ labfp = do_fopen(get_param_str("-labelfile",hts_output_params,
++ "utt.feats"), "r");
++
++ gp.RHO = get_param_float("-r",hts_engine_params,0.0);
++ gp.ALPHA = get_param_float("-a",hts_engine_params,0.42);
++ gp.F0_STD = get_param_float("-fs",hts_engine_params,1.0);
++ gp.F0_MEAN = get_param_float("-fm",hts_engine_params,0.0);
++ gp.UV = get_param_float("-u",hts_engine_params,0.5);
++ gp.LENGTH = (int)get_param_float("-l",hts_engine_params,0.0);
++
++ /* do what needs to be done */
++ LoadTreesFile(&ts, DUR);
++ LoadTreesFile(&ts, LF0);
++ LoadTreesFile(&ts, MCP);
++
++ /* load model files for duration, log f0 and mel-cepstrum */
++ LoadModelFiles(&ms);
++
++ /* if the name of output speech file is not specified, waveform generation won't be generated */
++ if (rawfp!=NULL)
++ init_vocoder(ms.mcepvsize-1, &vs);
++
++ /* check the number of window */
++ if (lf0pst.dw.num != ms.lf0stream)
++ {
++ cerr << "Festival: HTS: dynamic window for f0 is illegal\n";
++ festival_error();
++ }
++ if (ms.mcepvsize % mceppst.dw.num != 0 )
++ {
++ cerr << "Festival: HTS: dynamic window for mcep is illegal\n";
++ festival_error();
++ }
++
++ /* generate speech */
++ if (u->relation("Segment")->first()) /* only if there segments */
++ HTS21_Process(labfp, rawfp, lf0fp, mcepfp,
++ &mceppst, &lf0pst, &gp, &ms, &ts, &vs);
++
++ /* Load back in the waveform */
++ EST_Wave *w = new EST_Wave;
++
++ fclose(ts.fp[DUR]);
++ fclose(ts.fp[LF0]);
++ fclose(ts.fp[MCP]);
++ fclose(ms.fp[DUR]);
++ fclose(ms.fp[LF0]);
++ fclose(ms.fp[MCP]);
++ fclose(rawfp);
++ fclose(lf0fp);
++ fclose(mcepfp);
++ fclose(labfp);
++
++ wfree(vs.c);
++ wfree(lf0pst.dw.fn);
++ wfree(mceppst.dw.fn);
++ FreeTrees(&ts, DUR);
++ FreeTrees(&ts, LF0);
++ FreeTrees(&ts, MCP);
++ DeleteModelSet(&ms);
++
++ if (u->relation("Segment")->first()) /* only if there segments */
++ w->load_file(get_param_str("-or",hts_output_params,"tmp.raw"),
++ "raw", 16000,
++ "short", str_to_bo("native"), 1);
++
++ item = u->create_relation("Wave")->append();
++ item->set_val("wave",est_val(w));
++
++ return utt;
++}
++
++LISP hts21_mlsa_resynthesis(LISP ltrack);
++
++void festival_hts21_engine_init(void)
++{
++ proclaim_module("hts21_engine");
++
++ festival_def_utt_module("HTS21_Synthesize",HTS21_Synthesize_Utt,
++ "(HTS21_Synthesis UTT)\n\
++ Synthesize a waveform using the HTS 2.1 Engine and the current models");
++ init_subr_1("hts21_mlsa_resynthesis",hts21_mlsa_resynthesis,
++ "(hts21_mlsa_resynthesis TRACK)\n\
++ Return a WAVE synthesized from the F0/MCEP TRACK.");
++}
++
++/* -------------------- End of "hts_engine.c" -------------------- */
+--- /dev/null
++++ src/modules/hts21_engine/model.h
+@@ -0,0 +1,87 @@
++/* --------------------------------------------------------------- */
++/* The HMM-Based Speech Synthesis System (HTS): version 1.1b */
++/* HTS Working Group */
++/* */
++/* Department of Computer Science */
++/* Nagoya Institute of Technology */
++/* and */
++/* Interdisciplinary Graduate School of Science and Engineering */
++/* Tokyo Institute of Technology */
++/* Copyright (c) 2001-2003 */
++/* All Rights Reserved. */
++/* */
++/* Permission is hereby granted, free of charge, to use and */
++/* distribute this software and its documentation without */
++/* restriction, including without limitation the rights to use, */
++/* copy, modify, merge, publish, distribute, sublicense, and/or */
++/* sell copies of this work, and to permit persons to whom this */
++/* work is furnished to do so, subject to the following conditions: */
++/* */
++/* 1. The code must retain the above copyright notice, this list */
++/* of conditions and the following disclaimer. */
++/* */
++/* 2. Any modifications must be clearly marked as such. */
++/* */
++/* NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF TECHNOLOGY, */
++/* HTS WORKING GROUP, AND THE CONTRIBUTORS TO THIS WORK DISCLAIM */
++/* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */
++/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
++/* SHALL NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF */
++/* TECHNOLOGY, HTS WORKING GROUP, NOR THE CONTRIBUTORS BE LIABLE */
++/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY */
++/* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, */
++/* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS */
++/* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR */
++/* PERFORMANCE OF THIS SOFTWARE. */
++/* */
++/* --------------------------------------------------------------- */
++/* model.h : model definition */
++/* */
++/* 2003/06/11 by Heiga Zen */
++/* --------------------------------------------------------------- */
++
++typedef struct _Model { /* HMM handler */
++ char *name; /* the name of this HMM */
++ int durpdf; /* duration pdf index for this HMM */
++ int *lf0pdf; /* mel-cepstrum pdf indexes for each state of this HMM */
++ int *mceppdf; /* log f0 pdf indexes for each state of this HMM */
++ int *dur; /* duration for each state of this HMM */
++ int totaldur; /* total duration of this HMM */
++ float **lf0mean; /* mean vector of log f0 pdfs for each state of this HMM */
++ float **lf0variance; /* variance (diag) elements of log f0 for each state of this HMM */
++ float **mcepmean; /* mean vector of mel-cepstrum pdfs for each state of this HMM */
++ float **mcepvariance; /* variance (diag) elements of mel-cepstrum for each state of this HMM */
++ HTS_Boolean *voiced; /* voiced/unvoiced decision for each state of this HMM */
++ struct _Model *next; /* pointer to next HMM */
++} Model;
++
++
++typedef struct _UttModel { /* Utterance model handler */
++ Model *mhead;
++ Model *mtail;
++ int nModel;
++ int nState;
++ int totalframe;
++} UttModel;
++
++
++typedef struct _ModelSet { /* HMM set handler */
++ int nstate;
++ int lf0stream;
++ int mcepvsize;
++ int ndurpdf;
++ int *nmceppdf;
++ int *nlf0pdf;
++ float **durpdf,***mceppdf,****lf0pdf;
++ FILE *fp[3];
++} ModelSet;
++
++
++void LoadModelFiles (ModelSet *);
++void FindDurPDF (Model *, ModelSet *, float, int );
++void FindLF0PDF (int, Model *, ModelSet *, float);
++void FindMcpPDF (int, Model *, ModelSet *);
++void InitModelSet (ModelSet *);
++void DeleteModelSet(ModelSet *ms);
++
++/* -------------------- End of "model.h" -------------------- */
+--- /dev/null
++++ src/modules/hts21_engine/misc.cc
+@@ -0,0 +1,114 @@
++/* --------------------------------------------------------------- */
++/* The HMM-Based Speech Synthesis System (HTS): version 1.1b */
++/* HTS Working Group */
++/* */
++/* Department of Computer Science */
++/* Nagoya Institute of Technology */
++/* and */
++/* Interdisciplinary Graduate School of Science and Engineering */
++/* Tokyo Institute of Technology */
++/* Copyright (c) 2001-2003 */
++/* All Rights Reserved. */
++/* */
++/* Permission is hereby granted, free of charge, to use and */
++/* distribute this software and its documentation without */
++/* restriction, including without limitation the rights to use, */
++/* copy, modify, merge, publish, distribute, sublicense, and/or */
++/* sell copies of this work, and to permit persons to whom this */
++/* work is furnished to do so, subject to the following conditions: */
++/* */
++/* 1. The code must retain the above copyright notice, this list */
++/* of conditions and the following disclaimer. */
++/* */
++/* 2. Any modifications must be clearly marked as such. */
++/* */
++/* NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF TECHNOLOGY, */
++/* HTS WORKING GROUP, AND THE CONTRIBUTORS TO THIS WORK DISCLAIM */
++/* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */
++/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
++/* SHALL NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF */
++/* TECHNOLOGY, HTS WORKING GROUP, NOR THE CONTRIBUTORS BE LIABLE */
++/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY */
++/* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, */
++/* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS */
++/* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR */
++/* PERFORMANCE OF THIS SOFTWARE. */
++/* */
++/* --------------------------------------------------------------- */
++/* misc.c : miscellaneous functions (from SPTK) */
++/* */
++/* 2003/06/11 by Heiga Zen */
++/* --------------------------------------------------------------- */
++
++#include <cstdio>
++#include <cstdlib>
++#include <cstring>
++#include <cctype>
++#include "festival.h"
++#include "misc.h"
++
++FILE *getfp (char *name, char *opt)
++{
++ FILE *fp;
++
++ if ((fp=fopen(name, opt)) == NULL) {
++ fprintf (stderr, "Can't open '%s'!\n", name);
++ festival_error();
++ }
++ return (fp);
++}
++
++void GetToken (FILE *fp, char *buff)
++{
++ char c;
++ int i;
++ HTS_Boolean squote = 0;
++ HTS_Boolean dquote = 0;
++
++ c = fgetc (fp);
++
++ while (isspace(c))
++ c = fgetc (fp);
++
++ if (c=='\'') { /* single quote case */
++ c = fgetc (fp);
++ squote = 1;
++ }
++
++ if (c=='\"') { /*double quote case */
++ c = fgetc (fp);
++ dquote = 1;
++ }
++
++ if (c==',') { /*special character ',' */
++ strcpy (buff, ",");
++ return;
++ }
++
++ i = 0;
++ while (1) {
++ buff[i++] = c;
++ c = fgetc (fp);
++ if (squote && c == '\'') break;
++ if (dquote && c == '\"') break;
++ if (!(squote || dquote || isgraph(c)) ) break;
++ }
++
++ buff[i]=0;
++}
++
++void movem (double *a, double *b, int nitem)
++{
++ register long i;
++
++ i = nitem;
++
++ if (a>b)
++ while (i--) *b++ = *a++;
++ else {
++ a += i; b += i;
++ while (i--) *--b = *--a;
++ }
++}
++
++/* -------------------- End of "misc.c" -------------------- */
+--- /dev/null
++++ src/modules/hts21_engine/misc.h
+@@ -0,0 +1,50 @@
++/* --------------------------------------------------------------- */
++/* The HMM-Based Speech Synthesis System (HTS): version 1.1b */
++/* HTS Working Group */
++/* */
++/* Department of Computer Science */
++/* Nagoya Institute of Technology */
++/* and */
++/* Interdisciplinary Graduate School of Science and Engineering */
++/* Tokyo Institute of Technology */
++/* Copyright (c) 2001-2003 */
++/* All Rights Reserved. */
++/* */
++/* Permission is hereby granted, free of charge, to use and */
++/* distribute this software and its documentation without */
++/* restriction, including without limitation the rights to use, */
++/* copy, modify, merge, publish, distribute, sublicense, and/or */
++/* sell copies of this work, and to permit persons to whom this */
++/* work is furnished to do so, subject to the following conditions: */
++/* */
++/* 1. The code must retain the above copyright notice, this list */
++/* of conditions and the following disclaimer. */
++/* */
++/* 2. Any modifications must be clearly marked as such. */
++/* */
++/* NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF TECHNOLOGY, */
++/* HTS WORKING GROUP, AND THE CONTRIBUTORS TO THIS WORK DISCLAIM */
++/* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */
++/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
++/* SHALL NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF */
++/* TECHNOLOGY, HTS WORKING GROUP, NOR THE CONTRIBUTORS BE LIABLE */
++/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY */
++/* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, */
++/* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS */
++/* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR */
++/* PERFORMANCE OF THIS SOFTWARE. */
++/* */
++/* --------------------------------------------------------------- */
++/* misc.h : miscellaneous functions (from SPTK) */
++/* */
++/* 2003/06/11 by Heiga Zen */
++/* --------------------------------------------------------------- */
++
++FILE *getfp (char *, char *);
++void GetToken (FILE *,char *);
++void movem (double *, double *, int);
++
++typedef bool HTS_Boolean;
++typedef enum {DUR, LF0, MCP} Mtype;
++
++/* -------------------- End of "misc.h" -------------------- */
+--- /dev/null
++++ src/modules/hts21_engine/mlpg.cc
+@@ -0,0 +1,483 @@
++/* --------------------------------------------------------------- */
++/* The HMM-Based Speech Synthesis System (HTS): version 1.1b */
++/* HTS Working Group */
++/* */
++/* Department of Computer Science */
++/* Nagoya Institute of Technology */
++/* and */
++/* Interdisciplinary Graduate School of Science and Engineering */
++/* Tokyo Institute of Technology */
++/* Copyright (c) 2001-2003 */
++/* All Rights Reserved. */
++/* */
++/* Permission is hereby granted, free of charge, to use and */
++/* distribute this software and its documentation without */
++/* restriction, including without limitation the rights to use, */
++/* copy, modify, merge, publish, distribute, sublicense, and/or */
++/* sell copies of this work, and to permit persons to whom this */
++/* work is furnished to do so, subject to the following conditions: */
++/* */
++/* 1. The code must retain the above copyright notice, this list */
++/* of conditions and the following disclaimer. */
++/* */
++/* 2. Any modifications must be clearly marked as such. */
++/* */
++/* NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF TECHNOLOGY, */
++/* HTS WORKING GROUP, AND THE CONTRIBUTORS TO THIS WORK DISCLAIM */
++/* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */
++/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
++/* SHALL NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF */
++/* TECHNOLOGY, HTS WORKING GROUP, NOR THE CONTRIBUTORS BE LIABLE */
++/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY */
++/* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, */
++/* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS */
++/* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR */
++/* PERFORMANCE OF THIS SOFTWARE. */
++/* */
++/* --------------------------------------------------------------- */
++/* mlpg.c : speech parameter generation from pdf sequence */
++/* */
++/* 2003/06/11 by Heiga Zen */
++/* --------------------------------------------------------------- */
++
++#include <cstdio>
++#include <cstdlib>
++#include <cstring>
++#include <cctype>
++#include <cmath>
++#include "festival.h"
++
++#include "defaults.h"
++#include "misc.h"
++#include "model.h"
++#include "global.h"
++#include "vocoder.h"
++#include "mlpg.h"
++
++double finv (double x)
++{
++ if (x >= INFTY2) return 0.0;
++ if (x <= -INFTY2) return 0.0;
++ if (x <= INVINF2 && x >= 0) return INFTY;
++ if (x >= -INVINF2 && x < 0) return -INFTY;
++
++ return 1.0/x;
++}
++
++double *dcalloc(int x)
++{
++ return walloc(double,x);
++}
++
++double **ddcalloc(int x, int y)
++{
++ register int i;
++ double **ptr;
++
++ ptr = walloc(double *,x);
++
++ for (i=0; i<x; i++)
++ ptr[i] = dcalloc(y);
++
++ return(ptr);
++}
++
++float *fcalloc(int x)
++{
++ return walloc(float,x);
++}
++
++float **ffcalloc(int x, int y)
++{
++ register int i;
++ float **ptr;
++
++ ptr = walloc(float *,x);
++
++ for (i=0; i<x; i++)
++ ptr[i] = fcalloc(y);
++
++ return(ptr);
++}
++
++int str2farray (char *c, float **x)
++{
++ int i, size, sp;
++ char *p, *buf;
++
++ while (isspace(*c))
++ c++;
++
++ if (*c == '\0') {
++ *x = NULL;
++ return (0);
++ }
++
++ size = 1;
++ sp = 0;
++
++ for (p = c; *p != '\0'; p++) {
++ if (!isspace (*p)) {
++ if (sp == 1) {
++ size++;
++ sp = 0;
++ }
++ }
++ else
++ sp = 1;
++ }
++
++ buf = walloc(char,strlen(c));
++
++ *x = walloc(float,size);
++
++ for (i=0; i<size; i++)
++ (*x)[i] = (float)strtod (c, &c);
++
++ return (size);
++}
++
++/*----------------------------------------------------------------
++ matrix calcuration functions
++----------------------------------------------------------------*/
++
++/* calc_R_and_r : calcurate R=W'U^{-1}W and r=W'U^{-1}M */
++void calc_R_and_r(PStream *pst, int m)
++{
++ register int i, j, k, l, n;
++ double wu;
++
++ for (i=0; i<pst->T; i++) {
++ pst->sm.r[i] = pst->sm.ivseq[i][m] * pst->sm.mseq[i][m];
++ pst->sm.R[i][0] = pst->sm.ivseq[i][m];
++
++ for (j=1; j<pst->width; j++)
++ pst->sm.R[i][j]=0.0;
++
++ for (j=1; j<pst->dw.num; j++)
++ for (k=pst->dw.width[j][0]; k<=pst->dw.width[j][1]; k++) {
++ n = i+k;
++ if ( (n>=0) && (n<pst->T) && (pst->dw.coef[j][-k]!=0.0) ) {
++ l = j*(pst->order+1)+m;
++ wu = pst->dw.coef[j][-k] * pst->sm.ivseq[n][l];
++ pst->sm.r[i] += wu*pst->sm.mseq[n][l];
++
++ for (l=0; l<pst->width; l++) {
++ n = l-k;
++ if ( (n<=pst->dw.width[j][1]) && (i+l<pst->T) && (pst->dw.coef[j][n] != 0.0) )
++ pst->sm.R[i][l] += wu * pst->dw.coef[j][n];
++ }
++ }
++ }
++ }
++}
++
++/* Cholesky : Cholesky factorization of Matrix R */
++void Cholesky(PStream *pst)
++{
++ register int i, j, k;
++
++ pst->sm.R[0][0] = sqrt(pst->sm.R[0][0]);
++
++ for (i=1; i<pst->width; i++)
++ pst->sm.R[0][i] /= pst->sm.R[0][0];
++
++ for (i=1; i<pst->T; i++) {
++ for (j=1; j<pst->width; j++)
++ if (i-j >= 0)
++ pst->sm.R[i][0] -= pst->sm.R[i-j][j] * pst->sm.R[i-j][j];
++
++ pst->sm.R[i][0] = sqrt(pst->sm.R[i][0]);
++
++ for (j=1; j<pst->width; j++) {
++ for (k=0; k<pst->dw.max_L; k++)
++ if (j!=pst->width-1)
++ pst->sm.R[i][j] -= pst->sm.R[i-k-1][j-k]*pst->sm.R[i-k-1][j+1];
++
++ pst->sm.R[i][j] /= pst->sm.R[i][0];
++ }
++ }
++}
++
++/* Cholesky_forward : forward substitution to solve linear equations */
++void Cholesky_forward(PStream *pst)
++{
++ register int i, j;
++ double hold;
++
++ pst->sm.g[0] = pst->sm.r[0] / pst->sm.R[0][0];
++
++ for (i=1; i<pst->T; i++) {
++ hold = 0.0;
++ for (j=1; j<pst->width; j++) {
++ if (i-j >= 0)
++ hold += pst->sm.R[i-j][j]*pst->sm.g[i-j];
++ }
++ pst->sm.g[i] = (pst->sm.r[i]-hold)/pst->sm.R[i][0];
++ }
++}
++
++/* Cholesky_backward : backward substitution to solve linear equations */
++void Cholesky_backward(PStream *pst, int m)
++{
++ register int i, j;
++ double hold;
++
++ pst->par[pst->T-1][m] = pst->sm.g[pst->T-1] / pst->sm.R[pst->T-1][0];
++
++ for (i=pst->T-2; i>=0; i--) {
++ hold = 0.0;
++ for (j=1; j<pst->width; j++) {
++ if (pst->sm.R[i][j] != 0.0)
++ hold += pst->sm.R[i][j]*pst->par[i+j][m];
++ }
++ pst->par[i][m] = (float)((pst->sm.g[i] - hold) / pst->sm.R[i][0]);
++ }
++}
++
++/* generate parameter sequence from pdf sequence */
++void mlpg(PStream *pst)
++{
++ int m;
++
++ for (m=0; m<=pst->order; m++) {
++ calc_R_and_r(pst,m);
++ Cholesky(pst);
++ Cholesky_forward(pst);
++ Cholesky_backward(pst,m);
++ }
++}
++
++
++/* InitPStream : Initialise PStream for parameter generation */
++void InitPStream(PStream *pst)
++{
++ pst->width = pst->dw.max_L*2+1; /* band width of R */
++
++ pst->sm.mseq = ddcalloc(pst->T, pst->vSize);
++ pst->sm.ivseq = ddcalloc(pst->T, pst->vSize);
++ pst->sm.g = dcalloc (pst->T);
++ pst->sm.R = ddcalloc(pst->T, pst->width);
++ pst->sm.r = dcalloc (pst->T);
++ pst->par = ffcalloc(pst->T,pst->order+1);
++}
++
++/* FreePStream : Free PStream */
++void FreePStream(PStream *pst)
++{
++ register int t;
++
++ for (t=0; t<pst->T; t++) {
++ wfree(pst->sm.mseq[t]);
++ wfree(pst->sm.ivseq[t]);
++ wfree(pst->sm.R[t]);
++ wfree(pst->par[t]);
++ }
++
++ for (t=0; t<pst->dw.num; t++)
++ wfree(pst->dw.width[t]);
++ wfree(pst->dw.width);
++ wfree(pst->dw.coefr[0]);
++ for (t=1; t<pst->dw.num; t++)
++ wfree(pst->dw.coefr[t]);
++ wfree(pst->dw.coefr);
++ wfree(pst->dw.coef);
++
++ wfree(pst->sm.mseq);
++ wfree(pst->sm.ivseq);
++ wfree(pst->sm.R);
++ wfree(pst->sm.g);
++ wfree(pst->sm.r);
++ wfree(pst->par);
++}
++
++/* pdf2speech : parameter generation from pdf sequence */
++void pdf2speech( FILE *rawfp, FILE *lf0fp, FILE *mcepfp,
++ PStream *mceppst, PStream *lf0pst, globalP *gp, ModelSet *ms, UttModel *um, VocoderSetup *vs)
++{
++ int frame, mcepframe, lf0frame;
++ int state, lw, rw, k, n;
++ Model *m;
++ HTS_Boolean nobound, *voiced;
++
++ float f0;
++
++ lf0pst->vSize = ms->lf0stream;
++ lf0pst->order = 0;
++ mceppst->vSize = ms->mcepvsize;
++ mceppst->order = mceppst->vSize / mceppst->dw.num - 1;
++
++ InitDWin(lf0pst);
++ InitDWin(mceppst);
++
++ mcepframe = 0;
++ lf0frame = 0;
++
++ voiced = walloc(HTS_Boolean,um->totalframe+1);
++
++ for (m=um->mhead; m!=um->mtail ; m=m->next) {
++ for (state=2; state<=ms->nstate+1; state++) {
++ for (frame=1; frame<=m->dur[state]; frame++) {
++ voiced[mcepframe++] = m->voiced[state];
++ if (m->voiced[state]) {
++ lf0frame++;
++ }
++ }
++ }
++ }
++
++ mceppst->T = mcepframe;
++ lf0pst->T = lf0frame;
++
++ InitPStream(mceppst);
++ InitPStream(lf0pst);
++
++ mcepframe = 0;
++ lf0frame = 0;
++
++ for (m=um->mhead; m!=um->mtail; m=m->next) {
++ for (state=2; state<=ms->nstate+1; state++) {
++ for (frame=1; frame<=m->dur[state]; frame++) {
++ for (k=0; k<ms->mcepvsize; k++) {
++ mceppst->sm.mseq[mcepframe][k] = m->mcepmean[state][k];
++ mceppst->sm.ivseq[mcepframe][k] = finv(m->mcepvariance[state][k]);
++ }
++ for (k=0; k<ms->lf0stream; k++) {
++ lw = lf0pst->dw.width[k][WLEFT];
++ rw = lf0pst->dw.width[k][WRIGHT];
++ nobound = (HTS_Boolean)1;
++
++ for (n=lw; n<=rw;n++)
++ if (mcepframe+n<0 || um->totalframe<mcepframe+n)
++ nobound = (HTS_Boolean)0;
++ else
++ nobound = (HTS_Boolean)((int)nobound & voiced[mcepframe+n]);
++
++ if (voiced[mcepframe]) {
++ lf0pst->sm.mseq[lf0frame][k] = m->lf0mean[state][k+1];
++ if (nobound || k==0)
++ lf0pst->sm.ivseq[lf0frame][k] = finv(m->lf0variance[state][k+1]);
++ else
++ lf0pst->sm.ivseq[lf0frame][k] = 0.0;
++ }
++ }
++ if (voiced[mcepframe])
++ lf0frame++;
++ mcepframe++;
++ }
++ }
++ }
++
++ mlpg(mceppst);
++
++ if (lf0frame>0)
++ mlpg(lf0pst);
++
++ lf0frame = 0;
++
++ if (gp->XIMERA && lf0fp!=NULL)
++ fprintf(lf0fp, "# FrameShift=%dms\n", (FPERIOD*1000)/RATE);
++
++ for (mcepframe=0; mcepframe<mceppst->T; mcepframe++) {
++ if (voiced[mcepframe])
++ f0 = gp->F0_STD * exp(lf0pst->par[lf0frame++][0]) + gp->F0_MEAN;
++ else
++ f0 = 0.0;
++
++ if (mcepfp != NULL)
++ fwrite(mceppst->par[mcepframe], sizeof(float), mceppst->order+1, mcepfp);
++ if (lf0fp != NULL) {
++ if (gp->XIMERA)
++ fprintf(lf0fp, "%.1f 1\n", f0);
++ else
++ fwrite(&f0, sizeof(double), 1, lf0fp);
++ }
++
++ if (rawfp!=NULL)
++ vocoder(f0, mceppst->par[mcepframe], mceppst->order, rawfp, gp, vs);
++ }
++
++ FreePStream(mceppst);
++ FreePStream(lf0pst);
++ wfree(voiced);
++}
++
++/* InitDWin : Initialise dynamic window */
++void InitDWin(PStream *pst)
++{
++ int i;
++ int fsize, leng, fpos;
++ FILE *fp;
++
++ /* memory allocation */
++ pst->dw.width = walloc(int *,pst->dw.num);
++
++ for (i=0; i<pst->dw.num; i++) {
++ pst->dw.width[i] = walloc(int,2);
++ }
++
++ pst->dw.coef= walloc(float *,pst->dw.num);
++ /* because the pointers are moved, keep an original of the memory
++ being allocated */
++ pst->dw.coefr= walloc(float *,pst->dw.num);
++
++ /* window for static parameter */
++ pst->dw.width[0][WLEFT] = pst->dw.width[0][WRIGHT] = 0;
++ pst->dw.coef[0] = fcalloc (1);
++ pst->dw.coefr[0] = pst->dw.coef[0];
++ pst->dw.coef[0][0] = 1;
++
++ /* set delta coefficients */
++ for (i=1; i<pst->dw.num; i++) {
++ if (pst->dw.fn[i][0] == ' ')
++ fsize = str2farray(pst->dw.fn[i], &(pst->dw.coef[i]));
++ else { /* read from file */
++ if ((fp = fopen (pst->dw.fn[i], "r")) == NULL) {
++ fprintf(stderr, "file %s not found\n", pst->dw.fn[i]);
++ festival_error();
++ }
++
++ /* check the number of coefficients */
++ fseek(fp, 0L, 2);
++ fpos = (int)ftell(fp);
++ fsize = fpos/sizeof (float);
++ fseek(fp, 0L, 0);
++
++ /* read coefficients */
++ pst->dw.coef[i] = fcalloc (fsize);
++ pst->dw.coefr[i] = pst->dw.coef[i];
++ fread(pst->dw.coef[i], sizeof(float), fsize, fp);
++ if (EST_BIG_ENDIAN)
++ swap_bytes_float(pst->dw.coef[i],fsize);
++
++ fclose(fp);
++ }
++
++ /* set pointer */
++ leng = fsize / 2;
++ pst->dw.coef[i] += leng;
++ pst->dw.width[i][WLEFT] = -leng;
++ pst->dw.width[i][WRIGHT] = leng;
++
++ if (fsize % 2 == 0)
++ pst->dw.width[i][WRIGHT]--;
++ }
++
++ pst->dw.maxw[WLEFT] = pst->dw.maxw[WRIGHT] = 0;
++
++ for (i=0; i<pst->dw.num; i++) {
++ if (pst->dw.maxw[WLEFT] > pst->dw.width[i][WLEFT])
++ pst->dw.maxw[WLEFT] = pst->dw.width[i][WLEFT];
++ if (pst->dw.maxw[WRIGHT] < pst->dw.width[i][WRIGHT])
++ pst->dw.maxw[WRIGHT] = pst->dw.width[i][WRIGHT];
++ }
++
++ /* calcurate max_L to determine size of band matrix */
++ if ( pst->dw.maxw[WLEFT] >= pst->dw.maxw[WRIGHT] )
++ pst->dw.max_L = pst->dw.maxw[WLEFT];
++ else
++ pst->dw.max_L = pst->dw.maxw[WRIGHT];
++
++}
++
++/* -------------------- End of "mlpg.c" -------------------- */
+--- /dev/null
++++ src/modules/hts21_engine/tree.cc
+@@ -0,0 +1,325 @@
++/* --------------------------------------------------------------- */
++/* The HMM-Based Speech Synthesis System (HTS): version 1.1b */
++/* HTS Working Group */
++/* */
++/* Department of Computer Science */
++/* Nagoya Institute of Technology */
++/* and */
++/* Interdisciplinary Graduate School of Science and Engineering */
++/* Tokyo Institute of Technology */
++/* Copyright (c) 2001-2003 */
++/* All Rights Reserved. */
++/* */
++/* Permission is hereby granted, free of charge, to use and */
++/* distribute this software and its documentation without */
++/* restriction, including without limitation the rights to use, */
++/* copy, modify, merge, publish, distribute, sublicense, and/or */
++/* sell copies of this work, and to permit persons to whom this */
++/* work is furnished to do so, subject to the following conditions: */
++/* */
++/* 1. The code must retain the above copyright notice, this list */
++/* of conditions and the following disclaimer. */
++/* */
++/* 2. Any modifications must be clearly marked as such. */
++/* */
++/* NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF TECHNOLOGY, */
++/* HTS WORKING GROUP, AND THE CONTRIBUTORS TO THIS WORK DISCLAIM */
++/* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */
++/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
++/* SHALL NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF */
++/* TECHNOLOGY, HTS WORKING GROUP, NOR THE CONTRIBUTORS BE LIABLE */
++/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY */
++/* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, */
++/* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS */
++/* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR */
++/* PERFORMANCE OF THIS SOFTWARE. */
++/* */
++/* --------------------------------------------------------------- */
++/* tree.c : decision trees handling functions */
++/* */
++/* 2003/06/11 by Heiga Zen */
++/* --------------------------------------------------------------- */
++
++#include <cstdio>
++#include <cstring>
++#include <cstdlib>
++#include <cctype>
++#include "festival.h"
++
++#include "misc.h"
++#include "tree.h"
++
++HTS_Boolean DPMatch (char *str, char *pat, int pos, int max)
++{
++ if (pos > max) return 0;
++ if (*str == '\0' && *pat == '\0') return 1;
++
++ if (*pat == '*') {
++ if ( DPMatch(str+1, pat, pos+1, max)==1 )
++ return 1;
++ else
++ return DPMatch(str+1, pat+1, pos+1, max);
++ }
++ if (*str == *pat || *pat == '?') {
++ if ( DPMatch(str+1, pat+1, pos+1, max+1)==1 )
++ return 1;
++
++ else
++ if (*(pat + 1) == '*')
++ return DPMatch(str+1, pat+2, pos+1, max+1);
++ }
++
++ return 0;
++}
++
++HTS_Boolean PMatch (char *str, char *pat)
++{
++ int i, max = 0;
++ for(i=0; i < (int)strlen(pat); i++)
++ if (pat[i] != '*') max++;
++
++ return DPMatch(str, pat, 0, strlen(str)-max);
++}
++
++HTS_Boolean QMatch (char *str, Question *q)
++{
++ HTS_Boolean flag = 0;
++ Pattern *p;
++
++ for (p=q->phead; p!=q->ptail; p=p->next) {
++ flag = PMatch(str, p->pat);
++ if (flag)
++ return 1;
++ }
++
++ return 0;
++}
++
++int SearchTree (char *str, Node *node)
++{
++ HTS_Boolean answer = QMatch(str, node->quest);
++
++ if (answer) {
++ if (node->yes->pdf>0)
++ return node->yes->pdf;
++ else
++ return SearchTree(str, node->yes);
++ }
++ else {
++ if (node->no->pdf>0)
++ return node->no->pdf;
++ else
++ return SearchTree (str, node->no);
++ }
++
++ return -1;
++}
++
++void LoadQuestions(FILE *fp, Question *q, Mtype type)
++{
++ char buf[1024];
++
++ GetToken(fp, buf);
++ q->qName = wstrdup(buf);
++ q->phead = q->ptail = walloc(Pattern,1);
++
++ GetToken(fp,buf);
++ if (strcmp(buf, "{")==0) {
++ while (strcmp(buf,"}")!=0) {
++ GetToken (fp, buf);
++ q->ptail->pat = wstrdup(buf);
++ q->ptail->next = walloc(Pattern,1);
++ q->ptail = q->ptail->next;
++ GetToken (fp, buf);
++ }
++ }
++}
++
++HTS_Boolean IsTree (Tree *tree, char *buf)
++{
++ char *s,*l,*r;
++
++ s = buf;
++ if ( ((l = strchr(s, '[')) == NULL) || ((r = strrchr(s, ']'))==NULL) ) {
++ return 0;
++ }
++ else {
++ *r = '\0';
++ s = l+1;
++ tree->state = atoi(s);
++ }
++
++ return 1;
++}
++
++HTS_Boolean IsNum (char *buf)
++{
++ int i;
++
++ for (i=0; i<(int)strlen(buf); i++)
++ if (! (isdigit(buf[i]) || (buf[i] == '-')))
++ return 0;
++
++ return 1;
++}
++
++Question *FindQuestion(TreeSet *ts, Mtype type, char *buf)
++{
++ Question *q;
++
++ for (q=ts->qhead[type];q!=ts->qtail[type];q=q->next)
++ if (strcmp(buf, q->qName)==0)
++ return q;
++
++ printf(" Error ! Cannot find question %s ! \n",buf);
++ festival_error();
++
++ return 0;
++}
++
++int name2num(char *buf)
++{
++ return (atoi(strrchr(buf,'_')+1));
++}
++
++Node *FindNode (Node *node, int num)
++{
++ Node *dest;
++
++ if (node->idx==num) return node;
++ else {
++ if (node->yes != NULL) {
++ dest = FindNode(node->yes, num);
++ if (dest) return dest;
++ }
++ if (node->no != NULL) {
++ dest = FindNode(node->no, num);
++ if (dest) return dest;
++ }
++ }
++ return NULL;
++}
++
++void LoadTree (TreeSet *ts, FILE *fp, Tree *tree, Mtype type)
++{
++ char buf[1024];
++ Node *node;
++
++ GetToken(fp, buf);
++ node = walloc(Node,1);
++ tree->root = node;
++
++ if ( strcmp(buf,"{") == 0 ) {
++ while ( GetToken(fp,buf),strcmp(buf,"}")!= 0 ) {
++ node = FindNode(tree->root, atoi(buf));
++ GetToken (fp, buf); /* load a question applied at this node */
++
++ node->quest = FindQuestion(ts, type, buf);
++ node->yes = walloc(Node,1);
++ node->no = walloc(Node,1);
++
++ GetToken (fp, buf);
++ if (IsNum(buf)) {
++ node->no->idx = atoi(buf);
++ }
++ else {
++ node->no->pdf = name2num(buf);
++ }
++
++ GetToken(fp, buf);
++ if (IsNum(buf)) {
++ node->yes->idx = atoi(buf);
++ }
++ else {
++ node->yes->pdf = name2num(buf);
++ }
++ }
++ }
++ else {
++ node->pdf = name2num(buf);
++ }
++}
++
++void LoadTreesFile(TreeSet *ts, Mtype type)
++{
++ char buf[1024];
++ Question *q;
++ Tree *t;
++ FILE *fp = ts->fp[type];
++
++ q = walloc(Question,1);
++ ts->qhead[type] = q; ts->qtail[type] = NULL;
++
++ t = walloc(Tree,1);
++ ts->thead[type] = t; ts->ttail[type] = NULL;
++
++ while (!feof(fp)) {
++ GetToken(fp, buf);
++ if (strcmp(buf, "QS") == 0) {
++ LoadQuestions(fp, q, type);
++ q->next = walloc(Question,1);
++ q = ts->qtail[type] = q->next;
++ q->next = NULL;
++ }
++ if (IsTree(t, buf)) {
++ LoadTree(ts, fp, t, type);
++ t->next = walloc(Tree,1);
++ t = ts->ttail[type] = t->next;
++ t->next = NULL;
++ }
++ }
++}
++
++void InitTreeSet(TreeSet *ts)
++{
++ ts->fp[DUR] = NULL;
++ ts->fp[LF0] = NULL;
++ ts->fp[MCP] = NULL;
++
++ return;
++}
++
++static void delete_tree_nodes(Node *node)
++{
++ if (!node)
++ return;
++ if (node->yes)
++ delete_tree_nodes(node->yes);
++ if (node->no)
++ delete_tree_nodes(node->no);
++ wfree(node);
++}
++
++void FreeTrees(TreeSet *ts, Mtype type)
++{
++ Question *nq, *qq;
++ Pattern *pp, *np;
++ Tree *tt, *nt;
++
++ for (qq = ts->qhead[type]; qq; qq = nq)
++ {
++ nq = qq->next;
++
++ wfree(qq->qName);
++ for (pp = qq->phead; pp; pp = np)
++ {
++ np = pp->next;
++ wfree(pp->pat);
++ wfree(pp);
++ }
++ wfree(qq);
++ }
++
++ for (tt = ts->thead[type]; tt; tt = nt)
++ {
++ nt = tt->next;
++
++ delete_tree_nodes(tt->root);
++
++ wfree(tt);
++ }
++
++
++}
++
++/* -------------------- End of "tree.c" -------------------- */
+--- /dev/null
++++ lib/hts21compat.scm
+@@ -0,0 +1,75 @@
++;; ---------------------------------------------------------------- ;;
++;; Nagoya Institute of Technology and ;;
++;; Carnegie Mellon University ;;
++;; Copyright (c) 2002 ;;
++;; All Rights Reserved. ;;
++;; ;;
++;; Permission is hereby granted, free of charge, to use and ;;
++;; distribute this software and its documentation without ;;
++;; restriction, including without limitation the rights to use, ;;
++;; copy, modify, merge, publish, distribute, sublicense, and/or ;;
++;; sell copies of this work, and to permit persons to whom this ;;
++;; work is furnished to do so, subject to the following conditions: ;;
++;; ;;
++;; 1. The code must retain the above copyright notice, this list ;;
++;; of conditions and the following disclaimer. ;;
++;; ;;
++;; 2. Any modifications must be clearly marked as such. ;;
++;; ;;
++;; 3. Original authors' names are not deleted. ;;
++;; ;;
++;; 4. The authors' names are not used to endorse or promote ;;
++;; products derived from this software without specific prior ;;
++;; written permission. ;;
++;; ;;
++;; NAGOYA INSTITUTE OF TECHNOLOGY, CARNEGIE MELLON UNIVERSITY AND ;;
++;; THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH ;;
++;; REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF ;;
++;; MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NAGOYA INSTITUTE ;;
++;; OF TECHNOLOGY, CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS ;;
++;; BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ;;
++;; ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR ;;
++;; PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER ;;
++;; TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR ;;
++;; PERFORMANCE OF THIS SOFTWARE. ;;
++;; ;;
++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
++;; HTS 2.1 support code ;;
++;; Copyright is assigned by author to above ;;
++;; on condition it is licensed as above ;;
++;; Author : Peter M Drysdale <drysdalepete@gmail.com> ;;
++;; Date : November 2011 ;;
++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
++
++(require 'hts)
++(require_module 'hts21_engine)
++
++(defSynthType HTS21
++ (let ((featfile (make_tmp_filename))
++ (mcepfile (make_tmp_filename))
++ (f0file (make_tmp_filename))
++ (wavfile (make_tmp_filename)))
++
++ (apply_hooks hts_synth_pre_hooks utt)
++
++ (set! hts_output_params
++ (list
++ (list "-labelfile" featfile)
++ (list "-om" mcepfile)
++ (list "-of" f0file)
++ (list "-or" wavfile)))
++
++ (hts_dump_feats utt hts_feats_list featfile)
++
++ (HTS21_Synthesize utt)
++
++ (delete-file featfile)
++ (delete-file mcepfile)
++ (delete-file f0file)
++ (delete-file wavfile)
++
++ (apply_hooks hts_synth_post_hooks utt)
++ utt)
++)
++
++(provide 'hts21compat)
diff --git a/app-accessibility/festival/files/festival-2.1-init-scm.patch b/app-accessibility/festival/files/festival-2.1-init-scm.patch
new file mode 100644
index 0000000..efe575b
--- /dev/null
+++ b/app-accessibility/festival/files/festival-2.1-init-scm.patch
@@ -0,0 +1,24 @@
+--- festival/lib/init.scm 2006-09-15 01:34:32.000000000 -0500
++++ festival/lib/init.scm 2006-09-15 01:50:30.000000000 -0500
+@@ -52,8 +52,8 @@
+
+ ;;; A chance to set various variables to a local setting e.g.
+ ;;; lexdir, voices_dir audio etc etc.
+-(if (probe_file (path-append libdir "sitevars.scm"))
+- (load (path-append libdir "sitevars.scm")))
++(if (probe_file "/etc/festival/sitevars.scm")
++ (load "/etc/festival/sitevars.scm"))
+
+ ;;; CSTR siod extensions
+ (require 'cstr)
+@@ -133,8 +133,8 @@
+ ;;;
+ ;;; Local site initialization, if the file exists load it
+ ;;;
+-(if (probe_file (path-append libdir "siteinit.scm"))
+- (load (path-append libdir "siteinit.scm")))
++(if (probe_file "/etc/festival/siteinit.scm")
++ (load "/etc/festival/siteinit.scm"))
+
+ ;;; User initialization, if a user has a personal customization
+ ;;; file loaded it
diff --git a/app-accessibility/festival/files/festival-2.1-ldflags.patch b/app-accessibility/festival/files/festival-2.1-ldflags.patch
new file mode 100644
index 0000000..e6559c8
--- /dev/null
+++ b/app-accessibility/festival/files/festival-2.1-ldflags.patch
@@ -0,0 +1,12 @@
+diff -uNr festival.orig/config/systems/Linux.mak festival/config/systems/Linux.mak
+--- festival.orig/config/systems/Linux.mak 2011-02-09 10:08:20.000000000 -0500
++++ festival/config/systems/Linux.mak 2011-02-09 10:09:04.000000000 -0500
+@@ -46,7 +46,7 @@
+ JAVAH=/usr/bin/javah
+
+ TCL_LIBRARY = -ltcl
+-OS_LIBS = -ldl
++OS_LIBS = $(OPTIMISE_LDFLAGS) -ldl
+
+ ## the native audio module for this type of system
+ NATIVE_AUDIO_MODULE = LINUX16
diff --git a/app-accessibility/festival/files/festival.rc b/app-accessibility/festival/files/festival.rc
new file mode 100644
index 0000000..dbfe778
--- /dev/null
+++ b/app-accessibility/festival/files/festival.rc
@@ -0,0 +1,22 @@
+#!/sbin/runscript
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-accessibility/festival/files/festival.rc,v 1.5 2009/11/01 18:52:39 eva Exp $
+
+depend() {
+ need net
+ use alsasound esound
+}
+
+start() {
+ ebegin "Starting festival"
+ start-stop-daemon --start --quiet --background --make-pidfile --pidfile /var/run/festival.pid \
+ --chuid festival --exec /usr/bin/festival -- --server -b /etc/festival/server.scm
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping festival"
+ start-stop-daemon --stop --quiet --pidfile /var/run/festival.pid
+ eend $?
+}
diff --git a/app-accessibility/festival/files/server.scm b/app-accessibility/festival/files/server.scm
new file mode 100644
index 0000000..7af03fa
--- /dev/null
+++ b/app-accessibility/festival/files/server.scm
@@ -0,0 +1,20 @@
+; Maximum number of clients on the server
+(set! server_max_clients 10)
+
+; Server port
+(set! server_port 1314)
+
+; Log file location
+(set! server_log_file "/var/log/festival/festival.log")
+
+; Set the server password
+(set! server_passwd nil)
+
+; Server access list (hosts)
+; (set! server_access_list '("[^.]+" "127.0.0.1" "localhost.*" "192.168.*"))
+(set! server_access_list '("[^.]+" "127.0.0.1" "localhost" ))
+
+
+; Server deny list (hosts)
+(set! server_deny_list nil)
+
diff --git a/app-accessibility/festival/files/speech-tools-1.2.96_beta-gcc43-include.patch b/app-accessibility/festival/files/speech-tools-1.2.96_beta-gcc43-include.patch
new file mode 100644
index 0000000..6ab7ebf
--- /dev/null
+++ b/app-accessibility/festival/files/speech-tools-1.2.96_beta-gcc43-include.patch
@@ -0,0 +1,22 @@
+diff -Naur speech_tools-orig/base_class/EST_TSimpleMatrix.cc speech_tools/base_class/EST_TSimpleMatrix.cc
+--- speech_tools-orig/base_class/EST_TSimpleMatrix.cc 2004-09-30 06:53:35.000000000 -0600
++++ speech_tools/base_class/EST_TSimpleMatrix.cc 2008-01-05 11:00:07.000000000 -0600
+@@ -42,6 +42,7 @@
+
+ #include "EST_TSimpleMatrix.h"
+ #include "EST_TVector.h"
++#include <cstring>
+ #include <fstream>
+ #include <iostream>
+ #include "EST_cutils.h"
+diff -Naur speech_tools-orig/base_class/EST_TSimpleVector.cc speech_tools/base_class/EST_TSimpleVector.cc
+--- speech_tools-orig/base_class/EST_TSimpleVector.cc 2006-07-06 06:57:18.000000000 -0600
++++ speech_tools/base_class/EST_TSimpleVector.cc 2008-01-05 11:00:32.000000000 -0600
+@@ -42,6 +42,7 @@
+
+ #include "EST_TSimpleVector.h"
+ #include "EST_matrix_support.h"
++#include <cstring>
+ #include <fstream>
+ #include "EST_cutils.h"
+
diff --git a/app-accessibility/festival/files/voice_rms.patch b/app-accessibility/festival/files/voice_rms.patch
new file mode 100644
index 0000000..f45ccd2
--- /dev/null
+++ b/app-accessibility/festival/files/voice_rms.patch
@@ -0,0 +1,20 @@
+--- /usr/share/festival/voices/us/nitech_us_rms_arctic_hts/festvox/nitech_us_rms_arctic_hts.scm.old 2012-07-17 12:01:35.179290044 +0700
++++ /usr/share/festival/voices/us/nitech_us_rms_arctic_hts/festvox/nitech_us_rms_arctic_hts.scm 2012-07-17 12:03:10.445294146 +0700
+@@ -68,7 +68,7 @@
+ (set! hts_feats_list
+ (load (path-append hts_data_dir "feat.list") t))
+
+-(require 'hts)
++(require 'hts21compat)
+ (require_module 'hts_engine)
+
+ ;;; Voice specific parameter are defined in each of the following
+@@ -162,7 +162,7 @@
+ ;; Waveform synthesis model: hts
+ (set! hts_engine_params nitech_us_rms_arctic_hts::hts_engine_params)
+ (set! hts_feats_list nitech_us_rms_arctic_hts::hts_feats_list)
+- (Parameter.set 'Synth_Method 'HTS)
++ (Parameter.set 'Synth_Method 'HTS21)
+
+ ;; This is where you can modify power (and sampling rate) if desired
+ (set! after_synth_hooks nil)
diff --git a/app-accessibility/festival/hts21compat-howto b/app-accessibility/festival/hts21compat-howto
new file mode 100644
index 0000000..4ccf7f4
--- /dev/null
+++ b/app-accessibility/festival/hts21compat-howto
@@ -0,0 +1,4 @@
+#This is how the patch was produced
+wget 'http://anonscm.debian.org/gitweb/?p=tts/festival.git;a=blob_plain;f=debian/patches/hts21compat.diff;hb=cabc6f7f14fd687a5caae57ff5cc9e54141d6581' -O hts21compat.diff
+cat hts21compat.diff |sed 's@+++ festival-2.1~release/@+++ @g' > festival-2.1-hts21compat.patch
+rm hts21compat.diff
diff --git a/app-accessibility/festival/metadata.xml b/app-accessibility/festival/metadata.xml
new file mode 100644
index 0000000..ba6c525
--- /dev/null
+++ b/app-accessibility/festival/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer>
+ <email>neurogeek@gentoo.org</email>
+</maintainer>
+<herd>accessibility</herd>
+<herd>sound</herd>
+<use>
+ <flag name='mbrola'>Adds support for mbrola voices</flag>
+</use>
+</pkgmetadata>
diff --git a/app-text/calibre/files/calibre-server.conf b/app-text/calibre/files/calibre-server.conf
index c1bed84..c1bed84 100644..100755
--- a/app-text/calibre/files/calibre-server.conf
+++ b/app-text/calibre/files/calibre-server.conf
diff --git a/gnome-extra/nautilus-image-converter/Manifest b/gnome-extra/nautilus-image-converter/Manifest
new file mode 100755
index 0000000..0779d1c
--- /dev/null
+++ b/gnome-extra/nautilus-image-converter/Manifest
@@ -0,0 +1,2 @@
+DIST nautilus-image-converter-0.3.0.tar.bz2 282711 RMD160 07789a0d8d43a001bfd53f5853608d7f53235244 SHA1 fb202b0dfb367470ea756ecb521daf23d2ccd6b4 SHA256 34044b0279acca11dcb084c666d7bc02edbbe91f8709a457e8aec9a9367fbbf7
+EBUILD nautilus-image-converter-0.3.0.ebuild 508 RMD160 eba1aacd816790f4ca42e870082565f5249e8df9 SHA1 b67df3717cc979d7d79e037cfe866ff2a479a6a7 SHA256 c6d028250b5a803e364b89da86c5de58d6219066562501e3ef3af7ac38f6c7d0
diff --git a/gnome-extra/nautilus-image-converter/nautilus-image-converter-0.3.0.ebuild b/gnome-extra/nautilus-image-converter/nautilus-image-converter-0.3.0.ebuild
new file mode 100755
index 0000000..160a625
--- /dev/null
+++ b/gnome-extra/nautilus-image-converter/nautilus-image-converter-0.3.0.ebuild
@@ -0,0 +1,21 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=2
+
+inherit gnome2
+
+DESCRIPTION="Adds a 'Resize Images' item to the context menu for all images"
+HOMEPAGE="http://www.bitron.ch/software/nautilus-image-converter.php"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64"
+IUSE=""
+
+DEPEND=">=gnome-base/nautilus-2.21.0"
+RDEPEND="${DEPEND}
+ || ( media-gfx/imagemagick media-gfx/graphicsmagick[imagemagick] )"
+
+DOCS="AUTHORS ChangeLog NEWS README"