From 26451775eeb4188ce80ef301cddd22d3defd1fe6 Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Sat, 27 Dec 2014 13:17:59 -0800 Subject: [PATCH] Add festival port --- .../festival/festival-2.4.recipe | 119 ++ app-accessibility/festival/licenses/Festival | 113 ++ .../festival/patches/festival-2.4.patchset | 1148 +++++++++++++++++ 3 files changed, 1380 insertions(+) create mode 100644 app-accessibility/festival/festival-2.4.recipe create mode 100644 app-accessibility/festival/licenses/Festival create mode 100644 app-accessibility/festival/patches/festival-2.4.patchset diff --git a/app-accessibility/festival/festival-2.4.recipe b/app-accessibility/festival/festival-2.4.recipe new file mode 100644 index 000000000..6b6a9b346 --- /dev/null +++ b/app-accessibility/festival/festival-2.4.recipe @@ -0,0 +1,119 @@ +SUMMARY="Text-to-speech engine" +DESCRIPTION="Festival is a text-to-speech engine co-developed by the \ +University of Edinburgh, UK, and Carnegie Mellon University. It is designed to \ +support multiple languages and to be easy to extend, both in terms of voices \ +and new languages." +HOMEPAGE="http://www.cstr.ed.ac.uk/projects/festival" +SRC_URI=" + http://festvox.org/packed/festival/$portVersion/festival-${portVersion}-release.tar.gz + " +CHECKSUM_SHA256="1e47f293e0857ffde2bccead97947c040ea0b35ea12dd5796edb51583e5e5d84" +SOURCE_DIR="festival" +REVISION="1" + +# Only including the licenses that cover the files that are actually used +# and/or installed +LICENSE=" + Festival + " +COPYRIGHT=" + 1996 Alan W. Black + 1996-2004 University of Edinburgh, UK + 1997 Jacques H. de Villiers + 1997 Kevin A. Lenzo + 1997 Center for Spoken Language Understanding, Oregon Graduate \ + Institute of Science & Technology + 1999-2004 Language Technologies Institute, Carnegie Mellon University + 2001-2008 Tokyo Institute of Technology + 2001-2012 Nagoya Institute of Technology + 2012 The Department of Arts and Culture, The Government of the \ + Republic of South Africa + " + +ARCHITECTURES="x86_gcc2 x86 x86_64" +if [ $effectiveTargetArchitecture != x86_gcc2 ]; then + # x86_gcc2 is fine as primary target architecture as long as we're building + # for a different secondary architecture. + ARCHITECTURES="$ARCHITECTURES x86_gcc2" +else + ARCHITECTURES="$ARCHITECTURES !x86_gcc2" +fi +SECONDARY_ARCHITECTURES="x86 !x86_gcc2" + +PROVIDES=" + festival$secondaryArchSuffix = $portVersion + cmd:festival = $portVersion + cmd:festival_client = $portVersion + cmd:text2wave = $portVersion + " +PROVIDES_devel=" + festival${secondaryArchSuffix}_devel = $portVersion + devel:libFestival$secondaryArchSuffix = $portVersion + " +REQUIRES=" + haiku$secondaryArchSuffix + speech_tools$secondaryArchSuffix >= 2.4 + lib:libgcc_s$secondaryArchSuffix + lib:libncurses$secondaryArchSuffix + lib:libstdc++$secondaryArchSuffix + " +REQUIRES_devel=" + haiku${secondaryArchSuffix}_devel + festival$secondaryArchSuffix == $portVersion base + speech_tools${secondaryArchSuffix}_devel >= 2.4 + devel:libncurses$secondaryArchSuffix + " +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + speech_tools${secondaryArchSuffix}_devel >= 2.4 + devel:libncurses$secondaryArchSuffix + " +BUILD_PREREQUIRES=" + cmd:awk + cmd:find + cmd:make + cmd:gcc$secondaryArchSuffix + cmd:mkdepend + " + +PATCHES="festival-${portVersion}.patchset" + +BUILD() +{ + binDir=$prefix/bin + export binDir \ + portPackageLinksDir \ + relativeDevelopLibDir \ + secondaryArchSuffix + for f in lib/festival.scm \ + lib/lexicons.scm \ + lib/voices.scm \ + src/arch/festival/festival.cc + do + sed -e "s,@DOCDIR@,$docDir,g" \ + -e "s,@DATADIR@,$dataDir/festival,g" \ + -e "s,@LIBDIR@,$libDir/festival,g" \ + ${f}.in > ${f} + done + + make +} + +INSTALL() +{ + mkdir -p \ + $developLibDir \ + $prefix/bin \ + $dataDir/festival \ + $manDir/man1 \ + $docDir/examples + cp -a src/lib/libFestival.a $developLibDir + cp -a src/main/festival $prefix/bin + cp -a src/main/festival_client $prefix/bin + cp -a examples/text2wave $prefix/bin + cp -a lib/* $dataDir/festival + cp -a doc/*.1 $manDir/man1 + cp -a examples/*intro.text $docDir/examples + packageEntries devel \ + $developDir +} diff --git a/app-accessibility/festival/licenses/Festival b/app-accessibility/festival/licenses/Festival new file mode 100644 index 000000000..ff734e38a --- /dev/null +++ b/app-accessibility/festival/licenses/Festival @@ -0,0 +1,113 @@ +The system as a whole and most of the files in it are distributed +under the following copyright and conditions + + The Festival Speech Synthesis System + Centre for Speech Technology Research + University of Edinburgh, UK + Copyright (c) 1996-2014 + 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. + +Some further comments: + +Every effort has been made to ensure that Festival does not contain +any violation of intellectual property rights through disclosure of +trade secrets, copyright or patent violation. Considerable time and +effort has been spent to ensure that this is the case. However, +especially with patent problems, it is not always within our control +to know what has or has not been restricted. If you do suspect that +some part of Festival cannot be legally distributed please inform us +so that an alternative may be sought. Festival is only useful if it +is truly free to distribute. + +As of 1.4.0 the core distribution (and speech tools) is free. Unlike +previous versions which had a commercial restriction. You are free to +incorporate Festival in commercial (and of course non-commercial +systems), without any further communication or licence from us. +However if you are seriously using Festival within a commercial +application we would like to know, both so we know we are contributing +and so we can keep you informed of future developments. Also if you +require maintenance, support or wish us to provide consultancy feel +free to contact us. + +The voices however aren't all free. At present the US voices, kal and +ked are free. Our British voices are free themselves but they use OALD +which is restricted for non-commercial use. Our Spanish voice is also +so restricted. + +Note other modules that festival supports e.g MBROLA and OGI +extensions, may have different licencing please take care when using +the system to understand what you are actually using. + +-------------------------------------------------- + +A number of individual files in the system fall under a different +copyright from the above. All however are termed "free software" +but most people. + +./src/arch/festival/tcl.c + * Copyright (C)1997 Jacques H. de Villiers + * Copyright (C)1997 Center for Spoken Language Understanding, + * Oregon Graduate Institute of Science & Technology + See conditions in file. This is the standard TCL licence and hence + shouldn't cause problems from most people. + +./examples/festival_client.pl +# Copyright (C) 1997 +# Kevin A. Lenzo (lenzo@cs.cmu.edu) 7/97 + See condition in file + +./src/modules/clunits/* +./lib/*clunits* + Joint copyright University of Edinburgh and Carnegie Mellon University + Conditions remain as free software like the rest of distribution + +./src/modules/clustergen/* + Copyright Carnegie Mellon University + Nagoya Insitute of Technology (derived code from HTS) + HTS_vocoder_me.c HTS_vocoder_me.h + contains additions from Aby Louw + Copyright (c) 2012 The Department of Arts and Culture, + The Government of the Republic of South Africa. + under a free software licence compatible with the other + free software copyrights in this work + +./src/modules/hts_engine/* +./lib/hts.scm + The HMM-based speech synthesis system (HTS) + hts_engine API version 1.07 (http://hts-engine.sourceforge.net/) + Copyright (C) 2001-2012 Nagoya Institute of Technology + 2001-2008 Tokyo Institute of Technology + All rights reserved. + distributed under the Modified BSD licence. + +./lib/festival.el +;;; Copyright (C) Alan W Black 1996 +copyright under FSF General Public Licence + +Please also read the COPYING section of speech_tools/README for the +conditions on those files. + diff --git a/app-accessibility/festival/patches/festival-2.4.patchset b/app-accessibility/festival/patches/festival-2.4.patchset new file mode 100644 index 000000000..9dd69ea32 --- /dev/null +++ b/app-accessibility/festival/patches/festival-2.4.patchset @@ -0,0 +1,1148 @@ +From 3c12f4ea6c71f2775b73aa83edce01563b788fa6 Mon Sep 17 00:00:00 2001 +From: Timothy Gu +Date: Fri, 26 Dec 2014 23:20:33 -0800 +Subject: Fix include of base_class files + + +diff --git a/src/modules/MultiSyn/inst_tmpl/hash_itemp_tcdatap_t.cc b/src/modules/MultiSyn/inst_tmpl/hash_itemp_tcdatap_t.cc +index 1c4d1e5..54d3b77 100644 +--- a/src/modules/MultiSyn/inst_tmpl/hash_itemp_tcdatap_t.cc ++++ b/src/modules/MultiSyn/inst_tmpl/hash_itemp_tcdatap_t.cc +@@ -50,7 +50,7 @@ template <> TCData* EST_THash< EST_Item*, TCData* >::Dummy_Value=0; + + #if defined(INSTANTIATE_TEMPLATES) + +-#include "../base_class/EST_THash.cc" ++#include "base_class/EST_THash.cc" + + Instantiate_THash_T(EST_Item*, TCData*, TCDataP) + +diff --git a/src/modules/MultiSyn/inst_tmpl/hash_s_itemlistp_t.cc b/src/modules/MultiSyn/inst_tmpl/hash_s_itemlistp_t.cc +index b2a443a..036806e 100644 +--- a/src/modules/MultiSyn/inst_tmpl/hash_s_itemlistp_t.cc ++++ b/src/modules/MultiSyn/inst_tmpl/hash_s_itemlistp_t.cc +@@ -51,7 +51,7 @@ template <> ItemList* EST_THash< EST_String, ItemList* >::Dummy_Value=0; + + #if defined(INSTANTIATE_TEMPLATES) + +-#include "../base_class/EST_THash.cc" ++#include "base_class/EST_THash.cc" + + Instantiate_TStringHash_T(ItemList *, ItemListP) + +diff --git a/src/modules/MultiSyn/inst_tmpl/list_itemp_t.cc b/src/modules/MultiSyn/inst_tmpl/list_itemp_t.cc +index 45f6f18..78c513d 100644 +--- a/src/modules/MultiSyn/inst_tmpl/list_itemp_t.cc ++++ b/src/modules/MultiSyn/inst_tmpl/list_itemp_t.cc +@@ -51,8 +51,8 @@ Declare_TList_T(EST_Item *, EST_ItemP) + + #if defined(INSTANTIATE_TEMPLATES) + +-#include "../base_class/EST_TList.cc" +-#include "../base_class/EST_TSortable.cc" ++#include "base_class/EST_TList.cc" ++#include "base_class/EST_TSortable.cc" + + Instantiate_TList_T(EST_Item *, EST_ItemP) + +diff --git a/src/modules/MultiSyn/inst_tmpl/list_scorepair_t.cc b/src/modules/MultiSyn/inst_tmpl/list_scorepair_t.cc +index b03fe22..1207bd4 100644 +--- a/src/modules/MultiSyn/inst_tmpl/list_scorepair_t.cc ++++ b/src/modules/MultiSyn/inst_tmpl/list_scorepair_t.cc +@@ -45,8 +45,8 @@ Declare_TList(ScorePair) + Declare_TSortable(ScorePair) + + #if defined(INSTANTIATE_TEMPLATES) +-#include "../base_class/EST_TList.cc" +-#include "../base_class/EST_TSortable.cc" ++#include "base_class/EST_TList.cc" ++#include "base_class/EST_TSortable.cc" + Instantiate_TList(ScorePair); + Instantiate_TSortable(ScorePair); + #endif +diff --git a/src/modules/MultiSyn/inst_tmpl/list_strlist_t.cc b/src/modules/MultiSyn/inst_tmpl/list_strlist_t.cc +index 5ccf452..0760b64 100644 +--- a/src/modules/MultiSyn/inst_tmpl/list_strlist_t.cc ++++ b/src/modules/MultiSyn/inst_tmpl/list_strlist_t.cc +@@ -46,6 +46,6 @@ + Declare_TList_T(EST_TList,STR_LIST) + + #if defined(INSTANTIATE_TEMPLATES) +-#include "../base_class/EST_TList.cc" ++#include "base_class/EST_TList.cc" + Instantiate_TList_T(EST_StrList,STR_LIST); + #endif +diff --git a/src/modules/MultiSyn/inst_tmpl/list_uttp_t.cc b/src/modules/MultiSyn/inst_tmpl/list_uttp_t.cc +index f0fbb8a..d1c0409 100644 +--- a/src/modules/MultiSyn/inst_tmpl/list_uttp_t.cc ++++ b/src/modules/MultiSyn/inst_tmpl/list_uttp_t.cc +@@ -51,8 +51,8 @@ Declare_TList_T(EST_Utterance *, EST_UtteranceP) + + #if defined(INSTANTIATE_TEMPLATES) + +-#include "../base_class/EST_TList.cc" +-#include "../base_class/EST_TSortable.cc" ++#include "base_class/EST_TList.cc" ++#include "base_class/EST_TSortable.cc" + + Instantiate_TList_T_MIN(EST_Utterance *, EST_UtteranceP) + +diff --git a/src/modules/MultiSyn/inst_tmpl/list_voicemodulep_t.cc b/src/modules/MultiSyn/inst_tmpl/list_voicemodulep_t.cc +index 6258004..4eca26b 100644 +--- a/src/modules/MultiSyn/inst_tmpl/list_voicemodulep_t.cc ++++ b/src/modules/MultiSyn/inst_tmpl/list_voicemodulep_t.cc +@@ -50,8 +50,8 @@ Declare_TList_T(DiphoneVoiceModule *, DiphoneVoiceModuleP) + + #if defined(INSTANTIATE_TEMPLATES) + +-#include "../base_class/EST_TList.cc" +-#include "../base_class/EST_TSortable.cc" ++#include "base_class/EST_TList.cc" ++#include "base_class/EST_TSortable.cc" + + Instantiate_TList_T_MIN(DiphoneVoiceModule *, DiphoneVoiceModuleP) + +diff --git a/src/modules/MultiSyn/inst_tmpl/vector_jccp_t.cc b/src/modules/MultiSyn/inst_tmpl/vector_jccp_t.cc +index b243b5b..0915ebc 100644 +--- a/src/modules/MultiSyn/inst_tmpl/vector_jccp_t.cc ++++ b/src/modules/MultiSyn/inst_tmpl/vector_jccp_t.cc +@@ -50,8 +50,8 @@ Declare_TSimpleVector_T(EST_JoinCostCache*,EST_JoinCostCacheP) + + #if defined(INSTANTIATE_TEMPLATES) + +-#include "../base_class/EST_TSimpleVector.cc" +-#include "../base_class/EST_TVector.cc" ++#include "base_class/EST_TSimpleVector.cc" ++#include "base_class/EST_TVector.cc" + + Instantiate_TVector_T_MIN(EST_JoinCostCache*,EST_JoinCostCacheP) + Instantiate_TSimpleVector(EST_JoinCostCache*) +-- +1.8.3.4 + + +From 2edebb55a8e24107e7cdbac69ed8b1212ea6f4be Mon Sep 17 00:00:00 2001 +From: Timothy Gu +Date: Fri, 26 Dec 2014 23:22:17 -0800 +Subject: Adjust server access list for 127.0.0.1 + +Taken from Debian: 03-security-access_list.diff + +Signed-off-by: Timothy Gu + +diff --git a/lib/festival.scm b/lib/festival.scm +index 77b2292..928016d 100644 +--- a/lib/festival.scm ++++ b/lib/festival.scm +@@ -433,7 +433,7 @@ a newline before they can get a connection. It would be normal + to set this for the particular server task. + [see Server/client API]") + +-(defvar server_access_list '(localhost) ++(defvar server_access_list '("127.0.0.1" "localhost\.localdomain" "localhost") + "server_access_list + If non-nil this is the exhaustive list of machines and domains + from which clients may access the server. This is a list of REGEXs +-- +1.8.3.4 + + +From f91d1bbb19479c4f9c4488f245072a4840cbb72a Mon Sep 17 00:00:00 2001 +From: Timothy Gu +Date: Fri, 26 Dec 2014 23:24:06 -0800 +Subject: Add ALAW support + +Backported from Debian: 04-codec-add-alaw.diff + +Signed-off-by: Timothy Gu + +diff --git a/examples/text2wave.sh b/examples/text2wave.sh +index 7f91200..ed0b1da 100755 +--- a/examples/text2wave.sh ++++ b/examples/text2wave.sh +@@ -50,7 +50,7 @@ + Options + -mode Explicit tts mode. + -o ofile File to save waveform (default is stdout). +- -otype Output waveform type: ulaw, snd, aiff, riff, nist etc. ++ -otype Output waveform type: alaw, ulaw, snd, aiff, riff, nist etc. + (default is riff) + -F Output frequency. + -scale Volume factor +diff --git a/src/modules/diphone/di_io.cc b/src/modules/diphone/di_io.cc +index 8b53ccd..5559a1f 100644 +--- a/src/modules/diphone/di_io.cc ++++ b/src/modules/diphone/di_io.cc +@@ -415,6 +415,16 @@ static void load_signal_file(DIPHONE_DATABASE *db, int i, int mode) + ulaw_to_short(ulaw,db->vox[i]->signal,db->vox[i]->nsamples); + wfree(ulaw); + } ++ else if (db->group_encoding == di_alaw) ++ { ++ unsigned char *alaw = ++ walloc(unsigned char,db->vox[i]->nsamples); ++ db->vox[i]->signal = walloc(short,db->vox[i]->nsamples); ++ fseek(db->gfd,db->gsignalbase+(db->offsets[i]),SEEK_SET); ++ fread(alaw,sizeof(unsigned char),db->vox[i]->nsamples,db->gfd); ++ alaw_to_short(alaw,db->vox[i]->signal,db->vox[i]->nsamples); ++ wfree(alaw); ++ } + else + { + cerr << "Diphone: unknown group type" << endl; +@@ -800,8 +810,13 @@ static void di_group_load_signal(DIPHONE_DATABASE *db) + } + else if (db->group_encoding == di_ulaw) + { +- db->allulawsignal = walloc(unsigned char,totsamples); +- fread(db->allulawsignal,sizeof(unsigned char),totsamples,db->gfd); ++ db->allualawsignal = walloc(unsigned char,totsamples); ++ fread(db->allualawsignal,sizeof(unsigned char),totsamples,db->gfd); ++ } ++ else if (db->group_encoding == di_alaw) ++ { ++ db->allualawsignal = walloc(unsigned char,totsamples); ++ fread(db->allualawsignal,sizeof(unsigned char),totsamples,db->gfd); + } + } + else +@@ -821,7 +836,13 @@ static void di_group_load_signal(DIPHONE_DATABASE *db) + else if (db->group_encoding == di_ulaw) + { + db->vox[i]->signal = walloc(short,samp_counts[i]); +- ulaw_to_short(&db->allulawsignal[sample_offset], ++ ulaw_to_short(&db->allualawsignal[sample_offset], ++ db->vox[i]->signal,samp_counts[i]); ++ } ++ else if (db->group_encoding == di_alaw) ++ { ++ db->vox[i]->signal = walloc(short,samp_counts[i]); ++ alaw_to_short(&db->allualawsignal[sample_offset], + db->vox[i]->signal,samp_counts[i]); + } + else +@@ -838,7 +859,7 @@ static void di_group_load_signal(DIPHONE_DATABASE *db) + sample_offset += samp_counts[i]; + } + if (db->sig_access_type != di_direct) +- if (db->group_encoding == di_ulaw) ++ if (db->group_encoding == di_ulaw || db->group_encoding == di_alaw) + fseek(db->gfd,(long)sample_offset,SEEK_CUR); + else + fseek(db->gfd,(long)sample_offset*sizeof(short),SEEK_CUR); +@@ -867,7 +888,7 @@ static void di_group_load_lpc_params(DIPHONE_DATABASE *db) + if (db->swap) + swap_bytes_float(db->allframes,totframes*db->lpc_order); + } +- else if (db->group_encoding == di_ulaw) // its as shorts ++ else if (db->group_encoding == di_ulaw || db->group_encoding == di_alaw) // its as shorts + { + db->allframesshort = walloc(short,totframes*db->lpc_order); + fread(db->allframesshort,sizeof(short), +@@ -885,7 +906,7 @@ static void di_group_load_lpc_params(DIPHONE_DATABASE *db) + for (j=0;jlpc[i]->nframes;j++) + db->lpc[i]->f[j] = + &db->allframes[(frame_offset+j)*db->lpc_order]; +- else if (db->group_encoding == di_ulaw) ++ else if (db->group_encoding == di_ulaw || db->group_encoding == di_alaw) + { + int fixedpoint = FALSE; + if (siod_get_lval("lpc_fixedpoint",NULL) != NIL) +@@ -1031,6 +1052,13 @@ void di_save_grouped_db(const EST_Pathname &filename, DIPHONE_DATABASE *db) + fwrite(ulaw,sizeof(unsigned char),db->vox[i]->nsamples,fd); + wfree(ulaw); + } ++ else if (db->group_encoding == di_alaw) ++ { ++ unsigned char *alaw = walloc(unsigned char,db->vox[i]->nsamples); ++ short_to_alaw(db->vox[i]->signal,alaw,db->vox[i]->nsamples); ++ fwrite(alaw,sizeof(unsigned char),db->vox[i]->nsamples,fd); ++ wfree(alaw); ++ } + else + { + cerr << "Diphone: unknown group type for dumping" << endl; +@@ -1058,7 +1086,7 @@ void di_save_grouped_db(const EST_Pathname &filename, DIPHONE_DATABASE *db) + for (j=0; jlpc[i]->nframes; j++) + fwrite(db->lpc[i]->f[j],sizeof(float),db->lpc_order,fd); + } +- else if (db->group_encoding == di_ulaw) // saved as shorts ++ else if (db->group_encoding == di_ulaw || db->group_encoding == di_alaw) // saved as shorts + { + short *sh = new short[db->lpc_order]; + +diff --git a/src/modules/diphone/diphone.cc b/src/modules/diphone/diphone.cc +index f6b6768..0a3ea33 100644 +--- a/src/modules/diphone/diphone.cc ++++ b/src/modules/diphone/diphone.cc +@@ -180,6 +180,8 @@ void di_fixed_parameters(DIPHONE_DATABASE *db,LISP params) + db->group_encoding = di_raw; + else if (streq(db->group_encoding_str,"ulaw")) + db->group_encoding = di_ulaw; ++ else if (streq(db->group_encoding_str,"alaw")) ++ db->group_encoding = di_alaw; + else + { + cerr << "Diphone: unknown group encoding" << endl; +@@ -218,7 +220,7 @@ static void delete_diphone_db(DIPHONE_DATABASE *db) + { + wfree(db->indx[0]->diph); // ptr to the whole diphname table + wfree(db->allsignal); +- wfree(db->allulawsignal); ++ wfree(db->allualawsignal); + wfree(db->allframes); + } + for (i=0; i < db->nindex; i++) +@@ -275,7 +277,7 @@ DIPHONE_DATABASE *make_diphone_db(void) + db->alternates_before = NIL; + db->alternates_after = NIL; + db->allsignal = 0; +- db->allulawsignal = 0; ++ db->allualawsignal = 0; + db->offsets = 0; + db->gfd = 0; + db->default_diphone = 0; +diff --git a/src/modules/diphone/diphone.h b/src/modules/diphone/diphone.h +index 737c9a9..723abdc 100644 +--- a/src/modules/diphone/diphone.h ++++ b/src/modules/diphone/diphone.h +@@ -41,7 +41,7 @@ + + enum di_sigaccess_t {di_direct, di_dynamic, di_ondemand}; + enum di_db_type_t {di_pcm, di_lpc}; +-enum di_group_encode_t {di_raw, di_ulaw }; ++enum di_group_encode_t {di_raw, di_ulaw, di_alaw }; + enum di_group_t {di_grouped, di_ungrouped}; + + typedef struct { +@@ -109,7 +109,7 @@ typedef struct DD_STRUCT { + int lpc_pitch_synch; /* True if lpc frames are pitch synchronous */ + + short *allsignal; /* used in group files */ +- unsigned char *allulawsignal; ++ unsigned char *allualawsignal; + float *allframes; + short *allframesshort; + +diff --git a/src/modules/donovan/t2s.h b/src/modules/donovan/t2s.h +index d870e87..19c5767 100644 +--- a/src/modules/donovan/t2s.h ++++ b/src/modules/donovan/t2s.h +@@ -261,10 +261,6 @@ void tags(CONFIG *config, BUFFER *buffer, LING_LIST *ling_list); + /* transcribe.c */ + void transcribe(CONFIG *config, LING_LIST *ling_list); + +-/* ulaw.c */ +-unsigned char linear2ulaw(int sample); +-int ulaw2linear(unsigned char ulawbyte); +- + /* utils.c */ + char **split(char *in); + void tidy_split(char **root); +-- +1.8.3.4 + + +From 166b48d3baf174d83a2b61f069b85aba2f453f4d Mon Sep 17 00:00:00 2001 +From: Sergio Oller +Date: Fri, 26 Dec 2014 23:25:07 -0800 +Subject: Save waves in parts + +Taken from Debian: 05-performance-combine-waves.diff + +Signed-off-by: Timothy Gu + +diff --git a/examples/text2wave.sh b/examples/text2wave.sh +index ed0b1da..d6af881 100755 +--- a/examples/text2wave.sh ++++ b/examples/text2wave.sh +@@ -63,6 +63,8 @@ + (gc-status nil) + + ;;; Default argument values ++(defvar fp nil) ++(defvar totalnumsamples 0) + (defvar outfile "-") + (defvar output_type 'riff) + (defvar frequency nil) ;; default is no frequency modification +@@ -70,6 +72,7 @@ + (defvar mode nil) + (defvar volume "1.0") + (defvar wavefiles nil) ++(defvar an_utt nil) + + ;;; Get options + (define (get_options) +@@ -127,39 +130,40 @@ + (format stderr "%s: %s\n" "text2wave" message) + (text2wave_help)) + +-(define (save_record_wave utt) ++ ++(define (save_record_wave_fp utt) + "Saves the waveform and records its so it can be joined into a + a single waveform at the end." +- (let ((fn (make_tmp_filename))) +- (utt.save.wave utt fn) +- (set! wavefiles (cons fn wavefiles)) +- utt)) +- +-(define (combine_waves) +- "Join all the waves together into the desired output file +-and delete the intermediate ones." +- (let ((wholeutt (utt.synth (Utterance Text "")))) +- (mapcar +- (lambda (d) +- (utt.import.wave wholeutt d t) +- (delete-file d)) +- (reverse wavefiles)) +- (if frequency +- (utt.wave.resample wholeutt (parse-number frequency))) +- (if (not (equal? volume "1.0")) +- (begin +- (utt.wave.rescale wholeutt (parse-number volume)))) +- (utt.save.wave wholeutt outfile output_type) +- )) ++ (if (eq? totalnumsamples 0) ++ (wave.save.header fp (utt.wave utt) output_type nil ++ (list (list "numsamples" 0))) ++ ) ++ (set! totalnumsamples (+ totalnumsamples ++ (get_param 'num_samples (wave.info (utt.wave utt)) 0) ++ ) ++ ) ++ (if frequency ++ (utt.wave.resample utt (parse-number frequency)) ++ ) ++ (if (not (equal? volume "1.0")) ++ (begin ++ (utt.wave.rescale utt (parse-number volume)) ++ ) ++ ) ++ (wave.save.data.fp (utt.wave utt) fp output_type nil) ++ (set! an_utt utt) ++) + + ;;; + ;;; Redefine what happens to utterances during text to speech + ;;; +-(set! tts_hooks (list utt.synth save_record_wave)) ++(set! tts_hooks (list utt.synth save_record_wave_fp)) + + (define (main) + (get_options) + ++ (set! fp (fopen outfile "wb")) ++ + ;; do the synthesis + (mapcar + (lambda (f) +@@ -168,8 +172,12 @@ and delete the intermediate ones." + (tts_file f (tts_find_text_mode f auto-text-mode-alist)))) + text_files) + +- ;; Now put the waveforms together at again +- (combine_waves) ++ ;; Now update the header ++ (fseek fp 0 0) ++ (wave.save.header fp (utt.wave an_utt) output_type nil ++ (list (list "numsamples" totalnumsamples)) ++ ) ++ (fclose fp) + ) + + ;;; Do the work +diff --git a/src/arch/festival/wave.cc b/src/arch/festival/wave.cc +index a44c5e7..aa46d1c 100644 +--- a/src/arch/festival/wave.cc ++++ b/src/arch/festival/wave.cc +@@ -42,6 +42,7 @@ + #include + #include "festival.h" + #include "festivalP.h" ++#include "EST_Wave.h" + + #ifdef WIN32 + #include "winsock2.h" +@@ -101,6 +102,141 @@ static LISP wave_save(LISP lwave,LISP fname,LISP ftype,LISP stype) + return truth; + } + ++static LISP wave_save_data_fp(LISP lwave, LISP lfp, LISP ftype, LISP stype) ++{ ++ EST_Wave *w = wave(lwave); ++ EST_String filetype,sampletype; ++ FILE * fp; ++ ++ fp = get_c_file(lfp, stdout); ++ ++ if (ftype == NIL) ++ { ++ if (ft_get_param("Wavefiletype")) ++ filetype = get_c_string(ft_get_param("Wavefiletype")); ++ else ++ filetype = "nist"; ++ } ++ else ++ filetype = get_c_string(ftype); ++ if (stype == NIL) ++ { ++ if (ft_get_param("Wavesampletype")) ++ sampletype = get_c_string(ft_get_param("Wavesampletype")); ++ else ++ sampletype = "short"; ++ } ++ else ++ sampletype = get_c_string(stype); ++ ++ if (w->save_file_data(fp,filetype,sampletype,EST_NATIVE_BO) != write_ok) ++ { ++ cerr << "utt.save.wave.fp: failed to write wave" << endl; ++ festival_error(); ++ } ++ ++ return truth; ++} ++ ++ ++ ++static LISP wave_save_fp(LISP lwave, LISP lfp, LISP ftype, LISP stype) ++{ ++ EST_Wave *w = wave(lwave); ++ EST_String filetype,sampletype; ++ FILE * fp; ++ ++ fp = get_c_file(lfp, stdout); ++ ++ if (ftype == NIL) ++ { ++ if (ft_get_param("Wavefiletype")) ++ filetype = get_c_string(ft_get_param("Wavefiletype")); ++ else ++ filetype = "nist"; ++ } ++ else ++ filetype = get_c_string(ftype); ++ if (stype == NIL) ++ { ++ if (ft_get_param("Wavesampletype")) ++ sampletype = get_c_string(ft_get_param("Wavesampletype")); ++ else ++ sampletype = "short"; ++ } ++ else ++ sampletype = get_c_string(stype); ++ ++ if (w->save_file(fp,filetype,sampletype,EST_NATIVE_BO) != write_ok) ++ { ++ cerr << "utt.save.wave.data.fp: failed to write wave" << endl; ++ festival_error(); ++ } ++ ++ return truth; ++} ++ ++ ++ ++static LISP wave_save_header_fp(LISP arglist) ++{ ++ LISP lfp = car(arglist); ++ arglist = cdr(arglist); ++ LISP lwave = car(arglist); ++ arglist = cdr(arglist); ++ LISP lftype = car(arglist); ++ arglist = cdr(arglist); ++ LISP lstype = car(arglist); ++ arglist = cdr(arglist); ++ LISP force_values = car(arglist); ++ arglist = cdr(arglist); ++ ++ FILE *fp; ++ fp = get_c_file(lfp, NULL); ++ EST_String ftype, stype; ++ EST_Wave *w = wave(lwave); ++ ++ int num_samples = w->num_samples(); ++ int num_channels = w->num_channels(); ++ int sample_rate = w->sample_rate(); ++ int bo = EST_NATIVE_BO; ++ ++ num_samples = (int) get_param_float("numsamples", force_values, (float) num_samples); ++ num_channels = (int) get_param_float("numchannels", force_values, (float) num_channels); ++ sample_rate = (int) get_param_float("samplerate", force_values, (float) sample_rate); ++ bo = (int) get_param_float("bo", force_values, (float) bo); ++ ++ if (lftype == NIL) ++ { ++ if (ft_get_param("Wavefiletype")) ++ ftype = get_c_string(ft_get_param("Wavefiletype")); ++ else ++ ftype = "nist"; ++ } ++ else ++ ftype = get_c_string(lftype); ++ ++ if (lstype == NIL) ++ { ++ if (ft_get_param("Wavesampletype")) ++ stype = get_c_string(ft_get_param("Wavesampletype")); ++ else ++ stype = "short"; ++ } ++ else ++ stype = get_c_string(lstype); ++ ++ ++ if (wave_io_save_header(fp, num_samples, num_channels, ++ sample_rate, stype, bo, ftype) != write_ok) ++ { ++ cerr << "utt.save.wave.header: failed" << endl; ++ festival_error(); ++ } ++ ++ return truth; ++} ++ + static LISP wave_load(LISP fname,LISP ftype,LISP stype,LISP srate) + { + EST_Wave *w = new EST_Wave; +@@ -594,7 +730,31 @@ static LISP send_sexpr_to_client(LISP l) + void festival_wave_init(void) + { + // declare utterance (wave) specific Lisp functions +- ++ init_lsubr("wave.save.header", wave_save_header_fp, ++ "(wave.save.header FILEPOINTER WAVE FILETYPE SAMPLETYPE OVERRIDEPARAMS)\n\ ++ Write a wave header of format FILETYPE to FILEPOINTER.\n\ ++ Header parameters are read first from WAVE and SAMPLETYPE,\n\ ++ and can be overridden with OVERRIDEPARAMS\n\ ++ OVERRIDEPARAMS = ( (\"numsamples\" 84000)\n\ ++ (\"numchannels\" 1)\n\ ++ (\"samplerate\" 16000)\n\ ++ (\"bo\" 10)\n\ ++ (\"numsamples\" 16000)\n\ ++ )"); ++ init_subr_4("wave.save.fp", wave_save_fp, ++ "(wave.save.fp WAVE FILEPOINTER FILETYPE SAMPLETYPE)\n\ ++ Write WAVE to FILEPOINTER, respecting FILETYPE and SAMPLETYPE if specified\n\ ++ if these last two arguments are unspecified the global parameters\n\ ++ Wavefiletype and Wavesampletype are used. Returns t is successful\n\ ++ and throws an error if not."); ++ init_subr_4("wave.save.data.fp", wave_save_data_fp, ++ "(wave.save.data.fp WAVE FILEPOINTER FILETYPE SAMPLETYPE)\n\ ++ Write WAVE to FILEPOINTER, respecting FILETYPE and SAMPLETYPE if specified\n\ ++ ignoring any file header.\n\ ++ if these last two arguments are unspecified the global parameters\n\ ++ Wavefiletype and Wavesampletype are used. Returns t is successful\n\ ++ and throws an error if not. It can be used with wave.save.header\n\ ++ in order to concatenate several waves."); + init_subr_4("wave.save",wave_save, + "(wave.save WAVE FILENAME FILETYPE SAMPLETYPE)\n\ + Save WAVE in FILENAME, respecting FILETYPE and SAMPLETYPE if specifed\n\ +-- +1.8.3.4 + + +From 3a9c107c997e6301f96cfc9e7060ced0583ded40 Mon Sep 17 00:00:00 2001 +From: Timothy Gu +Date: Fri, 26 Dec 2014 23:28:01 -0800 +Subject: Fix memory allocation + +Author: Peter Drysdale + +Backported from Debian: 10-fix-memory-allocations.diff + +Signed-off-by: Timothy Gu + +diff --git a/src/modules/hts_engine/HTS_pstream.c b/src/modules/hts_engine/HTS_pstream.c +index e8cc184..8a3e3b2 100644 +--- a/src/modules/hts_engine/HTS_pstream.c ++++ b/src/modules/hts_engine/HTS_pstream.c +@@ -324,7 +324,7 @@ HTS_Boolean HTS_PStreamSet_create(HTS_PStreamSet * pss, HTS_SStreamSet * sss, do + /* copy dynamic window */ + pst->win_l_width = (int *) HTS_calloc(pst->win_size, sizeof(int)); + pst->win_r_width = (int *) HTS_calloc(pst->win_size, sizeof(int)); +- pst->win_coefficient = (double **) HTS_calloc(pst->win_size, sizeof(double)); ++ pst->win_coefficient = (double **) HTS_calloc(pst->win_size, sizeof(double *)); + for (j = 0; j < pst->win_size; j++) { + pst->win_l_width[j] = HTS_SStreamSet_get_window_left_width(sss, i, j); + pst->win_r_width[j] = HTS_SStreamSet_get_window_right_width(sss, i, j); +diff --git a/src/modules/hts_engine/HTS_sstream.c b/src/modules/hts_engine/HTS_sstream.c +index 95b18ac..6d1f35e 100644 +--- a/src/modules/hts_engine/HTS_sstream.c ++++ b/src/modules/hts_engine/HTS_sstream.c +@@ -293,7 +293,7 @@ HTS_Boolean HTS_SStreamSet_create(HTS_SStreamSet * sss, HTS_ModelSet * ms, HTS_L + sst->win_max_width = HTS_ModelSet_get_window_max_width(ms, i); + sst->win_l_width = (int *) HTS_calloc(sst->win_size, sizeof(int)); + sst->win_r_width = (int *) HTS_calloc(sst->win_size, sizeof(int)); +- sst->win_coefficient = (double **) HTS_calloc(sst->win_size, sizeof(double)); ++ sst->win_coefficient = (double **) HTS_calloc(sst->win_size, sizeof(double *)); + for (j = 0; j < sst->win_size; j++) { + sst->win_l_width[j] = HTS_ModelSet_get_window_left_width(ms, i, j); + sst->win_r_width[j] = HTS_ModelSet_get_window_right_width(ms, i, j); +-- +1.8.3.4 + + +From b9a00a59bd1696379d77a93816ea4a9e0a59a4ab Mon Sep 17 00:00:00 2001 +From: Timothy Gu +Date: Fri, 26 Dec 2014 23:29:34 -0800 +Subject: Replace multiple debug write calls by one + +Backported from Debian: 13-performance-single-cdebug-output.diff + +Signed-off-by: Timothy Gu + +diff --git a/src/modules/UniSyn_diphone/UniSyn_diphone.cc b/src/modules/UniSyn_diphone/UniSyn_diphone.cc +index eaf05ca..8689469 100644 +--- a/src/modules/UniSyn_diphone/UniSyn_diphone.cc ++++ b/src/modules/UniSyn_diphone/UniSyn_diphone.cc +@@ -123,10 +123,10 @@ LISP us_diphone_init(LISP args) + } + else + { +- *cdebug << ":" << get_param_str("grouped",args,"") << ":" << endl; +- *cdebug << "index grouped:" << d_index->grouped << endl; +- *cdebug << "true:" << true << endl; +- *cdebug << "false:" << false << endl; ++ *cdebug << ":" << get_param_str("grouped",args,"") << ":" << endl ++ << "index grouped:" << d_index->grouped << endl ++ << "true:" << true << endl ++ << "false:" << false << endl; + + d_index->coef_dir = get_param_str("coef_dir",args,""); + d_index->sig_dir = get_param_str("sig_dir",args,""); +-- +1.8.3.4 + + +From 9d99721191fac1ae64165b602af13c945c8e6771 Mon Sep 17 00:00:00 2001 +From: Timothy Gu +Date: Fri, 26 Dec 2014 23:12:45 -0800 +Subject: Add missing include + + +diff --git a/src/modules/clustergen/mlsa_resynthesis.cc b/src/modules/clustergen/mlsa_resynthesis.cc +index 5fc1baa..e4fba21 100644 +--- a/src/modules/clustergen/mlsa_resynthesis.cc ++++ b/src/modules/clustergen/mlsa_resynthesis.cc +@@ -41,6 +41,7 @@ + Written for HTS Engine API 1.07 (Jan 2013) + */ + ++#include + #include + + #include +-- +1.8.3.4 + + +From 521a9a67840df161b3bc90b82cc9ce802510c13e Mon Sep 17 00:00:00 2001 +From: Timothy Gu +Date: Fri, 26 Dec 2014 23:20:09 -0800 +Subject: Fix use of fgetpos() + + +diff --git a/src/modules/hts_engine/HTS_misc.c b/src/modules/hts_engine/HTS_misc.c +index 97eeee7..7af3c25 100644 +--- a/src/modules/hts_engine/HTS_misc.c ++++ b/src/modules/hts_engine/HTS_misc.c +@@ -245,7 +245,7 @@ size_t HTS_ftell(HTS_File * fp) + } else if (fp->type == HTS_FILE) { + fpos_t pos; + fgetpos((FILE *) fp->pointer, &pos); +-#if defined(_WIN32) || defined(__CYGWIN__) || defined(__APPLE__) ++#if defined(_WIN32) || defined(__CYGWIN__) || defined(__APPLE__) || defined(__HAIKU__) + return (size_t) pos; + #else + return (size_t) pos.__pos; +-- +1.8.3.4 + + +From 46f3fe1d2273b13f5a327a7d7d03ef8359488ab0 Mon Sep 17 00:00:00 2001 +From: Timothy Gu +Date: Fri, 26 Dec 2014 23:09:50 -0800 +Subject: Add config/config + +Inspired by Debian patch 01-config_config.diff. + +Signed-off-by: Timothy Gu + +diff --git a/config/config b/config/config +new file mode 100644 +index 0000000..383b149 +--- /dev/null ++++ b/config/config +@@ -0,0 +1,74 @@ ++########################################################-*-mode:Makefile-*- ++## ## ++## Festival: local configuration file ## ++## ## ++########################################################################### ++## ++## Specific config file for local installation ++## ++ ++########################################################################### ++## Which speech tools to use ++ ++EST=$(portPackageLinksDir)/speech_tools$(secondaryArchSuffix)_devel/$(relativeDevelopLibDir)/speech_tools$(secondaryArchSuffix) ++ ++########################################################################### ++## Where the festival tree will be installed. ++## ++## The default is that festival will remain where it is compiled. ++## ++## You may need to set this explicitly if automounter or NFS ++## side effects cause problems ++ ++FESTIVAL_HOME := $(shell (cd $(TOP); pwd)) ++ ++########################################################################### ++## Feature selection. ++## ++## Select modules to include. ++ ++## Non Free PSOLA synthesis. This isn't distributed with festival because ++## of a patent, if you have src/modules/diphone/di_psolaTM.cc you can ++## include this feature. ++# INCLUDE_PSOLA_TM=1 ++ ++## Support for TCL. So that festival may eval TCL commands and TCL may eval ++## festival commands. This was added to support the CSLU toolkit but ++## others may want it too. ++# INCLUDE_TCL=1 ++ ++########################################################################### ++## Take most settings from speech tools. ++ ++include $(EST)/config/system.mak ++include $(EST)/config/config ++ ++########################################################################### ++## Add any extra modules you wish to include ++ ++## These sub modules are *optional* and unless you know what they are ++## you probabaly don't want them or need them. They are typically ++## new code that isn't yet stable yet and being used for research or ++## old code left in for compatibility for some users ++ ++## Experimental UniSyn, metrical tree, phonological structure matching ++## code ++# ALSO_INCLUDE += UniSyn_phonology UniSyn_selection ++## Cluster unit selection code as described in "Building Voices in ++## Festival", again experimental and suitable for research purposes only. ++ALSO_INCLUDE += clunits clustergen hts_engine MultiSyn ++ ++## Old diphone code that will be delete, left in only for some ++## compatibility ++# ALSO_INCLUDE += diphone ++ ++## Other (non-Edinburgh) modules may also be specified here (e.g. OGI code), ++ ++ALSO_INCLUDE += ++ ++########################################################################### ++## ++## Describe your local system below by redefining things defined ++## in config/configs/default.mak. ++ ++ +-- +1.8.3.4 + + +From de3485cabba208df2ad622e7a6bafa07e291c140 Mon Sep 17 00:00:00 2001 +From: Timothy Gu +Date: Fri, 26 Dec 2014 23:10:57 -0800 +Subject: config/make_system: Copy system.mak from speech_tools + + +diff --git a/config/make_system.mak b/config/make_system.mak +index 5acf40a..5f81464 100644 +--- a/config/make_system.mak ++++ b/config/make_system.mak +@@ -39,6 +39,5 @@ + ########################################################################### + + system.mak : config +- @echo Check system type >&2 +- @/bin/sh $(TOP)/config/system.sh $(TOP)/config/systems > system.mak ++ cp $(EST)/config/system.mak system.mak + +-- +1.8.3.4 + + +From b329b31eaa2c9532b0b8b08e732a94e3dbe3b5a2 Mon Sep 17 00:00:00 2001 +From: Timothy Gu +Date: Sat, 27 Dec 2014 11:58:23 -0800 +Subject: Include config in make_system + +Signed-off-by: Timothy Gu + +diff --git a/config/make_system.mak b/config/make_system.mak +index 5f81464..13dbdc4 100644 +--- a/config/make_system.mak ++++ b/config/make_system.mak +@@ -38,6 +38,7 @@ + ## ## + ########################################################################### + ++include $(TOP)/config/config + system.mak : config + cp $(EST)/config/system.mak system.mak + +-- +1.8.3.4 + + +From f0b692b108d3c676cb8c5c4b38b0a1b7fa5c51f0 Mon Sep 17 00:00:00 2001 +From: Timothy Gu +Date: Sat, 27 Dec 2014 00:03:25 -0800 +Subject: Fix file system layout + +Inspired by Debian patch 20-debian-filesystem-standard.diff + +Signed-off-by: Timothy Gu + +diff --git a/examples/Makefile b/examples/Makefile +index b677cb9..170369f 100644 +--- a/examples/Makefile ++++ b/examples/Makefile +@@ -54,8 +54,7 @@ include $(TOP)/config/common_make_rules + + $(ALL) : % : %.sh + rm -f $@ +- @echo "#!/bin/sh" >$@ +- @echo "\"true\" ; exec "$(FESTIVAL_HOME)/bin/festival --script '$$0 $$*' >>$@ ++ @echo "#!$(binDir)/festival --script" >$@ + cat $< >>$@ + chmod +x $@ + +diff --git a/examples/text2wave.sh b/examples/text2wave.sh +index d6af881..cf62ef7 100755 +--- a/examples/text2wave.sh ++++ b/examples/text2wave.sh +@@ -40,7 +40,7 @@ + + ;;; Because this is a --script type file I has to explicitly + ;;; load the initfiles: init.scm and user's .festivalrc +-(load (path-append libdir "init.scm")) ++(load (path-append datadir "init.scm")) + + ;;; Process command line arguments + (define (text2wave_help) +diff --git a/lib/festival.scm b/lib/festival.scm.in +similarity index 99% +rename from lib/festival.scm +rename to lib/festival.scm.in +index 928016d..69d2796 100644 +--- a/lib/festival.scm ++++ b/lib/festival.scm.in +@@ -552,13 +552,13 @@ Doing stuff + (define (intro) + "(intro) + Synthesize an introduction to the Festival Speech Synthesis System." +- (tts (path-append libdir "../examples/intro.text") nil)) ++ (tts (path-append datadir "@DOCDIR@/examples/intro.text") nil)) + + (define (intro-spanish) + "(intro-spanish) + Synthesize an introduction to the Festival Speech Synthesis System + in spanish. Spanish voice must already be selected for this." +- (tts (path-append libdir "../examples/spintro.text") nil)) ++ (tts (path-append datadir "@DOCDIR@/examples/spintro.text") nil)) + + (define (na_play FILENAME) + "(play_wave FILENAME) +diff --git a/lib/init.scm b/lib/init.scm +index 90bccb7..42b9b68 100644 +--- a/lib/init.scm ++++ b/lib/init.scm +@@ -36,7 +36,7 @@ + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + ;;; Basic siod library (need this before load_library or require works) +-(load (path-append libdir "siod.scm")) ++(load (path-append datadir "siod.scm")) + + (defvar home-directory (or (getenv "HOME") "/") + "home-directory +diff --git a/lib/lexicons.scm b/lib/lexicons.scm.in +similarity index 98% +rename from lib/lexicons.scm +rename to lib/lexicons.scm.in +index 574c8fa..66dba14 100644 +--- a/lib/lexicons.scm ++++ b/lib/lexicons.scm.in +@@ -42,10 +42,10 @@ + ;;; you should set lexdir in sitevars.scm + + (defvar lexdir +- (if (probe_file (path-append libdir "dicts")) +- (path-append libdir "dicts/") ++ (if (probe_file (path-append datadir "dicts")) ++ (path-append datadir "dicts/") + ;; else we'll guess we're in the CSTR filespace +- (path-as-directory "/projects/festival/lib/dicts/")) ++ (path-as-directory "@DATADIR@/dicts/")) + "lexdir + The directory where the lexicon(s) are, by default.") + +diff --git a/lib/phrase.scm b/lib/phrase.scm +index bbabba6..e0a82c3 100644 +--- a/lib/phrase.scm ++++ b/lib/phrase.scm +@@ -93,7 +93,7 @@ in Token return punc, otherwise 0." + + (require 'pos) ;; for part of speech map + +-(defvar pbreak_ngram_dir libdir ++(defvar pbreak_ngram_dir datadir + "pbreak_ngram_dir + The directory containing the ngram models for predicting phrase + breaks. By default this is the standard library directory.") +diff --git a/lib/soleml-mode.scm b/lib/soleml-mode.scm +index 9856fb2..27b7279 100644 +--- a/lib/soleml-mode.scm ++++ b/lib/soleml-mode.scm +@@ -330,7 +330,7 @@ Flatten alist arguments." + (list 'exit_func soleml_exit_func) + '(analysis_type xxml) + (list 'filter +- (format nil "%s -D %s " sgml_parse_progname libdir)))) ++ (format nil "%s -D %s " sgml_parse_progname datadir)))) + tts_text_modes)) + + (provide 'soleml-mode) +diff --git a/lib/voices.scm b/lib/voices.scm.in +similarity index 99% +rename from lib/voices.scm +rename to lib/voices.scm.in +index 168d842..df50b15 100644 +--- a/lib/voices.scm ++++ b/lib/voices.scm.in +@@ -42,7 +42,7 @@ + ;; The path to search for voices is created from the load-path with + ;; an extra list of directories appended. + +-(defvar system-voice-path '( ) ++(defvar system-voice-path '("@DATADIR@/voices") + "system-voice-path + Additional directory not near the load path where voices can be + found, this can be redefined in lib/sitevars.scm if desired.") +diff --git a/src/arch/festival/Makefile b/src/arch/festival/Makefile +index fe49726..1b5eafe 100644 +--- a/src/arch/festival/Makefile ++++ b/src/arch/festival/Makefile +@@ -62,6 +62,6 @@ LOCAL_DEFINES += $(FESTIVAL_DEFINES) + LOCAL_INCLUDES += $(FESTIVAL_INCLUDES) + + festival.o: festival.cc +- $(CXX_COMMAND_TEMPLATES) -DFTNAME='$(PROJECT_NAME)' -DFTLIBDIRC='$(FTLIBDIR)' -DFTVERSION='$(PROJECT_VERSION)' -DFTSTATE='$(PROJECT_STATE)' -DFTDATE='$(PROJECT_DATE)' -DFTOSTYPE=\"$(SYSTEM_TYPE)\" festival.cc ++ $(CXX_COMMAND_TEMPLATES) -DFTNAME='$(PROJECT_NAME)' -DFTVERSION='$(PROJECT_VERSION)' -DFTSTATE='$(PROJECT_STATE)' -DFTDATE='$(PROJECT_DATE)' -DFTOSTYPEC='$(SYSTEM_TYPE)' festival.cc + + +diff --git a/src/arch/festival/festival.cc b/src/arch/festival/festival.cc.in +similarity index 97% +rename from src/arch/festival/festival.cc +rename to src/arch/festival/festival.cc.in +index 59abcdd..bea032c 100644 +--- a/src/arch/festival/festival.cc ++++ b/src/arch/festival/festival.cc.in +@@ -60,6 +60,9 @@ void festival_load_default_files(void); + #define STRINGIZE(S) _S_S_S(S) + + const char *festival_version = STRINGIZE(FTVERSION) ":" STRINGIZE(FTSTATE) " " STRINGIZE(FTDATE); ++const char *festival_libdir = "@LIBDIR@"; ++const char *festival_datadir = "@DATADIR@"; ++const char *festival_sysconfdir = "/boot/home/config/settings"; + + // Allow the path to be passed in without quotes because Windoze command line + // is stupid +@@ -79,7 +82,6 @@ const char *festival_version = STRINGIZE(FTVERSION) ":" STRINGIZE(FTSTATE) " " + #define FTOSTYPE "" + #endif + +-const char *festival_libdir = FTLIBDIR; + ostream *cdebug; + static int festival_server_port = 1314; + static EST_StrList sub_copyrights; +@@ -307,7 +309,7 @@ void festival_load_default_files(void) + EST_String userinitfile, home_str, initfile; + + // Load library init first +- initfile = (EST_String)EST_Pathname(festival_libdir).as_directory() + ++ initfile = (EST_String)EST_Pathname(festival_datadir).as_directory() + + "init.scm"; + if (access((const char *)initfile,R_OK) == 0) + vload(initfile,FALSE); +@@ -323,6 +325,8 @@ void festival_lisp_vars(void) + int major,minor,subminor; + + siod_set_lval("libdir",strintern(festival_libdir)); ++ siod_set_lval("datadir",strintern(festival_datadir)); ++ siod_set_lval("sysconfdir",strintern(festival_sysconfdir)); + if (!streq(FTOSTYPE,"")) + siod_set_lval("*ostype*",cintern(FTOSTYPE)); + siod_set_lval("festival_version", +@@ -356,6 +360,7 @@ void festival_lisp_vars(void) + if (mplayer_supported) + proclaim_module("mplayeraudio"); + ++#if 0 /* /usr/lib/festival/etc/machine -- ??? */ + // Add etc-dir path and machine specific directory etc/$OSTYPE + char *etcdir = walloc(char,strlen(festival_libdir)+strlen("etc/")+ + strlen(FTOSTYPE)+3); +@@ -376,6 +381,7 @@ void festival_lisp_vars(void) + + wfree(etcdir); + wfree(etcdircommon); ++#endif + return; + } + +diff --git a/src/include/festival.h b/src/include/festival.h +index e03c432..c11d5b8 100644 +--- a/src/include/festival.h ++++ b/src/include/festival.h +@@ -138,6 +138,7 @@ const EST_String utt_type(EST_Utterance &utt); + void add_item_features(EST_Item *s,LISP features); + + extern const char *festival_libdir; ++extern const char *festival_datadir; + + // Module specific LISP/etc definitions + void festival_init_modules(void); +diff --git a/src/main/festival_main.cc b/src/main/festival_main.cc +index f1af602..d12e984 100644 +--- a/src/main/festival_main.cc ++++ b/src/main/festival_main.cc +@@ -88,6 +88,8 @@ static void festival_main(int argc, char **argv) + "In evaluation mode \"filenames\" starting with ( are evaluated inline\n"+ + "Festival Speech Synthesis System: "+ festival_version +"\n"+ + "-q Load no default setup files\n"+ ++ "--datadir \n"+ ++ " Set data directory pathname\n"+ + "--libdir \n"+ + " Set library directory pathname\n"+ + "-b Run in batch mode (no interaction)\n"+ +@@ -127,6 +129,12 @@ static void festival_main(int argc, char **argv) + festival_libdir = wstrdup(al.val("--libdir")); + else if (getenv("FESTLIBDIR") != 0) + festival_libdir = getenv("FESTLIBDIR"); ++ ++ if (al.present("--datadir")) ++ festival_datadir = wstrdup(al.val("--datadir")); ++ else if (getenv("FESTDATADIR") != 0) ++ festival_datadir = getenv("FESTDATADIR"); ++ + if (al.present("--heap")) + heap_size = al.ival("--heap"); + +-- +1.8.3.4 +