aboutsummaryrefslogtreecommitdiff
path: root/flite
diff options
context:
space:
mode:
authorBryan Jurish <mukau@users.sourceforge.net>2006-02-02 12:49:19 +0000
committerBryan Jurish <mukau@users.sourceforge.net>2006-02-02 12:49:19 +0000
commit0727bfcaf2bd48bf501a7fa95515c400a1996902 (patch)
tree81a3774a9601ba1242482696344f3de3e08f8f22 /flite
parent6a4001a8538862ac02714a03fedd07c3b6f79366 (diff)
initial cvs import
svn path=/trunk/externals/moocow/; revision=4536
Diffstat (limited to 'flite')
-rw-r--r--flite/COPYING290
-rw-r--r--flite/Makefile.am139
-rw-r--r--flite/README.cvs13
-rw-r--r--flite/README.pod89
-rwxr-xr-xflite/autogen.sh48
-rw-r--r--flite/config/Makefile.am66
-rw-r--r--flite/configure.in242
-rw-r--r--flite/flite-1.1-noaudio.patch20
-rw-r--r--flite/flite-help.pd54
-rw-r--r--flite/flite-numbers.pd48
-rw-r--r--flite/flite-test.pd70
-rw-r--r--flite/flite-test2.pd34
-rw-r--r--flite/flite.c264
13 files changed, 1377 insertions, 0 deletions
diff --git a/flite/COPYING b/flite/COPYING
new file mode 100644
index 0000000..fa0bef4
--- /dev/null
+++ b/flite/COPYING
@@ -0,0 +1,290 @@
+GNU GENERAL PUBLIC LICENSE
+
+Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+
+Preamble
+
+The licenses for most software are designed to take away your freedom
+to share and change it. By contrast, the GNU General Public License is
+intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This General
+Public License applies to most of the Free Software Foundation's
+software and to any other program whose authors commit to using it.
+(Some other Free Software Foundation software is covered by the
+GNU Library General Public License instead.) You can apply it to your
+programs, too.
+
+When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new free
+programs; and that you know you can do these things.
+
+To protect your rights, we need to make restrictions that forbid anyone
+to deny you these rights or to ask you to surrender the rights. These
+restrictions translate to certain responsibilities for you if you distribute
+copies of the software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether gratis
+or for a fee, you must give the recipients all the rights that you have. You
+must make sure that they, too, receive or can get the source code. And
+you must show them these terms so they know their rights.
+
+We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on,
+we want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+Finally, any free program is threatened constantly by software patents.
+We wish to avoid the danger that redistributors of a free program will
+individually obtain patent licenses, in effect making the program
+proprietary. To prevent this, we have made it clear that any patent must
+be licensed for everyone's free use or not licensed at all.
+
+The precise terms and conditions for copying, distribution and
+modification follow.
+
+TERMS AND CONDITIONS FOR
+COPYING, DISTRIBUTION AND
+MODIFICATION
+
+0. This License applies to any program or other work which contains a
+notice placed by the copyright holder saying it may be distributed under
+the terms of this General Public License. The "Program", below, refers
+to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it, either
+verbatim or with modifications and/or translated into another language.
+(Hereinafter, translation is included without limitation in the term
+"modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of running
+the Program is not restricted, and the output from the Program is
+covered only if its contents constitute a work based on the Program
+(independent of having been made by running the Program). Whether
+that is true depends on what the Program does.
+
+1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the notices
+that refer to this License and to the absence of any warranty; and give
+any other recipients of the Program a copy of this License along with the
+Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide a
+ warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but does
+ not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program, and
+can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based on
+the Program, the distribution of the whole must be on the terms of this
+License, whose permissions for other licensees extend to the entire
+whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest your
+rights to work written entirely by you; rather, the intent is to exercise the
+right to control the distribution of derivative or collective works based
+on the Program.
+
+In addition, mere aggregation of another work not based on the
+Program with the Program (or with a work based on the Program) on a
+volume of a storage or distribution medium does not bring the other
+work under the scope of this License.
+
+3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding
+ machine-readable source code, which must be distributed under
+ the terms of Sections 1 and 2 above on a medium customarily
+ used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your cost
+ of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a
+ medium customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with
+ such an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to control
+compilation and installation of the executable. However, as a special
+exception, the source code distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies the
+executable.
+
+If distribution of executable or object code is made by offering access to
+copy from a designated place, then offering equivalent access to copy
+the source code from the same place counts as distribution of the source
+code, even though third parties are not compelled to copy the source
+along with the object code.
+
+4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt otherwise
+to copy, modify, sublicense or distribute the Program is void, and will
+automatically terminate your rights under this License. However, parties
+who have received copies, or rights, from you under this License will not
+have their licenses terminated so long as such parties remain in full
+compliance.
+
+5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and all
+its terms and conditions for copying, distributing or modifying the
+Program or works based on it.
+
+6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the original
+licensor to copy, distribute or modify the Program subject to these terms
+and conditions. You may not impose any further restrictions on the
+recipients' exercise of the rights granted herein. You are not responsible
+for enforcing compliance by third parties to this License.
+
+7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot distribute
+so as to satisfy simultaneously your obligations under this License and
+any other pertinent obligations, then as a consequence you may not
+distribute the Program at all. For example, if a patent license would not
+permit royalty-free redistribution of the Program by all those who
+receive copies directly or indirectly through you, then the only way you
+could satisfy both it and this License would be to refrain entirely from
+distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any patents
+or other property right claims or to contest validity of any such claims;
+this section has the sole purpose of protecting the integrity of the free
+software distribution system, which is implemented by public license
+practices. Many people have made generous contributions to the wide
+range of software distributed through that system in reliance on
+consistent application of that system; it is up to the author/donor to
+decide if he or she is willing to distribute software through any other
+system and a licensee cannot impose that choice.
+
+This section is intended to make thoroughly clear what is believed to be
+a consequence of the rest of this License.
+
+8. If the distribution and/or use of the Program is restricted in certain
+countries either by patents or by copyrighted interfaces, the original
+copyright holder who places the Program under this License may add an
+explicit geographical distribution limitation excluding those countries, so
+that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+9. The Free Software Foundation may publish revised and/or new
+versions of the General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may differ in
+detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number
+of this License, you may choose any version ever published by the Free
+Software Foundation.
+
+10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we
+sometimes make exceptions for this. Our decision will be guided by the
+two goals of preserving the free status of all derivatives of our free
+software and of promoting the sharing and reuse of software generally.
+
+NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF
+CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM,
+TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
+WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE
+PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND,
+EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
+PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD
+THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE
+COST OF ALL NECESSARY SERVICING, REPAIR OR
+CORRECTION.
+
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW
+OR AGREED TO IN WRITING WILL ANY COPYRIGHT
+HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED
+ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING
+ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
+INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT
+LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
+INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE
+WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR
+OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY
+OF SUCH DAMAGES.
+
+END OF TERMS AND CONDITIONS
diff --git a/flite/Makefile.am b/flite/Makefile.am
new file mode 100644
index 0000000..84c306c
--- /dev/null
+++ b/flite/Makefile.am
@@ -0,0 +1,139 @@
+# File: ./Makefile.am
+# Package: flite
+# Description:
+# + top-level automake file
+#
+# Process this file with Automake to create Makefile.in.
+#-----------------------------------------------------------------------
+
+#-----------------------------------------------------------------------
+# Options & Subdirectories
+#-----------------------------------------------------------------------
+
+## --- automake options
+#AUTOMAKE_OPTIONS = foreign dist-bzip2 dist-zip
+AUTOMAKE_OPTIONS = foreign
+
+## --- recursion subdirectories
+SUBDIRS = config
+
+## --- pseudo-deps for '.SUFFIXES'
+SUFFIXES = .pod .txt
+
+#-----------------------------------------------------------------------
+# Flags and variables
+#-----------------------------------------------------------------------
+PD_DIR = @PD_DIR@
+PD_INC = @PD_INC@
+PD_DOCDIR = @PD_DOC@
+PD_EXTDIR = @PD_EXTDIR@
+EXT = @EXT@
+
+#-----------------------------------------------------------------------
+# pd externals (hacked 'libexec_*')
+#-----------------------------------------------------------------------
+EXEEXT=.@EXT@
+libexecdir = @PD_EXTDIR@
+
+## --- externals
+libexec_PROGRAMS = flite
+
+## --- documentation
+datadir = @PD_DOCDIR@
+data_DATA = flite-help.pd
+
+#-----------------------------------------------------------------------
+# sources
+#-----------------------------------------------------------------------
+flite_SOURCES = flite.c
+
+#-----------------------------------------------------------------------
+# external compilation : flags
+#-----------------------------------------------------------------------
+DEFS = @DEFS@
+AFLAGS = @AFLAGS@
+DFLAGS = @DFLAGS@
+LFLAGS = @LFLAGS@
+WFLAGS = @WFLAGS@
+OFLAGS = @OFLAGS@
+
+AM_CPPFLAGS = $(DEFS) $(IFLAGS) $(DFLAGS)
+AM_CFLAGS = $(OFLAGS) $(WFLAGS) $(AFLAGS)
+
+flite_LDFLAGS = $(LFLAGS)
+flite_LDADD = $(FLITE_VOICELIBS) $(FLITE_LANGLIBS) $(FLITE_LEXLIBS) $(FLITE_LIBS)
+
+#-----------------------------------------------------------------------
+# Variables: cleanup
+#-----------------------------------------------------------------------
+## --- mostlyclean: built by 'make' & commonly rebuilt
+#MOSTLYCLEANFILES =
+
+## --- clean: built by 'make'
+#CLEANFILES =
+
+## --- distclean: built by 'configure'
+DISTCLEANFILES = \
+ config.log \
+ config.cache \
+ config.status
+
+## -- maintainerclean: built by maintainer / by hand
+MAINTAINERCLEANFILES = *~ \
+ $(PODS:.pod=.txt) \
+ Makefile Makefile.in \
+ aclocal.m4 \
+ configure \
+ install-sh \
+ stamp-h.in \
+ config.h.in
+
+maintainer-clean-local:
+ rm -rf autom4te.cache
+
+#CVSCLEAN_SUBDIRS = $(SUBDIRS)
+
+#CVSCLEANFILES = Makefile.in Makefile
+
+
+#-----------------------------------------------------------------------
+# Additional Variables & Rules: PODS
+#-----------------------------------------------------------------------
+PODS = README.pod
+
+.pod.txt:
+ pod2text $< $@
+
+
+#-----------------------------------------------------------------------
+# Variables: distribution
+#-----------------------------------------------------------------------
+
+## --- extra distribution files
+EXTRA_DIST = $(PODS:.pod=.txt) $(data_DATA) autogen.sh configure \
+ COPYING flite-1.1-noaudio.patch
+
+## --- recursion subdirectories for 'make dist'
+DIST_SUBDIRS = $(SUBDIRS)
+
+## --- dist-hook: when another 'Makefile.am' is overkill
+#DISTHOOK_DIRS = foo
+#DISTHOOK_FILES = foo/bar.txt foo/baz.txt
+#dist-hook:
+# for d in $(DISTHOOK_DIRS); do\
+# mkdir -p $(distdir)/$$d ;\
+# done
+# for f in $(DISTHOOK_FILES); do\
+# cp -p $(srcdir)/$$f $(distdir)/$$f ;\
+# done
+
+#dist-bz2: dist-bzip2 ;
+
+
+#-----------------------------------------------------------------------
+# Rules: cleanup
+#-----------------------------------------------------------------------
+.PHONY: cvsclean cvsclean-hook
+
+cvsclean: maintainer-clean ;
+
diff --git a/flite/README.cvs b/flite/README.cvs
new file mode 100644
index 0000000..2a0ee0c
--- /dev/null
+++ b/flite/README.cvs
@@ -0,0 +1,13 @@
+To build from cvs, do the following:
+
+ ./autogen.sh
+ ./configure
+ make
+ make install
+
+NOTE: The README.txt file in the distribution
+is auto-generated from perl ".pod" format by
+the "pod2text" included in most perl distributions.
+
+marmosets,
+ Bryan
diff --git a/flite/README.pod b/flite/README.pod
new file mode 100644
index 0000000..12d4dc2
--- /dev/null
+++ b/flite/README.pod
@@ -0,0 +1,89 @@
+=pod
+
+README for PD external distribution 'pd-flite'
+
+Last updated for version 0.01
+
+=head1 DESCRIPTION
+
+The 'pd-flite' distribution contains a single PD external ("flite"),
+which provides a high-level text-to-speech interface for English based on
+the 'libflite' library by Alan W Black and Kevin A. Lenzo.
+
+Currently tested only under linux.
+
+
+=head1 REQUIREMENTS
+
+=over 4
+
+=item * libflite >= v1.1
+
+The 'libflite' library by Alan W Black and Keven A. Lenzo
+is required to build the PD 'flite' external.
+It is available from http://cmuflite.org.
+
+You may want to apply the patch 'libflite-noaudio.patch'
+which comes with this distribution to the 'libflite'
+sources before compiling them (the '--with-audio=none'
+configure flag did not work for me on its own).
+
+=back
+
+
+=head1 INSTALLATION
+
+First, build and install the libflite distribution.
+
+Then, issue the following commands to the shell:
+
+ cd PACKAGENAME-X.YY (or wherever you extracted this distribution)
+ ./configure
+ make
+ make install
+
+
+=head1 BUILD OPTIONS
+
+The 'configure' script supports the following options, among others:
+
+=over 4
+
+=item * --with-flite-dir=DIR
+
+Specify the base directory of the libflite distribution.
+
+=item * --with-pd-dir=DIR
+
+Specify PD base directory.
+
+=item * --enable-debug , --disable-debug
+
+Whether to enable verbose debugging messages.
+Default=no.
+
+=back
+
+See the output of './configure --help' for more options.
+
+
+=head1 ACKNOWLEDGEMENTS
+
+PD by Miller Puckette and others.
+
+Flite run-time speech synthesis library by Alan W Black
+and Kevin A. Lenzo.
+
+Ideas, black magic, and other nuggets of information drawn
+from code by Guenter Geiger, Larry Troxler, and iohannes m zmoelnig.
+
+=head1 KNOWN BUGS
+
+It gobbles memory, and also processor time on synthesis operations.
+
+No support for alternative voices or lexica, and no
+mid- or low-level interface to the libflite functions.
+
+=head1 AUTHOR
+
+Bryan Jurish E<lt>moocow@ling.uni-potsdam.deE<gt>
diff --git a/flite/autogen.sh b/flite/autogen.sh
new file mode 100755
index 0000000..845f276
--- /dev/null
+++ b/flite/autogen.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+#-----------------------------------------------------------------------
+# File: autogen.sh
+# Description:
+# + wrapper for m4 black-magic
+#-----------------------------------------------------------------------
+
+MY_ALDIRS="."
+MY_AHDIRS="."
+MY_AMDIRS="."
+MY_ACDIRS="."
+
+test -z "$ACLOCAL" && ACLOCAL=aclocal
+test -z "$AUTOHEADER" && AUTOHEADER=autoheader
+test -z "$AUTOMAKE" && AUTOMAKE=automake
+test -z "$AUTOCONF" && AUTOCONF=autoconf
+
+if test -n "$MY_ALDIRS"; then
+ for d in $MY_ALDIRS ; do
+ echo "(cd $d ; $ACLOCAL)"
+ (cd $d ; $ACLOCAL)
+ done
+fi
+
+if test -n "$MY_AHDIRS"; then
+ for d in $MY_AHDIRS ; do
+ echo "(cd $d ; $AUTOHEADER)"
+ (cd $d ; $AUTOHEADER)
+ done
+fi
+
+if test -n "$MY_AMDIRS"; then
+ for d in $MY_AMDIRS ; do
+ echo "(cd $d ; $AUTOMAKE -a)"
+ (cd $d ; $AUTOMAKE -a)
+ done
+fi
+
+if test -n "$MY_ACDIRS"; then
+ for d in $MY_ACDIRS ; do
+ echo "(cd $d ; $AUTOCONF)"
+ (cd $d ; $AUTOCONF)
+ done
+fi
+
+#echo "(./configure)"
+#./configure $*
diff --git a/flite/config/Makefile.am b/flite/config/Makefile.am
new file mode 100644
index 0000000..3e097e9
--- /dev/null
+++ b/flite/config/Makefile.am
@@ -0,0 +1,66 @@
+## File: config/Makefile.am
+## Package:
+## Description:
+## + automake file for 'config' package-subdir
+##
+## Process this file with Automake to create Makefile.in.
+##-----------------------------------------------------------------------
+
+##-----------------------------------------------------------------------
+## Variables: options
+##-----------------------------------------------------------------------
+
+##-----------------------------------------------------------------------
+## Variables: cleanup
+##-----------------------------------------------------------------------
+
+## --- mostlyclean: built by 'make' & commonly rebuilt
+#MOSTLYCLEANFILES =
+
+## --- clean: built by 'make'
+#CLEANFILES =
+
+## --- distclean: built by 'configure'
+#DISTCLEANFILES =
+
+## -- maintainerclean: built by maintainer / by hand
+MAINTAINERCLEANFILES = \
+ *~ .*~ \
+ compile Makefile Makefile.in \
+ config.guess \
+ config.sub \
+ depcomp \
+ install-sh \
+ ltmain.sh \
+ missing \
+ mkinstalldirs \
+ texinfo.tex \
+ ylwrap
+
+
+##-----------------------------------------------------------------------
+## Variables: distribution
+##-----------------------------------------------------------------------
+
+## --- extra distribution files
+EXTRA_DIST = \
+ Makefile.in \
+ depcomp \
+ install-sh \
+ mkinstalldirs \
+ missing
+
+# config.guess
+# config.sub
+# ltmain.sh
+# texinfo.tex
+
+## --- recursion subdirectories for 'make dist'
+#DIST_SUBDIRS = $(SUBDIRS)
+
+#-----------------------------------------------------------------------
+# Rules: cleanup
+#-----------------------------------------------------------------------
+.PHONY: cvsclean cvsclean-hook
+
+cvsclean: maintainer-clean ;
diff --git a/flite/configure.in b/flite/configure.in
new file mode 100644
index 0000000..ded1a2e
--- /dev/null
+++ b/flite/configure.in
@@ -0,0 +1,242 @@
+dnl Process this file with autoconf to produce a configure script.
+dnl -- adapted from 'configure.in' in ggee distribution by Guenter Geiger
+AC_PREREQ(2.5)
+AC_INIT(pd-flite, [0.01], [moocow@ling.uni-potsdam.de])
+
+dnl
+dnl source & aux
+dnl
+AC_CONFIG_AUX_DIR(config)
+
+dnl
+dnl use automake
+dnl
+AM_INIT_AUTOMAKE(pd-flite, [0.01])
+
+dnl
+dnl use autoheader
+dnl
+AM_CONFIG_HEADER(config.h)
+
+dnl
+dnl default prefix (== pd-dir)
+dnl
+AC_PREFIX_DEFAULT(/usr/local/lib/pd)
+
+dnl
+dnl Save user flags
+dnl
+UCFLAGS="$CFLAGS"
+ULDFLAGS="$LDFLAGS"
+ULIBS="$LIBS"
+
+dnl
+dnl Programs
+dnl
+AC_PROG_CC
+AC_PROG_INSTALL
+
+dnl
+dnl Substitutions
+dnl
+AC_SUBST(AFLAGS)
+AC_SUBST(DFLAGS)
+AC_SUBST(IFLAGS)
+AC_SUBST(LFLAGS)
+AC_SUBST(OFLAGS)
+AC_SUBST(WFLAGS)
+AC_SUBST(LD)
+AC_SUBST(EXT)
+
+dnl version stuff (automatically exported?)
+AC_SUBST(PACKAGE_VERSION)
+AC_SUBST(PACKAGE_NAME)
+AC_SUBST(BUGREPORT)
+
+
+dnl
+dnl pd-directory/ies
+dnl
+AC_ARG_WITH(pd-dir,
+ AC_HELP_STRING([--with-pd-dir=DIR], [PD base directory (default=/usr/local/pd)]),
+ [PD_DIR="$withval"],
+ [PD_DIR="/usr/local/pd"])
+AC_SUBST(PD_DIR)
+
+AC_ARG_WITH(pd-include,
+ AC_HELP_STRING([--with-pd-include=DIR], [PD include directory (default=${PD_DIR}/src)]),
+ [PD_INC="$withval"],
+ [PD_INC="${PD_DIR}/src"])
+IFLAGS="$IFLAGS -I${PD_INC}"
+AC_SUBST(PD_INC)
+
+AC_ARG_WITH(pd-externs,
+ AC_HELP_STRING([--with-pd-externs=DIR], [PD externals directory (default=${PD_DIR}/externs)]),
+ [PD_EXTDIR="$withval"],
+ [PD_EXTDIR="${PD_DIR}/externs"])
+AC_SUBST(PD_EXTDIR)
+
+
+AC_ARG_WITH(pd-doc,
+ AC_HELP_STRING([--with-pd-doc=DIR],
+ [PD documentation directory (default=${PD_DIR}/doc/5.reference)]),
+ [PD_DOCDIR="$withval"],
+ [PD_DOCDIR="${PD_DIR}/doc/5.reference"])
+AC_SUBST(PD_DOCDIR)
+
+
+dnl
+dnl flite-directory
+dnl
+AC_ARG_WITH(flite-dir,
+ AC_HELP_STRING([--with-flite-dir=DIR], [Flite base directory (default=/usr/local/lib/flite-1.1-release)]),
+ [FLITE_DIR="$withval"],
+ [FLITE_DIR="/usr/local/lib/flite-1.1-release"])
+AC_SUBST(FLITE_DIR)
+IFLAGS="$IFLAGS -I${FLITE_DIR}/include"
+LFLAGS="$LFLAGS -L${FLITE_DIR}/lib"
+
+dnl
+dnl Check for flite : headers
+dnl
+UCPPFLAGS="$CPPFLAGS"
+CPPFLAGS="$UCPPFLAGS $IFLAGS"
+for h in flite.h ; do
+ AC_CHECK_HEADER($h,[pdflite_have_header="yes"],[pdflite_have_header="no"],[ ])
+ if test "$pdflite_have_header" = "no" ; then
+ AC_MSG_ERROR([required header 'flite.h' not found -- quitting],1)
+ fi
+done
+CPPFLAGS="$UCPPFLAGS"
+
+dnl
+dnl Check for flite : libs : flite
+dnl
+LDFLAGS="$ULDFLAGS $LFLAGS"
+LIBS="$LIBS -lm"
+AC_CHECK_LIB(flite,[flite_init],[],
+ [AC_MSG_ERROR([required library 'libflite.a' not found -- quitting],1)],
+ [-lm])
+LDFLAGS="$ULDFLAGS"
+FLITE_LIBS="-lflite -lm"
+AC_SUBST(FLITE_LIBS)
+
+dnl
+dnl Check for flite : libs : flite_cmulex
+dnl
+LDFLAGS="$ULDFLAGS $LFLAGS"
+AC_CHECK_LIB(flite_cmulex,[cmu_lex_init],[],
+ [AC_MSG_ERROR([required library 'libflite_cmulex.a' not found -- quitting],1)],
+ [-lflite -lm])
+FLITE_LEXLIBS="-lflite_cmulex"
+AC_SUBST(FLITE_LEXLIBS)
+
+dnl
+dnl Check for flite : libs : flite_usenglish
+dnl
+LDFLAGS="$ULDFLAGS $LFLAGS"
+AC_CHECK_LIB(flite_usenglish,[usenglish_init],[],
+ [AC_MSG_ERROR([required library 'libflite_usenglish.a' not found -- quitting],1)],
+ [-lflite_cmulex -lflite -lm])
+FLITE_LANGLIBS="-lflite_usenglish"
+AC_SUBST(FLITE_LANGLIBS)
+
+dnl Check for flite : libs : flite_cmu_us_kal16
+dnl
+LDFLAGS="$ULDFLAGS $LFLAGS"
+AC_CHECK_LIB(flite_cmu_us_kal16,[register_cmu_us_kal],[],
+ [AC_MSG_ERROR([required library 'libflite_cmu_us_kal16.a' not found -- quitting],1)],
+ [-lflite_usenglish -lflite_cmulex -lflite -lm])
+FLITE_VOICELIBS="-lflite_cmu_us_kal16"
+AC_SUBST(FLITE_VOICELIBS)
+
+AC_DEFINE([PDFLITE_REGISTER_VOICE],[register_cmu_us_kal],
+ [This is the function we will call to register the synth voice])
+
+
+
+dnl
+dnl debug version?
+dnl
+AC_MSG_CHECKING([whether we are building a debug version])
+AC_ARG_ENABLE([debug],
+ AC_HELP_STRING([--enable-debug],[build debug version (default=no)]))
+
+if test "$enable_debug" == "yes" ; then
+ AC_MSG_RESULT(yes)
+ DEBUG="yes"
+ DFLAGS="$DFLAGS -DPDFLITE_DEBUG"
+else
+ AC_MSG_RESULT(no)
+ DEBUG="no"
+fi
+AC_SUBST(DEBUG)
+
+dnl
+dnl compiler warnings
+dnl
+WFLAGS="-Wall"
+
+
+dnl
+dnl machine-dependent variables
+dnl
+LD=ld
+if test `uname -s` = Linux;
+then
+ LFLAGS="$LFLAGS -export_dynamic -shared"
+ if test "$DEBUG" == "no"; then
+ OFLAGS="-O6 -funroll-loops -fomit-frame-pointer"
+ else
+ OFLAGS="-g"
+ fi
+ EXT=pd_linux
+fi
+
+if test `uname -m` = alpha;
+then
+ AFLAGS="-mieee -mcpu=ev56";
+ OFLAGS="$CFLAGS"
+fi
+
+if test `uname -s` = IRIX64;
+then
+ LFLAGS="$LFLAGS -n32 -DUNIX -DIRIX -DN32 -woff 1080,1064,1185 \
+ -OPT:roundoff=3 -OPT:IEEE_arithmetic=3 -OPT:cray_ivdep=true \
+ -shared -rdata_shared"
+ OFLAGS="$CFLAGS"
+EXT=pd_irix6
+fi
+
+if test `uname -s` = IRIX32;
+then
+ LFLAGS="$LFLAGS -o32 -DUNIX -DIRIX -O2 -shared -rdata_shared"
+ OFLAGS="$CFLAGS"
+ EXT=pd_irix5
+fi
+
+dnl
+dnl Flags for MacOSX, borrowed from pd-0.35-test16
+dnl
+if test `uname -s` = Darwin;
+then
+ LD=cc
+ LFLAGS="$LFLAGS -bundle -undefined suppress -flat_namespace"
+ EXT=pd_darwin
+ DFLAGS="$DFLAGS -DMACOSX"
+
+ if test "$DEBUG" == "no"; then
+ OFLAGS="-O2"
+ else
+ OFLAGS="-g"
+ fi
+fi
+
+dnl
+dnl Restore user flags
+dnl
+LDFLAGS="$ULDFLAGS"
+CFLAGS="$UCFLAGS"
+LIBS="$ULIBS"
+
+AC_OUTPUT(config/Makefile Makefile)
diff --git a/flite/flite-1.1-noaudio.patch b/flite/flite-1.1-noaudio.patch
new file mode 100644
index 0000000..4c2ef0f
--- /dev/null
+++ b/flite/flite-1.1-noaudio.patch
@@ -0,0 +1,20 @@
+diff -uNr flite-1.1-release/src/audio/native_audio.h flite-1.1-release-noaudio/src/audio/native_audio.h
+--- flite-1.1-release/src/audio/native_audio.h Tue Dec 4 19:05:59 2001
++++ flite-1.1-release-noaudio/src/audio/native_audio.h Sun Nov 3 19:12:44 2002
+@@ -41,6 +41,16 @@
+ #ifndef _NATIVE_AUDIO_H__
+ #define _NATIVE_AUDIO_H__
+
++/* -- begin HACK: turn off all audio -- */
++#undef CST_AUDIO_COMMAND
++#undef CST_AUDIO_SUNOS
++#undef CST_AUDIO_LINUX
++#undef CST_AUDIO_ALSA
++#undef CST_AUDIO_FREEBSD
++#undef CST_AUDIO_WINCE
++#define CST_AUDIO_NONE
++/* -- end HACK -- */
++
+ #ifdef CST_AUDIO_COMMAND
+
+ #define AUDIO_OPEN_NATIVE audio_open_command
diff --git a/flite/flite-help.pd b/flite/flite-help.pd
new file mode 100644
index 0000000..eebdbee
--- /dev/null
+++ b/flite/flite-help.pd
@@ -0,0 +1,54 @@
+#N canvas 156 26 606 524 10;
+#X text 25 4 flite : text-to-speech synthesis with libflite;
+#N canvas 0 0 450 300 graph1 0;
+#X array words1 112963 float 0;
+#X coords 0 1 112962 -1 100 70 1;
+#X restore 265 245 graph;
+#N canvas 0 0 450 300 graph2 0;
+#X array words2 112963 float 0;
+#X coords 0 1 112962 -1 100 70 1;
+#X restore 426 248 graph;
+#X obj 22 298 print flite-synth-done;
+#X obj 23 279 flite words1;
+#X text 51 35 ARRAYNAME - initial array name;
+#X text 328 32 1 - control messages;
+#X text 321 59 1 - bang on completed synthesis;
+#X text 30 22 ARGUMENTS:;
+#X text 312 18 INLETS:;
+#X text 305 45 OUTLETS:;
+#X msg 27 81 set words1;
+#X msg 34 99 set words2;
+#X msg 64 167 synth;
+#X text 104 170 "synth" message synthesizes current text-buffer;
+#X text 157 145 "text" message sets input text-buffer;
+#X text 108 87 "set" message selects the output array;
+#X text 225 211 "list" messages set text and synthesize;
+#X obj 31 444 dac~;
+#X msg 262 358 \; pd dsp 1;
+#X msg 328 358 \; pd dsp 0;
+#X text 10 340 For playback \, you can use 'tabplay~':;
+#X msg 32 363 set words1;
+#X msg 37 383 set words2;
+#X obj 31 417 tabplay~ words1;
+#X msg 146 380 bang;
+#X msg 197 381 stop;
+#X msg 146 358 start;
+#X text 173 485 Bryan Jurish <moocow@ling.uni-potsdam.de>;
+#X msg 58 145 text test 123;
+#X text 172 419 ACKNOWLEDGEMENTS:;
+#X text 190 434 Flite runtime speech synthesis library by Alan W Black
+and Kevin A. Lenzo.;
+#X msg 61 211 list bang bahda boobop;
+#X connect 4 0 3 0;
+#X connect 11 0 4 0;
+#X connect 12 0 4 0;
+#X connect 13 0 4 0;
+#X connect 22 0 24 0;
+#X connect 23 0 24 0;
+#X connect 24 0 18 0;
+#X connect 24 0 18 1;
+#X connect 25 0 24 0;
+#X connect 26 0 24 0;
+#X connect 27 0 25 0;
+#X connect 29 0 4 0;
+#X connect 32 0 4 0;
diff --git a/flite/flite-numbers.pd b/flite/flite-numbers.pd
new file mode 100644
index 0000000..bcd1970
--- /dev/null
+++ b/flite/flite-numbers.pd
@@ -0,0 +1,48 @@
+#N canvas 47 239 465 419 10;
+#X obj 69 219 random;
+#X floatatom 105 199 10 0 0;
+#X msg 105 176 65535;
+#X obj 105 153 loadbang;
+#X msg 14 13 start;
+#X msg 57 13 stop;
+#X msg 172 19 \; pd dsp 1;
+#X msg 238 19 \; pd dsp 0;
+#X msg 85 245 text \$1;
+#X obj 319 14 table \$0-numtab;
+#X obj 85 324 tabplay~ \$0-numtab;
+#X obj 85 277 flite \$0-numtab;
+#X obj 14 58 s \$0-start;
+#X obj 57 35 s \$0-stop;
+#X obj 39 124 r \$0-start;
+#X obj 39 148 t b b;
+#X msg 39 245 synth;
+#X obj 73 359 dac~;
+#X obj 206 371 s \$0-start;
+#X obj 206 347 spigot;
+#X msg 276 305 1;
+#X msg 243 305 0;
+#X obj 276 281 r \$0-start;
+#X obj 243 261 r \$0-stop;
+#X msg 210 295 0 1;
+#X connect 0 0 8 0;
+#X connect 1 0 0 1;
+#X connect 2 0 1 0;
+#X connect 3 0 2 0;
+#X connect 4 0 12 0;
+#X connect 5 0 13 0;
+#X connect 8 0 11 0;
+#X connect 10 0 17 0;
+#X connect 10 0 17 1;
+#X connect 10 1 19 0;
+#X connect 11 0 10 0;
+#X connect 14 0 15 0;
+#X connect 15 0 16 0;
+#X connect 15 1 0 0;
+#X connect 16 0 11 0;
+#X connect 19 0 18 0;
+#X connect 20 0 19 1;
+#X connect 21 0 19 1;
+#X connect 22 0 20 0;
+#X connect 23 0 21 0;
+#X connect 23 0 24 0;
+#X connect 24 0 10 0;
diff --git a/flite/flite-test.pd b/flite/flite-test.pd
new file mode 100644
index 0000000..52d34db
--- /dev/null
+++ b/flite/flite-test.pd
@@ -0,0 +1,70 @@
+#N canvas 164 1 726 560 10;
+#X msg 36 43 set ary2;
+#X msg 13 22 set ary1;
+#N canvas 0 0 450 300 graph1 0;
+#X array ary1 42489 float 0;
+#X coords 0 1 42488 -1 200 140 1;
+#X restore 41 223 graph;
+#N canvas 0 0 450 300 graph2 0;
+#X array ary2 10 float 0;
+#X coords 0 1 9 -1 200 140 1;
+#X restore 277 221 graph;
+#X obj 122 164 flite ary1;
+#X msg 121 16 text moo the cow;
+#X msg 133 38 text 42 marmosets;
+#X msg 149 83 synth;
+#X obj 390 418 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 8 -262144
+-1 -1 11000 1;
+#X obj 388 442 dbtorms;
+#X obj 356 497 dac~;
+#X obj 365 472 *~ 0;
+#X msg 208 406 bang;
+#X msg 264 405 0 1;
+#X msg 264 384 stop;
+#X msg 208 384 start;
+#X obj 12 79 s aryset;
+#X obj 249 438 tabplay~ ary1;
+#X obj 302 405 r aryset;
+#X msg 46 390 set ary1;
+#X msg 111 389 set ary2;
+#X msg 472 452 \; pd dsp 1;
+#X msg 473 486 \; pd dsp 0;
+#X msg 145 61 text text;
+#X obj 108 471 spigot;
+#X obj 145 449 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
+1;
+#X text 87 450 Loop;
+#X msg 285 15 list moo the cow;
+#X msg 287 40 list 42 marmosets;
+#X msg 289 66 list list;
+#X msg 291 91 list bang;
+#X obj 122 187 print flite-synth-done;
+#X connect 0 0 4 0;
+#X connect 0 0 16 0;
+#X connect 1 0 4 0;
+#X connect 1 0 16 0;
+#X connect 4 0 31 0;
+#X connect 5 0 4 0;
+#X connect 6 0 4 0;
+#X connect 7 0 4 0;
+#X connect 8 0 9 0;
+#X connect 9 0 11 1;
+#X connect 11 0 10 0;
+#X connect 11 0 10 1;
+#X connect 12 0 17 0;
+#X connect 13 0 17 0;
+#X connect 13 0 25 0;
+#X connect 14 0 13 0;
+#X connect 15 0 12 0;
+#X connect 17 0 11 0;
+#X connect 17 1 24 0;
+#X connect 18 0 17 0;
+#X connect 19 0 17 0;
+#X connect 20 0 17 0;
+#X connect 23 0 4 0;
+#X connect 24 0 17 0;
+#X connect 25 0 24 1;
+#X connect 27 0 4 0;
+#X connect 28 0 4 0;
+#X connect 29 0 4 0;
+#X connect 30 0 4 0;
diff --git a/flite/flite-test2.pd b/flite/flite-test2.pd
new file mode 100644
index 0000000..20777d6
--- /dev/null
+++ b/flite/flite-test2.pd
@@ -0,0 +1,34 @@
+#N canvas 489 199 450 300 10;
+#X obj 72 150 flite testary;
+#X obj 312 53 table testary;
+#X msg 54 13 moo;
+#X msg 91 14 is;
+#X msg 127 13 a;
+#X msg 175 13 cow;
+#X msg 175 62 marmoset;
+#X msg 176 38 bovine;
+#X obj 72 174 tabplay~ testary;
+#X obj 181 199 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 110 222 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 8 -262144
+-1 -1 8100 1;
+#X obj 107 245 dbtorms;
+#X obj 63 247 dac~;
+#X obj 72 222 *~ 0;
+#X msg 72 109 text \$1 \, synth;
+#X obj 72 87 pack s;
+#X connect 0 0 8 0;
+#X connect 2 0 15 0;
+#X connect 3 0 15 0;
+#X connect 4 0 15 0;
+#X connect 5 0 15 0;
+#X connect 6 0 15 0;
+#X connect 7 0 15 0;
+#X connect 8 0 13 0;
+#X connect 8 1 9 0;
+#X connect 10 0 11 0;
+#X connect 11 0 13 1;
+#X connect 13 0 12 0;
+#X connect 13 0 12 1;
+#X connect 14 0 0 0;
+#X connect 15 0 14 0;
diff --git a/flite/flite.c b/flite/flite.c
new file mode 100644
index 0000000..9493a38
--- /dev/null
+++ b/flite/flite.c
@@ -0,0 +1,264 @@
+/* -*- Mode: C -*- */
+/*=============================================================================*\
+ * File: flite.c
+ * Author: Bryan Jurish <moocow@ling.uni-potsdam.de>
+ * Description: speech synthesis for PD
+ *
+ * PD interface to 'flite' C libraries.
+ *
+ *=============================================================================*/
+
+
+#include <m_pd.h>
+
+/* black magic */
+#ifdef NT
+#pragma warning( disable : 4244 )
+#pragma warning( disable : 4305 )
+#endif
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <math.h>
+#include <flite.h>
+#include <cst_wave.h>
+
+/*--------------------------------------------------------------------
+ * DEBUG
+ *--------------------------------------------------------------------*/
+//#define FLITE_DEBUG 1
+//#undef FLITE_DEBUG
+
+
+/*--------------------------------------------------------------------
+ * Globals
+ *--------------------------------------------------------------------*/
+extern cst_voice *PDFLITE_REGISTER_VOICE();
+static cst_voice *voice;
+
+#define DEFAULT_BUFSIZE 256
+#define DEFAULT_BUFSTEP 256
+
+/*=====================================================================
+ * Structures and Types
+ *=====================================================================*/
+
+static char *flite_description =
+ "flite: Text-to-Speech external v%s by Bryan Jurish";
+//static char *flite_acknowledge = "flite: based on code by ";
+//static char *flite_version = "flite: PD external v%s by Bryan Jurish";
+
+
+
+/*---------------------------------------------------------------------
+ * flite
+ *---------------------------------------------------------------------*/
+static t_class *flite_class;
+typedef struct _flite
+{
+ t_object x_obj; /* black magic (probably inheritance-related) */
+ t_symbol *x_arrayname; /* arrayname (from '_tabwrite' code in $PD_SRC/d_array.c) */
+ char *textbuf; /* text buffer (hack) */
+ int bufsize; /* text buffer size */
+} t_flite;
+
+
+/*--------------------------------------------------------------------
+ * flite_synth : synthesize current text-buffer
+ *--------------------------------------------------------------------*/
+void flite_synth(t_flite *x) {
+ cst_wave *wave;
+ int i,vecsize;
+ t_garray *a;
+ t_float *vec;
+
+# ifdef FLITE_DEBUG
+ post("flite: got message 'synth'");
+# endif
+
+ // -- sanity checks
+ if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
+ error("flite: no such array '%s'", x->x_arrayname->s_name);
+ if (!x->textbuf) {
+ error("flite: attempt to synthesize empty text-buffer!");
+ return;
+ }
+
+# ifdef FLITE_DEBUG
+ post("flite: flite_text_to_wave()");
+# endif
+ wave = flite_text_to_wave(x->textbuf,voice);
+
+ if (!wave) {
+ error("flite: synthesis failed for text '%s'", x->textbuf);
+ return;
+ }
+
+ // -- resample
+# ifdef FLITE_DEBUG
+ post("flite: cst_wave_resample()");
+# endif
+ cst_wave_resample(wave,sys_getsr());
+
+ // -- resize & write to our array
+# ifdef FLITE_DEBUG
+ post("flite: garray_resize(%d)", wave->num_samples);
+# endif
+
+ garray_resize(a, wave->num_samples);
+ if (!garray_getfloatarray(a, &vecsize, &vec))
+ error("flite: bad template for write to array '%s'", x->x_arrayname->s_name);
+
+# ifdef FLITE_DEBUG
+ post("flite: ->write to garray loop<-");
+# endif
+ for (i = 0; i < wave->num_samples; i++) {
+ *vec++ = wave->samples[i]/32767.0;
+ }
+
+ // -- outlet synth-done-bang
+ outlet_bang(x->x_obj.ob_outlet);
+
+ // -- cleanup
+ delete_wave(wave);
+
+ // -- redraw
+ garray_redraw(a);
+}
+
+/*--------------------------------------------------------------------
+ * flite_text : set text-buffer
+ *--------------------------------------------------------------------*/
+void flite_text(t_flite *x, t_symbol *s, int argc, t_atom *argv) {
+ int i, alen, buffered;
+ t_symbol *asym;
+
+ // -- allocate initial text-buffer if required
+ if (x->textbuf == NULL) {
+ x->bufsize = DEFAULT_BUFSIZE;
+ x->textbuf = getbytes(x->bufsize);
+ }
+ if (x->textbuf == NULL) {
+ error("flite: allocation failed for text buffer");
+ x->bufsize = 0;
+ return;
+ }
+
+ // -- convert args to strings
+ buffered = 0;
+ for (i = 0; i < argc; i++) {
+ asym = atom_gensym(argv);
+ alen = 1+strlen(asym->s_name);
+
+ // -- reallocate if necessary
+ while (buffered + alen > x->bufsize) {
+ x->textbuf = resizebytes(x->textbuf,x->bufsize,x->bufsize+DEFAULT_BUFSTEP);
+ x->bufsize = x->bufsize+DEFAULT_BUFSTEP;
+ if (x->textbuf == NULL) {
+ error("flite: allocation failed for text buffer");
+ x->bufsize = 0;
+ return;
+ }
+ }
+
+ // -- append arg-string to text-buf
+ if (i == 0) {
+ strcpy(x->textbuf+buffered, asym->s_name);
+ buffered += alen-1;
+ } else {
+ *(x->textbuf+buffered) = ' ';
+ strcpy(x->textbuf+buffered+1, asym->s_name);
+ buffered += alen;
+ }
+
+ // -- increment/decrement
+ argv++;
+ }
+
+#ifdef FLITE_DEBUG
+ post("flite_debug: got text='%s'", x->textbuf);
+#endif
+}
+
+
+/*--------------------------------------------------------------------
+ * flite_list : parse & synthesize text in one swell foop
+ *--------------------------------------------------------------------*/
+void flite_list(t_flite *x, t_symbol *s, int argc, t_atom *argv) {
+ flite_text(x,s,argc,argv);
+ flite_synth(x);
+}
+
+
+/*--------------------------------------------------------------------
+ * flite_set : set arrayname
+ *--------------------------------------------------------------------*/
+static void flite_set(t_flite *x, t_symbol *ary) {
+#ifdef FLITE_DEBUG
+ post("flite_set: called with arg='%s'", ary->s_name);
+#endif
+ x->x_arrayname = ary;
+}
+
+
+/*--------------------------------------------------------------------
+ * constructor / destructor
+ *--------------------------------------------------------------------*/
+static void *flite_new(t_symbol *ary)
+{
+ t_flite *x;
+
+ x = (t_flite *)pd_new(flite_class);
+
+ // set initial arrayname
+ x->x_arrayname = ary;
+
+ // init textbuf
+ x->textbuf = NULL;
+ x->bufsize = 0;
+
+ // create bang-on-done outlet
+ outlet_new(&x->x_obj, &s_bang);
+
+ return (void *)x;
+}
+
+static void flite_free(t_flite *x) {
+ if (x->bufsize && x->textbuf != NULL) {
+ freebytes(x->textbuf, x->bufsize);
+ x->bufsize = 0;
+ }
+}
+
+/*--------------------------------------------------------------------
+ * setup
+ *--------------------------------------------------------------------*/
+void flite_setup(void) {
+ post("");
+ post(flite_description, PACKAGE_VERSION);
+ post("");
+
+ // --- setup synth
+ flite_init();
+ voice = PDFLITE_REGISTER_VOICE();
+
+ // --- register class
+ flite_class = class_new(gensym("flite"),
+ (t_newmethod)flite_new, // newmethod
+ (t_method)flite_free, // freemethod
+ sizeof(t_flite), // size
+ CLASS_DEFAULT, // flags
+ A_DEFSYM, // arg1: table-name
+ 0);
+
+ // --- class methods
+ class_addlist(flite_class, flite_list);
+ class_addmethod(flite_class, (t_method)flite_set, gensym("set"), A_DEFSYM, 0);
+ class_addmethod(flite_class, (t_method)flite_text, gensym("text"), A_GIMME, 0);
+ class_addmethod(flite_class, (t_method)flite_synth, gensym("synth"), 0);
+
+ // --- help patch
+ class_sethelpsymbol(flite_class, gensym("flite-help.pd"));
+}