recite.1.0/README 644 0 0 5617 5432053507 12675ustar PeterMiller 0 0 readme(recite) readme(recite) NNAAMMEE recite - english text speech synthesizer DDEESSCCRRIIPPTTIIOONN The recite program is a combination of programs I picked up off the net to do speech synthesis. I glued them together to get something approximating what I was after. All I wanted was for the workstation to be able to report some errors verbally. The idea was that I could react rapidly to system faults in our distributed computing environment. The first of the programs was Package: SPEAK Author: John A. Wasser Dated: 4/15/85 Copyright: none, public domain Email: WASSER%VIKING@decwrl.dec.com Archie Pattern: speak.tar.Z The english-to-phonemes portion was extracted, and a few names were changed and prototypes added. The speach part was not used, because it stored phonemes in files and simple butted them together, giving an unaesthetic result. The second package used was Author: Klatt which only provided phonemes-to-sound. The difference was, this one generated the wave forms algorithmically. BBUUIILLDDIINNGG RREECCIITTEE Full instruction for building the _r_e_c_i_t_e program may be found in the _B_U_I_L_D_I_N_G file included in this distribution. CCOOPPYYRRIIGGHHTT The _r_e_c_i_t_e program is Copyright (c) 1993 Peter Miller. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, 1 readme(recite) readme(recite) MA 02139, USA. It should be in the file called _L_I_C_E_N_S_E included in this distribution. AAUUTTHHOORR Peter Miller UUCP uunet!munnari!bmr.gov.au!pmiller /\/\* CSNET pmiller@bmr.gov.au 2 recite.1.0/BUILDING 644 0 0 12550 5432053507 13147ustar PeterMiller 0 0 building(recite) building(recite) NNAAMMEE recite - english text speech synthesizer SSIITTEE CCOONNFFIIGGUURRAATTIIOONN A file which may require editing is the _M_a_k_e_f_i_l_e file. The first few lines contain comments describing what may require changing. In general these changes will relate to the name of your favorite C compiler, and where it keeps its include files. KKNNOOWWNN SSYYSSTTEEMMSS This distribution of _r_e_c_i_t_e is known to build on the following systems: SunOS 4.1 The native _c_c(1) and also _g_c_c(1) are known to work. Please let the author know of any other systems you get _r_e_c_i_t_e working on, and the modifications necessary. The _r_e_c_i_t_e program was developed using gcc, however this is not the default in the _M_a_k_e_f_i_l_e file. The _r_e_c_i_t_e program source attempts to use ANSI C features without compromising the ability to be compilted on older C compilers. Functions mandated by the ANSI C standard are used, because many systems provided them, one way or another. Please let the author know of any others you think should be added to the _c_o_m_m_o_n_/_a_n_s_i_._c file. You may need to use some ANSI C header files which the _r_e_c_i_t_e code uses, but which some systems (as yet) fail to provide. You will find lines at the top of the _M_a_k_e_f_i_l_e file similar to H = -I/usr/include -Ih Change this to suit your system and your compiler. The "h" directory must be searched last as it is intended to suplement your system, not replace it. You will need to check the include files in the "h" directory to see that they are suitable for your system. You may want to delete any that your system already has. BBUUIILLDDIINNGG RREECCIITTEE All you should need to do is use the % mmaakkee _._._._l_o_t_s _o_f _o_u_t_p_u_t_._._. % command and wait. When this finishes you should see a directory called _b_i_n containing the file: _r_e_c_i_t_e. 1 building(recite) building(recite) TTEESSTTIINNGG The _r_e_c_i_t_e program comes with a test suite. To run this test suite, use the command % mmaakkee ssuurree _._._._l_o_t_s _o_f _o_u_t_p_u_t_._._. Passed All Tests % The tests take a few seconds each, with a few very fast, and a couple very slow, but it varies greatly depending on your CPU. If all went well, the message Passed All Tests should appear at the end of the make. IINNSSTTAALLLLIINNGG RREECCIITTEE Put the _r_e_c_i_t_e program somewhere where users will automatically pick it up, such as in the _/_u_s_r_/_l_o_c_a_l_/_b_i_n directory. Use the command # ccpp bbiinn//** //uussrr//llooccaall//bbiinn # The manuals can be installed using the commands # ccpp mmaann11//** //uussrr//mmaann//mmaann11 # These paths are only example, where to install things tends to be very system specific, and I won't even try to guess. GGEETTTTIINNGG HHEELLPP If you need assistance with the _r_e_c_i_t_e program, please do not hesitate to contact the author at Peter Miller Any and all feedback is welcome. When reporting problems, please include the version number given by the % recite -version % command. In the _c_o_m_m_o_n_/_m_a_i_n_._h file, the is a define of _D_E_B_U_G in comments. If the comments are removed, extensive debugging is turned on. This causes some performance loss, but performs much run-time checking and adds the --TTRRaaccee command line option. When followed by one or more file names, this turns on execution traces in those files. 2 building(recite) building(recite) CCOOPPYYRRIIGGHHTT The _r_e_c_i_t_e program is Copyright (c) 1993 Peter Miller. All rights reserved. The _r_e_c_i_t_e package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. AAUUTTHHOORR Peter Miller UUCP uunet!munnari!bmr.gov.au!pmiller /\/\* CSNET pmiller@bmr.gov.au 3 dded to the _c_o_m_m_o_n_/_a_n_s_i_._c file. You may need to use some ANSI C header files which the _r_e_c_i_t_e codrecite.1.0/CHANGES 644 0 0 32432 5432053507 13023ustar PeterMiller 0 0 Project "recite.1.0" Page 1 List of Changes Wed Aug 11 12:17:40 1993 Change State Description ------- ------- ------------- 1 completed grab the speak program as a start 2 completed add klatt phoneme processing 3 completed add frames to sound processing 4 completed add a few more english rules 5 completed fix fricative problem 6 completed fix makefile for distribution 7 being_ fix copyright notices integrated Project "recite.1.0", Change 1 Page 1 Change Details Wed Aug 11 12:17:43 1993 NAME Project "recite.1.0", Delta 1, Change 1. SUMMARY grab the speak program as a start DESCRIPTION Take the english to text part of the speak program done by John A. Wasser This change is exempt from testing against the baseline. CAUSE This change was caused by internal_enhancement. FILES Type Action Edit File Name ------- ------- ------- ----------- source create 1 LICENSE source create 1 audio/audio.c source create 1 audio/audio.h source create 1 aux/BUILDING.man source create 1 aux/CHANGES.sh source create 1 aux/Howto.cook source create 1 aux/MANIFEST.sh source create 1 aux/Makefile.awk source create 1 aux/Makefile.sh source create 1 aux/README.man source create 1 aux/patches.sh source create 1 common/ansi.c source create 1 common/arglex.c source create 1 common/arglex.h source create 1 common/error.c source create 1 common/error.h source create 1 common/help.c source create 1 common/help.h source create 1 common/main.h source create 1 common/mem.c source create 1 common/mem.h source create 1 common/s-v-arg.h source create 1 common/trace.c source create 1 common/trace.h source create 1 common/version.c source create 1 common/version.h source create 1 config source create 1 english/english.c source create 1 english/english.h source create 1 english/phoneme.c source create 1 english/phoneme.h source create 1 english/rules.c source create 1 english/saynum.c source create 1 english/saynum.h source create 1 english/spellword.c source create 1 english/spellword.h source create 1 klatt/klatt.c source create 1 klatt/klatt.h source create 1 man1/recite.1 Project "recite.1.0", Change 1 Page 2 Change Details Wed Aug 11 12:17:43 1993 Type Action Edit File Name ------- ------- ------- ----------- source create 1 phonemes/phonemes.c source create 1 phonemes/phonemes.h source create 1 recite/file.c source create 1 recite/file.h source create 1 recite/main.c test create 1 test/00/t0001a.sh HISTORY What When Who Comment ------ ------ ----- --------- new_change Wed Feb 3 pmiller 12:13:27 1993 develop_begin Wed Feb 3 pmiller Elapsed time: 0.000 12:13:51 1993 days. develop_end Wed Feb 3 pmiller 23:12:41 1993 review_pass Wed Feb 3 pmiller 23:14:19 1993 integrate_begin Wed Feb 3 pmiller 23:14:34 1993 integrate_pass Wed Feb 3 pmiller 23:17:27 1993 Project "recite.1.0", Change 2 Page 1 Change Details Wed Aug 11 12:17:44 1993 NAME Project "recite.1.0", Delta 2, Change 2. SUMMARY add klatt phoneme processing DESCRIPTION add klatt phoneme processing CAUSE This change was caused by internal_enhancement. FILES Type Action Edit File Name ------- ------- ------- ----------- source modify 2 common/ansi.c source modify 2 common/trace.c source modify 2 common/trace.h source create 1 phonemes/features.c source create 1 phonemes/features.h source create 1 phonemes/fricatives.c source create 1 phonemes/fricatives.h source create 1 phonemes/output.c source create 1 phonemes/output.h source modify 2 phonemes/phonemes.c source modify 2 phonemes/phonemes.h source create 1 phonemes/plosives.c source create 1 phonemes/plosives.h source create 1 phonemes/rules.c source create 1 phonemes/rules.h source create 1 phonemes/sonorants.c source create 1 phonemes/sonorants.h source create 1 phonemes/var.c source create 1 phonemes/var.h source create 1 phonemes/vowel.c source create 1 phonemes/vowel.h source modify 2 recite/main.c test create 1 test/00/t0002a.sh HISTORY What When Who Comment ------ ------ ----- --------- new_change Wed Feb 3 pmiller 23:19:18 1993 develop_begin Wed Feb 3 pmiller Elapsed time: 1.713 23:19:23 1993 days. develop_end Mon Feb 8 pmiller 13:40:16 1993 review_pass Mon Feb 8 pmiller 13:41:18 1993 integrate_begin Mon Feb 8 pmiller 13:41:37 1993 integrate_pass Mon Feb 8 pmiller 13:44:40 1993 Project "recite.1.0", Change 3 Page 1 Change Details Wed Aug 11 12:17:45 1993 NAME Project "recite.1.0", Delta 5, Change 3. SUMMARY add frames to sound processing DESCRIPTION add frames to sound processing CAUSE This change was caused by internal_enhancement. FILES Type Action Edit File Name ------- ------- ------- ----------- source modify 2 audio/audio.c source modify 2 aux/Howto.cook source create 1 common/frame.c source create 1 common/frame.h source modify 2 english/english.c source modify 2 english/phoneme.c source modify 2 english/rules.c source modify 2 english/saynum.c source modify 2 klatt/klatt.c source modify 2 klatt/klatt.h source create 1 klatt/parwave.c source create 1 klatt/parwave.h source create 1 klatt/r250.c source create 1 klatt/r250.h source modify 2 phonemes/features.h source modify 2 phonemes/fricatives.c source remove 1 phonemes/output.c source remove 1 phonemes/output.h source modify 3 phonemes/phonemes.c source modify 3 phonemes/phonemes.h source modify 2 phonemes/plosives.c source modify 2 phonemes/sonorants.c source modify 2 phonemes/vowel.c source modify 2 recite/file.c source modify 3 recite/main.c test modify 2 test/00/t0001a.sh test modify 2 test/00/t0002a.sh test create 1 test/00/t0003a.sh HISTORY What When Who Comment ------ ------ ----- --------- new_change Mon Feb 8 pmiller 13:46:37 1993 develop_begin Mon Feb 8 pmiller Elapsed time: 2.217 13:46:43 1993 days. develop_end Wed Feb 10 pmiller 15:24:27 1993 review_pass Wed Feb 10 pmiller 15:24:32 1993 integrate_begin Wed Feb 10 pmiller 15:25:04 1993 Project "recite.1.0", Change 3 Page 2 Change Details Wed Aug 11 12:17:45 1993 What When Who Comment ------ ------ ----- --------- integrate_fail Wed Feb 10 pmiller references to output.h 15:28:28 1993 still remain develop_end Wed Feb 10 pmiller Elapsed time: 0.188 15:32:13 1993 days. review_pass Wed Feb 10 pmiller 16:56:44 1993 integrate_begin Wed Feb 10 pmiller Elapsed time: 0.000 16:57:03 1993 days. integrate_fail Thu Feb 11 pmiller hangs strangely 09:25:26 1993 Elapsed time: 1.953 days. develop_end Fri Feb 12 pmiller 16:34:25 1993 review_pass Fri Feb 12 pmiller 16:34:34 1993 integrate_begin Fri Feb 12 pmiller Elapsed time: 0.068 16:34:48 1993 days. integrate_pass Fri Feb 12 pmiller 17:05:25 1993 Project "recite.1.0", Change 4 Page 1 Change Details Wed Aug 11 12:17:46 1993 NAME Project "recite.1.0", Delta 6, Change 4. SUMMARY add a few more english rules DESCRIPTION add a few more english rules This change is exempt from testing against the baseline. CAUSE This change was caused by internal_enhancement. FILES Type Action Edit File Name ------- ------- ------- ----------- source modify 2 config source modify 3 english/english.c source modify 3 english/phoneme.c source modify 3 english/rules.c source create 1 english/rules.h source modify 4 phonemes/phonemes.c source modify 2 phonemes/rules.c source modify 2 phonemes/rules.h test modify 3 test/00/t0001a.sh test modify 3 test/00/t0002a.sh HISTORY What When Who Comment ------ ------ ----- --------- new_change Fri Feb 12 pmiller 22:12:27 1993 develop_begin Fri Feb 12 pmiller Elapsed time: 43.678 22:12:32 1993 days. develop_end Fri Apr 16 pmiller 11:17:48 1993 review_pass Fri Apr 16 pmiller 11:19:01 1993 integrate_begin Fri Apr 16 pmiller 11:19:20 1993 integrate_pass Fri Apr 16 pmiller 11:24:17 1993 Project "recite.1.0", Change 5 Page 1 Change Details Wed Aug 11 12:17:47 1993 NAME Project "recite.1.0", Delta 7, Change 5. SUMMARY fix fricative problem DESCRIPTION fix fricative problem This change is exempt from testing against the development directory. This change is exempt from testing against the baseline. CAUSE This change was caused by internal_bug. FILES Type Action Edit File Name ------- ------- ------- ----------- source modify 2 aux/Makefile.sh source modify 4 english/rules.c source modify 3 klatt/klatt.c source modify 2 klatt/parwave.c source modify 3 phonemes/plosives.c HISTORY What When Who Comment ------ ------ ----- --------- new_change Fri Apr 16 pmiller 11:36:48 1993 develop_begin Fri Apr 16 pmiller Elapsed time: 82.707 11:36:52 1993 days. develop_end Wed Aug 11 pmiller 09:25:13 1993 review_pass Wed Aug 11 pmiller 09:25:30 1993 integrate_begin Wed Aug 11 pmiller Elapsed time: 0.023 09:25:57 1993 days. integrate_pass Wed Aug 11 pmiller 09:36:22 1993 Project "recite.1.0", Change 6 Page 1 Change Details Wed Aug 11 12:17:49 1993 NAME Project "recite.1.0", Delta 10, Change 6. SUMMARY fix makefile for distribution DESCRIPTION fix makefile for distribution This change is exempt from testing against the development directory. This change is exempt from testing against the baseline. CAUSE This change was caused by internal_bug. FILES Type Action Edit File Name ------- ------- ------- ----------- source modify 3 aux/Howto.cook source modify 3 aux/Makefile.sh source modify 3 common/trace.c source modify 3 config source modify 2 klatt/r250.c HISTORY What When Who Comment ------ ------ ----- --------- new_change Wed Aug 11 pmiller 09:37:43 1993 develop_begin Wed Aug 11 pmiller Elapsed time: 0.083 09:37:48 1993 days. develop_end Wed Aug 11 pmiller Elapsed time: 0.028 10:14:59 1993 days. develop_end_ Wed Aug 11 pmiller undo 10:27:39 1993 develop_end Wed Aug 11 pmiller 10:30:49 1993 review_pass Wed Aug 11 pmiller 10:31:03 1993 integrate_begin Wed Aug 11 pmiller Elapsed time: 0.024 10:31:36 1993 days. integrate_fail Wed Aug 11 pmiller problems with common/ 10:42:20 1993 trace.c when doing test-build with the generated makefile Elapsed time: 0.027 days. develop_end Wed Aug 11 pmiller 10:54:25 1993 review_pass Wed Aug 11 pmiller 10:54:32 1993 integrate_begin Wed Aug 11 pmiller 10:54:57 1993 integrate_fail Wed Aug 11 pmiller nitialization in r250 11:04:38 1993 is wrong Elapsed time: 0.028 Project "recite.1.0", Change 6 Page 2 Change Details Wed Aug 11 12:17:49 1993 What When Who Comment ------ ------ ----- --------- days. develop_end Wed Aug 11 pmiller 11:17:12 1993 review_pass Wed Aug 11 pmiller 11:19:27 1993 integrate_begin Wed Aug 11 pmiller 11:19:53 1993 integrate_pass Wed Aug 11 pmiller 11:29:05 1993 Project "recite.1.0", Change 7 Page 1 Change Details Wed Aug 11 12:17:50 1993 NAME Project "recite.1.0", Delta 11, Change 7. SUMMARY fix copyright notices DESCRIPTION fix copyright notices This change must pass a full regression test. This change is exempt from testing against the baseline. CAUSE This change was caused by internal_improvement. STATE This change is in 'being_integrated' state. FILES Type Action Edit File Name ------- ------- ------- ----------- source modify 2 audio/audio.c source modify 1 audio/audio.h source modify 1 aux/BUILDING.man source modify 1 aux/CHANGES.sh source modify 1 aux/MANIFEST.sh source modify 1 aux/Makefile.awk source modify 1 aux/README.man source modify 1 aux/patches.sh source modify 1 common/arglex.c source modify 1 common/arglex.h source modify 1 common/error.c source modify 1 common/error.h source modify 1 common/frame.c source modify 1 common/frame.h source modify 1 common/help.c source modify 1 common/help.h source modify 1 common/main.h source modify 1 common/mem.c source modify 1 common/mem.h source modify 1 common/s-v-arg.h source modify 2 common/trace.h source modify 1 common/version.c source modify 1 common/version.h source modify 1 english/english.h source modify 1 english/phoneme.h source modify 1 english/rules.h source modify 1 english/saynum.h source modify 1 english/spellword.h source modify 3 klatt/klatt.c source modify 2 klatt/klatt.h source modify 1 klatt/parwave.h source modify 1 klatt/r250.h source modify 1 man1/recite.1 source modify 2 phonemes/features.h source modify 1 phonemes/fricatives.h source modify 3 phonemes/phonemes.h Project "recite.1.0", Change 7 Page 2 Change Details Wed Aug 11 12:17:50 1993 Type Action Edit File Name ------- ------- ------- ----------- source modify 1 phonemes/plosives.h source modify 1 phonemes/sonorants.h source modify 1 phonemes/var.c source modify 1 phonemes/var.h source modify 1 phonemes/vowel.h source modify 2 recite/file.c source modify 1 recite/file.h source modify 3 recite/main.c test modify 1 test/00/t0003a.sh HISTORY What When Who Comment ------ ------ ----- --------- new_change Wed Aug 11 pmiller 11:33:05 1993 develop_begin Wed Aug 11 pmiller Elapsed time: 0.086 11:33:08 1993 days. develop_end Wed Aug 11 pmiller 12:12:02 1993 review_pass Wed Aug 11 pmiller 12:12:11 1993 integrate_begin Wed Aug 11 pmiller 12:12:51 1993 nst the baseline. CAUSE This change was caused by internal_bug. FILES Type Action Edit File Name ------- ------- ------- ----------- source modify 3 aux/Howto.cook source modify 3 aux/Makefile.sh source modify 3 common/trrecite.1.0/LICENSE 644 0 0 30310 5432053507 13026ustar PeterMiller 0 0 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our 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. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, 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 a 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 tell them 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. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement 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 work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 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 General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual 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 General Public License. d) 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. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 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 Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying 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. 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. 7. 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 the 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 the license, you may choose any version ever published by the Free Software Foundation. 8. 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 9. 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. 10. 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 Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! oundation, 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 9. BECAUSE THE PROGRAMrecite.1.0/MANIFEST 644 0 0 7274 5432053507 13147ustar PeterMiller 0 0 README Blurb about cook BUILDING Instructions how to build, test and install cook CHANGES Change history of this release of cook LICENSE MANIFEST This file Makefile Instructions to make(1) how to build and test cook audio/audio.c functions to use workstation's speaker audio/audio.h interface definition for audio/audio.c aux/BUILDING.man source of the BUILDING file aux/CHANGES.sh shell script to generate CHANGES file aux/Howto.cook instructions to cook(1), how to build project aux/MANIFEST.sh shell script to generate the MANIFEST file aux/Makefile.awk helper file for generating Makefile file aux/Makefile.sh shell script to generate Makefile file aux/README.man source of the README file aux/patches.sh shell script to generate the patch file common/ansi.c common/arglex.c functions to perform lexical analysis on command line arguments common/arglex.h interface definition for arglex.c common/error.c functions to report errors common/error.h interface definition for error.c common/frame.c functions to manipulate parameter frames common/frame.h interface definition for common/frame.c common/help.c functions to provide consistent -Help behaviour common/help.h interface definition for comon/help.c common/main.h common defined, including DEBUG define common/mem.c functions to manipulate dynamic memory common/mem.h interface definition for common/mem.c common/patchlevel.h The patch level of this distribution. common/s-v-arg.h insulation from varargs.h versus stdarg.h incompatibilities common/trace.c common/trace.h interface definition for common/trace.c common/version.c functions to report version common/version.h interface definition for common/version.c config instructions to aegis, per-project configuration english/english.c functions to translate english to phonemes english/english.h interface definition for english/english.c english/phoneme.c functions to scan translation table english/phoneme.h interface definition for english/phoneme.c english/rules.c tables to map english to phonemes english/rules.h interface definition for english/rules.c english/saynum.c english/saynum.h interface definition for english/saynum.c english/spellword.c english/spellword.h interface definition for SPELLWORD.c klatt/klatt.c functions to mainipluate klatt data klatt/klatt.h interface definition for klatt/klatt.c klatt/parwave.c functions to translate frames into waveforms klatt/parwave.h interface definition for klatt/parwave.c klatt/r250.c functions to implement a 32bit parallel period 2^250 PBRS klatt/r250.h interface definition for klatt/r250.c man1/recite.1 manual page describing recite command phonemes/features.c phonemes/features.h interface definition for phonemes/features.c phonemes/fricatives.c phonemes/fricatives.h interface definition for phonemes/fricatives.c phonemes/phonemes.c functions to conver phonmes to klatt phonemes/phonemes.h interface definition for phonemes/phonemes.c phonemes/plosives.c phonemes/plosives.h interface definition for phonemes/plosives.c phonemes/rules.c functions to translate phonemes to frames phonemes/rules.h interface definition for phonemes/rules.c phonemes/sonorants.c phonemes/sonorants.h interface definition for phonemes/sonorants.c phonemes/var.c variable instances phonemes/var.h interface definition for phonemes/var.c phonemes/vowel.c phonemes/vowel.h interface definition for phonemes/vowel.c recite/file.c functions to access binary files recite/file.h interface definition for recite/file.c recite/main.c interface definition for recite/file.c test/00/t0001a.sh Test the english_to_phonemes functionality test/00/t0002a.sh Test the phonemes to frames translation test/00/t0003a.sh Test the klatt to sound translations file aux/patches.sh shell script to generate the patch file common/ansi.c common/arglex.c functions to perform lexical analysis on command line arguments common/arglex.h interface definition for arglex.c common/error.c functions to report errors common/error.h interface definition for error.c common/frame.c functiorecite.1.0/Makefile 644 0 0 16102 5432053507 13464ustar PeterMiller 0 0# # extra includes required for your system # # H = H = -I/usr/demo/SOUND # # the name of the compiler to use # CC = cc # CC = gcc # # The compiler flags to use, except for include path. # CFLAGS = -O # CFLAGS = -g # CFLAGS = -O -Wall -ansi # gcc # # extra libraries required for your system # # LIBRARIES = LIBRARIES = -L/usr/demo/SOUND -laudio # You should not need to alter anything below this point. #------------------------------------------------------------ all: bin/recite audio/audio.o: audio/audio.c audio/audio.h common/main.h common/error.h \ common/mem.h $(CC) $(CFLAGS) -Iaudio -Icommon $(H) -c audio/audio.c mv audio.o audio common/ansi.o: common/ansi.c common/main.h $(CC) $(CFLAGS) -Icommon -Icommon $(H) -c common/ansi.c mv ansi.o common common/arglex.o: common/arglex.c common/main.h common/arglex.h \ common/error.h common/mem.h $(CC) $(CFLAGS) -Icommon -Icommon $(H) -c common/arglex.c mv arglex.o common common/error.o: common/error.c common/s-v-arg.h common/main.h \ common/error.h common/arglex.h $(CC) $(CFLAGS) -Icommon -Icommon $(H) -c common/error.c mv error.o common common/frame.o: common/frame.c common/error.h common/main.h \ common/frame.h common/mem.h $(CC) $(CFLAGS) -Icommon -Icommon $(H) -c common/frame.c mv frame.o common common/help.o: common/help.c common/arglex.h common/main.h \ common/error.h common/help.h common/patchlevel.h $(CC) $(CFLAGS) -Icommon -Icommon $(H) -c common/help.c mv help.o common common/mem.o: common/mem.c common/mem.h common/main.h common/error.h $(CC) $(CFLAGS) -Icommon -Icommon $(H) -c common/mem.c mv mem.o common common/trace.o: common/trace.c common/s-v-arg.h common/error.h \ common/main.h common/mem.h common/arglex.h \ common/trace.h $(CC) $(CFLAGS) -Icommon -Icommon $(H) -c common/trace.c mv trace.o common common/version.o: common/version.c common/arglex.h common/main.h \ common/error.h common/help.h common/version.h \ common/mem.h $(CC) $(CFLAGS) -Icommon -Icommon $(H) -c common/version.c mv version.o common english/english.o: english/english.c english/english.h common/main.h \ common/mem.h english/phoneme.h english/spellword.h \ english/saynum.h common/trace.h $(CC) $(CFLAGS) -Ienglish -Icommon $(H) -c english/english.c mv english.o english english/phoneme.o: english/phoneme.c english/english.h common/main.h \ english/phoneme.h english/rules.h common/trace.h $(CC) $(CFLAGS) -Ienglish -Icommon $(H) -c english/phoneme.c mv phoneme.o english english/rules.o: english/rules.c english/rules.h common/main.h $(CC) $(CFLAGS) -Ienglish -Icommon $(H) -c english/rules.c mv rules.o english english/saynum.o: english/saynum.c english/phoneme.h common/main.h \ english/saynum.h $(CC) $(CFLAGS) -Ienglish -Icommon $(H) -c english/saynum.c mv saynum.o english english/spellword.o: english/spellword.c english/spellword.h \ common/main.h english/english.h $(CC) $(CFLAGS) -Ienglish -Icommon $(H) -c english/spellword.c mv spellword.o english klatt/klatt.o: klatt/klatt.c common/frame.h common/main.h klatt/klatt.h \ common/mem.h klatt/parwave.h common/trace.h $(CC) $(CFLAGS) -Iklatt -Icommon $(H) -c klatt/klatt.c mv klatt.o klatt klatt/parwave.o: klatt/parwave.c common/error.h common/main.h \ klatt/parwave.h klatt/r250.h common/trace.h $(CC) $(CFLAGS) -Iklatt -Icommon $(H) -c klatt/parwave.c mv parwave.o klatt klatt/r250.o: klatt/r250.c klatt/r250.h common/main.h $(CC) $(CFLAGS) -Iklatt -Icommon $(H) -c klatt/r250.c mv r250.o klatt phonemes/features.o: phonemes/features.c phonemes/features.h \ common/frame.h common/main.h $(CC) $(CFLAGS) -Iphonemes -Icommon $(H) -c phonemes/features.c mv features.o phonemes phonemes/fricatives.o: phonemes/fricatives.c phonemes/features.h \ common/frame.h common/main.h phonemes/fricatives.h \ phonemes/rules.h common/trace.h phonemes/var.h $(CC) $(CFLAGS) -Iphonemes -Icommon $(H) -c phonemes/fricatives.c mv fricatives.o phonemes phonemes/phonemes.o: phonemes/phonemes.c common/error.h common/main.h \ phonemes/features.h common/frame.h \ phonemes/fricatives.h common/mem.h phonemes/phonemes.h \ phonemes/plosives.h phonemes/rules.h \ phonemes/sonorants.h common/trace.h phonemes/var.h \ phonemes/vowel.h $(CC) $(CFLAGS) -Iphonemes -Icommon $(H) -c phonemes/phonemes.c mv phonemes.o phonemes phonemes/plosives.o: phonemes/plosives.c phonemes/features.h \ common/frame.h common/main.h phonemes/plosives.h \ phonemes/rules.h common/trace.h phonemes/var.h $(CC) $(CFLAGS) -Iphonemes -Icommon $(H) -c phonemes/plosives.c mv plosives.o phonemes phonemes/rules.o: phonemes/rules.c phonemes/features.h common/frame.h \ common/main.h phonemes/rules.h common/trace.h $(CC) $(CFLAGS) -Iphonemes -Icommon $(H) -c phonemes/rules.c mv rules.o phonemes phonemes/sonorants.o: phonemes/sonorants.c phonemes/features.h \ common/frame.h common/main.h phonemes/rules.h \ phonemes/sonorants.h common/trace.h phonemes/var.h $(CC) $(CFLAGS) -Iphonemes -Icommon $(H) -c phonemes/sonorants.c mv sonorants.o phonemes phonemes/var.o: phonemes/var.c phonemes/var.h phonemes/features.h \ common/frame.h common/main.h $(CC) $(CFLAGS) -Iphonemes -Icommon $(H) -c phonemes/var.c mv var.o phonemes phonemes/vowel.o: phonemes/vowel.c phonemes/features.h common/frame.h \ common/main.h phonemes/rules.h common/trace.h \ phonemes/var.h phonemes/vowel.h $(CC) $(CFLAGS) -Iphonemes -Icommon $(H) -c phonemes/vowel.c mv vowel.o phonemes recite/file.o: recite/file.c recite/file.h common/main.h common/error.h \ common/mem.h $(CC) $(CFLAGS) -Irecite -Icommon $(H) -c recite/file.c mv file.o recite recite/main.o: recite/main.c common/arglex.h common/main.h \ common/error.h recite/file.h common/frame.h \ common/help.h common/mem.h common/trace.h \ common/version.h $(CC) $(CFLAGS) -Irecite -Icommon $(H) -c recite/main.c mv main.o recite t0001a: all test/00/t0001a.sh sh test/00/t0001a.sh t0002a: all test/00/t0002a.sh sh test/00/t0002a.sh t0003a: all test/00/t0003a.sh sh test/00/t0003a.sh ReciteObj = audio/audio.o common/ansi.o common/arglex.o common/error.o \ common/frame.o common/help.o common/mem.o \ common/trace.o common/version.o english/english.o \ english/phoneme.o english/rules.o english/saynum.o \ english/spellword.o klatt/klatt.o klatt/parwave.o \ klatt/r250.o phonemes/features.o phonemes/fricatives.o \ phonemes/phonemes.o phonemes/plosives.o \ phonemes/rules.o phonemes/sonorants.o phonemes/var.o \ phonemes/vowel.o recite/file.o recite/main.o bin/recite: $(ReciteObj) -mkdir bin $(CC) -o bin/recite $(ReciteObj) $(LIBRARIES) -lm sure: t0001a t0002a t0003a @echo Passed All Tests clean: rm -f core audio/audio.o common/ansi.o common/arglex.o \ common/error.o common/frame.o common/help.o \ common/mem.o common/trace.o common/version.o \ english/english.o english/phoneme.o english/rules.o \ english/saynum.o english/spellword.o klatt/klatt.o \ klatt/parwave.o klatt/r250.o phonemes/features.o \ phonemes/fricatives.o phonemes/phonemes.o \ phonemes/plosives.o phonemes/rules.o \ phonemes/sonorants.o phonemes/var.o phonemes/vowel.o \ recite/file.o recite/main.o clobber: clean rm -f bin/recite CFLAGS) -Iklatt -Icommon $(H) -c klatt/klatt.c mv klatt.o klatt klatt/parwave.o: klatt/parwave.c common/error.h common/main.h \ klatt/parwave.h klatt/r250.h common/trace.h $(CC) $(CFLAGS) -Iklatt -Icommon $(H) -c klatt/parwave.c mv parwave.o klatt klatt/r250.o: klatt/r250.c klatt/r250.h common/main.h $(CC) $(CFLAGS) -Iklatt -Icommon $(H) -c klatt/r250.c mv r250.o klatt phonemes/features.o: phonemes/features.c phonemes/features.h \ recite.1.0/audio/audio.c 644 0 0 13032 5432053507 14371ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: functions to use workstation's speaker * * Portions of this file are derived from a program * by H.F. Silverman (Jan-91) and A. Smith (Feb-91), * no copyright notice present. */ #include #include #include #include #include #include #include #include #include #include static double volume; void ulaw_volume(n) double n; { volume = n; } static char *audio_strerror _((int)); static char * audio_strerror(n) int n; { switch (n) { case AUDIO_SUCCESS: return "operation sucessful"; case AUDIO_UNIXERROR: return strerror(errno); case AUDIO_ERR_BADHDR: return "bad audio header structure"; case AUDIO_ERR_BADFILEHDR: return "bad file header format"; case AUDIO_ERR_BADARG: return "bad function argument"; case AUDIO_ERR_NOEFFECT: return "device control ignored"; case AUDIO_ERR_ENCODING: return "unknown encoding format"; case AUDIO_ERR_INTERRUPTED: return "operation was interrupted"; default: return "unknown audio error"; } } void ulaw_read(filename, data_p, datalen_p) char *filename; char **data_p; long *datalen_p; { int fd; char *data; size_t data_max; size_t datalen; Audio_hdr h; int err; /* * open the file */ if (filename) { fd = open(filename, O_RDONLY, 0666); if (fd < 0) nfatal("open \"%s\"", filename); } else { fd = 0; filename = "(standard input)"; } /* * make sure it is an audio file */ err = audio_read_filehdr(fd, &h, (char *)0, 0); if (err) fatal("audio read filehdr \"%s\": %s", filename, audio_strerror(err)); /* * make sure we like the encoding */ if ( h.sample_rate != 8000 || h.samples_per_unit != 1 || h.bytes_per_unit != 1 || h.channels != 1 || h.encoding != AUDIO_ENCODING_ULAW ) { char buf[AUDIO_MAX_ENCODE_INFO]; err = audio_enc_to_str(&h, buf); if (err) strcpy(buf, "in an unknown format"); fatal ( "the \"%s\" file is %s, which is not handled", filename, buf ); } /* * read the data */ data_max = (1L << 18); data = mem_alloc(data_max); datalen = 0; for (;;) { long rsize; long nbytes; if (datalen >= data_max) { rsize = (1L << 18); data_max += rsize; mem_change_size(&data, data_max); } else rsize = data_max - datalen; nbytes = read(fd, data + datalen, rsize); if (nbytes < 0) nfatal("read \"%s\"", filename); if (!nbytes) break; datalen += nbytes; } if (datalen < data_max) mem_change_size(&data, datalen); *data_p = data; *datalen_p = datalen; /* * close the file */ if (close(fd)) nfatal("close \"%s\"", filename); } void ulaw_write(filename, data, datalen) char *filename; char *data; long datalen; { int fd; Audio_hdr h; int err; if (filename) { fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0666); if (fd < 0) nfatal("create \"%s\"", filename); } else { fd = 1; filename = "(standard output)"; } h.sample_rate = 8000; h.samples_per_unit = 1; h.bytes_per_unit = 1; h.channels = 1; h.encoding = AUDIO_ENCODING_ULAW; h.data_size = datalen; err = audio_write_filehdr(fd, &h, (char *)0, 0); if (err) { fatal ( "audio_write_filehdr \"%s\": %s", filename, audio_strerror(err) ); } if (write(fd, data, datalen) < 0) nfatal("write \"%s\"", filename); if (close(fd)) nfatal("close \"%s\"", filename); } void ulaw_play(jack, data, datalen) int jack; char *data; long datalen; { int err; unsigned int myport; double vol; char *Audio_dev = "/dev/audio"; int fd; /* file descriptor for audio device */ Audio_hdr Dev_hdr; /* audio header for device */ /* * Try it quickly, first */ fd = open(Audio_dev, O_WRONLY | O_NDELAY, 0666); #if 1 if (fd < 0 && errno == EBUSY) { error("waiting for %s", Audio_dev); fd = open(Audio_dev, O_WRONLY, 0666); } #endif if (fd < 0) nfatal("open \"%s\"", Audio_dev); /* * Get the device output encoding configuration */ if (audio_get_play_config(fd, &Dev_hdr) != AUDIO_SUCCESS) fatal("%s is not an audio device", Audio_dev); if (volume > 0) { vol = volume; err = audio_set_play_gain(fd, &vol); if (err != AUDIO_SUCCESS) fatal("%s: could not set output volume", Audio_dev); } /* * Set the output port */ myport = AUDIO_SPEAKER; if (jack) myport = AUDIO_HEADPHONE; err = audio_set_play_port(fd, &myport); if (err != AUDIO_SUCCESS) fatal("%s: cound not set port", Audio_dev); err = write(fd, data, datalen); if (err != datalen && datalen > 0) nfatal("write \"%s\"", Audio_dev); /* * Close audio system */ audio_drain(fd, 0); close(fd); }  Hauserlog.320.lis `euserlog.323.lis xuserlog.328.lis userlog.330.lis E labtam D geoterrex  uw-xdm.tar.Zwar READMEi i rev-edge.ps.Zng  bucky.balls ,xrs.log @xpathconfis T#realname h routers.pic | routers.ps $announcing-aegis-1-2 @  sysconf.c T   pathconf.ch  xx.c recite.1.0/audio/audio.h 644 0 0 2173 5432053507 14362ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: interface definition for audio/audio.c */ #ifndef AUDIO_H #define AUDIO_H #include void ulaw_play _((int spkr_or_jack, char *data, long datalen)); void ulaw_volume _((double)); void ulaw_read _((char *filename, char **data, long *datalen)); void ulaw_write _((char *filename, char *data, long datalen)); #endif /* AUDIO_H */ Y | O_CREAT | O_TRUNC, 0666); if (fd < 0) nfatal("create \"%s\"", filename); } else { fd = 1; filename = "(standard output)"; } h.sample_rate = 8000; h.samples_per_unit = 1; h.bytes_per_unit = 1; h.channels = 1; h.encoding = AUDIO_ENCODING_ULAW; h.data_size = datalen; err = audio_write_filehdr(fd, &h, (char *)0, 0); if (err) { fatal ( "audio_write_filehdr recite.1.0/aux/BUILDING.man 644 0 0 11271 5432053507 14515ustar PeterMiller 0 0'\" t .\" recite - english text speech synthesizer .\" Copyright (C) 1993 Peter Miller. .\" All rights reserved. .\" .\" This program is free software; you can redistribute it and/or modify .\" it under the terms of the GNU General Public License as published by .\" the Free Software Foundation; either version 1, or (at your option) .\" any later version. .\" .\" This program is distributed in the hope that it will be useful, .\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the .\" GNU General Public License for more details. .\" .\" You should have received a copy of the GNU General Public License .\" along with this program; if not, write to the Free Software .\" Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. .\" .\" MANIFEST: source of the BUILDING file .\" .TH building recite .if n .hy 0 .if n .ad l .if n .nr IN 8n .SH NAME recite \- english text speech synthesizer .SH SITE CONFIGURATION A file which may require editing is the .I Makefile file. The first few lines contain comments describing what may require changing. In general these changes will relate to the name of your favorite C compiler, and where it keeps its include files. .ne 1i .SH KNOWN SYSTEMS This distribution of .I recite is known to build on the following systems: .TP 8n SunOS 4.1 .br The native .IR cc (1) and also .IR gcc (1) are known to work. .PP Please let the author know of any other systems you get .I recite working on, and the modifications necessary. .PP The .I recite program was developed using gcc, however this is not the default in the .I Makefile file. The .I recite program source attempts to use ANSI C features without compromising the ability to be compilted on older C compilers. Functions mandated by the ANSI C standard are used, because many systems provided them, one way or another. Please let the author know of any others you think should be added to the .I common/ansi.c file. .PP You may need to use some ANSI C header files which the .I recite code uses, but which some systems (as yet) fail to provide. You will find lines at the top of the .I Makefile file similar to .RS H = -I/usr/include -Ih .RE Change this to suit your system and your compiler. The "h" directory must be searched last as it is intended to suplement your system, not replace it. .PP You will need to check the include files in the "h" directory to see that they are suitable for your system. You may want to delete any that your system already has. .br .ne 1i .SH BUILDING RECITE All you should need to do is use the .RS % \fBmake\fP .br \fI\&...lots of output...\fP .br % .RE command and wait. When this finishes you should see a directory called .I bin containing the file: .IR recite . .br .ne 1i .SH TESTING The .I recite program comes with a test suite. To run this test suite, use the command .RS .nf % \fBmake sure\fP \fI\&...lots of output...\fP Passed All Tests % .fi .RE .PP The tests take a few seconds each, with a few very fast, and a couple very slow, but it varies greatly depending on your CPU. .PP If all went well, the message .RS Passed All Tests .RE should appear at the end of the make. .br .ne 1i .SH INSTALLING RECITE Put the .I recite program somewhere where users will automatically pick it up, such as in the .I /usr/local/bin directory. Use the command .RS # \fBcp bin/* /usr/local/bin\fP .br # .RE .PP The manuals can be installed using the commands .RS # \fBcp man1/* /usr/man/man1\fP .br # .RE .PP These paths are only example, where to install things tends to be very system specific, and I won't even try to guess. .br .ne 1i .SH GETTING HELP If you need assistance with the .I recite program, please do not hesitate to contact the author at .RS Peter Miller .RE Any and all feedback is welcome. .PP When reporting problems, please include the version number given by the .RS % recite -version .br % .RE command. .PP In the .I common/main.h file, the is a define of .I DEBUG in comments. If the comments are removed, extensive debugging is turned on. This causes some performance loss, but performs much run-time checking and adds the .B -TRace command line option. When followed by one or more file names, this turns on execution traces in those files. .br .ne 2i .SH COPYRIGHT The .I recite program is Copyright .if n (c) .if t \(co 1993 Peter Miller. .br All rights reserved. .PP The .I recite package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. .br .ne 1i .SH AUTHOR .TS tab(;); l l l. Peter Miller;UUCP;uunet!munnari!bmr.gov.au!pmiller /\e/\e*;CSNET;pmiller@bmr.gov.au .TE Az Qdu.cy ,nempty @S anno.README LWdu `synpaintk tY rtidea.mann [ rtidea.ps D ] rtidea.cat U dot.twmrc _ .xinit.mlu3:0ew T$announcing-aegis-1-3 c realname.c  realname.change.recite.1.0/aux/CHANGES.sh 644 0 0 2234 5432053507 14206ustar PeterMiller 0 0#! /bin/sh # # recite - english text speech synthesizer # Copyright (C) 1992, 1993 Peter Miller. # All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 1, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # # MANIFEST: shell script to generate CHANGES file # case $# in 1) project=$1 ;; *) echo "usage: $0 " 1>&2 exit 1 ;; esac set -e aegis -l changes -p $project -v -pl 66 -pw 72 < /dev/null changes=`aegis -list changes -terse -project $project` for n in $changes do echo '' | tr '\12' '\14' aegis -l change_details -p $project -c $n -v -pl 66 -pw 72 < /dev/null done exit 0 directory called .I bin containing the file: .IR recite . .br .ne 1i .SH TESTING The .I recite program comes with a test suite. To run this test suite, use the command .RS .nf % \fBmake sure\fP \fI\&...lots of output...\fP Passed All Tests % .fi .RE .PP The tests take a few seconds each, with a few very fast, and a couple very slow, but it varies greatlrecite.1.0/aux/Howto.cook 644 0 0 23027 5432053507 14602ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: instructions to cook(1), how to build project */ /* * You may want to change some of these options. * ([debug] must be defined, even if empty, use comments.) * * Change ``main.h'' to add the DEBUG define. * All files reference this file, so this will cause recompilation * of all files, both in the change and in the baseline. */ debug = /* -g */ ; /* * Make sure the [project], [change] and [version] variables are set. */ #ifndef project echo "The [project] variable was not set from the command line." set silent; echo "If you want to do a build with is not a development build" set silent; echo "or an integration build, use the make command, not cook." set silent; fail; #endif #ifndef change echo "The [change] variable was not set from the command line." set silent; echo "If you want to do a build with is not a development build" set silent; echo "or an integration build, use the make command, not cook." set silent; fail; #endif #ifndef version echo "The [version] variable was not set from the command line." set silent; echo "If you want to do a build with is not a development build" set silent; echo "or an integration build, use the make command, not cook." set silent; fail; #endif /* * If this is a development build, the version will be x.y.Czzz, * so look toi see if there is a C in the version string. * Include the baseline in the search path if this is * a development build. */ if [match_mask %1C%2 [version]] then { baseline = [collect aegis -cd -bl -p [project]]; search_list = . [baseline]; } /* * The source files. * This is given to us by aegis. */ vs_file = common/patchlevel.h; change_files = [collect aegis -l chafil -ter -p [project] -c [change]] [vs_file] ; project_files = [collect aegis -l profil -ter -p [project] -c [change]] ; source_files = [sort [stringset [project_files] [change_files]]] ; common_obj = [fromto common/%.c common/%.o [match_mask common/%.c [source_files]]] ; english_obj = [fromto english/%.c english/%.o [match_mask english/%.c [source_files]]] ; phonemes_obj = [fromto phonemes/%.c phonemes/%.o [match_mask phonemes/%.c [source_files]]] ; klatt_obj = [fromto klatt/%.c klatt/%.o [match_mask klatt/%.c [source_files]]] ; audio_obj = [fromto audio/%.c audio/%.o [match_mask audio/%.c [source_files]]] ; recite_obj = [fromto recite/%.c recite/%.o [match_mask recite/%.c [source_files]]] [common_obj] [english_obj] [phonemes_obj] [klatt_obj] [audio_obj] ; /* * how to compile C sources */ cc = cc; cc_flags = -O [debug]; cc_include_flags = ; /* * this next section is for gcc * comment it out if you don't have gcc * * The gcc include files MUST be first. */ cc = gcc; cc_include_flags = -I/usr/local/lib/gcc-include [cc_include_flags]; cc_flags = [cc_flags] -ansi -Wall -Wstrict-prototypes -Wmissing-prototypes; cc_link_flags = ; /* * include files from common */ cc_include_flags = [cc_include_flags] [prepost "-I" "/common" [search_list]]; /* * Need the SunOS sound library */ cc_include_flags = [cc_include_flags] -I/usr/demo/SOUND; cc_link_flags = [cc_link_flags] -L/usr/demo/SOUND -laudio -lm; /* * Need to look at the ANSI include files which come with aegis, * but only after the system files. * (Since they supplement system files, not replace them.) * / cc_include_flags = [cc_include_flags] -I/usr/include [prepost "-I" "/h" [search_list]]; */ /* * Build %1/%2.o from %1/%2.c */ %1/%2.o: %1/%2.c: [collect c_incl -s [stringset [prepost "-I" "/%1" [search_list]] [cc_include_flags]] -eia [resolve %1/%2.c]] { if [not [exists %1]] then mkdir %1 set clearstat; if [exists [target]] then rm [target] set clearstat; if [defined %2_flags] then extra = [%2_flags]; else extra = ; [cc] [stringset [prepost "-I" "/%1" [search_list]] [cc_include_flags]] [cc_flags] [extra] -c [resolve %1/%2.c]; mv %2.o %1/%2.o; } /* * How to use yacc sources. */ yacc = yacc; yacc_flags = ; %1/%2.gen.c %1/%2.gen.h: %1/%2.y { if [not [exists %1]] then mkdir %1 set clearstat; if [exists %1/%2.list] then rm %1/%2.list set clearstat; if [exists y.output] then rm y.output set clearstat; if [exists %1/%2.gen.c] then rm %1/%2.gen.c set clearstat; if [exists %1/%2.gen.h] then rm %1/%2.gen.h set clearstat; [yacc] -d [yacc_flags] [resolve %1/%2.y]; sed "'s/[yY][yY]/%2_/g'" < y.tab.c > %1/%2.gen.c; rm y.tab.c; sed "'s/[yY][yY]/%2_/g'" < y.tab.h > %1/%2.gen.h; rm y.tab.h; if [exists y.output] then mv y.output %1/%2.list set clearstat; } /* * The default recipe */ all = doc.targets bin/recite; /* * Integration builds also make the shar files for distribution. */ if [defined change] then if [not [defined baseline]] then all = [all] archive/Part01.Z archive/[project].tar.Z /* archive/[project].patch.Z */ ; all: [all]; /* * build the programs from their objects */ bin/%: [%_obj] { if [not [exists bin]] then mkdir bin set clearstat; if [exists [target]] then rm [target] set clearstat; [cc] -o [target] [resolve [%_obj]] -static [cc_link_flags]; chmod og\=u-w [target]; } /* * The version stamp is to be updated for every * integration and development build. */ #ifndef baseline if [exists [vs_file]] then rm [vs_file] set clearstat; #endif if [not [exists [vs_file]]] then { if [not [exists [dirname [vs_file]]]] then mkdir [dirname [vs_file]] set clearstat; echo "'#define PATCHLEVEL \""[version]"\"'" > [vs_file] set clearstat; } /* * These recipes are only expected to be exercised in an integration build. * They will work sort-of-OK for a development build, but are incapable * of constructing a useful development build Makefile. */ Makefile: aux/Makefile.sh aux/Makefile.awk [source_files] { if [exists Makefile] then rm Makefile set clearstat; sh [resolve aux/Makefile.sh [source_files]] | gawk -f [resolve aux/Makefile.awk] > Makefile; } /* * formatting documents and manual entries */ doc.targets: cat txt special; /* * manual entries */ cat = [fromto man%1/%2.%1 cat%1/%2.%1 [match_mask man%1/%2.%1 [source_files]]]; cat: [cat]; cat%1/%2.%1: man%1/%2.%1: [collect c_incl -r -eia [prepost "-I" "/man%1" [search_list]] [resolve man%1/%2.%1]] { if [not [exists cat%1]] then mkdir cat%1 set clearstat; roffpp [prepost "-I" "/man%1" [search_list]] [resolve man%1/%2.%1] | gtbl | gnroff -man > cat%1/%2.%1; } /* * user manuals */ txt = [fromto doc/%.ms doc/%.ps.Z [match_mask doc/%.ms [source_files]]]; txt: [txt]; doc/%.ps.Z: doc/%.ms: [collect c_incl -r -eia [prepost "-I" "/doc" [search_list]] [resolve doc/%.ms]] { if [not [exists doc]] then mkdir doc set clearstat; if [exists [target]] then rm -f [target] set clearstat; roffpp [prepost "-I" "/doc" [search_list]] [resolve doc/%.ms] | groff -p -t -ms | compress > [target]; } /* * specials */ special = [fromto aux/%.man % [match_mask aux/%.man [source_files]]]; special: [special]; %: aux/%.man: [collect c_incl -r -eia [prepost "-I" "/aux" [search_list]] [resolve aux/%.man]] { if [exists [target]] then rm -f [target] set clearstat; roffpp [prepost "-I" "/aux" [search_list]] [resolve aux/%.man] | gtbl | gnroff -man > [target]; } source_file_order = README [sort [stringset Makefile CHANGES MANIFEST [special] [source_files] - README ] ]; archive/Part01.Z: [source_file_order] { if [not [exists archive]] then mkdir archive set clearstat; parts = [glob "archive/Part*"]; if [parts] then rm [parts] set clearstat; /* assumes shar.3.49 available */ shar -n[project] -a -c -oarchive/Part -L50 [source_file_order]; compress -v archive/Part*; } archive/[project].tar.Z: [source_file_order] { if [not [exists archive]] then mkdir archive set clearstat; if [exists [target]] then rm [target] set clearstat; tar cf - [source_file_order] | tardy -p [project] -now -unu 0 -gnu 0 -una Peter -gna Miller -ms 0644 -mc 07022 | compress > [target]; } archive/[project].patch.Z: [source_file_order] { if [not [exists archive]] then mkdir archive set clearstat; if [exists [target]] then rm [target] set clearstat; sh [resolve aux/patches.sh] [project] [change] | compress > [target]; } CHANGES: aux/CHANGES.sh [vs_file] { if [exists [target]] then rm [target] set clearstat; sh [resolve aux/CHANGES.sh] [project] > [target]; } MANIFEST: aux/MANIFEST.sh [vs_file] { if [exists [target]] then rm [target] set clearstat; sh [resolve aux/MANIFEST.sh [source_file_order]] > [target]; } /* * link to the correct common/conf.h file */ #ifndef baseline if [exists common/conf.h] then rm common/conf.h set clearstat; #endif if [not [exists common/conf.h]] then { if [not [exists common]] then mkdir common; uname-os = [collect uname -s]; uname-rel = [collect uname -r]; echo "'#include <../conf/"[uname-os]-[uname-rel]">'" > common/conf.h set clearstat; cooktime -m 2-jan-70 common/conf.h; } their objects */ bin/%: [%_obj] { if [not [exists bin]] then mkdir bin set clearstat; if [exists [target]] then rm [target] set clearstat; [cc] -o [target] [resolve [%_obj]] -static [cc_link_flags]; chmod og\=u-w [target]; } /* * The version stamp is to be updated for every * integration and development build. */ #ifndef baseline if [exists [vs_file]] then rm [vs_file] set clearstat; #endif if [not [exists [vs_file]]] then { if [not [exists [dirname [vs_frecite.1.0/aux/MANIFEST.sh 644 0 0 2754 5432053507 14353ustar PeterMiller 0 0#! /bin/sh # # recite - english text speech synthesizer # Copyright (C) 1993 Peter Miller. # All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 1, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # # MANIFEST: shell script to generate the MANIFEST file # echo echo for f in $* do case $f in MANIFEST) info="This file" ;; COPYING) info="GNU General Public License" ;; README) info="Blurb about cook" ;; BUILDING) info="Instructions how to build, test and install cook" ;; CHANGES) info="Change history of this release of cook" ;; Makefile) info="Instructions to make(1) how to build and test cook" ;; common/patchlevel.h) info="The patch level of this distribution." ;; *) info=`awk ' /[ ]MANIFEST:[ ]/ { for (j = 1; j < NF; ++j) if ($j == "MANIFEST:") break; for (k = j + 1; k <= NF; ++k) printf(" %s", $k); printf("\n"); exit; }' $f` ;; esac echo "$f $info" done exit 0 order] { if [not [erecite.1.0/aux/Makefile.awk 644 0 0 2131 5432053507 15017ustar PeterMiller 0 0# # recite - english text speech synthesizer # Copyright (C) 1991, 1992, 1993 Peter Miller. # All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 1, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # # MANIFEST: helper file for generating Makefile file # length <= 72 length > 72 { if (substr($0, 1, 1) == "\t") { printf "\t" pos = 8 } else pos = 0 for (j = 1; j <= NF; ++j) { if (pos + 1 + length($j) > 72) { printf "\\\n\t\t" pos = 16 } printf "%s ", $j pos += length($j) + 1 } printf "\n" } of this release of cook" ;; Makefile) info="Instructions to make(1) how to build and test cook" ;; common/patchlevel.h) info="The patch level of this distribution." ;; *) info=`awk ' /[ ]MANIFEST:[ ]/ { for (j = 1; j < NF; ++j) if ($j == "MANIFEST:") break; for (k = j + 1; k <= NF; ++k) printf(" %s", $k); printf("\n"); exit; }' $f` ;; esac echo "$f $info" done exit 0 order] { if [not [erecite.1.0/aux/Makefile.sh 644 0 0 4672 5432053507 14663ustar PeterMiller 0 0#! /bin/sh # # recite - english text speech synthesizer # Copyright (C) 1993 Peter Miller. # All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 1, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # # MANIFEST: shell script to generate Makefile file # recite_files= common= test_files= clean_files=core echo "#" echo "# extra includes required for your system" echo "#" echo "# H =" echo "H = -I/usr/demo/SOUND" echo "" echo "#" echo "# the name of the compiler to use" echo "#" echo "CC = cc" echo "# CC = gcc" echo echo "#" echo "# The compiler flags to use, except for include path." echo "#" echo "CFLAGS = -O" echo "# CFLAGS = -g" echo "# CFLAGS = -O -Wall -ansi # gcc" echo "" echo "#" echo "# extra libraries required for your system" echo "#" echo "# LIBRARIES =" echo "LIBRARIES = -L/usr/demo/SOUND -laudio" echo "" echo "# You should not need to alter anything below this point." echo "#------------------------------------------------------------" echo "" echo "all: bin/recite" echo "" rm common/conf.h for file in $* do case $file in */*.c) dir=`dirname $file` root=`basename $file .c` dep=`c_incl -nc -I$dir -Icommon -ns $file` echo "" echo "$dir/${root}.o: $file" $dep echo " $(CC) $(CFLAGS) -I$dir -Icommon $(H) -c $file" echo " mv ${root}.o $dir" recite_files="$recite_files $dir/${root}.o" clean_files="$clean_files $dir/${root}.o" ;; test/*/*) root=`basename $file .sh` echo "" echo "${root}: all $file" echo " sh $file" test_files="$test_files ${root}" ;; *) ;; esac done echo "" echo "ReciteObj =" $recite_files echo "" echo "bin/recite: $(ReciteObj)" echo " -mkdir bin" echo " $(CC) -o bin/recite $(ReciteObj) $(LIBRARIES) -lm" echo "" echo "sure:" $test_files echo " @echo Passed All Tests" echo "" echo "clean:" echo " rm -f" $clean_files echo "" echo "clobber: clean" echo " rm -f bin/recite" exit 0 oject] > [target]; } MANIFEST: aux/MANIFEST.sh [vs_file] { if [existrecite.1.0/aux/README.man 644 0 0 5747 5432053507 14250ustar PeterMiller 0 0'\" t .\" recite - english text speech synthesizer .\" Copyright (C) 1993 Peter Miller. .\" All rights reserved. .\" .\" This program is free software; you can redistribute it and/or modify .\" it under the terms of the GNU General Public License as published by .\" the Free Software Foundation; either version 1, or (at your option) .\" any later version. .\" .\" This program is distributed in the hope that it will be useful, .\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the .\" GNU General Public License for more details. .\" .\" You should have received a copy of the GNU General Public License .\" along with this program; if not, write to the Free Software .\" Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. .\" .\" MANIFEST: source of the README file .\" .TH readme recite .if n .hy 0 .if n .ad l .if n .nr IN 8n .SH NAME recite \- english text speech synthesizer .SH DESCRIPTION The recite program is a combination of programs I picked up off the net to do speech synthesis. I glued them together to get something approximating what I was after. .PP All I wanted was for the workstation to be able to report some errors verbally. The idea was that I could react rapidly to system faults in our distributed computing environment. .PP The first of the programs was .RS .TS l l. Package: SPEAK Author: John A. Wasser Dated: 4/15/85 Copyright: none, public domain Email: WASSER%VIKING@decwrl.dec.com Archie Pattern: speak.tar.Z .TE .RE The english-to-phonemes portion was extracted, and a few names were changed and prototypes added. The speach part was not used, because it stored phonemes in files and simple butted them together, giving an unaesthetic result. .PP The second package used was .RS .TS l l. Author: Klatt .TE .RE which only provided phonemes-to-sound. The difference was, this one generated the wave forms algorithmically. .SH BUILDING RECITE Full instruction for building the .I recite program may be found in the .I BUILDING file included in this distribution. .SH COPYRIGHT The .I recite program is Copyright .if t \(co .if n (c) 1993 Peter Miller. .br All rights reserved. .PP This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. .PP You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. .PP It should be in the file called .I LICENSE included in this distribution. .SH AUTHOR .TS tab(;); l l l. Peter Miller;UUCP;uunet!munnari!bmr.gov.au!pmiller /\e/\e*;CSNET;pmiller@bmr.gov.au .TE file .sh` echo "" echrecite.1.0/aux/patches.sh 644 0 0 5337 5432053507 14574ustar PeterMiller 0 0#! /bin/sh # # recite - english text speech synthesizer # Copyright (C) 1993 Peter Miller. # All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 1, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # # MANIFEST: shell script to generate the patch file # case $# in 2) project=$1 change=$2 ;; *) echo "usage: $0 " 1>&2 exit 1 ;; esac set -e tmp=/tmp/$$ tmp2=/tmp/$$.2 # # These files are generated # so we don't have an older version in history # weird="README BUILDING CHANGES MANIFEST Makefile" echo "#! /bin/sh" echo "#" echo "# This is a self-applying patch in a shell script." echo "# It has this form because some of the files are generated," echo "# and thus no history is available for them;" echo "# they need to be deleted before the patch is applied." echo "#" echo "# Change directory to the appropriate place" echo "# before applying running this shell script." echo "#" echo "# Don't forget the -p0 option if you apply this patch manually." echo "#" echo "# ------------------------------------------------------------" echo echo "#" echo "# Before you apply this patch," echo "# please delete the following files:" echo "#" echo "rm -f $weird" echo echo "#" echo "# Now patch the files..." echo "# (Don't forget the -p0 option.)" echo "#" echo "patch -p0 << 'fubar'" # # the patchlevel patch can be generated accurately # echo "Index: common/patchlevel.h" prev=`aegis -list version -p $project -c $change | awk -F'"' '/previous/{print $2}'` echo "Prereq: \"$prev\"" echo "#define PATCHLEVEL \"$prev\"" > $tmp set +e diff -c $tmp common/patchlevel.h | sed '1,2d' set -e # # fake patches for the generated files # for f in $weird do echo "Index: $f" set +e diff -c /dev/null $f | sed '1,2d' set -e done # # get a list of files from aegis # files=`(aegis -l pf -p $project -c $change -ter; aegis -l cf -p $project -c $change -ter) | sort` # # get the diff listing for each file # for f in $files do aegis -cp $f -delta 1 -output $tmp -p $project -c $change set +e if diff -c $tmp $f > $tmp2 2> /dev/null then set -e else set -e echo "Index: $f" sed '1,2d' < $tmp2 fi done echo "fubar" # # clean up and go home # rm -f $tmp $tmp2 exit 0 e generated," echo "# and thus no history is available for them;" echo "# they need to be deleted before the patch is applied." echo "#" echo "# Change directory to the appropriate place" echo "# before applying running this shell script." echo "#" echo "# Don't forget the -p0 option if yrecite.1.0/common/ansi.c 644 0 0 2335 5432053507 14375ustar PeterMiller 0 0/* * beget - search for Life patterns * ansi functions * * This file contains functions for use with non-ANSI conforming systems * to implement absent ANSI functionality. */ #if 1 /* ndef __STDC__ */ #include #include #include #include #include /* * NAME * strerror - string for error number * * SYNOPSIS * char *strerror(int errnum); * * DESCRIPTION * The strerror function maps the error number in errnum to an error * message string. * * RETURNS * The strerror function returns a pointer to the string, the contents of * which are implementation-defined. The array pointed to shall not be * modified by the program, but may be overwritten by a subsequent call to * the strerror function. * * CAVEAT * Unknown errors will be rendered in the form "Error %d", where %d will * be replaced by a decimal representation of the error number. */ #ifndef strerror char * strerror(n) int n; { extern int sys_nerr; extern char *sys_errlist[]; static char buffer[16]; if (n < 1 || n > sys_nerr) { sprintf(buffer, "Error %d", n); return buffer; } return sys_errlist[n]; } #endif #endif /* __STDC__ */  Z.newsrc8 .openwin-init`P .openwin-menuh .openwin-sysffx.plange.rhosts.rhrc+.rolo.sched.sig-su .signaturec.sunviewvtdxdmrecite.1.0/common/arglex.c 644 0 0 14530 5432053507 14745ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1991, 1992, 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: functions to perform lexical analysis on command line arguments */ #include #include #include #include #include #include #include #include #include static arglex_table_t table[] = { { "-", arglex_token_stdio, }, { "-Help", arglex_token_help, }, { "-List", arglex_token_list, }, { "-VERSion", arglex_token_version, }, { 0, 0, }, /* end marker */ }; static int argc; static char **argv; arglex_value_t arglex_value; arglex_token_t arglex_token; char *progname; static arglex_table_t *utable; static char *partial; static char *basename _((char *)); static char * basename(s) char *s; { char *bp; char *ep; bp = s; ep = 0; while (*s) { if (s[0] == '/' && s[1] && s[1] != '/') bp = s + 1; if (s > bp && s[0] == '/' && s[-1] != '/') ep = s; ++s; } if (!ep) ep = s; *s = 0; return bp; } void arglex_init(ac, av, tp) int ac; char **av; arglex_table_t *tp; { progname = basename(av[0]); argc = ac - 1; argv = av + 1; utable = tp; } int arglex_compare(formal, actual) char *formal; char *actual; { char fc; char ac; int result; for (;;) { ac = *actual++; if (isupper(ac)) ac = tolower(ac); fc = *formal++; switch (fc) { case 0: result = !ac; goto ret; case '_': if (ac == '-') break; /* fall through... */ case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u': case 'v': case 'w': case 'x': case 'y': case 'z': /* * optional characters */ if (ac == fc && arglex_compare(formal, actual)) { result = 1; goto ret; } /* * skip forward to next * mandatory character, or after '_' */ while (islower(*formal)) ++formal; if (*formal == '_') { ++formal; if (ac == '_' || ac == '-') ++actual; } --actual; break; case '*': /* * This is a hack, it should really * check for a match match the stuff after * the '*', too, a la glob. */ if (!ac) { result = 0; goto ret; } partial = actual - 1; result = 1; goto ret; case '\\': if (actual[-1] != *formal++) { result = 0; goto ret; } break; case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z': fc = tolower(fc); /* fall through... */ default: /* * mandatory characters */ if (fc != ac) { result = 0; goto ret; } break; } } ret: return result; } static int is_a_number _((char *)); static int is_a_number(s) char *s; { long n; int sign; n = 0; switch (*s) { default: sign = 1; break; case '+': s++; sign = 1; break; case '-': s++; sign = -1; break; } switch (*s) { case '0': if ((s[1] == 'x' || s[1] == 'X') && s[2]) { s += 2; for (;;) { switch (*s) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': n = n * 16 + *s++ - '0'; continue; case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': n = n * 16 + *s++ - 'A' + 10; continue; case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': n = n * 16 + *s++ - 'a' + 10; continue; } break; } } else { for (;;) { switch (*s) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': n = n * 8 + *s++ - '0'; continue; } break; } } break; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': for (;;) { switch (*s) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': n = n * 10 + *s++ - '0'; continue; } break; } break; default: return 0; } if (*s) return 0; arglex_value.alv_number = n * sign; return 1; } arglex_token_t arglex() { arglex_table_t *tp; int j; arglex_table_t *hit[20]; int nhit; if (argc <= 0) { arglex_token = arglex_token_eoln; arglex_value.alv_string = ""; goto ret; } arglex_value.alv_string = argv[0]; argc--; argv++; if (is_a_number(arglex_value.alv_string)) { arglex_token = arglex_token_number; goto ret; } nhit = 0; partial = 0; for (tp = table; tp->name; tp++) { if (arglex_compare(tp->name, arglex_value.alv_string)) hit[nhit++] = tp; } if (utable) { for (tp = utable; tp->name; tp++) { if (arglex_compare(tp->name, arglex_value.alv_string)) hit[nhit++] = tp; } } switch (nhit) { case 0: break; case 1: if (partial) arglex_value.alv_string = partial; arglex_token = hit[0]->token; goto ret; default: { size_t len; char *buf; len = strlen(hit[0]->name + 1); for (j = 1; j < nhit; ++j) len += strlen(hit[j]->name) + 2; buf = mem_alloc(len); strcpy(buf, hit[0]->name); for (j = 1; j < nhit; ++j) { strcat(buf, ", "); strcat(buf, hit[j]->name); } fatal ( "option \"%s\" ambiguous (%s)", arglex_value.alv_string, buf ); } } /* not found in the table */ if (arglex_value.alv_string[0] == '-') arglex_token = arglex_token_option; else arglex_token = arglex_token_string; ret: #if 0 printf("arglex %d\n", arglex_token); #endif return arglex_token; } case 'r': case 's': case 't': case 'u': case 'v': case 'w': case 'x': case 'y': case 'z': /* * optional characters */ if (ac == fc && arglex_compare(recite.1.0/common/arglex.h 644 0 0 3175 5432053507 14735ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1991, 1992, 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: interface definition for arglex.c */ #ifndef ARGLEX_H #define ARGLEX_H #include typedef enum arglex_token_t arglex_token_t; enum arglex_token_t { arglex_token_eoln = -20, arglex_token_help, arglex_token_number, arglex_token_list, arglex_token_option, arglex_token_stdio, arglex_token_string, arglex_token_version, }; typedef struct arglex_value_t arglex_value_t; struct arglex_value_t { char *alv_string; long alv_number; double alv_double; }; typedef struct arglex_table_t arglex_table_t; struct arglex_table_t { char *name; int token; }; extern arglex_token_t arglex_token; extern arglex_value_t arglex_value; extern char *progname; void arglex_init _((int argc, char **argv, arglex_table_t *table)); arglex_token_t arglex _((void)); int arglex_compare _((char *formal, char *actual)); #endif /* ARGLEX_H */ d a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: interface definition for arglex.c */ #ifndef ARGLEX_H #define ARGLEX_H #include typedef enum arglex_token_t arglex_token_t; enum arglex_token_t { arglex_token_eoln = -20, arglex_token_help,recite.1.0/common/error.c 644 0 0 17301 5432053507 14613ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1991, 1992, 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: functions to report errors */ #include #include #include #include #include #include #include #include #include #include static char *huge_buffer; static void make_huge_buffer _((void)); static void make_huge_buffer() { static int entry_count; if (huge_buffer) return; entry_count++; if (entry_count != 1) { static char small_buffer[100]; /* just enuf for "out of memory" message */ huge_buffer = small_buffer; } else { huge_buffer = malloc(100000L); if (!huge_buffer) fatal("can't alloc buffer for error messages"); } entry_count--; } /* * NAME * wrap - wrap s string over lines * * SYNOPSIS * void wrap(char *); * * DESCRIPTION * The wrap function is used to print error messages onto stderr * wrapping ling lines. * * CAVEATS * Line length is assumed to be 80 characters. */ #define PAGE_WIDTH 79 static void wrap _((char *)); static void wrap(s) char *s; { static char escapes[] = "\rr\nn\ff\bb\tt"; char tmp[PAGE_WIDTH + 2]; int first_line; char *tp; int bomb_later; /* * Flush stdout so that errors are in sync with the output. * If you get an error doing this, whinge about it _after_ reporting * the originating error. Also, clear the error on stdout to * avoid getting caught in an infinite loop. */ if (fflush(stdout) || ferror(stdout)) { bomb_later = errno; clearerr(stdout); } else bomb_later = 0; first_line = 1; while (*s) { char *ep; int ocol; /* * Work out how many characters fit on the line. */ if (first_line) ocol = strlen(progname) + 2; else ocol = 8; for (ep = s; *ep; ++ep) { int cw; int c; c = (unsigned char)*ep; if (isprint(c)) cw = 1 + (c == '\\'); else cw = (strchr(escapes, c) ? 2 : 4); if (ocol + cw > PAGE_WIDTH) break; ocol += cw; } /* * see if there is a better place to break the line */ if (*ep && *ep != ' ') { char *mp; for (mp = ep; mp > s; --mp) { if (strchr(" /", mp[-1])) { ep = mp; break; } } } /* * ignore trailing blanks */ while (ep > s && ep[-1] == ' ') ep--; /* * print the line */ if (first_line) sprintf(tmp, "%s: ", progname); else strcpy(tmp, "\t"); tp = tmp + strlen(tmp); while (s < ep) { int c; c = (unsigned char)*s++; if (isprint(c)) { if (c == '\\') *tp++ = '\\'; *tp++ = c; } else { char *esc; esc = strchr(escapes, c); if (esc) { *tp++ = '\\'; *tp++ = esc[1]; } else { sprintf(tp, "\\%3.3o", c); tp += strlen(tp); } } } *tp++ = '\n'; *tp = 0; fputs(tmp, stderr); if (ferror(stderr)) break; /* * skip leading spaces for subsequent lines */ while (*s == ' ') s++; first_line = 0; } if (fflush(stderr) || ferror(stderr)) { /* don't print why, there is no point! */ exit(1); } if (bomb_later) { errno = bomb_later; nfatal("(stdout)"); } } /* * NAME * error - place a message on the error stream * * SYNOPSIS * void error(char *s, ...); * * DESCRIPTION * Error places a message on the error output stream. * The first argument is a printf-like format string, * optionally followed by other arguments. * The message will be prefixed by the program name and a colon, * and will be terminated with a newline, automatically. * * CAVEAT * Things like "error(filename)" blow up if the filename * contains a '%' character. */ /*VARARGS1*/ void error(s sva_last) char *s; sva_last_decl { va_list ap; make_huge_buffer(); sva_init(ap, s); vsprintf(huge_buffer, s, ap); va_end(ap); wrap(huge_buffer); } /* * NAME * nerror - place a system fault message on the error stream * * SYNOPSIS * void nerror(char *s, ...); * * DESCRIPTION * Nerror places a message on the error output stream. * The first argument is a printf-like format string, * optionally followed by other arguments. * The message will be prefixed by the program name and a colon, * and will be terminated with a text description of the error * indicated by the 'errno' global variable, automatically. * * CAVEAT * Things like "nerror(filename)" blow up if the filename * contains a '%' character. */ /*VARARGS1*/ void nerror(s sva_last) char *s; sva_last_decl { va_list ap; int n; n = errno; make_huge_buffer(); sva_init(ap, s); vsprintf(huge_buffer, s, ap); va_end(ap); strcat(huge_buffer, ": "); strcat(huge_buffer, strerror(n)); wrap(huge_buffer); } /* * NAME * nfatal - place a system fault message on the error stream and exit * * SYNOPSIS * void nfatal(char *s, ...); * * DESCRIPTION * Nfatal places a message on the error output stream and exits. * The first argument is a printf-like format string, * optionally followed by other arguments. * The message will be prefixed by the program name and a colon, * and will be terminated with a text description of the error * indicated by the 'errno' global variable, automatically. * * CAVEAT * Things like "nfatal(filename)" blow up if the filename * contains a '%' character. * * This function does NOT return. */ /*VARARGS1*/ void nfatal(s sva_last) char *s; sva_last_decl { va_list ap; int n; n = errno; make_huge_buffer(); sva_init(ap, s); vsprintf(huge_buffer, s, ap); va_end(ap); strcat(huge_buffer, ": "); strcat(huge_buffer, strerror(n)); wrap(huge_buffer); exit(1); } /* * NAME * fatal - place a message on the error stream and exit * * SYNOPSIS * void fatal(char *s, ...); * * DESCRIPTION * Fatal places a message on the error output stream and exits. * The first argument is a printf-like format string, * optionally followed by other arguments. * The message will be prefixed by the program name and a colon, * and will be terminated with a newline, automatically. * * CAVEAT * Things like "error(filename)" blow up if the filename * contains a '%' character. * * This function does NOT return. */ /*VARARGS1*/ void fatal(s sva_last) char *s; sva_last_decl { va_list ap; make_huge_buffer(); sva_init(ap, s); vsprintf(huge_buffer, s, ap); va_end(ap); wrap(huge_buffer); exit(1); } /* * NAME * assert - make an assertion * * SYNOPSIS * void assert(int condition); * * DESCRIPTION * Assert is a handy tool for a programmer to guarantee the internal * consistency of their program. If "-DDEBUG" is specified on * the compiler's command line, then assert will generate code to verify * the assertios made. If no DEBUG is defined, assertions will generate * no code. * * CAVEAT * If the assertion fails, a fatal diagnostic is issued. * * The #define's which control the compilation may be found in "error.h". * */ #ifdef DEBUG void cook_assert(c, s, file, line) int c; char *s; char *file; int line; { if (c) return; error("%s: %d: assertion \"%s\" failed (bug)", file, line, s); abort(); } #endif /* DEBUG */ 't print why, there is no point! */ exit(1); } if (bomb_later) { errno = bomb_later; nfatal("(stdout)"); } } /* * NAME * error - place a message on the error stream * * SYNOPSIS * void error(char *s, ...); * * DESCRIPTION * Error places a message on the error output stream. * The first argumentrecite.1.0/common/error.h 644 0 0 2435 5432053507 14602ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1991, 1992, 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: interface definition for error.c */ #ifndef ERROR_H #define ERROR_H #include void error _((char *, ...)); void fatal _((char *, ...)); void nerror _((char *, ...)); void nfatal _((char *, ...)); #ifdef DEBUG # ifdef __STDC__ # define assert(c) cook_assert((c) != 0, #c, __FILE__, __LINE__) # else # define assert(c) cook_assert((c) != 0, "c", __FILE__, __LINE__) # endif void cook_assert _((int, char *, char *, int)); #else # define assert(c) #endif #endif /* ERROR_H */ nfatal("(stdout)"); } } /* * NAME * error - place a message on the error stream * * SYNOPSIS * void error(char *s, ...); * * DESCRIPTION * Error places a message on the error output stream. * The first argumentrecite.1.0/common/frame.c 644 0 0 11536 5432053507 14560ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: functions to manipulate parameter frames */ #include #include #include #include static frame_ty *list; static long list_pos; static long list_max; void frame_out(fp) frame_ty *fp; { if (list_pos >= list_max) { size_t nbytes; list_max += (1L << 10); nbytes = list_max * sizeof(frame_ty); if (!list) list = (frame_ty *)mem_alloc(nbytes); else mem_change_size((char **)&list, nbytes); } list[list_pos++] = *fp; } void frame_out_collect(out_p, outlen_p) char **out_p; long *outlen_p; { if (list) { size_t nbytes; nbytes = list_pos * sizeof(frame_ty); if (list_pos < list_max) mem_change_size((char **)&list, nbytes); *out_p = (char *)list; *outlen_p = nbytes; } else { *out_p = 0; *outlen_p = 0; } list = 0; list_max = 0; list_pos = 0; } static int calc_width _((int)); static int calc_width(n) int n; { int result; if (!n) return 1; if (n < 0) { result = 1; n = -n; } else result = 0; while (n > 0) { n /= 10; result++; } return result; } void frame_write(filename, data, datalen) char *filename; char *data; long datalen; { int i; FILE *fp; frame_ty *frame; long frame_count; frame_ty width; if (filename) { fp = fopen(filename, "w"); if (!fp) nfatal("open \"%s\"", filename); } else { fp = stdout; filename = "(standard output)"; } frame = (frame_ty *)data; frame_count = datalen / sizeof(frame_ty); /* * compute fields widths */ width.f0 = 1; width.f1 = 1; width.f2 = 1; width.f3 = 1; width.bw1 = 1; width.bw2 = 1; width.bw3 = 1; width.fnz = 1; width.fnp = 1; width.av = 1; width.anp = 1; width.asp = 1; width.af = 1; width.a1 = 1; width.a2 = 1; width.a3 = 1; width.a4 = 1; width.a5 = 1; width.a6 = 1; width.ab = 1; for (i = 0; i < frame_count; i++) { int w; #define CWID(xx) w = calc_width(frame[i].xx); if (w > width.xx) width.xx = w; CWID(f0); CWID(f1); CWID(f2); CWID(f3); CWID(bw1); CWID(bw2); CWID(bw3); CWID(fnz); CWID(fnp); CWID(av); CWID(anp); CWID(asp); CWID(af); CWID(a1); CWID(a2); CWID(a3); CWID(a4); CWID(a5); CWID(a6); CWID(ab); #undef CWID } /* * emit the frames */ for (i = 0; i < frame_count; i++) { fprintf ( fp, "%*hd %*hd %*hd %*hd %*hd %*hd %*hd %*hd %*hd %*hd \ %*hd %*hd %*hd %*hd %*hd %*hd %*hd %*hd %*hd %*hd\n", width.f0, frame[i].f0, width.f1, frame[i].f1, width.f2, frame[i].f2, width.f3, frame[i].f3, width.bw1, frame[i].bw1, width.bw2, frame[i].bw2, width.bw3, frame[i].bw3, width.fnz, frame[i].fnz, width.fnp, frame[i].fnp, width.av, frame[i].av, width.anp, frame[i].anp, width.asp, frame[i].asp, width.af, frame[i].af, width.a1, frame[i].a1, width.a2, frame[i].a2, width.a3, frame[i].a3, width.a4, frame[i].a4, width.a5, frame[i].a5, width.a6, frame[i].a6, width.ab, frame[i].ab ); } if (fflush(fp)) nfatal("write \"%s\"", filename); if (fclose(fp)) nfatal("close \"%s\"", filename); } static int frame_read_one _((FILE *fp, char *filename)); static int frame_read_one(fp, filename) FILE *fp; char *filename; { frame_ty frame; int n; n = fscanf ( fp, "%hd%hd%hd%hd%hd%hd%hd%hd%hd%hd%hd%hd%hd%hd%hd%hd%hd%hd%hd%hd", &frame.f0, &frame.f1, &frame.f2, &frame.f3, &frame.bw1, &frame.bw2, &frame.bw3, &frame.fnz, &frame.fnp, &frame.av, &frame.anp, &frame.asp, &frame.af, &frame.a1, &frame.a2, &frame.a3, &frame.a4, &frame.a5, &frame.a6, &frame.ab ); if (n != 20) { if (ferror(fp)) nfatal("read \"%s\"", filename); if (n != EOF) fatal("%s: format error", filename); return 0; } frame_out(&frame); return 1; } void frame_read(filename, data, datalen) char *filename; char **data; long *datalen; { FILE *fp; if (filename) { fp = fopen(filename, "r"); if (!fp) nfatal("open \"%s\"", filename); } else { fp = stdin; filename = "(standard input)"; } while (frame_read_one(fp, filename)) ; if (fclose(fp)) nfatal("close \"%s\"", filename); frame_out_collect(data, datalen); } #include #include #include static frame_ty *list; static long list_pos; static long list_max; void frame_out(fp) frrecite.1.0/common/frame.h 644 0 0 3076 5432053507 14545ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: interface definition for common/frame.c */ #ifndef FRAME_H #define FRAME_H #include typedef struct frame_ty frame_ty; struct frame_ty { short f0; /* 0 */ short f1; /* 1 */ short f2; /* 2 */ short f3; /* 3 */ short bw1; /* 4 */ short bw2; /* 5 */ short bw3; /* 6 */ short fnz; /* 7 */ short fnp; /* 8 */ short av; /* 9 */ short anp; /* 10 */ short asp; /* 11 */ short af; /* 12 */ short a1; /* 13 */ short a2; /* 14 */ short a3; /* 15 */ short a4; /* 16 */ short a5; /* 17 */ short a6; /* 18 */ short ab; /* 19 */ }; void frame_read _((char *filename, char **data, long *datalen)); void frame_write _((char *filename, char *data, long datalen)); void frame_out _((frame_ty *)); void frame_out_collect _((char **data, long *datalen)); #endif /* FRAME_H */ list = 0; list_max = 0; list_pos = 0; } static int calc_width _((int)); static int calc_width(n) int n; { int result; if (!n) return 1; if (n < 0) { result = 1; n = -n; } else result = 0; while (n > 0) { n /= 10; result++; } return result; } void frame_write(filename, data, datalen) char *filename; char *data; long datalen; { int i; FILE *fp; frame_ty *frame; long frame_count; frame_ty width; irecite.1.0/common/help.c 644 0 0 6534 5432053507 14400ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1991, 1992, 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: functions to provide consistent -Help behaviour */ #include #include #include #include #include #include #include #include int isatty _((int)); static char *cr[] = { "%s version %v", "Copyright (C) 1993 Peter Miller.", "All rights reserved.", "", "The %s program comes with ABSOLUTELY NO WARRANTY;", "for details use the '%s -VERSion Warranty' command.", "The %s program is free software, and you are welcome to", "redistribute it under certain conditions;", "for details use the '%s -VERSion Redistribution' command.", }; static char *au[] = { "Peter Miller UUCP uunet!munnari!bmr.gov.au!pmiller", "/\\/\\* Internet pmiller@bmr.gov.au", }; static void interpret _((FILE *, char **, int, char *)); static void interpret(fp, text, text_len, prefix) FILE *fp; char **text; int text_len; char *prefix; { int j; for (j = 0; j < text_len; ++j) { char indent[10]; char *ip1; char *ip2; char *s; s = text[j]; strcpy(indent, prefix); ip2 = indent + strlen(indent); ip1 = s; while (isspace(*ip1)) *ip2++ = *ip1++; *ip2 = 0; if (ip1[0] == '%' && isupper(ip1[1]) && !ip1[2]) { switch (ip1[1]) { default: assert(0); break; case 'C': interpret(fp, cr, SIZEOF(cr), indent); break; case 'A': interpret(fp, au, SIZEOF(au), indent); break; } continue; } if (*prefix) fputs(prefix, fp); while (*s) { if (*s != '%') putc(*s, fp); else { switch (*++s) { default: assert(0); break; case '%': putc(*s, fp); break; case 's': fputs(progname, fp); break; case 'v': fputs(version_stamp(), fp); break; } } ++s; } fputc('\n', fp); } } void help(text, text_len, usage) char **text; int text_len; void (*usage)_((void)); { FILE *fp; char *pager; /* * collect the rest of thge command line, * if necessary */ if (usage && arglex() != arglex_token_eoln) usage(); /* * if output is to the terminal, * send the output through a paginator */ if (isatty(0)) { pager = getenv("PAGER"); if (!pager) pager = "more"; } else pager = 0; /* * open the paginator */ if (pager) { fp = popen(pager, "w"); if (!fp) { nerror("%s", pager); pager = 0; fp = stdout; } } else fp = stdout; /* * do what they asked */ interpret(fp, text, text_len, ""); /* * close the paginator */ if (pager) pclose(fp); } char * version_stamp() { return PATCHLEVEL; } width.fnp, frame[i].fnp, width.av, frame[i].av, width.anp, frame[i].anp, width.asp, frame[i].asp, width.af, frame[i].af, width.a1, frame[i].a1, wirecite.1.0/common/help.h 644 0 0 2004 5432053507 14371ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1991, 1992, 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: interface definition for comon/help.c */ #ifndef HELP_H #define HELP_H #include void help _((char **text, int text_lem, void (*usage)(void))); char *version_stamp _((void)); #endif /* HELP_H */ l.h> int isatty _((int)); static char *cr[] = { "%s version %v", "Copyright (C) 1993 Peter Miller.", "All rights reserved.", "", "The %s program comes with ABSOLUTELY NO WARRANTY;", "for details use the '%s -VERSion Warranty' command.", "The %s program is free software, and you are welcome to", "redistribute it under certain conditions;", "for details use the '%s -VERSion Redistribution' command.", }; static char *au[] = { "Peter Miller UUCP uunet!munnari!bmr.gov.au!pmiller", "/\\recite.1.0/common/main.h 644 0 0 2171 5432053507 14372ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: common defined, including DEBUG define */ #ifndef MAIN_H #define MAIN_H #ifdef __STDC__ # define _(x) x #else # define _(x) () # define const #endif #define SIZEOF(a) (sizeof(a) / sizeof(a[0])) #define ENDOF(a) ((a) + SIZEOF(a)) /* * take the following out of comments to enable debugging * #define DEBUG */ #endif /* MAIN_H */ ts reserved.", "", "The %s program comes with ABSOLUTELY NO WARRANTY;", "for details use the '%s -VERSion Warranty' command.", "The %s program is free software, and you are welcome to", "redistribute it under certain conditions;", "for details use the '%s -VERSion Redistribution' command.", }; static char *au[] = { "Peter Miller UUCP uunet!munnari!bmr.gov.au!pmiller", "/\\recite.1.0/common/mem.c 644 0 0 7415 5432053507 14225ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1990-1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: functions to manipulate dynamic memory */ #include #include #include #include #include #include /* * NAME * memory_error - diagnostic * * SYNOPSIS * void memory_error(void); * * DESCRIPTION * The memory_error function is used to report fatal problems with the * memory allocator. * * RETURNS * The memory_error function does not return. */ static void memory_error _((void)); static void memory_error() { #ifdef DEBUG nerror("memory allocator"); abort(); #else nfatal("memory allocator"); #endif } /* * NAME * mem_alloc - allocate and clear memory * * SYNOPSIS * char *mem_alloc(size_t n); * * DESCRIPTION * Mem_alloc uses malloc to allocate the required sized chunk of memory. * If any error is returned from malloc() an fatal diagnostic is issued. * The memory is zeroed befor it is returned. * * CAVEAT * It is the responsibility of the caller to ensure that the space is * freed when finished with, by a call to free(). */ char * mem_alloc(n) size_t n; { char *cp; if (n < 1) n = 1; errno = 0; cp = (char *)malloc(n); if (!cp) { if (!errno) errno = ENOMEM; memory_error(); } return cp; } /* * NAME * mem_alloc_clear - allocate and clear memory * * SYNOPSIS * char *mem_alloc_clear(size_t n); * * DESCRIPTION * Mem_alloc_clear uses malloc to allocate the required sized chunk of memory. * If any error is returned from malloc() an fatal diagnostic is issued. * The memory is zeroed befor it is returned. * * CAVEAT * It is the responsibility of the caller to ensure that the space is * freed when finished with, by a call to free(). */ char * mem_alloc_clear(n) size_t n; { char *cp; cp = mem_alloc(n); memset(cp, 0, n); return cp; } void mem_change_size(cpp, n) char **cpp; size_t n; { char *cp; cp = *cpp; if (n < 1) n = 1; errno = 0; cp = realloc(cp, n); if (!cp) { if (!errno) errno = ENOMEM; memory_error(); } *cpp = cp; } /* * NAME * enlarge - enlarges dynamic arrays * * SYNOPSIS * char *enlarge(size_t *length, char **base, size_t size); * * DESCRIPTION * Enlarge is used to append more space onto the end of dynamically * allocated arrays. * If any error is returned from the memory allocator, * a fatal diagnostic is issued. * * RETURNS * A pointer to the element added. * * CAVEAT * Because it uses realloc, pointers into the array may be invalid after * a call to enlarge(); only use indexing. * * The new space is not zeroed. * * It is the responsibility of the caller to ensure that the array is * freed when finished with, by a call to free(). */ char * enlarge(length, base, size) size_t *length; char **base; size_t size; { char *result; assert(!*length == !*base); if (*length) *base = (char*)realloc(*base, (*length + 1) * size); else *base = (char*)malloc(size); if (!*base) memory_error(); result = (*base + (*length)++ * size); return result; } void mem_free(cp) char *cp; { free(cp); } tatic int frame_read_one _((FILE *fp, char *filename)); static int frame_read_one(fp, filename) FILE *fp; char *filename; { frame_ty frame; int n; n = fscanf ( fp, "%hd%hd%hd%hd%hd%hd%hd%hd%hd%hd%hd%hd%hd%hd%hd%hd%hd%hd%hd%hrecite.1.0/common/mem.h 644 0 0 2153 5432053507 14224ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1991, 1992, 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: interface definition for common/mem.c */ #ifndef MEM_H #define MEM_H #include #include char *enlarge _((size_t *, char **, size_t)); char *mem_alloc _((size_t)); char *mem_alloc_clear _((size_t)); void mem_change_size _((char **, size_t)); void mem_free _((char *)); #endif /* MEM_H */ oblems with the * memory allocator. * * RETURNS * The memory_error function does not return. */ static void memory_error _((void)); static void memory_error() { #ifdef DEBUG nerror("memory allocator"); abort(); #else nfatal("memory allocator"); #endif } /* * NAME * mem_alloc - allocate and clear memory * * SYNOPSIS * char *mem_alloc(size_t n); * * DESCRIPTION * Mem_alloc uses mallocrecite.1.0/common/patchlevel.h 644 0 0 36 5432053507 15533ustar PeterMiller 0 0#define PATCHLEVEL "1.0.D011" eech synthesizer * Copyright (C) 1991, 1992, 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITrecite.1.0/common/s-v-arg.h 644 0 0 3476 5432053507 14733ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1992, 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: insulation from varargs.h versus stdarg.h incompatibilities */ #ifndef S_V_ARG_H #define S_V_ARG_H /* * This file contains insulation from whether is being used * or whether is being used. Incompatibilities are hidden behind * three macros: * sva_last - last argument in variable arg func defn * sva_last_decl - declaration for last arg * sva_start - hides whether nth is used or not * These macros are non-syntactic (ugh!) but they sure make things prettier. * * Do not directly include either or in the code, * always use this header instead. * * Never refer directly to va_start, va_arg, or va_dcl directly in the code. * Direct references to va_list, va_arg and va_end are OK. */ #ifndef __STDC__ #include #define sva_last ,va_alist #define sva_last_decl va_dcl #define sva_init(ap, nth) va_start(ap) #else #include #define sva_last #define sva_last_decl #define sva_init(ap, nth) va_start(ap, nth) #endif #endif /* S_V_ARG_H */ abort(); #else nfatal("memory allocator"); #endif } /* * NAME * mem_alloc - allocate and clear memory * * SYNOPSIS * char *mem_alloc(size_t n); * * DESCRIPTION * Mem_alloc uses mallocrecite.1.0/common/trace.c 644 0 0 16141 5432053507 14561ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1991, 1992, 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include #include #include #include #define INDENT 2 #define PAGE_WIDTH 79 typedef struct known_t known_t; struct known_t { int flag; int *flag_p; known_t *next; char filename[1]; }; static char *file_name; static int line_number; static int page_width; static known_t *known; static char *basename _((char *)); static char * basename(file) char *file; { char *cp1; char *cp2; static char buf[7]; long len; cp1 = strrchr(file, '/'); if (cp1) ++cp1; else cp1 = file; cp2 = strrchr(cp1, '.'); if (!cp2) cp2 = cp1 + strlen(cp1); if (cp2 > cp1 + sizeof(buf) - 1) len = sizeof(buf) - 1; else len = cp2 - cp1; memcpy(buf, cp1, len); buf[len] = 0; return buf; } int trace_pretest(file, result) char *file; int *result; { char *s; known_t *kp; s = basename(file); for (kp = known; kp; kp = kp->next) if (!strcmp(s, kp->filename)) break; if (!kp) { kp = (known_t *)mem_alloc(sizeof(known_t) + strlen(s)); strcpy(kp->filename, s); kp->next = known; kp->flag = 2; /* disabled */ known = kp; } kp->flag_p = result; *result = kp->flag; return *result; } void trace_where(file, line) char *file; int line; { file_name = basename(file); line_number = line; } static void trace_putchar _((int)); static void trace_putchar(c) int c; { static int depth; static char buffer[PAGE_WIDTH + 2]; static char *cp; static int in_col; static int out_col; if (!page_width) { page_width = PAGE_WIDTH - 24; if (page_width < 8) page_width = 8; } if (!cp) { strcpy(buffer, progname); cp = buffer + strlen(buffer); if (cp > buffer + 6) cp = buffer + 6; *cp++ = ':'; *cp++ = '\t'; strcpy(cp, file_name); cp += strlen(cp); *cp++ = ':'; *cp++ = '\t'; sprintf(cp, "%d:\t", line_number); cp += strlen(cp); in_col = 0; out_col = 0; } switch (c) { case '\n': *cp++ = '\n'; *cp = 0; fflush(stdout); fputs(buffer, stderr); fflush(stderr); if (ferror(stderr)) nfatal("(stderr)"); cp = 0; break; case ' ': if (out_col) ++in_col; break; case '\t': if (out_col) in_col = (in_col/INDENT + 1) * INDENT; break; case /*{*/'}': case /*(*/')': case /*[*/']': if (depth > 0) --depth; /* fall through */ default: if (!out_col) { if (c != '#') /* modulo so never too long */ in_col = (INDENT * depth) % page_width; else in_col = 0; } if (in_col >= page_width) { trace_putchar('\n'); trace_putchar(c); return; } while (((out_col + 8) & -8) <= in_col && out_col + 1 < in_col) { *cp++ = '\t'; out_col = (out_col + 8) & -8; } while (out_col < in_col) { *cp++ = ' '; ++out_col; } if (c == '{'/*}*/ || c == '('/*)*/ || c == '['/*]*/) ++depth; *cp++ = c; in_col++; out_col++; break; } } void trace_printf(s sva_last) char *s; sva_last_decl { char buffer[1 << 10]; va_list ap; sva_init(ap, s); vsprintf(buffer, s, ap); va_end(ap); for (s = buffer; *s; ++s) trace_putchar(*s); } void trace_enable(file) char *file; { char *s; known_t *kp; s = basename(file); for (kp = known; kp; kp = kp->next) if (!strcmp(s, kp->filename)) break; if (!kp) { kp = (known_t *)mem_alloc(sizeof(known_t) + strlen(s)); strcpy(kp->filename, s); kp->flag_p = 0; kp->next = known; known = kp; } kp->flag = 3; /* enabled */ if (kp->flag_p) *kp->flag_p = kp->flag; } void trace_char_real(name, vp) char *name; char *vp; { trace_printf("%s = '", name); if (*vp < ' ' || *vp > '~' || strchr("(){}[]", *vp)) { char *s; s = strchr("\bb\nn\tt\rr\ff", *vp); if (s) { trace_putchar('\\'); trace_putchar(s[1]); } else trace_printf("\\%03o", (unsigned char)*vp); } else { if (strchr("'\\", *vp)) trace_putchar('\\'); trace_putchar(*vp); } trace_printf("'; /* 0x%02X, %d */\n", (unsigned char)*vp, *vp); } void trace_char_unsigned_real(name, vp) char *name; unsigned char *vp; { trace_printf("%s = '", name); if (*vp < ' ' || *vp > '~' || strchr("(){}[]", *vp)) { char *s; s = strchr("\bb\nn\tt\rr\ff", *vp); if (s) { trace_putchar('\\'); trace_putchar(s[1]); } else trace_printf("\\%03o", *vp); } else { if (strchr("'\\", *vp)) trace_putchar('\\'); trace_putchar(*vp); } trace_printf("'; /* 0x%02X, %d */\n", *vp, *vp); } void trace_int_real(name, vp) char *name; int *vp; { trace_printf("%s = %d;\n", name, *vp); } void trace_int_unsigned_real(name, vp) char *name; unsigned int *vp; { trace_printf("%s = %u;\n", name, *vp); } void trace_long_real(name, vp) char *name; long *vp; { trace_printf("%s = %ld;\n", name, *vp); } void trace_long_unsigned_real(name, vp) char *name; unsigned long *vp; { trace_printf("%s = %lu;\n", name, *vp); } void trace_pointer_real(name, vptrptr) char *name; void *vptrptr; { void **ptr_ptr = vptrptr; void *ptr; ptr = *ptr_ptr; if (!ptr) trace_printf("%s = NULL;\n", name); else trace_printf("%s = 0x%08lX;\n", name, ptr); } void trace_short_real(name, vp) char *name; short *vp; { trace_printf("%s = %hd;\n", name, *vp); } void trace_short_unsigned_real(name, vp) char *name; unsigned short *vp; { trace_printf("%s = %hu;\n", name, *vp); } void trace_string_real(name, vp) char *name; char *vp; { char *s; long count; trace_printf("%s = ", name); if (!vp) { trace_printf("NULL;\n"); return; } trace_printf("\""); count = 0; for (s = vp; *s; ++s) { switch (*s) { case '('/*)*/: case '['/*]*/: case '{'/*}*/: ++count; break; case /*(*/')': case /*[*/']': case /*{*/'}': --count; break; } } if (count > 0) count = -count; else count = 0; for (s = vp; *s; ++s) { int c; c = *s; if (c < ' ' || c > '~') { char *cp; cp = strchr("\bb\ff\nn\rr\tt", c); if (cp) trace_printf("\\%c", cp[1]); else { escape: trace_printf("\\%03o", (unsigned char)c); } } else { switch (c) { case '('/*)*/: case '['/*]*/: case '{'/*}*/: ++count; if (count <= 0) goto escape; break; case /*(*/')': case /*[*/']': case /*{*/'}': --count; if (count < 0) goto escape; break; case '\\': case '"': trace_printf("\\"); break; } trace_printf("%c", c); } } trace_printf("\";\n"); } */ default: if (!out_col) { if (c != '#') /* modulo so never too long */ in_col = (INDENT * depth) % page_width; else in_col = 0; } if (in_col >= page_width) { trace_putchar('\n'); trace_putchar(c); return; } while (((out_col + 8) & -8) <= in_col && out_col + 1 < in_col) { *cp++ = '\t'; out_col = (out_col + 8) & -8; } while (out_col < in_col) { *cp++ = recite.1.0/common/trace.h 644 0 0 11307 5432053507 14565ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1991, 1992, 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: interface definition for common/trace.c */ #ifndef TRACE_H #define TRACE_H #include #include #ifdef DEBUG #define trace_pretest_ \ ( \ ( \ trace_pretest_result \ ? \ trace_pretest_result \ : \ trace_pretest(__FILE__, &trace_pretest_result) \ ) \ & \ 1 \ ) #define trace_where_ trace_where(__FILE__, __LINE__) #define trace(x) (void)(trace_pretest_ && (trace_where_, trace_printf x, 0)) #define trace_if() (trace_pretest_ && (trace_where_, 1)) #else #define trace(x) #define trace_if() 0 #endif /* * This variable is static to each file which * includes the "trace.h" file. * Tracing is file-by-file, but need only test this once. * Files will fail to trace if a trace call is executed in them * prior to a call to trace_enable turning it on. */ #ifdef DEBUG static int trace_pretest_result; #endif int trace_pretest _((char *file, int *result)); void trace_where _((char *file, int line)); void trace_printf _((char *, ...)); void trace_enable _((char *)); #ifdef __STDC__ #define trace_stringize(x) #x #else #define trace_stringize(x) "x" #endif #ifdef DEBUG #define trace_char(x) \ (void) \ ( \ trace_pretest_ \ && \ ( \ trace_where_, \ trace_char_real(trace_stringize(x), &x), \ 0 \ ) \ ) void trace_char_real _((char *, char *)); #define trace_char_unsigned(x) \ (void) \ ( \ trace_pretest_ \ && \ ( \ trace_where_, \ trace_char_unsigned_real(trace_stringize(x), &x), \ 0 \ ) \ ) void trace_char_unsigned_real _((char *, unsigned char *)); #define trace_int(x) \ (void) \ ( \ trace_pretest_ \ && \ ( \ trace_where_, \ trace_int_real(trace_stringize(x), &x), \ 0 \ ) \ ) void trace_int_real _((char *, int *)); #define trace_int_unsigned(x) \ (void) \ ( \ trace_pretest_ \ && \ ( \ trace_where_, \ trace_int_unsigned_real(trace_stringize(x), &x), \ 0 \ ) \ ) void trace_int_unsigned_real _((char *, unsigned *)); #define trace_long(x) \ (void) \ ( \ trace_pretest_ \ && \ ( \ trace_where_, \ trace_long_real(trace_stringize(x), &x), \ 0 \ ) \ ) void trace_long_real _((char *, long *)); #define trace_long_unsigned(x) \ (void) \ ( \ trace_pretest_ \ && \ ( \ trace_where_, \ trace_long_unsigned_real(trace_stringize(x), &x), \ 0 \ ) \ ) void trace_long_unsigned_real _((char *, unsigned long *)); #define trace_pointer(x) \ (void) \ ( \ trace_pretest_ \ && \ ( \ trace_where_, \ trace_pointer_real(trace_stringize(x), &x), \ 0 \ ) \ ) void trace_pointer_real _((char *, void *)); #define trace_short(x) \ (void) \ ( \ trace_pretest_ \ && \ ( \ trace_where_, \ trace_short_real(trace_stringize(x), &x), \ 0 \ ) \ ) void trace_short_real _((char *, short *)); #define trace_short_unsigned(x) \ (void) \ ( \ trace_pretest_ \ && \ ( \ trace_where_, \ trace_short_unsigned_real(trace_stringize(x), &x), \ 0 \ ) \ ) void trace_short_unsigned_real _((char *, unsigned short *)); #define trace_string(x) \ (void) \ ( \ trace_pretest_ \ && \ ( \ trace_where_, \ trace_string_real(trace_stringize(x), x), \ 0 \ ) \ ) void trace_string_real _((char *, char *)); #else #define trace_char(x) #define trace_char_unsigned(x) #define trace_int(x) #define trace_int_unsigned(x) #define trace_long(x) #define trace_long_unsigned(x) #define trace_pointer(x) #define trace_short(x) #define trace_short_unsigned(x) #define trace_string(x) #endif #endif /* TRACE_H */ trace_char_unsigned_real(name, vp) char *name; unsigned char *vp; { trace_printf("%s = '", name); if (*vp < ' ' || *vp > '~' || strchr("(){}[]", *vp)) { char *s; s = strchr("\bb\nn\tt\rr\ff", *vp); if (s) { trace_putchar('\\'); trace_putchar(s[1]); } else trace_printf("\\%03o", *vp); recite.1.0/common/version.c 644 0 0 30641 5432053507 15151ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1991, 1992, 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: functions to report version */ #include #include #include #include #include #include #include #include static void version_copyright _((void)); static void version_copyright() { static char *text[] = { "%C" }; help(text, SIZEOF(text), (void (*)_((void)))0); } static void version_redistribution _((void)); static void version_redistribution() { static char *text[] = { " GNU GENERAL PUBLIC LICENSE", " TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION", "", " 0. This License Agreement 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 work containing the", "Program or a portion of it, either verbatim or with modifications. Each", "licensee is addressed as \"you\".", "", " 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", "General Public License and to the absence of any warranty; and give any", "other recipients of the Program a copy of this General Public License", "along with the Program. You may charge a fee for the physical act of", "transferring a copy.", "", " 2. You may modify your copy or copies of the Program or any portion of", "it, and copy and distribute such modifications under the terms of Paragraph", "1 above, provided that you also do the following:", "", " a) cause the modified files to carry prominent notices stating that", " you changed the files and the date of any change; and", "", " b) cause the whole of any work that you distribute or publish, that", " in whole or in part contains the Program or any part thereof, either", " with or without modifications, to be licensed at no charge to all", " third parties under the terms of this General Public License (except", " that you may choose to grant warranty protection to some or all", " third parties, at your option).", "", " c) If the modified program normally reads commands interactively when", " run, you must cause it, when started running for such interactive use", " in the simplest and most usual 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 General", " Public License.", "", " d) 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.", "", "Mere aggregation of another independent work with the Program (or its", "derivative) on a volume of a storage or distribution medium does not bring", "the other work under the scope of these terms.", "", " 3. You may copy and distribute the Program (or a portion or derivative of", "it, under Paragraph 2) in object code or executable form under the terms of", "Paragraphs 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", " Paragraphs 1 and 2 above; or,", "", " b) accompany it with a written offer, valid for at least three", " years, to give any third party free (except for a nominal charge", " for the cost of distribution) a complete machine-readable copy of the", " corresponding source code, to be distributed under the terms of", " Paragraphs 1 and 2 above; or,", "", " c) accompany it with the information you received as to where the", " corresponding source code may be obtained. (This alternative is", " allowed only for noncommercial distribution and only if you", " received the program in object code or executable form alone.)", "", "Source code for a work means the preferred form of the work for making", "modifications to it. For an executable file, complete source code means", "all the source code for all modules it contains; but, as a special", "exception, it need not include source code for modules which are standard", "libraries that accompany the operating system on which the executable", "file runs, or for standard header files or definitions files that", "accompany that operating system.", "", " 4. You may not copy, modify, sublicense, distribute or transfer the", "Program except as expressly provided under this General Public License.", "Any attempt otherwise to copy, modify, sublicense, distribute or transfer", "the Program is void, and will automatically terminate your rights to use", "the Program under this License. However, parties who have received", "copies, or rights to use copies, from you under this General Public", "License will not have their licenses terminated so long as such parties", "remain in full compliance.", "", " 5. By copying, distributing or modifying 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.", "", " 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.", "", " 7. 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 the 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", "the license, you may choose any version ever published by the Free Software", "Foundation.", "", " 8. 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.", }; help(text, SIZEOF(text), (void (*)_((void)))0); } static void version_warranty _((void)); static void version_warranty() { static char *text[] = { " NO WARRANTY", "", " 9. BECAUSE THE %s PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY", "FOR THE %s PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN", "OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES", "PROVIDE THE %s 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", "%s PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,", "REPAIR OR CORRECTION.", "", " 10. 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 %s 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 %s 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.", }; help(text, SIZEOF(text), (void (*)_((void)))0); } static void version_usage _((void)); static void version_usage() { fprintf(stderr, "usage: %s -VERSion [ ]\n", progname); fprintf(stderr, " %s -VERSion -Help\n", progname); exit(1); } typedef struct table_t table_t; struct table_t { char *name; void (*func)_((void)); }; static table_t table[] = { { "Copyright", version_copyright, }, { "Redistribution", version_redistribution, }, { "Warranty", version_warranty, }, }; static void version_main _((void)); static void version_main() { void (*func)_((void)); /* trace(("version_main()\n{\n"/ *}* /)); */ if (arglex_token == arglex_token_string) { int nhit; table_t *tp; table_t *hit[SIZEOF(table)]; int j; size_t len; char *buf; nhit = 0; for (tp = table; tp < ENDOF(table); ++tp) { if (arglex_compare(tp->name, arglex_value.alv_string)) hit[nhit++] = tp; } switch (nhit) { case 0: fatal ( "version information name \"%s\" unknown", arglex_value.alv_string ); case 1: break; default: len = strlen(hit[0]->name) + 1; for (j = 1; j < nhit; ++j) len += strlen(hit[j]->name) + 2; buf = mem_alloc(len); strcpy(buf, hit[j]->name); for (j = 1; j < nhit; ++j) { strcat(buf, ", "); strcat(buf, hit[j]->name); } fatal ( "version information name \"%s\" ambiguous (%s)", arglex_value.alv_string, buf ); } arglex(); func = hit[0]->func; } else func = version_copyright; if (arglex_token != arglex_token_eoln) version_usage(); func(); /* trace((/ *{* /"}\n")); */ } static void version_help _((void)); static void version_help() { static char *text[] = { "NAME", " %s -VERSion - give version information", "", "SYNOPSIS", " %s -VERSion [ ]", " %s -VERSion -Help", "", "DESCRIPTION", " The %s -VERSion command is used to give version", " information and conditions of use.", "", " There are a number of possible info-names, as follow", " (abbreviations as for command line options):", "", " Copyright", " The copyright notice for the %s program. Version", " information will also be printed.", " This is the default.", "", " Redistribution", " Print the conditions of use and redistribution.", "", " Warranty", " Print the limited warranty.", "", "OPTIONS", " The following options are understood:", "", " -Help", " This option may be used to obtain more", " information about how to use the %s program.", "", " All options are case insensitive. Options may be", " abbreviated; the abbreviation is the upper case letters.", " Options and other command line arguments may be mixed", " arbitrarily on the command line.", "", "ERRORS", " It is an error if the info-name given is unknown.", "", "EXIT STATUS", " The %s command will exit with a status of 1 on any", " error. The %s command will only exit with a status of", " 0 if there are no errors.", "", "COPYRIGHT", " %C", "", "AUTHOR", " %A", }; help(text, SIZEOF(text), version_usage); } void version() { /* trace(("version()\n{\n"/ *}* /)); */ switch (arglex()) { default: version_main(); break; case arglex_token_help: version_help(); break; } /* trace((/ *{* /"}\n")); */ } RISK AS", "TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE", "%s PROGRAMrecite.1.0/common/version.h 644 0 0 1721 5432053507 15133ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1990, 1991, 1992, 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: interface definition for common/version.c */ #ifndef VERSION_H #define VERSION_H #include void version _((void)); #endif /* VERSION_H */ -Help\n", progname); exit(1); } typedef strurecite.1.0/config 644 0 0 26303 5432053507 13220ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1991, 1992, 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: instructions to aegis, per-project configuration */ /* * how to build the project */ build_command = "cook -b ${s aux/Howto.cook} project=$p change=$c version=$v -nl"; /* * When do -Integrate_Begin, link the baseline to the integration directory, * rather than copying it. This should be much faster. * * There is a gotcha: all the recipes in Howto.cook must unlink their targets * before re-creating them, otherwise the baseline will be trashed. */ link_integration_directory = true; /* * create a new history */ history_create_command = "fhist ${b $h} -create -i $in -p ${d $h} -r"; /* * get a file from history */ history_get_command = "fhist ${b $h} -e '$edit' -o $out -p ${d $h} -v 0"; /* * add a new change to the history */ history_put_command = "fhist ${b $h} -u -i $in -p ${d $h} -r"; /* * query the topmost edit of a history file * Result to be printed on stdout. */ history_query_command = "fhist ${b $h} -l 0 -p ${d $h} -q"; /* * difference of 2 files */ diff_command = "fcomp -w -s $orig $in -o $out"; /* * difference of 3 files */ diff3_command = "fmerge $orig $mr $in -o $out -c /dev/null"; /* * whenever files are added to or removed from the change, * execute the following command. */ change_file_command = "rm -f .c_inclrc"; /* * new file templates */ file_template = [ { pattern = [ "*.[cyl]" ]; body ="\ /*\n\ * recite - english text speech synthesizer\n\ * Copyright (C) ${date %Y} Peter Miller.\n\ * All rights reserved.\n\ *\n\ * This program is free software; you can redistribute it and/or modify\n\ * it under the terms of the GNU General Public License as published by\n\ * the Free Software Foundation; either version 1, or (at your option)\n\ * any later version.\n\ *\n\ * This program is distributed in the hope that it will be useful,\n\ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ * GNU General Public License for more details.\n\ *\n\ * You should have received a copy of the GNU General Public License\n\ * along with this program; if not, write to the Free Software\n\ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n\ *\n\ * MANIFEST: functions to manipulate ${basename $fn .c}s\n\ */\n\ \n\ #include <${b $fn .c}.h>\n"; }, { pattern = [ "*.h" ]; body = "\ /*\n\ * recite - english text speech synthesizer\n\ * Copyright (C) ${date %Y} Peter Miller.\n\ * All rights reserved.\n\ *\n\ * This program is free software; you can redistribute it and/or modify\n\ * it under the terms of the GNU General Public License as published by\n\ * the Free Software Foundation; either version 1, or (at your option)\n\ * any later version.\n\ *\n\ * This program is distributed in the hope that it will be useful,\n\ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ * GNU General Public License for more details.\n\ *\n\ * You should have received a copy of the GNU General Public License\n\ * along with this program; if not, write to the Free Software\n\ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n\ *\n\ * MANIFEST: interface definition for ${b $fn .h}.c\n\ */\n\ \n\ #ifndef ${upcase ${id $fn}}\n\ #define ${upcase ${id $fn}}\n\ \n\ #include \n\ \n\ #endif /* ${upcase ${id $fn}} */\n"; }, { pattern = [ "test/*/*.sh" ]; body = "\ #! /bin/sh\n\ #\n\ # recite - english text speech synthesizer\n\ # Copyright (C) ${date %Y} Peter Miller.\n\ # All rights reserved.\n\ #\n\ # This program is free software; you can redistribute it and/or modify\n\ # it under the terms of the GNU General Public License as published by\n\ # the Free Software Foundation; either version 1, or (at your option)\n\ # any later version.\n\ #\n\ # This program is distributed in the hope that it will be useful,\n\ # but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ # GNU General Public License for more details.\n\ #\n\ # You should have received a copy of the GNU General Public License\n\ # along with this program; if not, write to the Free Software\n\ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n\ #\n\ # MANIFEST: Test the ??? functionality\n\ #\n\ \n\ work=/tmp/$$$$\n\ PAGER=cat\n\ export PAGER\n\ \n\ here=`pwd`\n\ if test $$? -ne 0 ; then exit 1; fi\n\ \n\ fail()\n\ {\n\ set +x\n\ echo FAILED test of ... 1>&2\n\ rm -rf $$work\n\ exit 1\n\ }\n\ pass()\n\ {\n\ set +x\n\ cd $$here\n\ rm -rf $$work\n\ exit 0\n\ }\n\ trap \"fail\" 1 2 3 15\n\ \n\ mkdir $$work\n\ if test $$? -ne 0 ; then exit 1; fi\n\ cd $$work\n\ if test $$? -ne 0 ; then fail; fi\n\ \n\ #\n\ # put your test here\n\ #\n\ $$here/myprog\n\ if test $$? -ne 0 ; then fail; fi\n\ \n\ #\n\ # Only definite negatives are possible.\n\ # The functionality exercised by this test appears to work,\n\ # no other guarantees are made.\n\ #\n\ pass\n"; }, { pattern = [ "*.sh" ]; body = "\ #! /bin/sh\n\ #\n\ # recite - english text speech synthesizer\n\ # Copyright (C) ${date %Y} Peter Miller.\n\ # All rights reserved.\n\ #\n\ # This program is free software; you can redistribute it and/or modify\n\ # it under the terms of the GNU General Public License as published by\n\ # the Free Software Foundation; either version 1, or (at your option)\n\ # any later version.\n\ #\n\ # This program is distributed in the hope that it will be useful,\n\ # but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ # GNU General Public License for more details.\n\ #\n\ # You should have received a copy of the GNU General Public License\n\ # along with this program; if not, write to the Free Software\n\ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n\ #\n\ # MANIFEST: shell script to ${b $fn .sh}\n\ #\n\ \n\ exit 0\n"; }, { pattern = [ "*.man", "*.[12345678]" ]; body = "\ '\\\" t\n\ .\\\" recite - english text speech synthesizer\n\ .\\\" Copyright (C) ${date %Y} Peter Miller.\n\ .\\\" All rights reserved.\n\ .\\\"\n\ .\\\" This program is free software; you can redistribute it and/or modify\n\ .\\\" it under the terms of the GNU General Public License as published by\n\ .\\\" the Free Software Foundation; either version 1, or (at your option)\n\ .\\\" any later version.\n\ .\\\"\n\ .\\\" This program is distributed in the hope that it will be useful,\n\ .\\\" but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ .\\\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ .\\\" GNU General Public License for more details.\n\ .\\\"\n\ .\\\" You should have received a copy of the GNU General Public License\n\ .\\\" along with this program; if not, write to the Free Software\n\ .\\\" Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n\ .\\\"\n\ .\\\" MANIFEST: manual page describing ${b $fn .1}\n\ .\\\"\n\ .TH recite 1\n\ .if n .ad l\n\ .if n .hy 0\n\ .SH NAME\n\ recite \\- english text speech synthesizer\n\ .SH SYNOPSIS\n\ .B recite\n\ [\n\ .IR option \\&...\n\ ]\n\ .IR filename \\&...\n\ .br\n\ .B recite\n\ .B -Help\n\ .br\n\ .B recite\n\ .B -VERSion\n\ .SH DESCRIPTION\n\ The\n\ .I recite\n\ program is used to\n\ .SH OPTIONS\n\ The following options are understood:\n\ .TP 8n\n\ .B -Help\n\ .br\n\ Provide some help with using the\n\ .I recite\n\ program.\n\ .TP 8n\n\ .B -VERSion\n\ .br\n\ Print the version of the\n\ .I recite\n\ program being executed.\n\ .PP\n\ All other options will produce a diagnostic error.\n\ Options may be abbreviated,\n\ the minimum abbreviation is shown in upper-case.\n\ Options are case insensitive.\n\ Options and file names may be mixed arbitrarily on the command line.\n\ .SH EXIT STATUS\n\ The\n\ .I recite\n\ program will exit with a status of 1 on any error.\n\ The\n\ .I recite\n\ program will only exit with a status of 0 if there are no errors.\n\ .SH COPYRIGHT\n\ .if t .ds C) \\(co\n\ .if n .ds C) (C)\n\ The\n\ .I recite\n\ program is Copyright \\*(C) ${date %Y} Peter Miller.\n\ .br\n\ All rights reserved.\n\ .PP\n\ The\n\ .I recite\n\ program comes with ABSOLUTELY NO WARRANTY;\n\ for details use the '\\fIrecite -VERSion Warranty\\fP' command.\n\ This is free software\n\ and you are welcome to redistribute it under certain conditions;\n\ for details use the '\\fIrecite -VERSion Redistribution\\fP' command.\n\ .SH AUTHOR\n\ .nf\n\ .ta 8n 16n 24n\n\ Peter Miller\tUUCP\tuunet!munnari!bmr.gov.au!pmiller\n\ /\\e/\\e*\t\tInternet\tpmiller@bmr.gov.au\n\ .fi\n"; }, { pattern = [ "*.so", "*.ms", "*.me" ]; body = "\ .\\\"\n\ .\\\" recite - english text speech synthesizer\n\ .\\\" Copyright (C) ${date %Y} Peter Miller.\n\ .\\\" All rights reserved.\n\ .\\\"\n\ .\\\" This program is free software; you can redistribute it and/or modify\n\ .\\\" it under the terms of the GNU General Public License as published by\n\ .\\\" the Free Software Foundation; either version 1, or (at your option)\n\ .\\\" any later version.\n\ .\\\"\n\ .\\\" This program is distributed in the hope that it will be useful,\n\ .\\\" but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ .\\\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ .\\\" GNU General Public License for more details.\n\ .\\\"\n\ .\\\" You should have received a copy of the GNU General Public License\n\ .\\\" along with this program; if not, write to the Free Software\n\ .\\\" Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n\ .\\\"\n\ .\\\" MANIFEST: document describing ${b $fn .ms}\n\ .\\\"\n"; }, { pattern = [ "*" ]; body = "\ #\n\ # recite - english text speech synthesizer\n\ # Copyright (C) ${date %Y} Peter Miller.\n\ # All rights reserved.\n\ #\n\ # This program is free software; you can redistribute it and/or modify\n\ # it under the terms of the GNU General Public License as published by\n\ # the Free Software Foundation; either version 1, or (at your option)\n\ # any later version.\n\ #\n\ # This program is distributed in the hope that it will be useful,\n\ # but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ # GNU General Public License for more details.\n\ #\n\ # You should have received a copy of the GNU General Public License\n\ # along with this program; if not, write to the Free Software\n\ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n\ #\n\ # MANIFEST: $fn\n\ #\n"; } ]; develop_begin_command = "ln -s $bl bl"; ful,\n\ .\\\" but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ .\\\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ .\\\" GNU General Public License for more details.\n\ .\\\"\n\ .\\\" You should have received a copy of the GNU General Public License\n\ .\\\" along with this prograrecite.1.0/english/english.c 644 0 0 23303 5432053507 15253ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: functions to translate english to phonemes */ #include #include #include #include #include #include #include #define THE_END -1 /* * maximum length of a word */ #define MAX_LENGTH 1000 static int Char, Char1, Char2, Char3; static char *get_byte_data; static long get_byte_pos; static long get_byte_len; static char *put_byte_data; static long put_byte_pos; static long put_byte_max; typedef struct peephole_ty peephole_ty; struct peephole_ty { char *pattern; char *replacement; }; static peephole_ty peephole[] = { { "AA?r", "(AXR)?", }, { "a?r", "(AXR)?", }, { "EH?r", "(EXR)?", }, { "IY?r", "(IXR)?", }, { "OW?r", "(OXR)?", }, { "AX?r", "(OXR)?", }, { "AO?r", "(OXR)?", }, { "UH?r", "(UXR)?", }, }; static void outchar _((int)); static void outchar(chr) int chr; { peephole_ty *p; if (put_byte_pos >= put_byte_max) { long nbytes; put_byte_max += (1L << 15); nbytes = put_byte_max + 6; /* for peephole */ if (!put_byte_data) put_byte_data = mem_alloc(nbytes); else mem_change_size(&put_byte_data, nbytes); } put_byte_data[put_byte_pos++] = chr; /* * see of any of the peephole optimizations apply */ for (p = peephole; p < ENDOF(peephole); ++p) { char *bp; char *cp; int match; int digit; bp = put_byte_data + put_byte_pos - 1; cp = p->pattern + strlen(p->pattern) - 1; match = 1; digit = 0; while (cp >= p->pattern) { int c1, c2; if (bp < put_byte_data) { match = 0; break; } c1 = *cp--; c2 = *bp--; if (c1 == '?') { if (c2 < '1' || c2 > '9') ++bp; else digit = c2; } else if (c1 != c2) { match = 0; break; } } if (match) { put_byte_pos = bp - put_byte_data + 1; for (cp = p->replacement; *cp; ++cp) { if (*cp == '?') { if (digit) put_byte_data[put_byte_pos++] = digit; } else put_byte_data[put_byte_pos++] = *cp; } break; } } } void english_outstring(string) char *string; { trace(("outstring(\"%s\")\n{\n"/*}*/, string)); while (*string) outchar(*string++); trace((/*{*/"}\n")); } static int makeupper _((int)); static int makeupper(character) int character; { if (islower(character)) return toupper(character); return character; } static int get_byte _((void)); static int get_byte() { if (get_byte_pos >= get_byte_len) return THE_END; return (unsigned char)get_byte_data[get_byte_pos++]; } static int new_char _((void)); static int new_char() { /* * If the cache is full of newline, time to prime the look-ahead * again. If an THE_END is found, fill the remainder of the queue with * THE_END's. */ if (Char == '\n' && Char1 == '\n' && Char2 == '\n' && Char3 == '\n') { /* prime the pump again */ Char = get_byte(); if (Char == THE_END) { Char1 = THE_END; Char2 = THE_END; Char3 = THE_END; return Char; } if (Char == '\n') return Char; Char1 = get_byte(); if (Char1 == THE_END) { Char2 = THE_END; Char3 = THE_END; return Char; } if (Char1 == '\n') return Char; Char2 = get_byte(); if (Char2 == THE_END) { Char3 = THE_END; return Char; } if (Char2 == '\n') return Char; Char3 = get_byte(); } else { /* * Buffer not full of newline, shuffle the characters and * either get a new one or propagate a newline or THE_END. */ Char = Char1; Char1 = Char2; Char2 = Char3; if (Char3 != '\n' && Char3 != THE_END) Char3 = get_byte(); } return Char; } static void have_dollars _((void)); static void have_dollars() { long int value; trace(("have_dollars()\n{\n"/*}*/)); value = 0L; for (new_char() ; isdigit(Char) || Char == ',' ; new_char()) { if (Char != ',') value = 10 * value + (Char-'0'); } say_cardinal(value); /* Say number of whole dollars */ /* Found a character that is a non-digit and non-comma */ /* Check for no decimal or no cents digits */ if (Char != '.' || !isdigit(Char1)) { if (value == 1L) xlate_word(" DOLLAR "); else xlate_word(" DOLLARS "); goto done; } /* We have '.' followed by a digit */ new_char(); /* Skip the period */ /* If it is ".dd " say as " DOLLARS AND n CENTS " */ if (isdigit(Char1) && !isdigit(Char2)) { if (value == 1L) xlate_word(" DOLLAR "); else xlate_word(" DOLLARS "); if (Char == '0' && Char1 == '0') { new_char(); /* Skip tens digit */ new_char(); /* Skip units digit */ goto done; } xlate_word(" AND "); value = (Char-'0')*10 + Char1-'0'; say_cardinal(value); if (value == 1L) xlate_word(" CENT "); else xlate_word(" CENTS "); new_char(); /* Used Char (tens digit) */ new_char(); /* Used Char1 (units digit) */ goto done; } /* Otherwise say as "n POINT ddd DOLLARS " */ xlate_word(" POINT "); for ( ; isdigit(Char) ; new_char()) { say_ascii(Char); } xlate_word(" DOLLARS "); done: trace((/*{*/"}\n")); } static void have_special _((void)); static void have_special() { trace(("have_special()\n{\n"/*}*/)); if (Char == '\n') outchar('\n'); else if (!isspace(Char)) say_ascii(Char); new_char(); trace((/*{*/"}\n")); } static void have_number _((void)); static void have_number() { long value; int lastdigit; trace(("have_number()\n{\n"/*}*/)); value = Char - '0'; lastdigit = Char; for (new_char() ; isdigit(Char) ; new_char()) { value = 10 * value + (Char-'0'); lastdigit = Char; } /* Recognize ordinals based on last digit of number */ switch (lastdigit) { case '1': /* ST */ if (makeupper(Char) == 'S' && makeupper(Char1) == 'T' && !isalpha(Char2) && !isdigit(Char2)) { say_ordinal(value); new_char(); /* Used Char */ new_char(); /* Used Char1 */ goto done; } break; case '2': /* ND */ if (makeupper(Char) == 'N' && makeupper(Char1) == 'D' && !isalpha(Char2) && !isdigit(Char2)) { say_ordinal(value); new_char(); /* Used Char */ new_char(); /* Used Char1 */ goto done; } break; case '3': /* RD */ if (makeupper(Char) == 'R' && makeupper(Char1) == 'D' && !isalpha(Char2) && !isdigit(Char2)) { say_ordinal(value); new_char(); /* Used Char */ new_char(); /* Used Char1 */ goto done; } break; case '0': case '4': case '5': case '6': case '7': case '8': case '9': /* TH */ if (makeupper(Char) == 'T' && makeupper(Char1) == 'H' && !isalpha(Char2) && !isdigit(Char2)) { say_ordinal(value); new_char(); /* Used Char */ new_char(); /* Used Char1 */ goto done; } break; } say_cardinal(value); /* Recognize decimal points */ if (Char == '.' && isdigit(Char1)) { xlate_word(" POINT "); for (new_char() ; isdigit(Char) ; new_char()) { say_ascii(Char); } } /* Spell out trailing abbreviations */ if (isalpha(Char)) { while (isalpha(Char)) { say_ascii(Char); new_char(); } } done: trace((/*{*/"}\n")); } /* * Handle abbreviations. Text in buff was followed by '.' */ static void abbrev _((char *)); static void abbrev(buff) char *buff; { trace(("abbrev()\n{\n"/*}*/)); if (strcmp(buff, " DR ") == 0) { xlate_word(" DOCTOR "); new_char(); } else if (strcmp(buff, " MR ") == 0) { xlate_word(" MISTER "); new_char(); } else if (strcmp(buff, " MRS ") == 0) { xlate_word(" MISSUS "); new_char(); } else if (strcmp(buff, " PHD ") == 0) { spell_word(" PHD "); new_char(); } else xlate_word(buff); trace((/*{*/"}\n")); } static void have_letter _((void)); static void have_letter() { int count; char buff[MAX_LENGTH]; trace(("have_letter()\n{\n"/*}*/)); count = 0; buff[count++] = ' '; /* Required initial blank */ buff[count++] = makeupper(Char); new_char(); while (isalpha(Char) || Char == '\'') { if (count < MAX_LENGTH - 2) buff[count++] = makeupper(Char); new_char(); } buff[count++] = ' '; /* Required terminating blank */ buff[count] = 0; /* Check for AAANNN type abbreviations */ if (isdigit(Char)) { spell_word(buff); goto done; } if (count == 3 && !isalpha(buff[1])) /* one character, two spaces */ say_ascii(buff[1]); else if (Char == '.') /* Possible abbreviation */ abbrev(buff); else xlate_word(buff); if (Char == '-' && isalpha(Char1)) new_char(); /* Skip hyphens */ done: trace((/*{*/"}\n")); } void english_to_phonemes(in, inlen, out_p, outlen_p) char *in; long inlen; char **out_p; long *outlen_p; { trace(("english_to_phonemes()\n{\n"/*}*/)); get_byte_data = in; get_byte_pos = 0; get_byte_len = inlen; put_byte_pos = 0; put_byte_max = 0; put_byte_data = 0; /* Prime the queue */ Char = '\n'; Char1 = '\n'; Char2 = '\n'; Char3 = '\n'; new_char(); while (Char != THE_END) { if (isdigit(Char)) have_number(); else if (isalpha(Char) || Char == '\'') have_letter(); else if (Char == '$' && isdigit(Char1)) have_dollars(); else have_special(); } if (put_byte_pos < put_byte_max) { put_byte_max = put_byte_pos; mem_change_size(&put_byte_data, put_byte_max); } *out_p = put_byte_data; *outlen_p = put_byte_pos; trace((/*{*/"}\n")); } void have_special() { trace(("have_special()\n{\n"/*}*/)); if (Char == '\n') outchar('\n'); else if (!isspace(Char)) say_ascii(Char); new_char(); trace((/*{*/"}\n")); } static void have_number _((void)); static void have_number() { long value; int lastdigit; trace(("have_number()\n{\n"/*}*/)); valuerecite.1.0/english/english.h 644 0 0 2075 5432053507 15243ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: interface definition for english/english.c */ #ifndef ENGLISH_H #define ENGLISH_H #include void english_to_phonemes _((char *in, long inlen, char **out, long *outlen)); /* * interface for internals */ void english_outstring _((char *)); #endif /* ENGLISH_H */ har2) && !isdigit(Char2)) { say_ordinal(value); new_char(); /* Used Char */ new_char(); /* Used Char1 */ goto done; } break; } say_cardinal(value); /* Recognize decimal points */ if (Char == '.' && isdigit(Char1)) { xlate_word(" POINT "); for (new_char() ; isdigit(Char) ; new_char()) { say_ascii(Char); } } /* Spell out trailing abbreviations */ if (isalpha(Char)) { while (isalpha(Char)) { say_ascii(Crecite.1.0/english/phoneme.c 644 0 0 20530 5432053507 15254ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: functions to scan translation table */ #include #include #include #define FALSE (0) #define TRUE (!0) #include #include #include #include /* * English to Phoneme translation. * * Rules are made up of four parts: * * The left context. * The text to match. * The right context. * The phonemes to substitute for the matched text. * * Procedure: * * Seperate each block of letters (apostrophes included) * and add a space on each side. For each unmatched * letter in the word, look through the rules where the * text to match starts with the letter in the word. If * the text to match is found and the right and left * context patterns also match, output the phonemes for * that rule and skip to the next unmatched letter. * * * Special Context Symbols: * * # One or more vowels * : Zero or more consonants * ^ One consonant. * . One of B, D, V, G, J, L, M, N, R, W or Z (voiced * consonants) * % One of ER, E, ES, ED, ING, ELY (a suffix) * (Right context only) * + One of E, I or Y (a "front" vowel) * @ one of T S R D L Z N J TH CH SH (left only) * & one of S C G Z X J CH SH (left only) * ? one or more digits (left and right) */ static int isvowel _((int)); static int isvowel(chr) int chr; { return (chr == 'A' || chr == 'E' || chr == 'I' || chr == 'O' || chr == 'U'); } static int isconsonant _((int)); static int isconsonant(chr) int chr; { return (isupper(chr) && !isvowel(chr)); } static int leftmatch _((char *pattern, char *context)); static int leftmatch(pattern, context) char *pattern; /* first char of pattern to match in text */ char *context; /* last char of text to be matched */ { char *pat; char *text; int count; if (*pattern == '\0') /* null string matches any context */ { return TRUE; } /* point to last character in pattern string */ count = strlen(pattern); pat = pattern + (count - 1); text = context; for (; count > 0; pat--, count--) { /* First check for simple text or space */ if (isalpha(*pat) || *pat == '\'' || *pat == ' ') if (*pat != *text) return FALSE; else { text--; continue; } switch (*pat) { case '#': /* One or more vowels */ if (!isvowel(*text)) return FALSE; text--; while (isvowel(*text)) text--; break; case ':': /* Zero or more consonants */ while (isconsonant(*text)) text--; break; case '^': /* One consonant */ if (!isconsonant(*text)) return FALSE; text--; break; case '?': /* one or more digits */ if (!isdigit(*text)) return FALSE; text--; while (isdigit(*text)) --text; break; case '.': /* B, D, V, G, J, L, M, N, R, W, Z */ if (*text != 'B' && *text != 'D' && *text != 'V' && *text != 'G' && *text != 'J' && *text != 'L' && *text != 'M' && *text != 'N' && *text != 'R' && *text != 'W' && *text != 'Z') return FALSE; text--; break; case '+': /* E, I or Y (front vowel) */ if (*text != 'E' && *text != 'I' && *text != 'Y') return FALSE; text--; break; case '@': /* T S R D L Z N J TH CH SH */ if (strchr("TSRDLZNJ", *text)) { --text; break; } if ( count > 1 && *text == 'H' && strchr("TSC", text[-1])) { text -= 2; break; } return 0; case '&': /* S C G Z X J CH SH */ if (strchr("SCGZXJ", *text)) { --text; break; } if ( count > 1 && *text == 'H' && strchr("SC", text[-1])) { text -= 2; break; } return 0; case '%': default: error("Bad char in left rule: '%c'", *pat); return FALSE; } } return TRUE; } static int rightmatch _((char *pattern, char *context)); static int rightmatch(pattern, context) char *pattern; /* first char of pattern to match in text */ char *context; /* last char of text to be matched */ { char *pat; char *text; if (*pattern == '\0') /* null string matches any context */ return TRUE; pat = pattern; text = context; for (pat = pattern; *pat != '\0'; pat++) { /* First check for simple text or space */ if (isalpha(*pat) || *pat == '\'' || *pat == ' ') if (*pat != *text) return FALSE; else { text++; continue; } switch (*pat) { case '#': /* One or more vowels */ if (!isvowel(*text)) return FALSE; text++; while (isvowel(*text)) text++; break; case '?': /* one or more digits */ if (!isdigit(*text)) return FALSE; text++; while (isdigit(*text)) text++; break; case ':': /* Zero or more consonants */ while (isconsonant(*text)) text++; break; case '^': /* One consonant */ if (!isconsonant(*text)) return FALSE; text++; break; case '.': /* B, D, V, G, J, L, M, N, R, W, Z */ if (*text != 'B' && *text != 'D' && *text != 'V' && *text != 'G' && *text != 'J' && *text != 'L' && *text != 'M' && *text != 'N' && *text != 'R' && *text != 'W' && *text != 'Z') return FALSE; text++; break; case '+': /* E, I or Y (front vowel) */ if (*text != 'E' && *text != 'I' && *text != 'Y') return FALSE; text++; break; case '%': /* ER, E, ES, ED, ING, ELY (a suffix) */ if (*text == 'E') { text++; if (*text == 'L') { text++; if (*text == 'Y') { text++; break; } else { text--; /* Don't gobble L */ break; } } else if (*text == 'R' || *text == 'S' || *text == 'D') text++; break; } else if (*text == 'I') { text++; if (*text == 'N') { text++; if (*text == 'G') { text++; break; } } return FALSE; } else return FALSE; default: error("Bad char in right rule:'%c'", *pat); return FALSE; } } return TRUE; } static int find_rule _((char *word, int index, rule_t *rules)); static int find_rule(word, index, rules) char *word; int index; rule_t *rules; { rule_t *rule; char *left, *match, *right, *output; int remainder; int result; trace(("find_rule(word = \"%s\", index = %d)\n{\n"/*}*/, word, index)); result = index; for (;;) { /* Search for the rule */ rule = rules++; match = rule->middle; if (!match) { /* bad symbol! */ error("no rule for \"%s\" at %d", word, index); /* Skip it! */ result = index + 1; break; } for (remainder = index; *match; match++, remainder++) { if (*match != word[remainder]) break; } if (*match) /* found missmatch */ continue; trace(("Word: \"%.*s/%s\"\n", index, word, word + index)); trace (( "Trying: \"%s/%s/%s\" -> \"%s\"\n", rule->left, rule->middle, rule->right, rule->output )); left = rule->left; right = rule->right; if (!leftmatch(left, &word[index - 1])) continue; trace(("leftmatch(\"%s\", \"%c\") succeded!\n", left, word[index-1])); if (!rightmatch(right, &word[remainder])) continue; trace(("rightmatch(\"%s\", \"%s\") succeded!\n", right, &word[remainder])); output = rule->output; trace(("Success:\n")); english_outstring(output); result = remainder; break; } trace(("return %d;\n", result)); trace((/*{*/"}\n")); return result; } void xlate_word(word) char *word; { int index; /* Current position in word */ int type; /* First letter of match part */ trace(("xlate_word(\"%s\")\n{\n"/*}*/, word)); index = 1; /* Skip the initial blank */ do { if (isupper(word[index])) type = word[index] - 'A' + 1; else type = 0; index = find_rule(word, index, english_rules[type]); } while (word[index]); trace((/*{*/"}\n")); } ase '%': default: error("Bad char in left rule: '%c'", *pat); return FALSE; } } return TRUE; } static int rightmatch _((char *pattern, char *context)); srecite.1.0/english/phoneme.h 644 0 0 1705 5432053507 15244ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: interface definition for english/phoneme.c */ #ifndef PHONEME_H #define PHONEME_H #include void xlate_word _((char *)); #endif /* PHONEME_H */ even the implied warranty of * MERCHANTABILITY or FITNESSrecite.1.0/english/rules.c 644 0 0 126140 5432053507 14777ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: tables to map english to phonemes * * * English to Phoneme rules. * * Derived from: * * AUTOMATIC TRANSLATION OF ENGLISH TEXT TO PHONETICS * BY MEANS OF LETTER-TO-SOUND RULES * * NRL Report 7948 * * January 21st, 1976 * Naval Research Laboratory, Washington, D.C. * * * Published by the National Technical Information Service as * document "AD/A021 929". * * * * The Phoneme codes: * * Vowels * AA fAther * AE fAt * AH bUt * AO lAWn * AW hOW * AX About * (AXR) bAR peephole * AY hIde * EH gEt * ER mURdER * (EXR) bARE peephole * EY gAte * IH bIt * IX Imp PM * (IXR) bEER peephole * IY bEEt * OW lOne * (OXR) bOAR peephole * OY tOY * UH fUll * UW fOOl * (UXR) pOOR peephole * YU YOU * * Sonorants: * EL as in? PM * h How * HX as in? PM * l Laugh * LX as in? PM * r Rate * RX as in? PM * w Wear * WH WHere * y Young * * Nasals: * EM as in? PM * EN as in? PM * m suM * n suN * NG suNG * * Fricatives: * DH eiTHer * f Fault * s Sue * SH leaSH * TH eTHer * v Vault * z Zoo * ZH leiSure * * Plosives: * b Back * d Dime * DX as in? PM * g Goat * GP as in? PM * k Coat * KP as in? PM * p Pack * t Time * TQ as in? PM * * Afficates: * CH CHar * j Jar * * Pseudo Vowels: * (AXP) as in? PM * * * * Rules are made up of four parts: * * The left context. * The text to match. * The right context. * The phonemes to substitute for the matched text. * * Procedure: * * Seperate each block of letters (apostrophes included) * and add a space on each side. For each unmatched * letter in the word, look through the rules where the * text to match starts with the letter in the word. If * the text to match is found and the right and left * context patterns also match, output the phonemes for * that rule and skip to the next unmatched letter. * * * Special Context Symbols: * * # One or more vowels * : Zero or more consonants * ^ One consonant. * . One of B, D, V, G, J, L, M, N, R, W or Z (voiced * consonants) * % One of ER, E, ES, ED, ING, ELY (a suffix) * (Found in right context only) * + One of E, I or Y (a "front" vowel) * @ one of T S R D L Z N J TH CH SH (left only) * & one of S C G Z X J CH SH (left only) * */ #include /* Context definitions */ static char Anything[] = ""; /* No context requirement */ static char Nothing[] = " "; /* Context is beginning or end of word */ /* Phoneme definitions */ static char Pause[] = " "; /* Short silence */ static char Silent[] = ""; /* No phonemes */ #define LEFT_PART 0 #define MATCH_PART 1 #define RIGHT_PART 2 #define OUT_PART 3 /*0 = Punctuation */ /* * LEFT_PART MATCH_PART RIGHT_PART OUT_PART */ static rule_t punct_rules[] = { {Anything, "0", Anything, " zIY4rOW " }, {Nothing, "1ST", Anything, "fER4st" }, {Nothing, "10TH", Anything, "tEH4nTH" }, {Nothing, "10 ", Anything, " tEH4n " }, {Anything, "1", Anything, " wAH4n " }, {Nothing, "2ND", Anything, "sEH4kAEnd" }, {Anything, "2", Anything, " tUW4 " }, {Nothing, "3RD", Anything, "THER4d" }, {Anything, "3", Anything, " THrIY4 " }, {Anything, "4", Anything, " fAX4r " }, {Nothing, "5TH", Anything, "fIH4fTH" }, {Anything, "5", Anything, " fAY4v " }, {Anything, "6", Anything, " sIH4ks " }, {Anything, "7", Anything, " sEH4vAEn " }, {Nothing, "8TH", Anything, "EY4TH" }, {Anything, "8", Anything, " EY4t " }, {Anything, "9", Anything, " nAY4n " }, {Anything, " ", "'", Silent }, {Anything, " ", Anything, Pause }, {Anything, "-", Anything, Silent }, {Anything, "...", Anything, " THrUW " }, {Anything, ".", "?", " pOY2nt " }, {Anything, ".", Nothing, "." }, {Anything, ".", Anything, Pause }, {Anything, "!", Anything, "." }, {Anything, "\"", Nothing, "-AH5nkwOWt- " }, {Anything, "\"", Anything, "kwOW4t-" }, {Anything, "##", Anything, "#" }, {Anything, "#", Anything, " nAH4mbER " }, {"C", "'S", Anything, "s" }, {"G", "'S", Anything, "z" }, {"&", "'S", Anything, "IHz" }, {".", "'S", Anything, "z" }, {"#:&E", "'S", Anything, "IHz" }, {"#:.E", "'S", Anything, "z" }, {"#:^E", "'S", Anything, "s" }, {"#", "'S", Anything, "z" }, {Anything, "'S", Anything, "s" }, {Anything, "'T", Anything, "t" }, {Anything, "'LL", Anything, "l" }, {Anything, "'D", Anything, "d" }, {Anything, "'M", Anything, "m" }, {Anything, "$", Anything, " dAA2lER " }, {Anything, "%", Anything, " pERsEH2nt " }, {Anything, "&", Anything, " AEnd " }, {Anything, "'", Anything, Silent }, {Anything, "*", Anything, " AE4stERIHsk " }, {Anything, "+", Anything, " plAH4s " }, {Anything, ",", Anything, Pause }, {Nothing, "-", Nothing, "-" }, {Anything, "-", Anything, Silent }, {Anything, "/", Anything, " slAE4SH " }, {Anything, ":", Anything, ". " }, {Anything, ";", Anything, "." }, {Anything, "<", Anything, " lEH4s DHAEn " }, {Anything, "=", Anything, " IY4kwAElz " }, {Anything, ">", Anything, " grEY4tER DHAEn " }, {Anything, "?", Anything, "." }, {Anything, "@", Anything, " AE6t " }, {Anything, "(", Anything, "," }, {Anything, ")", Anything, "," }, {Anything, "^", Anything, " kAE4rIHt " }, {Anything, "~", Anything, "nAA4t " }, {Anything, "\\", Anything, Pause }, {Anything, "[", Anything, Pause }, {Anything, "]", Anything, Pause }, {Anything, "{", Anything, Pause }, {Anything, "}", Anything, Pause }, {Anything, "|", Anything, "AX4r " }, {Anything, "_", Anything, Pause }, {Anything, "`", Anything, Pause }, {Anything, "", Anything, Pause }, {0, 0, 0, 0, }, }; /* * LEFT_PART MATCH_PART RIGHT_PART OUT_PART */ static rule_t A_rules[] = { {Nothing, "A. ", Anything, "EH4y. " }, {Anything, "A", Nothing, "AH" }, {Nothing, "ARE", Nothing, "AAr" }, {Nothing, "AREN'T", Nothing, "AA2rIHnt" }, {Nothing, "AND", Nothing, "AEnd" }, {Nothing, "AS", Nothing, "AEz" }, {Nothing, "AT", Nothing, "AEt" }, {Nothing, "AN", Nothing, "AEn" }, {Nothing, "AVE.", Nothing, "AE2vIHnUW" }, {Nothing, "AR", "O", "AXr" }, {Anything, "AR", "#", "EH4r" }, {" ^", "AS", "#", "EY4s" }, {Anything, "A", "WA", "AX" }, {Anything, "AW", Anything, "AO5" }, {" :", "ANY", Anything, "EH4nIY" }, {Anything, "A", "^+#", "EY5" }, {"#:", "ALLY", Anything, "AElIY" }, {Nothing, "AL", "#", "AEl" }, {Anything, "AGAIN", Anything, "AXgEH4n" }, {Anything, "ABOUT", Anything, "AXbAW1t" }, {Anything, "APPLE", Anything, "AE3pAEl" }, {"#:", "AG", "E", "IHj" }, {Anything, "A", "^%", "EY2" }, {Anything, "AL", "F ", "AE2" }, {Anything, "A", "^+:#", "AE1" }, {" :", "A", "^+ ", "EY4" }, {Nothing, "ARR", Anything, "AXr" }, {Anything, "ARR", Anything, "AE4r" }, {" :", "AR", Nothing, "AA5r" }, {Anything, "AR", Nothing, "ER" }, {Anything, "AR", Anything, "AA1r" }, {Anything, "AIR", Anything, "EH4r" }, {Anything, "AI", Anything, "EY4" }, {Anything, "AY", Anything, "EY5" }, {Anything, "AU", Anything, "AO4" }, {"#:", "AL", Nothing, "AEl" }, {"#:", "ALS", Nothing, "AElz" }, {Anything, "ALK", Anything, "AO4k" }, {Anything, "AL", "^", "AOl" }, {" :", "ABLE", Anything, "EY4bAEl" }, {Anything, "ABLE", Anything, "AXbAEl" }, {Anything, "A", "VO", "EY4" }, {Anything, "ANG", "+", "EY4nj" }, {Nothing, "AMIGA", Anything, "AHmIY5gAH" }, {Anything, "ATARI", Anything, "AHtAA4rIY" }, {Anything, "ATOMIC", Anything, "AHtAA4mIHk" }, {Anything, "A", "TOM", "AE2" }, {Anything, "A", "TTI", "AE" }, {Nothing, "AT", Nothing, "AEt" }, {Nothing, "A", "T", "AH" }, {Anything, "A", "A", Silent }, {Anything, "A", Anything, "AE" }, {0, 0, 0, 0, }, }; /* * LEFT_PART MATCH_PART RIGHT_PART OUT_PART */ static rule_t B_rules[] = { {Nothing, "B", Nothing, "bIY4" }, {Anything, "BECAUSE", Anything, "bIHkAH1z" }, {Nothing, "BE", "^#", "bIH" }, {Anything, "BEING", Anything, "bIY4IHNG" }, {Nothing, "BOTH", Nothing, "bOW4TH" }, {Nothing, "BY", Nothing, "bAY" }, {Nothing, "BUT", Nothing, "bAHt" }, {Nothing, "BEEN", Nothing, "bIHn" }, {Nothing, "BUS", "#", "bIH4z" }, {Anything, "BREAK", Anything, "brEY4k" }, {Anything, "BUIL", Anything, "bIH4l" }, {"B", "B", Anything, Silent }, {Anything, "B", Anything, "b" }, {0, 0, 0, 0, }, }; /* * LEFT_PART MATCH_PART RIGHT_PART OUT_PART */ static rule_t C_rules[] = { {Nothing, "C", Nothing, "sIY4" }, {Nothing, "CONSISTENT", Anything, "kAEnsIH5stIHnt" }, {Anything, "COMMODORE", Anything, "kAA4mAXdAXr" }, {Anything, "CERTAIN", Anything, "sER5tIHn" }, {Anything, "CONTOUR", Anything, "kAA5ntUH1r" }, {Nothing, "COS", Nothing, "kOW2sAY1n" }, {Nothing, "CH", "^", "k" }, {"^E", "CH", Anything, "k" }, {Anything, "CHA", "R#", "kEH5" }, {Anything, "CH", Anything, "CH" }, {" S", "CI", "#", "sAY4" }, {Anything, "CI", "A", "SH" }, {Anything, "CI", "O", "SH" }, {Anything, "CI", "EN", "SH" }, {Anything, "CITY", Anything, "sIHtIY" }, {Anything, "C", "+", "s" }, {Anything, "CK", Anything, "k" }, {Anything, "COM", "%", "kAHm" }, {Anything, "CUIT", Anything, "kIHt" }, {Anything, "CREA", "^+", "krIYEY4" }, {Anything, "CC", "+", "ks" }, {Anything, "CC", Anything, "k" }, {Anything, "C", Anything, "k" }, {0, 0, 0, 0, }, }; /* * LEFT_PART MATCH_PART RIGHT_PART OUT_PART */ static rule_t D_rules[] = { {Nothing, "DR.", Nothing, "dAA4ktER" }, {Nothing, "D", Nothing, " dIY4 " }, {"#:", "DED", Nothing, "dIHd" }, {".E", "D", Nothing, "d" }, {"#:^E", "D", Nothing, "t" }, {Nothing, "DE", "^#", "dIH1" }, {Nothing, "DO", Nothing, "dUW" }, {Nothing, "DOES", Anything, "dAHz" }, {Anything, "DONE", Nothing, "dAH5n" }, {Anything, "DOING", Anything, "dUW4IHNG" }, {Anything, "DOW", Anything, "dAW2" }, {"#", "DU", "A", "jUW" }, {Anything, "DUC", "+", "dUW4s" }, {"#", "DU", "^#", "jAX" }, {"D", "D", Anything, Silent }, {Anything, "DOLLAR", Anything, "dAA4lER" }, {Anything, "D", Anything, "d" }, {0, 0, 0, 0, }, }; /* * LEFT_PART MATCH_PART RIGHT_PART OUT_PART */ static rule_t E_rules[] = { {Nothing, "E", Nothing, "IY4" }, {"#:", "E", Nothing, Silent }, {"':^", "E", Nothing, Silent }, {" :", "E", Nothing, "IY" }, {"#", "ED", Nothing, "d" }, {"#:", "E", "D ", Silent }, {Anything, "EV", "ER", "EH4v" }, {"#:", "ERED", Nothing, "ERd" }, {"#:", "ERING", Anything, "ERIHNG" }, {"#:", "EN", Nothing, "EHn" }, {"#:", "ENED", Nothing, "EHnd" }, {"#:", "ENESS", Nothing, "nEHs" }, {Anything, "EDGE", Anything, "EHj" }, {Anything, "ENG", "ISH", "IY3NGg" }, {Anything, "E", "^%", "IY4" }, {Anything, "ERI", "#", "IY4rIY" }, {Anything, "ERI", Anything, "EH4rIH" }, {"#:", "ER", "#", "ER1" }, {Anything, "ERROR", Anything, "EH4rAXr" }, {Anything, "ERAS", "E", "IHrEY5s" }, {Anything, "ER", "#", "EH1r" }, {"#:", "ER", Nothing, "ER" }, {"#:", "ERS", Nothing, "ERz" }, {Anything, "ER", Anything, "ER" }, {Nothing, "EVEN", Anything, "IYvEHn" }, {"#:", "E", "W", Silent }, {"@", "EW", Anything, "UW1" }, {Anything, "EW", Anything, "yUW1" }, {Anything, "E", "O", "IY" }, {"#:&", "ES", Nothing, "IHz" }, {"#:", "E", "S ", Silent }, {"#:", "ELY", Nothing, "lIY" }, {"#:", "EMENT", Anything, "mEHnt" }, {Anything, "EFUL", Anything, "fUHl" }, {Anything, "EE", Anything, "IY4" }, {Anything, "EARN", Anything, "ER5n" }, {Nothing, "EAR", "^", "ER5" }, {Anything, "EAD", Anything, "EH1d" }, {"#:", "EA", Nothing, "IYAH" }, {Anything, "EA", "SU", "EH5" }, {Anything, "EA", Anything, "IY5" }, {Anything, "EIGH", Anything, "EY4" }, {Anything, "EI", Anything, "IY4" }, {Nothing, "EYE", Anything, "AY4" }, {Anything, "EY", Anything, "IY1" }, {Anything, "EU", Anything, "yUW5" }, {Anything, "EQUAL", Anything, "IY5kwAEl" }, {Anything, "E", Anything, "EH1" }, {0, 0, 0, 0, }, }; /* * LEFT_PART MATCH_PART RIGHT_PART OUT_PART */ static rule_t F_rules[] = { {Nothing, "F", Nothing, "EH4f" }, {Nothing, "FOR", Nothing, "fAXr" }, {Nothing, "FROM", Nothing, "frAHm" }, {Nothing, "FT.", Nothing, "fIY2t" }, {Anything, "FUL", Anything, "fUHl" }, {Anything, "FRIEND", Anything, "frEH5nd" }, {Anything, "FE", "MALE", "fIY4" }, {Anything, "FATHER", Anything, "fAA4DHER" }, {Anything, "F", "F", Silent }, {Anything, "F", Anything, "f" }, {0, 0, 0, 0, }, }; /* * LEFT_PART MATCH_PART RIGHT_PART OUT_PART */ static rule_t G_rules[] = { {Nothing, "G", Nothing, " jIY4 " }, {Anything, "GIV", Anything, "gIH5v" }, {Nothing, "G", "I^", "g" }, {Anything, "GE", "T", "gEH5" }, {"SU", "GGES", Anything, "gjEH4s" }, {Anything, "GG", Anything, "g" }, {" B#", "G", Anything, "g" }, {Anything, "G", "+", "j" }, {Anything, "GREAT", Anything, "grEY4t" }, {Anything, "GON", "E", "gAA3n" }, {"#", "GH", Anything, Silent }, {Nothing, "GN", Anything, "n" }, {Anything, "G", Anything, "g" }, {0, 0, 0, 0, }, }; /* * LEFT_PART MATCH_PART RIGHT_PART OUT_PART */ static rule_t H_rules[] = { {Nothing, "H", Nothing, "EY4CH" }, {Nothing, "HAV", Anything, "hAEv" }, {Nothing, "HAS", Nothing, "hAEz" }, {Nothing, "HAD", Nothing, "hAEd" }, {Nothing, "HERE", Anything, "hIYr" }, {Nothing, "HOUR", Anything, "AW5ER" }, {Anything, "HOW", Anything, "hAW" }, {Anything, "H", "#", "h" }, {Anything, "H", Anything, Silent }, {0, 0, 0, 0, }, }; /* * LEFT_PART MATCH_PART RIGHT_PART OUT_PART */ static rule_t I_rules[] = { {Nothing, "IN", Nothing, "IHn" }, {Nothing, "IBM", Nothing, "AY5 bIY EH5m" }, {Anything, "ISLA", "ND", "AY3lIX" }, {Nothing, "IN", Anything, "IH4n" }, {"#:", "I", "NG", "IH" }, {Nothing, "IS", Nothing, "IHz" }, {Nothing, "IF", Nothing, "IHf" }, {Nothing, "INTO", Nothing, "IH2ntUW" }, {Nothing, "I", Nothing, "AY4" }, {Anything, "I", Nothing, "AY" }, {Anything, "IN", "D", "AY5n" }, {"SEM", "I", Anything, "IY" }, {" ANT", "I", Anything, "AY" }, {Anything, "IER", Anything, "IY1ER" }, {"#:R", "IED", Anything, "IYd" }, {Anything, "IED", Nothing, "AY5d" }, {Anything, "IEN", Anything, "IYEHn" }, {Anything, "IE", "T", "AY4EH" }, {Anything, "I'", Anything, "AY5" }, {" :", "I", "^%", "AY5" }, {" :", "I", "%", "AY5" }, {Anything, "I", "%", "IY" }, {Anything, "IE", Anything, "IY4" }, {Nothing, "IDEA", Anything, "AYdIY5AH" }, {Anything, "I", "^+:#", "IH" }, {"#:", "I", "^AL", "IH" }, {Anything, "IR", "#", "AY1r" }, {Anything, "IZ", "%", "AY1z" }, {Anything, "IS", "%", "AY4z" }, {Anything, "I", "D%", "AY4" }, {"#:", "ITY", Nothing, "IHtIY" }, {"I^", "I", "^#", "IH1" }, {"+^", "I", "^+", "AY1" }, {Anything, "I", "T%", "AY2" }, {"#:^", "I", "^%", "AY2" }, {"#:^", "I", "^+", "IH1" }, {Anything, "I", "^+", "AY1" }, {Anything, "IR", Anything, "ER1" }, {Anything, "IGH", Anything, "AY4" }, {Anything, "ILD", Anything, "AY5ld" }, {Nothing, "IGN", Anything, "IHgn" }, {Anything, "IGN", Nothing, "AY4n" }, {Anything, "IGN", "^", "AY4n" }, {Anything, "IGN", "%", "AY4n" }, {"#:", "IC", Nothing, "IHk" }, {Anything, "ICRO", Anything, "AY5krOW" }, {Anything, "IQUE", Anything, "IY4k" }, {Anything, "I", Anything, "IH1" }, {0, 0, 0, 0, }, }; /* * LEFT_PART MATCH_PART RIGHT_PART OUT_PART */ static rule_t J_rules[] = { {Nothing, "J", Nothing, "jEY4" }, {Anything, "JOSE", "PH", "jOW5sIH" }, {"J", "J", Anything, Silent }, {Anything, "J", Anything, "j" }, {0, 0, 0, 0, }, }; /* * LEFT_PART MATCH_PART RIGHT_PART OUT_PART */ static rule_t K_rules[] = { {Nothing, "K", Nothing, "kEY4" }, {Anything, "KNOW", "L", "nAA4" }, {Nothing, "K", "N", Silent }, {"K", "K", Anything, Silent }, {Anything, "K", Anything, "k" }, {0, 0, 0, 0, }, }; /* * LEFT_PART MATCH_PART RIGHT_PART OUT_PART */ static rule_t L_rules[] = { {Nothing, "L", Nothing, "EH4l" }, {Anything, "LIV", "ELY", "lAY3v" }, {Nothing, "LIV", "%", "lIH4v" }, {Nothing, "LIV", "ING", "lIH3v" }, {Nothing, "LISA", Nothing, "lIY5sAH" }, {Anything, "LEVEL", Anything, "lEH4vAEl" }, {Anything, "LISTEN", Anything, "lIH4sIHn" }, {Nothing, "LB.", Nothing, "pAW3ndz" }, {Nothing, "LN", Nothing, "lAO2g" }, {Anything, "LO", "C#", "lOW1" }, {"L", "L", Anything, Silent }, {"#:^", "L", "%", "AEl" }, {Anything, "LEAD", Anything, "lIYd" }, {Nothing, "LAUGH", Anything, "lAE4f" }, {Anything, "L", Anything, "l" }, {0, 0, 0, 0, }, }; /* * LEFT_PART MATCH_PART RIGHT_PART OUT_PART */ static rule_t M_rules[] = { {Anything, "MACINTO", "SH", "mAE5kIHntAA1" }, {Anything, "MACINTAL", "K", "mAE5kIHntAO1" }, {Anything, "MAJ", "OR ", "mEY4j" }, {Nothing, "MR.", Nothing, "mIH2stER" }, {Nothing, "MS.", Anything, "mIH5z" }, {Nothing, "MRS.", Nothing, "mIH2sIXz" }, {Nothing, "MI.", Nothing, "mAY2lz" }, {Nothing, "M", Nothing, "EH3m" }, {Anything, "MOV", Anything, "mUW4v" }, {Anything, "MACHIN", Anything, "mAHSHIY5n" }, {"M", "M", Anything, Silent }, {Anything, "M", Anything, "m" }, {0, 0, 0, 0, }, }; /* * LEFT_PART MATCH_PART RIGHT_PART OUT_PART */ static rule_t N_rules[] = { {Nothing, "N", Nothing, "EH4n" }, {"E", "NG", "+", "nj" }, {Anything, "NG", "R", "NGg" }, {Anything, "NG", "#", "NGg" }, {Anything, "NGL", "%", "NGgAEl" }, {Anything, "NG", Anything, "NG" }, {Anything, "NK", Anything, "NGk" }, {Nothing, "NOW", Nothing, "nAW4" }, {"N", "N", Anything, Silent }, {Anything, "NON", "E", "nAH4n" }, {Anything, "NEU", Anything, "nUW2" }, {Anything, "N", Anything, "n" }, {0, 0, 0, 0, }, }; /* * LEFT_PART MATCH_PART RIGHT_PART OUT_PART */ static rule_t O_rules[] = { {Nothing, "O", Nothing, "OW4" }, {Anything, "OF", Nothing, "AHv" }, {Nothing, "ON", Nothing, "AAn" }, {Nothing, "OH", Nothing, "OW5" }, {Anything, "OROUGH", Anything, "ER4OW" }, {"#:", "OR", Nothing, "ER" }, {Nothing, "OZ.", Nothing, "AW2nsIHz" }, {Nothing, "OR", Nothing, "AXr" }, {Anything, "OR", Nothing, "ER" }, {"#:", "ORS", Nothing, "ERz" }, {Anything, "ORE", "^ ", "OWr" }, {Anything, "OR", Anything, "AXr" }, {"H", "ONEY", Anything, "AHnIY" }, {"M", "ONEY", Anything, "AHnIY" }, {Anything, "OR", Anything, "OWr" }, {Nothing, "ONE", Anything, "wAH5n" }, {"#", "ONE", Nothing, "wAH1n" }, {Anything, "OW", Anything, "OW1" }, {Nothing, "OVER", Anything, "OW5vER" }, {"R", "O", "L", "AX2" }, {"PR", "O", "V%", "UW4" }, {"PR", "O", "VING", "UW4" }, {"PR", "O", "V", "AX" }, {Anything, "OV", Anything, "AH4v" }, {Anything, "OL", "K", "OW3" }, {Anything, "OL", "T", "AX2l" }, {Anything, "OL", "D", "AX2l" }, {Anything, "O", "^%", "OW5" }, {Anything, "O", "^EN", "OW4" }, {Anything, "O", "^I#", "OW5" }, {Anything, "OL", "D", "OW4l" }, {Anything, "OUGHT", Anything, "AO5t" }, {Anything, "OUGH", Anything, "AH5f" }, {Nothing, "OU", Anything, "AW" }, {"H", "OU", "S#", "AW4" }, {Anything, "OUS", Anything, "AXs" }, {Anything, "OUR", Anything, "AX1r" }, {Anything, "OULD", Anything, "UH5d" }, {"^", "OU", "^L", "AH5" }, {Anything, "OUP", Anything, "UW5p" }, {Anything, "OU", Anything, "AW1" }, {Anything, "OY", Anything, "OY1" }, {Anything, "OING", Anything, "OW4IHNG" }, {Anything, "OI", Anything, "OY5" }, {Anything, "OOR", Anything, "UH5r" }, {Anything, "OOK", Anything, "UH5k" }, {"F", "OOD", Anything, "UW5d" }, {"L", "OOD", Anything, "AH5d" }, {"M", "OOD", Anything, "UW5d" }, {Anything, "OOD", Anything, "UH5d" }, {"F", "OOT", Anything, "UH5t" }, {Anything, "OO", Anything, "UW5" }, {Anything, "O'", Anything, "AX" }, {Anything, "O", "E", "OW1" }, {Anything, "O", Nothing, "OW1" }, {Anything, "OA", Anything, "OW4" }, {Nothing, "ONLY", Anything, "OW4nlIY" }, {Nothing, "ONCE", Anything, "wAH4ns" }, {Anything, "ON'T", Anything, "OW4nt" }, {" C", "O", "N", "AX" }, {"C", "O", "N", "AA1" }, {Anything, "O", "NG", "AO1" }, {" :^", "O", "N", "AH1" }, {"I", "ON", Anything, "AEn" }, {"#:", "ON", Nothing, "AEn" }, {"#^", "ON", Anything, "AEn" }, {"FR", "O", "ST", "AO4" }, {"L", "O", "ST", "AO4" }, {"C", "O", "ST", "AO4" }, {Anything, "O", "ST%", "OW4" }, {Anything, "O", "ST ", "OW5" }, {Anything, "OF", "^", "AO4f" }, {Anything, "OTHER", Anything, "AH5DHER" }, {"R", "O", "B", "AA1" }, {"PR", "O", ":#", "OW5" }, {Anything, "OSS", Nothing, "AA5s" }, {"#:^", "OM", Anything, "AHm" }, {Anything, "O", Anything, "AA1" }, {0, 0, 0, 0, }, }; /* * LEFT_PART MATCH_PART RIGHT_PART OUT_PART */ static rule_t P_rules[] = { {Nothing, "P", Nothing, "pIY4" }, {Anything, "PH", Anything, "f" }, {Anything, "PEOPL", Anything, "pIY5pAEl" }, {Anything, "PURPOSE", Anything, "pER5pAXs" }, {Anything, "PIT", "CH", "pIH5" }, {Anything, "POW", Anything, "pAW4" }, {Anything, "PUT", Nothing, "pUHt" }, {Anything, "P", "P", Silent }, {Nothing, "P", "N", Silent }, {Nothing, "P", "S", Silent }, {Nothing, "PROF.", Anything, "prAXfEH4sER" }, {Anything, "P", Anything, "p" }, {0, 0, 0, 0, }, }; /* * LEFT_PART MATCH_PART RIGHT_PART OUT_PART */ static rule_t Q_rules[] = { {Nothing, "Q", Nothing, "kyUW4" }, {"S", "QUAR", Anything, "kwEH4r" }, {Anything, "QUAR", Anything, "kwAX5r" }, {Anything, "QUA", "L", "kwAA3" }, {Anything, "QU", Anything, "kw" }, {"Q", "Q", Anything, Silent }, {Anything, "Q", Anything, "k" }, {0, 0, 0, 0, }, }; /* * LEFT_PART MATCH_PART RIGHT_PART OUT_PART */ static rule_t R_rules[] = { {Nothing, "R", Nothing, "AA4r" }, {Anything, "READY", Anything, "rEH5dIY" }, {Anything, "READ", Anything, "rIY4d" }, {Nothing, "RE", "^#", "rIY1" }, {Anything, "R", "R", Silent }, {Anything, "R", Anything, "r" }, {0, 0, 0, 0, }, }; /* * LEFT_PART MATCH_PART RIGHT_PART OUT_PART */ static rule_t S_rules[] = { {Nothing, "S", Nothing, "EH4s" }, {Nothing, "SO", Nothing, "sOW" }, {Anything, "SH", Anything, "SH" }, {"#", "SION", Anything, "ZHAEn" }, {Anything, "SOME", Anything, "sAHm" }, {"#", "SUR", "#", "ZHER" }, {Anything, "SUR", "#", "SHER" }, {"#", "SU", "#", "ZHUW" }, {"#", "SSU", "#", "SHUW" }, {"#", "SED", Nothing, "zd" }, {Anything, "SIS", Anything, "sIH1s" }, {Nothing, "ST.", Nothing, "strIY2t" }, {"#", "S", "#", "z" }, {Anything, "SAID", Anything, "sEH2d" }, {Anything, "SAYS", Anything, "sEH2z" }, {Nothing, "SIN", Nothing, "sAY2n" }, {"^", "SION", Anything, "SHAEn" }, {Anything, "S", "S", Silent }, {".", "S", Nothing, "z" }, {"#:.E", "S", Nothing, "z" }, {"#:^##", "S", Nothing, "z" }, {"#:^#", "S", Nothing, "s" }, {"U", "S", Nothing, "s" }, {" :#", "S", Nothing, "z" }, {"##", "S", Nothing, "z" }, {Nothing, "SCH", Anything, "sk" }, {Anything, "S", "C+", Silent }, {"#", "SM", Anything, "zAEm" }, {"#", "SN", "'", "zAEn" }, {Anything, "STLE", Anything, "sAEl" }, {Anything, "S", Anything, "s" }, {0, 0, 0, 0, }, }; /* * LEFT_PART MATCH_PART RIGHT_PART OUT_PART */ static rule_t T_rules[] = { {Nothing, "T", Nothing, "tIY4" }, {Nothing, "THE", " #", "DHIY" }, {Nothing, "THE", Nothing, "DHAX" }, {Anything, "TO", Nothing, "tUW" }, {Nothing, "THAT", Anything, "DHAEt" }, {Nothing, "THIS", Nothing, "DHIHs" }, {Nothing, "THEY", Anything, "DHEY1" }, {Nothing, "THERE", Anything, "DHEH1r" }, {Anything, "THER", Anything, "DHER" }, {Anything, "THEIR", Anything, "DHEH2r" }, {Nothing, "THAN", Nothing, "DHAEn" }, {Nothing, "THEM", Nothing, "DHEH2m" }, {Anything, "THESE", Nothing, "DHIYz" }, {Nothing, "THEN", Anything, "DHEH1n" }, {Anything, "THROUGH", Anything, "THrUW4" }, {Anything, "THOSE", Anything, "DHAX1z" }, {Anything, "THOUGH", Nothing, "DHOW1" }, {Anything, "TODAY", Anything, "tUWdEY5" }, {Anything, "TOMO", "RROW", "tAEmAA5" }, {Anything, "TO", "TAL", "tOW5" }, {Nothing, "THUS", Anything, "DHAH4s" }, {Anything, "TH", Anything, "TH" }, {"#:", "TED", Nothing, "tIXd" }, {"S", "TI", "#N", "CH" }, {Anything, "TI", "O", "SH" }, {Anything, "TI", "A", "SH" }, {Anything, "TIEN", Anything, "SHAEn" }, {Anything, "TUR", "#", "CHER" }, {Anything, "TU", "A", "CHUW" }, {Nothing, "TWO", Anything, "tUW5" }, {"&", "T", "EN", Silent }, {"F", "T", "EN", Silent }, {Anything, "T", "T", Silent }, {Anything, "T", Anything, "t" }, {0, 0, 0, 0, }, }; /* * LEFT_PART MATCH_PART RIGHT_PART OUT_PART */ static rule_t U_rules[] = { {Nothing, "U", Nothing, "yUW4" }, {Nothing, "UN", "I", "yUWn" }, {Nothing, "UN", Anything, "AH1n" }, {Nothing, "UPON", Anything, "AXpAA3n" }, {"@", "UR", "#", "UH4r" }, {Anything, "UR", "#", "yUH4r" }, {Anything, "UR", Anything, "ER1" }, {Anything, "U", "^ ", "AH" }, {Anything, "U", "^^", "AH5" }, {Anything, "UY", Anything, "AY5" }, {" G", "U", "#", Silent }, {"G", "U", "%", Silent }, {"G", "U", "#", "w" }, {"#N", "U", Anything, "yUW1" }, {"@", "U", Anything, "UW1" }, {"U", "U", Anything, Silent }, {Nothing, "USA", Nothing, "yUW5EHsEY2" }, {Anything, "U", Anything, "yUW1" }, {0, 0, 0, 0, }, }; /* * LEFT_PART MATCH_PART RIGHT_PART OUT_PART */ static rule_t V_rules[] = { {Nothing, "V", Nothing, "vIY4" }, {Anything, "VIEW", Anything, "vyUW5" }, {Anything, "VOCABULAR", Anything, "vAXkAE4bYUlEHr" }, {"V", "V", Anything, Silent }, {Anything, "V", Anything, "v" }, {0, 0, 0, 0, }, }; /* * LEFT_PART MATCH_PART RIGHT_PART OUT_PART */ static rule_t W_rules[] = { {Nothing, "W", Nothing, "dAH4bAElyUW" }, {Nothing, "WIZARD", Anything, "wIH4zERd" }, {Nothing, "WERE", Anything, "wER" }, {Anything, "WA", "SH", "wAA2" }, {Anything, "WA", "ST", "wEY2" }, {Anything, "WA", "S", "wAH1" }, {Anything, "WA", "T", "wAA1" }, {Anything, "WHERE", Anything, "WHEH1r" }, {Anything, "WHAT", Anything, "WHAHt" }, {Anything, "WHOL", Anything, "hOW2l" }, {Anything, "WHO", Anything, "hUW" }, {Anything, "WH", Anything, "w" }, {Anything, "WAR", "#", "wEH2r" }, {Anything, "WAR", Anything, "wAO5r" }, {Anything, "WOR", "^", "wER" }, {Anything, "WR", Anything, "r" }, {Anything, "WOM", "A", "wUH5m" }, {Anything, "WOM", "E", "wIH5m" }, {Anything, "WEA", "R", "wEH" }, {Anything, "WANT", Anything, "wAA5nt" }, {"ANS", "WER", Anything, "ER" }, {"W", "W", Anything, Silent }, {Anything, "W", Anything, "w" }, {0, 0, 0, 0, }, }; /* * LEFT_PART MATCH_PART RIGHT_PART OUT_PART */ static rule_t X_rules[] = { {"?", "X", "?", " bAY " }, {"? ", "X", " ?", "bAY" }, {Nothing, "X", Nothing, "EH4ks" }, {Nothing, "X", Anything, "z" }, {"X", "X", Anything, Silent }, {Anything, "XC", "+", "ks" }, {Anything, "X", Anything, "ks" }, {0, 0, 0, 0, }, }; /* * LEFT_PART MATCH_PART RIGHT_PART OUT_PART */ static rule_t Y_rules[] = { {Nothing, "Y", Nothing, "wAY4" }, {Anything, "YOUNG", Anything, "yAH2NG" }, {Nothing, "YOUR", Anything, "yAXr" }, {Nothing, "YOU", Anything, "yUW" }, {Nothing, "YES", Anything, "yEH2s" }, {Nothing, "Y", Anything, "y" }, {"F", "Y", Anything, "AY" }, {"PS", "YCH", Anything, "AY1k" }, {"#:^", "Y", Nothing, "IY" }, {"#:^", "Y", "I", "IY" }, {" :", "Y", Nothing, "AY" }, {" :", "Y", "#", "AY" }, {" :", "Y", "^+:#", "IH" }, {" :", "Y", "^#", "AY" }, {"Y", "Y", Anything, Silent }, {Anything, "Y", Anything, "IH" }, {0, 0, 0, 0, }, }; /* * LEFT_PART MATCH_PART RIGHT_PART OUT_PART */ static rule_t Z_rules[] = { {Nothing, "Z", Nothing, "zIY4" }, {"Z", "Z", Anything, Silent }, {Anything, "Z", Anything, "z" }, {0, 0, 0, 0, }, }; rule_t *english_rules[] = { punct_rules, A_rules, B_rules, C_rules, D_rules, E_rules, F_rules, G_rules, H_rules, I_rules, J_rules, K_rules, L_rules, M_rules, N_rules, O_rules, P_rules, Q_rules, R_rules, S_rules, T_rules, U_rules, V_rules, W_rules, X_rules, Y_rules, Z_rules }; _t V_rules[] = { {Nothing, "V", Nothing, "vIY4" }, {Anything, "VIEW", Anything, "vyUW5" }, {Anything, "VOCABULAR", Anything, "vAXkAE4bYUlEHr" }, {"V", "V", Anything, Silent }, {Anything, "V", Anything, "v" }, {0, 0, 0, 0, }, }; /* * LEFT_PART MATCH_PART RIGHT_PART OUT_PART */ static rule_recite.1.0/english/rules.h 644 0 0 2053 5432053507 14740ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: interface definition for english/rules.c */ #ifndef RULES_H #define RULES_H #include typedef struct rule_t rule_t; struct rule_t { char *left; char *middle; char *right; char *output; }; extern rule_t *english_rules[]; #endif /* RULES_H */ T", Anything, "WHAHt" }, {Anything, "WHOL", Anything, "hOW2l" }, {Anything, "WHO", Anything, "hUW" }, {Anything, "WH", Anything, "w" }, {Anything, "WAR", "#", "wEH2r" }, {Anything, "WAR", Anything, "wAO5r" }, {Anything, "WOR", "^", "wER" }, {Anything, "WR", Anything, "r" }, {Anything, "WOM", recite.1.0/english/saynum.c 644 0 0 10643 5432053507 15141ustar PeterMiller 0 0 #include #include /* * Integer to Readable ASCII Conversion Routine. * * Synopsis: * * say_cardinal(value) * long int value; -- The number to output * * The number is translated into a string of phonemes * */ static char *Cardinals[] = { " ZERO ", " ONE ", " TWO ", " THREE ", " FOUR ", " FIVE ", " SIX ", " SEVEN ", " EIGHT ", " NINE ", " TEN ", " ELEVEN ", " TWELVE ", " THIRTEEN ", " FOURTEEN ", " FIFTEEN ", " SIXTEEN ", " SEVENTEEN ", " EIGHTEEN ", " NINETEEN " }; static char *Twenties[] = { " TWENTY ", " THIRTY ", " FOURTY ", " FIFTY ", " SIXTY ", " SEVENTY ", " EIGHTY ", " NINETY " }; static char *Ordinals[] = { " ZEROTH ", " FIRST ", " SECOND ", " THIRD ", " FOURTH ", " FIFTH ", " SIXTH ", " SEVENTH ", " EIGHTH ", " NINTH ", " TENTH ", " ELEVENTH ", " TWELFTH ", " THIRTEENTH ", " FOURTEENTH ", " FIFTEENTH ", " SIXTEENTH ", " EVENTEENTH ", " EIGHTEENTH ", " NINETEENTH " }; static char *Ord_twenties[] = { " TWENTIETH ", " THIRTIETH ", " FOURTIETH ", " FIFTIETH ", " SIXTIETH ", " SEVENTIETH ", " EIGHTIETH ", " NINETIETH " }; /* * Translate a number to phonemes. This version is for CARDINAL numbers. * Note: this is recursive. */ void say_cardinal(value) long int value; { if (value < 0) { xlate_word(" MINUS "); value = (-value); if (value < 0) { /* Overflow! -32768 */ xlate_word(" INFINITY "); return; } } if (value >= 1000000000L) { /* Billions */ say_cardinal(value/1000000000L); xlate_word(" BILLION "); value = value % 1000000000; if (value == 0) /* Even billion */ return; if (value < 100) /* as in THREE BILLION AND FIVE */ xlate_word(" AND "); } if (value >= 1000000L) { /* Millions */ say_cardinal(value/1000000L); xlate_word(" MILLION "); value = value % 1000000L; if (value == 0) /* Even million */ return; if (value < 100) /* as in THREE MILLION AND FIVE */ xlate_word(" AND "); } /* Thousands 1000..1099 2000..99999 */ /* 1100 to 1999 is eleven-hunderd to ninteen-hunderd */ if ((value >= 1000L && value <= 1099L) || value >= 2000L) { say_cardinal(value/1000L); xlate_word(" THOUSAND "); value = value % 1000L; if (value == 0) /* Even thousand */ return; if (value < 100) /* as in THREE THOUSAND AND FIVE */ xlate_word(" AND "); } if (value >= 100L) { xlate_word(Cardinals[value/100]); xlate_word(" HUNDRED "); value = value % 100; if (value == 0) /* Even hundred */ return; } if (value >= 20) { xlate_word(Twenties[(value-20)/ 10]); value = value % 10; if (value == 0) /* Even ten */ return; } xlate_word(Cardinals[value]); } /* * Translate a number to phonemes. This version is for ORDINAL numbers. * Note: this is recursive. */ void say_ordinal(value) long int value; { if (value < 0) { xlate_word(" MINUS "); value = (-value); if (value < 0) /* Overflow! -32768 */ { xlate_word(" INFINITY "); return; } } if (value >= 1000000000L) { /* Billions */ say_cardinal(value/1000000000L); value = value % 1000000000; if (value == 0) { xlate_word(" BILLIONTH "); /* Even billion */ return; } xlate_word(" BILLION "); if (value < 100) /* as in THREE BILLION AND FIVE */ xlate_word(" AND "); } if (value >= 1000000L) { /* Millions */ say_cardinal(value/1000000L); value = value % 1000000L; if (value == 0) { xlate_word(" MILLIONTH "); /* Even million */ return; } xlate_word(" MILLION "); if (value < 100) /* as in THREE MILLION AND FIVE */ xlate_word(" AND "); } /* Thousands 1000..1099 2000..99999 */ /* 1100 to 1999 is eleven-hunderd to ninteen-hunderd */ if ((value >= 1000L && value <= 1099L) || value >= 2000L) { say_cardinal(value/1000L); value = value % 1000L; if (value == 0) { xlate_word(" THOUSANDTH "); /* Even thousand */ return; } xlate_word(" THOUSAND "); if (value < 100) /* as in THREE THOUSAND AND FIVE */ xlate_word(" AND "); } if (value >= 100L) { xlate_word(Cardinals[value/100]); value = value % 100; if (value == 0) { xlate_word(" TUNDREDTH "); /* Even hundred */ return; } xlate_word(" HUNDRED "); } if (value >= 20) { if ((value%10) == 0) { xlate_word(Ord_twenties[(value-20)/ 10]); /* Even ten */ return; } xlate_word(Twenties[(value-20)/ 10]); value = value % 10; } xlate_word(Ordinals[value]); } "Y", Anything, Silent }, {Anything, "Y", Anything, recite.1.0/english/saynum.h 644 0 0 1735 5432053507 15130ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: interface definition for english/saynum.c */ #ifndef SAYNUM_H #define SAYNUM_H #include void say_ordinal _((long)); void say_cardinal _((long)); #endif /* SAYNUM_H */ (" AND "); } /* Thousands 1000..recite.1.0/english/spellword.c 644 0 0 3755 5432053507 15626ustar PeterMiller 0 0#include #include #include static char *Ascii[] = { "nUWl ", "stAArt AXv hEHdER ", "stAArt AXv tEHkst ", "EHnd AXv tEHkst ", "EHnd AXv trAEnsmIHSHAXn", "EHnkwAYr ", "AEk ", "bEHl ", "bAEkspEYs ", "tAEb ", "lIHnIYfIYd ", "vERtIHkAXl tAEb ", "fAOrmfIYd ", "kAErAYj rIYtERn ", "SHIHft AWt ", "SHIHft IHn ", "dIHlIYt ", "dIHvIHs kAAntrAAl wAHn ", "dIHvIHs kAAntrAAl tUW ", "dIHvIHs kAAntrAAl THrIY ", "dIHvIHs kAAntrAAl fOWr ", "nAEk ", "sIHnk ", "EHnd tEHkst blAAk ", "kAEnsEHl ", "EHnd AXv mEHsIHj ", "sUWbstIHtUWt ", "EHskEYp ", "fAYEHld sIYpERAEtER ", "grUWp sIYpERAEtER ", "rIYkAOrd sIYpERAEtER ", "yUWnIHt sIYpERAEtER ", "spEYs ", "EHksklAEmEYSHAXn mAArk ", "dAHbl kwOWt ", "nUWmbER sAYn ", "dAAlER sAYn ", "pERsEHnt ", "AEmpERsAEnd ", "kwOWt ", "OWpEHn pEHrEHn ", "klOWz pEHrEHn ", "AEstEHrIHsk ", "plAHs ", "kAAmmAX ", "mIHnAHs ", "pIYrIYAAd ", "slAESH ", "zIHrOW ", "wAHn ", "tUW ", "THrIY ", "fOWr ", "fAYv ", "sIHks ", "sEHvAXn ", "EYt ", "nAYn ", "kAAlAXn ", "sEHmIHkAAlAXn ", "lEHs DHAEn ", "EHkwAXl sAYn ", "grEYtER DHAEn ", "kwEHsCHAXn mAArk ", "AEt sAYn ", "EY ", "bIY ", "sIY ", "dIY ", "IY ", "EHf ", "jIY ", "EYtCH ", "AY ", "jEY ", "kEY ", "EHl ", "EHm ", "EHn ", "AA ", "pIY ", "kw ", "AAr ", "EHz ", "tIY ", "AHw ", "vIY ", "dAHblyUWw ", "EHks ", "wAYIY ", "zIY ", "lEHft brAEkEHt ", "bAEkslAESH ", "rAYt brAEkEHt ", "kAErEHt ", "AHndERskAOr ", "AEpAAstrAAfIH ", "EY ", "bIY ", "sIY ", "dIY ", "IY ", "EHf ", "jIY ", "EYtCH ", "AY ", "jEY ", "kEY ", "EHl ", "EHm ", "EHn ", "AA ", "pIY ", "kw ", "AAr ", "EHz ", "tIY ", "AHw ", "vIY ", "dAHblyUWw ", "EHks ", "wAYIY ", "zIY ", "lEHft brEYs ", "vERtIHkAXl bAAr ", "rAYt brEYs ", "tAYld ", "dEHl ", }; void say_ascii(character) int character; { english_outstring(Ascii[character & 0x7F]); } void spell_word(word) char *word; { for (word++; word[1]; word++) say_ascii(*word); } if (value >= 100000recite.1.0/english/spellword.h 644 0 0 1736 5432053507 15630ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: interface definition for SPELLWORD.c */ #ifndef SPELLWORD_H #define SPELLWORD_H #include void say_ascii _((int)); void spell_word _((char *)); #endif /* SPELLWORD_H */ "fOWr ", "fAYv ", "sIHks ", "sErecite.1.0/klatt/klatt.c 644 0 0 11636 5432053507 14435ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: functions to mainipluate klatt data * * Derived from a program * dated 25 July 1987, L. Goldstein, S. Levy */ #include #include #include #include #include #include static unsigned char *playbuf_data; static size_t playbuf_size; static size_t playbuf_pos; #define NUM_SET_PARS 20 #define NMSPF_DEF 10 #define NF_DEF 20 #define MAX_SAM 500 #define NFRAMES 20 #define NFRAMES_PER_PAGE 20 #define NSAMP_PER_BLOCK 256 #define MIDSCALE 2048 #define BOOLEAN int #define MAX_PLA 100000 #define NCHANGE 20 #define SWITCH 5 #define BADVAL 99 #define CR 13 #define ZERO 48 #define NINE 57 #define BACKSPACE 8 #define NPARTOT 47 /* default values for pars array from .doc file */ static pars_ty def_pars = { 1000, /* F0hz10 */ 60, /* AVdb */ 500, /* F1hz */ 60, /* B1hz */ 1500, /* F2hz */ 90, /* B2hz */ 2800, /* F3hz */ 150, /* B3hz */ 3250, /* F4hz */ 200, /* B4hz */ 3700, /* F5hz */ 200, /* B5hz */ 4990, /* F6hz */ 500, /* B6hz */ 280, /* FNZhz */ 90, /* BNZhz */ 280, /* FNPhz */ 90, /* BNPhz */ 0, /* AP */ 30, /* Kopen */ 0, /* Aturb */ 0, /* TLTdb */ 0, /* AF */ 0, /* Kskew */ 0, /* A1 */ 80, /* B1phz */ 0, /* A2 */ 200, /* B2phz */ 0, /* A3 */ 350, /* B3phz */ 0, /* A4 */ 500, /* B4phz */ 0, /* A5 */ 600, /* B5phz */ 0, /* A6 */ 800, /* B6phz */ 0, /* ANP */ 0, /* AB */ 0, /* AVpdb */ 66 /* Gain0 */ }; static int totsam; static int icount; static int ibuf; static pars_ty *par_array; /* parameter buffer */ static short *inflect; /* needed for interpolation */ static int data_exist = 0; ; static long initsw, warnsw, dispt, disptcum; static int nframes; /* * read parameter values from a file into the parameter array */ static void read_pars _((char *data, long datalen)); static void read_pars(data, datalen) char *data; long datalen; { frame_ty *frame; int j; frame_ty *fp; pars_ty *pp; trace(("read_pars()\n{\n"/*}*/)); frame = (frame_ty *)data; nframes = datalen / sizeof(frame_ty); par_array = (pars_ty *)mem_alloc(nframes * sizeof(pars_ty)); inflect = (short *)mem_alloc(nframes * sizeof(short)); for (j = 0; j < nframes; ++j) { fp = &frame[j]; pp = &par_array[j]; *pp = def_pars; pp->F0hz10 = fp->f0; pp->F1hz = fp->f1; pp->F2hz = fp->f2; pp->F3hz = fp->f3; pp->B1hz = fp->bw1; pp->B2hz = fp->bw2; pp->B3hz = fp->bw3; pp->FNZhz = fp->fnz; pp->FNPhz = fp->fnp; pp->AVdb = fp->av; /* pp->TLTdb = fp->anp; */ pp->ANP = fp->anp; pp->AP = fp->asp; pp->AF = fp->af; pp->A1 = fp->a1; pp->A2 = fp->a2; pp->A3 = fp->a3; pp->A4 = fp->a4; pp->A5 = fp->a5; pp->A6 = fp->a6; pp->AB = fp->ab; } trace((/*{*/"}\n")); } static void playbuf _((int)); static void playbuf(sample) int sample; { trace(("playbuf(%d)\n{\n"/*}*/, sample)); if (playbuf_pos >= playbuf_size) { playbuf_size += (1L << 16); trace(("playbuf_size = %ld\n", playbuf_size)); if (!playbuf_data) playbuf_data = (unsigned char *)mem_alloc(playbuf_size); else mem_change_size((char **)&playbuf_data, playbuf_size); trace(("playbuf_data = %08lX\n", (long)playbuf_data)); } playbuf_data[playbuf_pos++] = sample; trace((/*{*/"}\n")); } static void playbuf_collect _((char **, long *)); static void playbuf_collect(out, outlen) char **out; long *outlen; { trace(("playbuf_collect()\n{\n"/*}*/)); if (playbuf_pos < playbuf_size) { playbuf_size = playbuf_pos; mem_change_size((char **)&playbuf_data, playbuf_size); } *out = (char *)playbuf_data; *outlen = playbuf_size; playbuf_data = 0; playbuf_size = 0; playbuf_pos = 0; trace((/*{*/"}\n")); } void klatt_to_ulaw(in, inlen, out, outlen) char *in; long inlen; char **out; long *outlen; { short iwave[NSAMP_PER_FRAME]; int isam; trace(("klatt_to_ulaw()\n{\n"/*}*/)); read_pars(in, inlen); ibuf = 0; initsw = 0; warnsw = 0; dispt = 0; disptcum =0; for (icount = 0; icount < nframes; icount++) { parwav(&par_array[icount], iwave); for (isam = 0; isam < NSAMP_PER_FRAME; ++isam) playbuf(audio_s2u(iwave[isam])); data_exist = 1; totsam = ibuf; } playbuf_collect(out, outlen); trace((/*{*/"}\n")); } ong initsw, warnsw, dispt, disptcum; static int nframes; /* * read parameter values from a filerecite.1.0/klatt/klatt.h 644 0 0 1746 5432053507 14423ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: interface definition for klatt/klatt.c */ #ifndef KLATT_H #define KLATT_H #include void klatt_to_ulaw _((char *in, long inlen, char **out, long *outlen)); #endif /* KLATT_H */ atic void playbuf _((int))recite.1.0/klatt/parwave.c 644 0 0 136030 5432053507 14777ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: functions to translate frames into waveforms * * Portions of this file are derived floatfrom a program * Copyright 1982 by Dennis H. Klatt: * Klatt synthesizer * Modified version of synthesizer described in * J. Acoust. Soc. Am., Mar. 1980. -- new voicing source. */ #include #include #include #include #include /* * variables to hold speaker definition from host */ static long outsl; /* Output waveform selector */ static long samrate; /* Number of output samples per second */ static long FLPhz; /* Frequeny of glottal downsample low-pass filter */ static long BLPhz; /* Bandwidt of glottal downsample low-pass filter */ static long nfcascade; /* Number of formants in cascade vocal tract */ static long glsource; /* 1->impulsive, 2->natural voicing source */ /* * variables to hold input parameters from host */ static long F0hz10; /* Voicing fund freq in Hz */ static long F1hz ; /* First formant freq in Hz, 200 to 1300 */ static long F2hz ; /* Second formant freq in Hz, 550 to 3000 */ static long F3hz ; /* Third formant freq in Hz, 1200 to 4999 */ static long F4hz ; /* Fourth formant freq in Hz, 1200 to 4999 */ static long F5hz ; /* Fifth formant freq in Hz, 1200 to 4999 */ static long F6hz ; /* Sixth formant freq in Hz, 1200 to 4999 */ static long FNZhz ; /* Nasal zero freq in Hz, 248 to 528 */ static long FNPhz ; /* Nasal pole freq in Hz, 248 to 528 */ static long B1hz ; /* First formant bw in Hz, 40 to 1000 */ static long B2hz ; /* Second formant bw in Hz, 40 to 1000 */ static long B3hz ; /* Third formant bw in Hz, 40 to 1000 */ static long B4hz ; /* Fourth formant bw in Hz, 40 to 1000 */ static long B5hz ; /* Fifth formant bw in Hz, 40 to 1000 */ static long B6hz ; /* Sixth formant bw in Hz, 40 to 2000 */ static long B1phz ; /* Par. 1st formant bw in Hz, 40 to 1000 */ static long B2phz ; /* Par. 2nd formant bw in Hz, 40 to 1000 */ static long B3phz ; /* Par. 3rd formant bw in Hz, 40 to 1000 */ static long B4phz ; /* Par. 4th formant bw in Hz, 40 to 1000 */ static long B5phz ; /* Par. 5th formant bw in Hz, 40 to 1000 */ static long B6phz ; /* Par. 6th formant bw in Hz, 40 to 2000 */ static long BNZhz ; /* Nasal zero bw in Hz, 40 to 1000 */ static long BNPhz ; /* Nasal pole bw in Hz, 40 to 1000 */ static long AVdb ; /* Amp of voicing in dB, 0 to 70 */ static long AVpdb ; /* Amp of voicing, par in dB, 0 to 70 */ static long AP ; /* Amp of aspiration in dB, 0 to 70 */ static long AF ; /* Amp of frication in dB, 0 to 80 */ static long A1 ; /* Amp of par 1st formant in dB, 0 to 80 */ static long ANP ; /* Amp of par nasal pole in dB, 0 to 80 */ static long A2 ; /* Amp of F2 frication in dB, 0 to 80 */ static long A3 ; /* Amp of F3 frication in dB, 0 to 80 */ static long A4 ; /* Amp of F4 frication in dB, 0 to 80 */ static long A5 ; /* Amp of F5 frication in dB, 0 to 80 */ static long A6 ; /* Amp of F6 (same as r6pa), 0 to 80 */ static long AB ; /* Amp of bypass fric. in dB, 0 to 80 */ static long TLTdb ; /* Voicing spectral tilt in dB, 0 to 24 */ static long Kopen ; /* # of samples in open period, 10 to 65 */ static long Aturb ; /* Breathiness in voicing, 0 to 80 */ static long Kskew ; /* Skewness of alternate periods,0 to 40 */ /* in sample#/2 */ static long Gain0 ; /* Overall gain, 60 dB is unity 0 to 60 */ /* * same variables converted to linear floating point */ static double amp_parF1; /* A1 converted to linear gain */ static double amp_parFNP; /* AP converted to linear gain */ static double amp_parF2; /* A2 converted to linear gain */ static double amp_parF3; /* A3 converted to linear gain */ static double amp_parF4; /* A4 converted to linear gain */ static double amp_parF5; /* A5 converted to linear gain */ static double amp_parF6; /* A6 converted to linear gain */ static double amp_bypas; /* AB converted to linear gain */ static double amp_voice; /* AVdb converted to linear gain */ static double par_amp_voice; /* AVpdb converted to linear gain */ static double amp_aspir; /* AP converted to linear gain */ static double amp_frica; /* AF converted to linear gain */ static double amp_breth; /* ATURB converted to linear gain */ static double amp_gain0; /* G0 converted to linear gain */ /* COUNTERS */ static long ns ; /* Number of samples into current frame */ static long nper ; /* Current loc in voicing period 40000 samp/s */ static long n4 ; /* Counter of 4 samples in glottal source loop */ /* COUNTER LIMITS */ static long T0 ; /* Fundamental period in output samples times 4 */ static long nopen ; /* Number of samples in open phase of period */ static long nmod ; /* Position in period to begin noise amp. modul */ static long nspfr ; /* Number of samples in a parameter frame */ /* ALL-PURPOSE TEMPORARY VARIABLES */ static long temp ; static double temp1 ; /* VARIABLES THAT HAVE TO STICK AROUND FOR AWHILE, AND THUS "temp" */ /* IS NOT APPROPRIATE */ static long nrand ; /* Varible used by random number generator */ static long skew ; /* Alternating jitter, in half-period units */ static double a ; /* Makes waveshape of glottal pulse when open */ static double b ; /* Makes waveshape of glottal pulse when open */ static double voice ; /* Current sample of voicing waveform */ static double vwave ; /* Ditto, but before multiplication by AVdb */ static double noise ; /* Output of random number generator */ static double frics ; /* Frication sound source */ static double aspiration; /* Aspiration sound source */ static double sourc ; /* Sound source if all-parallel config used */ static double casc_next_in; /* Input to next used resonator of casc */ static double out ; /* Output of cascade branch, also final output */ static double rnzout; /* Output of cascade nazal zero resonator */ static double glotout; /* Output of glottal sound source */ static double par_glotout; /* Output of parallelglottal sound sourc */ static double outbypas; /* Output signal from bypass path */ /* INTERNAL MEMORY FOR DIGITAL RESONATORS AND ANTIRESONATOR */ static double rnpp_1; /* Last output sample from parallel nasal pole */ static double rnpp_2; /* Second-previous output sample */ static double r1p_1 ; /* Last output sample from parallel 1st formant */ static double r1p_2 ; /* Second-previous output sample */ static double r2p_1 ; /* Last output sample from parallel 2nd formant */ static double r2p_2 ; /* Second-previous output sample */ static double r3p_1 ; /* Last output sample from parallel 3rd formant */ static double r3p_2 ; /* Second-previous output sample */ static double r4p_1 ; /* Last output sample from parallel 4th formant */ static double r4p_2 ; /* Second-previous output sample */ static double r5p_1 ; /* Last output sample from parallel 5th formant */ static double r5p_2 ; /* Second-previous output sample */ static double r6p_1 ; /* Last output sample from parallel 6th formant */ static double r6p_2 ; /* Second-previous output sample */ static double r1c_1 ; /* Last output sample from cascade 1st formant */ static double r1c_2 ; /* Second-previous output sample */ static double r2c_1 ; /* Last output sample from cascade 2nd formant */ static double r2c_2 ; /* Second-previous output sample */ static double r3c_1 ; /* Last output sample from cascade 3rd formant */ static double r3c_2 ; /* Second-previous output sample */ static double r4c_1 ; /* Last output sample from cascade 4th formant */ static double r4c_2 ; /* Second-previous output sample */ static double r5c_1 ; /* Last output sample from cascade 5th formant */ static double r5c_2 ; /* Second-previous output sample */ static double r6c_1 ; /* Last output sample from cascade 6th formant */ static double r6c_2 ; /* Second-previous output sample */ static double rnpc_1; /* Last output sample from cascade nasal pole */ static double rnpc_2; /* Second-previous output sample */ static double rnz_1 ; /* Last output sample from cascade nasal zero */ static double rnz_2 ; /* Second-previous output sample */ static double rgl_1 ; /* Last output crit-damped glot low-pass filter */ static double rgl_2 ; /* Second-previous output sample */ static double rlp_1 ; /* Last output from downsamp low-pass filter */ static double rlp_2 ; /* Second-previous output sample */ static double rout_1 ; /* Last output sample from output low-pass */ static double rout_2 ; /* Second-previous output sample */ static double vlast ; /* Previous output of voice */ static double nlast ; /* Previous output of random number generator */ static double glotlast; /* Previous value of glotout */ /* COEFFICIENTS FOR DIGITAL RESONATORS AND ANTIRESONATOR */ static double rnppa ; /* "a" coefficient for parallel nasal pole */ static double rnppb ; /* "b" coefficient */ static double rnppc ; /* "c" coefficient */ static double r1pa ; /* "a" coef for par. 1st formant */ static double r1pb ; /* "b" coefficient */ static double r1pc ; /* "c" coefficient */ static double r2pa ; /* Could be same as A2 if all integer impl. */ static double r2pb ; /* "b" coefficient */ static double r2pc ; /* "c" coefficient */ static double r3pa ; /* Could be same as A3 if all integer impl. */ static double r3pb ; /* "b" coefficient */ static double r3pc ; /* "c" coefficient */ static double r4pa ; /* Could be same as A4 if all integer impl. */ static double r4pb ; /* "b" coefficient */ static double r4pc ; /* "c" coefficient */ static double r5pa ; /* Could be same as A5 if all integer impl. */ static double r5pb ; /* "b" coefficient */ static double r5pc ; /* "c" coefficient */ static double r6pa ; /* Could be same as A6 if all integer impl. */ static double r6pb ; /* "b" coefficient */ static double r6pc ; /* "c" coefficient */ static double r1ca ; /* Could be same as r1pa if all integer impl. */ static double r1cb ; /* Could be same as r1pb if all integer impl. */ static double r1cc ; /* Could be same as r1pc if all integer impl. */ static double r2ca ; /* "a" coefficient for cascade 2nd formant */ static double r2cb ; /* "b" coefficient */ static double r2cc ; /* "c" coefficient */ static double r3ca ; /* "a" coefficient for cascade 3rd formant */ static double r3cb ; /* "b" coefficient */ static double r3cc ; /* "c" coefficient */ static double r4ca ; /* "a" coefficient for cascade 4th formant */ static double r4cb ; /* "b" coefficient */ static double r4cc ; /* "c" coefficient (same as R4Cccoef) */ static double r5ca ; /* "a" coefficient for cascade 5th formant */ static double r5cb ; /* "b" coefficient */ static double r5cc ; /* "c" coefficient (same as R5Cccoef) */ static double r6ca ; /* "a" coefficient for cascade 5th formant */ static double r6cb ; /* "b" coefficient */ static double r6cc ; /* "c" coefficient (same as R5Cccoef) */ static double rnpca ; /* "a" coefficient for cascade nasal pole */ static double rnpcb ; /* "b" coefficient */ static double rnpcc ; /* "c" coefficient */ static double rnza ; /* "a" coefficient for cascade nasal zero */ static double rnzb ; /* "b" coefficient */ static double rnzc ; /* "c" coefficient */ static double rgla ; /* "a" coefficient for crit-damp glot filter */ static double rglb ; /* "b" coefficient */ static double rglc ; /* "c" coefficient */ static double rlpa ; /* "a" coefficient for downsam low-pass filter */ static double rlpb ; /* "b" coefficient */ static double rlpc ; /* "c" coefficient */ static double routa ; /* "a" coefficient for output low-pass filter */ static double routb ; /* "b" coefficient */ static double routc ; /* "c" coefficient */ static double decay ; /* TLTdb converted to exponential time const */ static double onemd ; /* in voicing one-pole low-pass filter */ /* CONSTANTS AND TABLES TO BE PUT IN ROM */ #define CASCADE_PARALLEL 1 /* Normal synthesizer config */ #define ALL_PARALLEL 2 /* Only use parallel branch */ /* * Constant B0 controls shape of glottal pulse as a function * of desired duration of open phase N0 * (Note that N0 is specified in terms of 40,000 samples/sec of speech) * * Assume voicing waveform V(t) has form: k1 t**2 - k2 t**3 * * If the radiation characterivative, a temporal derivative * is folded in, and we go from continuous time to discrete * integers n: dV/dt = vwave[n] * = sum over i=1,2,...,n of { a - (i * b) } * = a n - b/2 n**2 * * where the constants a and b control the detailed shape * and amplitude of the voicing waveform over the open * potion of the voicing cycle "nopen". * * Let integral of dV/dt have no net dc flow --> a = (b * nopen) / 3 * * Let maximum of dUg(n)/dn be constant --> b = gain / (nopen * nopen) * meaning as nopen gets bigger, V has bigger peak proportional to n * * Thus, to generate the table below for 40 <= nopen <= 263: * * B0[nopen - 40] = 1920000 / (nopen * nopen) */ short B0[224] = { 1200, 1142, 1088, 1038, 991, 948, 907, 869, 833, 799, 768, 738, 710, 683, 658, 634, 612, 590, 570, 551, 533, 515, 499, 483, 468, 454, 440, 427, 415, 403, 391, 380, 370, 360, 350, 341, 332, 323, 315, 307, 300, 292, 285, 278, 272, 265, 259, 253, 247, 242, 237, 231, 226, 221, 217, 212, 208, 204, 199, 195, 192, 188, 184, 180, 177, 174, 170, 167, 164, 161, 158, 155, 153, 150, 147, 145, 142, 140, 137, 135, 133, 131, 128, 126, 124, 122, 120, 119, 117, 115, 113, 111, 110, 108, 106, 105, 103, 102, 100, 99, 97, 96, 95, 93, 92, 91, 90, 88, 87, 86, 85, 84, 83, 82, 80, 79, 78, 77, 76, 75, 75, 74, 73, 72, 71, 70, 69, 68, 68, 67, 66, 65, 64, 64, 63, 62, 61, 61, 60, 59, 59, 58, 57, 57, 56, 56, 55, 55, 54, 54, 53, 53, 52, 52, 51, 51, 50, 50, 49, 49, 48, 48, 47, 47, 46, 46, 45, 45, 44, 44, 43, 43, 42, 42, 41, 41, 41, 41, 40, 40, 39, 39, 38, 38, 38, 38, 37, 37, 36, 36, 36, 36, 35, 35, 35, 35, 34, 34, 33, 33, 33, 33, 32, 32, 32, 32, 31, 31, 31, 31, 30, 30, 30, 30, 29, 29, 29, 29, 28, 28, 28, 28, 27, 27 }; /* * Convertion table, db to linear, 87 dB --> 32767 * 86 dB --> 29491 (1 dB down = 0.5**1/6) * ... * 81 dB --> 16384 (6 dB down = 0.5) * ... * 0 dB --> 0 * * The just noticeable difference for a change in intensity of a vowel * is approximately 1 dB. Thus all amplitudes are quantized to 1 dB * steps. */ static double amptable[88] = { 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 6., 7., 8., 9., 10., 11., 13., 14., 16., 18., 20., 22., 25., 28., 32., 35., 40., 45., 51., 57., 64., 71., 80., 90., 101., 114., 128., 142., 159., 179., 202., 227., 256., 284., 318., 359., 405., 455., 512., 568., 638., 719., 811., 911., 1024., 1137., 1276., 1438., 1622., 1823., 2048., 2273., 2552., 2875., 3244., 3645., 4096., 4547., 5104., 5751., 6488., 7291., 8192., 9093., 10207., 11502., 12976., 14582., 16384., 18350., 20644., 23429., 26214., 29491., 32767 }; spkrdef_ty spkrdef = { 0, /* OUTS */ SAMP_RATE, /* Srat */ NSAMP_PER_FRAME, /* NSfr */ 900, /* Flp */ 600, /* BWlp */ 3, /* NFca */ NATURAL /* VSsw */ }; static long sigmx; static long dispt; static long disptcum; static long ms25; static double r8ca; static double r8cb; static double r8cc; static double r7ca; static double r7cb; static double r7cc; static double r8c_1; static double r8c_2; static double r7c_1; static double r7c_2; static int count = 0; static double minus_pi_t; static double two_pi_t; /* * NAME * setabc * * SYNOPSIS * void setabc(long f, long bw, double *a, double *b, double *c); * * DESCRIPTION * The setabc function is used to * convert formant freqencies and bandwidth into * resonator difference equation constants */ static void setabc _((long f, long bw, double *a, double *b, double *c)); static void setabc(f, bw, acoef, bcoef, ccoef) long f; /* Frequency of resonator in Hz */ long bw; /* Bandwidth of resonator in Hz */ double *acoef; double *bcoef; double *ccoef; { double r; double arg; /* * Let r = exp(-pi bw t) */ arg = minus_pi_t * bw; r = exp(arg); /* * Let c = -r**2 */ *ccoef = -(r * r); /* * Let b = r * 2*cos(2 pi f t) */ arg = two_pi_t * f; *bcoef = r * cos(arg) * 2.; /* * Let a = 1.0 - b - c */ *acoef = 1.0 - *bcoef - *ccoef; trace(("f=%ld bw=%ld acoef=%8.5f bcoef=%8.5f ccoef=%8.5f\n", f, bw, *acoef, *bcoef, *ccoef)); } static void resonclr _((void)); static void resonclr() { rnpp_1 = 0; /* Last output sample from parallel nasal pole */ rnpp_2 = 0; /* Second-previous output sample */ r1p_1 = 0; /* Last output sample from parallel 1st formant */ r1p_2 = 0; /* Second-previous output sample */ r2p_1 = 0; /* Last output sample from parallel 2nd formant */ r2p_2 = 0; /* Second-previous output sample */ r3p_1 = 0; /* Last output sample from parallel 3rd formant */ r3p_2 = 0; /* Second-previous output sample */ r4p_1 = 0; /* Last output sample from parallel 4th formant */ r4p_2 = 0; /* Second-previous output sample */ r5p_1 = 0; /* Last output sample from parallel 5th formant */ r5p_2 = 0; /* Second-previous output sample */ r6p_1 = 0; /* Last output sample from parallel 6th formant */ r6p_2 = 0; /* Second-previous output sample */ r1c_1 = 0; /* Last output sample from cascade 1st formant */ r1c_2 = 0; /* Second-previous output sample */ r2c_1 = 0; /* Last output sample from cascade 2nd formant */ r2c_2 = 0; /* Second-previous output sample */ r3c_1 = 0; /* Last output sample from cascade 3rd formant */ r3c_2 = 0; /* Second-previous output sample */ r4c_1 = 0; /* Last output sample from cascade 4th formant */ r4c_2 = 0; /* Second-previous output sample */ r5c_1 = 0; /* Last output sample from cascade 5th formant */ r5c_2 = 0; /* Second-previous output sample */ r6c_1 = 0; /* Last output sample from cascade 6th formant */ r6c_2 = 0; /* Second-previous output sample */ r7c_1 = 0; r7c_2 = 0; r8c_1 = 0; r8c_2 = 0; rnpc_1 = 0; /* Last output sample from cascade nasal pole */ rnpc_2 = 0; /* Second-previous output sample */ rnz_1 = 0; /* Last output sample from cascade nasal zero */ rnz_2 = 0; /* Second-previous output sample */ rgl_1 = 0; /* Last output crit-damped glot low-pass filter */ rgl_2 = 0; /* Second-previous output sample */ rlp_1 = 0; /* Last output from downsamp low-pass filter */ rlp_2 = 0; /* Second-previous output sample */ vlast = 0; /* Previous output of voice */ nlast = 0; /* Previous output of random number generator */ glotlast = 0; /* Previous value of glotout */ } /* * NAME * DBtoLIN * * SYNOPSIS * double DBtoLIN(long dB); * * DESCRIPTION * The DBtoLIN function is used to * convert from decibels to a linear scale factor */ static double DBtoLIN _((long dB)); static double DBtoLIN(dB) long dB; { double lgtemp; /* * Check limits or argument (can be removed in final product) */ if (dB < 0) { trace(("Try to compute amptable[%d]\n", dB)); return(0); } lgtemp = amptable[dB] * .001; return (lgtemp); } /* * NAME * setzeroabc * * SYNOPSIS * void setzeroabc(long f, long bw, double *a, double *b, double *c); * * DESCRIPTION * The setzeroabc function is used to * convert formant freqencies and bandwidth into * anti-resonator difference equation constants */ static void setzeroabc _((long f, long bw, double *a, double *b, double *c)); static void setzeroabc(f, bw, acoef, bcoef, ccoef) long f; /* Frequency of resonator in Hz */ long bw; /* Bandwidth of resonator in Hz */ double *acoef; double *bcoef; double *ccoef; { double r; double arg; /* * First compute ordinary resonator coefficients */ /* * Let r = exp(-pi bw t) */ arg = minus_pi_t * bw; r = exp(arg); /* * Let c = -r**2 */ *ccoef = -(r * r); /* * Let b = r * 2*cos(2 pi f t) */ arg = two_pi_t * f; *bcoef = r * cos(arg) * 2.; /* * Let a = 1.0 - b - c */ *acoef = 1. - *bcoef - *ccoef; /* * Now convert to antiresonator coefficients (a'=1/a, b'=b/a, c'=c/a) */ *acoef = 1.0 / *acoef; *ccoef *= -*acoef; *bcoef *= -*acoef; trace(("fz=%3d bw=%3d acoef=%8.5f bcoef=%8.5f ccoef=%8.5f\n", f, bw, *acoef, *bcoef, *ccoef)); } /* * NAME * gethost * * SYNOPSIS * void gethost(void); * * DESCRIPTION * The gethost function is used to * get the variable parameters from host computer, * initially also get definition of fixed pars */ static void gethost _((pars_ty *)); static void gethost(pars) pars_ty *pars; { static int initsw; /* * Initialize speaker definition */ if (!initsw) { initsw++; /* * Read Speaker Definition from Host */ /* Select which waveform to output */ outsl = spkrdef.OUTs; /* Sampling rate */ samrate = SAMP_RATE; /* spkrdef.Srat */ /* number of samples per frame of pars */ nspfr = NSAMP_PER_FRAME; /* spkrdef.NSfr */ /* Freq of glottal low-pass filter */ FLPhz = (950 * samrate) / 10000; /* spkrdef.Flp */ /* Bw of glottal low-pass filter */ BLPhz = (630 * samrate) / 10000; /* spkrdef.BWlp */ /* Number formants in cascade tract*/ nfcascade = spkrdef.NFca; /* 1->impulsive, 2->natural voicing*/ glsource = spkrdef.VSsw; minus_pi_t = -(4 * atan(1.)) / samrate; two_pi_t = -2. * minus_pi_t; setabc(FLPhz, BLPhz, &rlpa, &rlpb, &rlpc); /* Init ran # generator */ r250_init(); /* Number samps in 25 ms */ ms25 = (25 * samrate) / 1000; /* initialize resonantors for new utterance */ resonclr(); nper = 0; T0 = 0; } /* * Read speech frame definition into temp store * and move some parameters into active use immediately * (voice-excited ones are updated pitch synchronously * to avoid waveform glitches). */ F0hz10 = pars->F0hz10; AVdb = pars->AVdb - 7; if (AVdb < 0) AVdb = 0; F1hz = pars->F1hz; B1hz = pars->B1hz; F2hz = pars->F2hz; B2hz = pars->B2hz; F3hz = pars->F3hz; B3hz = pars->B3hz; F4hz = pars->F4hz; B4hz = pars->B4hz; F5hz = pars->F5hz; B5hz = pars->B5hz; F6hz = pars->F6hz; /* f of parallel 6th formant */ B6hz = pars->B6hz; /* bw of cascade 6th formant (doesn't exist) */ FNZhz = pars->FNZhz; BNZhz = pars->BNZhz; FNPhz = pars->FNPhz; BNPhz = pars->BNPhz; AP = pars->AP; amp_aspir = DBtoLIN(AP) * .05; Kopen = pars->Kopen; Aturb = pars->Aturb; TLTdb = pars->TLTdb; AF = pars->AF; amp_frica = DBtoLIN(AF) * 0.25; Kskew = pars->Kskew; AVpdb = pars->AVpdb; par_amp_voice = DBtoLIN(AVpdb); A1 = pars->A1; amp_parF1 = DBtoLIN(A1) * 0.4; B1phz = pars->B1phz; A2 = pars->A2; amp_parF2 = DBtoLIN(A2) * 0.15; B2phz = pars->B2phz; A3 = pars->A3; amp_parF3 = DBtoLIN(A3) * 0.06; B3phz = pars->B3phz; A4 = pars->A4; amp_parF4 = DBtoLIN(A4) * 0.04; B4phz = pars->B4phz; A5 = pars->A5; amp_parF5 = DBtoLIN(A5) * 0.022; B5phz = pars->B4phz; A6 = pars->A6; amp_parF6 = DBtoLIN(A6) * 0.03; B6phz = pars->B6phz; ANP = pars->ANP; amp_parFNP = DBtoLIN(ANP) * 0.6; AB = pars->AB; amp_bypas = DBtoLIN(AB) * 0.05; Gain0 = pars->Gain0 - 3; if (Gain0 <= 0) Gain0 = 57; amp_gain0 = DBtoLIN(Gain0); #if 0 pr_pars(); #endif /* * Set coefficients of variable cascade resonators */ if (nfcascade >= 8) setabc(7500, 600, &r8ca, &r8cb, &r8cc); if (nfcascade >= 7) setabc(6500, 500, &r7ca, &r7cb, &r7cc); if (nfcascade >= 6) setabc(F6hz, B6hz, &r6ca, &r6cb, &r6cc); if (nfcascade >= 5) setabc(F5hz, B5hz, &r5ca, &r5cb, &r5cc); setabc(F4hz, B4hz, &r4ca, &r4cb, &r4cc); setabc(F3hz, B3hz, &r3ca, &r3cb, &r3cc); setabc(F2hz, B2hz, &r2ca, &r2cb, &r2cc); setabc(F1hz, B1hz, &r1ca, &r1cb, &r1cc); /* * Set coeficients of nasal resonator and zero antiresonator */ setabc(FNPhz, BNPhz, &rnpca, &rnpcb, &rnpcc); setzeroabc(FNZhz, BNZhz, &rnza, &rnzb, &rnzc); /* * Set coefficients of parallel resonators, and amplitude of outputs */ setabc(F1hz, B1hz, &r1pa, &r1pb, &r1pc); r1pa *= amp_parF1; setabc(FNPhz, BNPhz, &rnppa, &rnppb, &rnppc); rnppa *= amp_parFNP; setabc(F2hz, B2phz, &r2pa, &r2pb, &r2pc); r2pa *= amp_parF2; setabc(F3hz, B3phz, &r3pa, &r3pb, &r3pc); r3pa *= amp_parF3; setabc(F4hz, B4phz, &r4pa, &r4pb, &r4pc); r4pa *= amp_parF4; setabc(F5hz, B5phz, &r5pa, &r5pb, &r5pc); r5pa *= amp_parF5; setabc(F6hz, B6phz, &r6pa, &r6pb, &r6pc); r6pa *= amp_parF6; /* * output low-pass filter */ setabc((long)0.0, (long)8000.0, &routa, &routb, &routc); /* * Print a dot on screen every 25 ms to indicate program not dead */ dispt += nspfr; disptcum += nspfr; } /* * NAME * resonglot * * SYNOPSIS * void resonglot(void); * * DESCRIPTION * The resonglot funtion is used to * critically-damped Low-Pass Resonator of Impulsive Glottal Source */ static void resonglot _((void)); static void resonglot() { long temp3; long temp4; temp4 = rglc * rgl_2; /* (ccoef * old2) */ rgl_2 = rgl_1; temp3 = rglb * rgl_1; /* + (bcoef * old1) */ temp4 += temp3; temp3 = rgla * vwave; /* + (acoef * input) */ rgl_1 = temp4 + temp3; } /* * NAME * impulsive_source * * SYNOPSIS * double impulsive_source(void); * * DESCRIPTION * The impulsive_source function is used to */ static double impulsive_source _((void)); static double impulsive_source() { static double doublet[] = { 0., 13000000., -13000000. }; if (nper < SIZEOF(doublet)) vwave = doublet[nper]; else vwave = 0.; /* * Low-pass filter the differenciated impulse with a critically-damped * second-order filter, time constant proportional to Kopen */ resonglot(); return (rgl_1); } /* * NAME * natural_source * * SYNOPSIS * double natural_source(void); * * DESCRIPTION * The natural_source function is used to * Vwave is the differentiated glottal flow waveform, there is a weak * spectral zero around 800 Hz, magic constants a, b reset pitch-synch */ static double natural_source _((void)); static double natural_source() { double lgtemp; /* * See if glottis open */ if (nper < nopen) { a -= b; vwave += a; lgtemp = vwave * 0.03; return lgtemp; } /* * Glottis closed */ vwave = 0; return 0; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* S U B R O U T I N E P I T C H _ S Y N C _ P A R _ U P D A T E */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Reset selected parameters pitch-synchronously */ static void pitch_synch_par_reset _((void)); static void pitch_synch_par_reset() { long zero; if (F0hz10 > 0) { /* Period in samp*4 */ T0 = (40 * samrate) / F0hz10; amp_voice = DBtoLIN(AVdb); /* * Duration of period before amplitude modulation */ nmod = T0; if (AVdb > 0) { nmod >>= 1; } /* * Breathiness of voicing waveform */ amp_breth = DBtoLIN(Aturb) * 0.1; /* * Set open phase of glottal period * where 40 <= open phase <= 263 */ nopen = 4 * Kopen; if ((glsource == IMPULSIVE) && (nopen > 263)) nopen = 263; if (nopen >= (T0-1)) { nopen = T0 - 2; trace(("Warning: glottal open period cannot exceed T0, truncated\n")); } if (nopen < 40) { /* F0 max = 1000 Hz */ nopen = 40; trace(("Warning: minimum glottal open period is 10 samples, truncated, nopen = %d\n", nopen)); } /* * Reset a & b, which determine shape of * "natural" glottal waveform */ b = B0[nopen - 40]; a = (b * nopen) * .333; /* * Reset width of "impulsive" glottal pulse */ temp = samrate / nopen; /* WAS 11000 !!! */ zero = 0; setabc(zero, temp, &rgla, &rglb, &rglc); /* * Make gain at F1 about constant */ temp1 = nopen *.00833; rgla *= temp1 * temp1; /* * Truncate skewness so as not to exceed * duration of closed phase of glottal period */ temp = T0 - nopen; if (Kskew > temp) { trace(("Kskew duration=%d > glottal closed period=%d, truncate\n", Kskew, T0-nopen)); Kskew = temp; } if (skew >= 0) { /* Reset skew to requested Kskew */ skew = Kskew; } else { skew = -Kskew; } /* * Add skewness to closed portion of voicing period */ T0 = T0 + skew; skew = - skew; } else { /* Default for f0 undefined */ T0 = 4; amp_voice = 0.; nmod = T0; amp_breth = 0.; a = 0.; b = 0.; } /* * Reset these pars pitch synchronously or at update rate if f0=0 */ if ((T0 != 4) || (ns == 0)) { /* * Set one-pole low-pass filter that tilts glottal source */ decay = (.033 * TLTdb); if (decay > 0.) { onemd = 1. - decay; } else { onemd = 1.; } } } /* * NAME * gen_noise * * SYNOPSIS * void gen_noise(void); * * DESCRIPTION * The gen_noise function is used to generate a * random number in the range -8192 to 8191. * * OUTPUT * may be found in "nrand" unfiltered, or "noise" low pass filtered. */ static void gen_noise _((void)); static void gen_noise() { nrand = (r250() & ((1L << 14) - 1)) - (1L << 13); /* * Tilt down noise spectrum by soft low-pass filter having * a pole near the origin in the z-plane, i.e. * output = input + (0.75 * lastoutput) */ noise = nrand + (0.75 * nlast); nlast = noise; } /* * Low-Pass Downsampling Resonator of Glottal Source */ static void resonlp _((void)); static void resonlp() { long temp3; long temp4; temp4 = rlpc * rlp_2; /* (ccoef * old2) */ rlp_2 = rlp_1; temp3 = rlpb * rlp_1; /* + (bcoef * old1) */ temp4 += temp3; temp3 = rlpa * voice; /* + (acoef * input) */ rlp_1 = temp4 + temp3; voice = rlp_1; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* S U B R O U T I N E R E S O N C */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Nasal Antiresonator of Cascade Vocal Tract: * Output = (rnza * input) + (rnzb * oldin1) + (rnzc * oldin2) */ static void resoncnz _((void)); static void resoncnz() { long temp3; long temp4; temp4 = rnzc * rnz_2; /* (ccoef * oldin2) */ rnz_2 = rnz_1; temp3 = rnzb * rnz_1; /* + (bcoef * oldin1) */ temp4 += temp3; temp3 = rnza * glotout; /* + (acoef * input) */ rnz_1 = glotout; rnzout = temp4 + temp3; } /* Nasal Resonator of Cascade Vocal Tract */ static void resoncnp _((void)); static void resoncnp() { long temp3, temp4; temp4 = rnpcc * rnpc_2; /* (ccoef * old2) */ rnpc_2 = rnpc_1; temp3 = rnpcb * rnpc_1; /* + (bcoef * old1) */ temp4 += temp3; temp3 = rnpca * rnzout; /* + (acoef * input) */ rnpc_1 = temp4 + temp3; } /* Eighth cascaded Formant */ static void resonc8 _((void)); static void resonc8() { long temp3, temp4; temp4 = r8cc * r8c_2; /* (ccoef * old2) */ r8c_2 = r8c_1; temp3 = r8cb * r8c_1; /* + (bcoef * old1) */ temp4 += temp3; temp3 = r8ca * casc_next_in; /* + (acoef * input) */ r8c_1 = temp4 + temp3; } /* Seventh cascaded Formant */ static void resonc7 _((void)); static void resonc7() { long temp3, temp4; temp4 = r7cc * r7c_2; /* (ccoef * old2) */ r7c_2 = r7c_1; temp3 = r7cb * r7c_1; /* + (bcoef * old1) */ temp4 += temp3; temp3 = r7ca * casc_next_in; /* + (acoef * input) */ r7c_1 = temp4 + temp3; } /* Sixth cascaded Formant */ static void resonc6 _((void)); static void resonc6() { long temp3, temp4; temp4 = r6cc * r6c_2; /* (ccoef * old2) */ r6c_2 = r6c_1; temp3 = r6cb * r6c_1; /* + (bcoef * old1) */ temp4 += temp3; temp3 = r6ca * casc_next_in; /* + (acoef * input) */ r6c_1 = temp4 + temp3; } /* Fifth Formant */ static void resonc5 _((void)); static void resonc5() { long temp3, temp4; temp4 = r5cc * r5c_2; /* (ccoef * old2) */ r5c_2 = r5c_1; temp3 = r5cb * r5c_1; /* + (bcoef * old1) */ temp4 += temp3; temp3 = r5ca * casc_next_in; /* + (acoef * input) */ r5c_1 = temp4 + temp3; } /* Fourth Formant */ static void resonc4 _((void)); static void resonc4() { long temp3, temp4; temp4 = r4cc * r4c_2; /* (ccoef * old2) */ r4c_2 = r4c_1; temp3 = r4cb * r4c_1; /* + (bcoef * old1) */ temp4 += temp3; temp3 = r4ca * casc_next_in; /* + (acoef * input) */ r4c_1 = temp4 + temp3; } /* Third Formant */ static void resonc3 _((void)); static void resonc3() { long temp3, temp4; temp4 = r3cc * r3c_2; /* (ccoef * old2) */ r3c_2 = r3c_1; temp3 = r3cb * r3c_1; /* + (bcoef * old1) */ temp4 += temp3; temp3 = r3ca * casc_next_in; /* + (acoef * input) */ r3c_1 = temp4 + temp3; } /* Second Formant */ static void resonc2 _((void)); static void resonc2() { long temp3, temp4; temp4 = r2cc * r2c_2; /* (ccoef * old2) */ r2c_2 = r2c_1; temp3 = r2cb * r2c_1; /* + (bcoef * old1) */ temp4 += temp3; temp3 = r2ca * casc_next_in; /* + (acoef * input) */ r2c_1 = temp4 + temp3; } /* First Formant of Cascade Vocal Tract */ static void resonc1 _((void)); static void resonc1() { long temp3, temp4; temp4 = r1cc * r1c_2; /* (ccoef * old2) */ r1c_2 = r1c_1; temp3 = r1cb * r1c_1; /* + (bcoef * old1) */ temp4 += temp3; temp3 = r1ca * casc_next_in; /* + (acoef * input) */ r1c_1 = temp4 + temp3; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* S U B R O U T I N E R E S O N P */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Output = (acoef * input) + (bcoef * old1) + (ccoef * old2); */ /* Sixth Formant of Parallel Vocal Tract */ static void reson6p _((void)); static void reson6p() { long temp3, temp4; temp4 = r6pc * r6p_2; r6p_2 = r6p_1; temp3 = r6pb * r6p_1; temp4 += temp3; temp3 = r6pa * sourc; r6p_1 = temp4 + temp3; } /* Fifth Formant of Parallel Vocal Tract */ static void reson5p _((void)); static void reson5p() { long temp3, temp4; temp4 = r5pc * r5p_2; r5p_2 = r5p_1; temp3 = r5pb * r5p_1; temp4 += temp3; temp3 = r5pa * sourc; r5p_1 = temp4 + temp3; } /* Fourth Formant of Parallel Vocal Tract */ static void reson4p _((void)); static void reson4p() { long temp3, temp4; temp4 = r4pc * r4p_2; r4p_2 = r4p_1; temp3 = r4pb * r4p_1; temp4 += temp3; temp3 = r4pa * sourc; r4p_1 = temp4 + temp3; } /* Third Formant of Parallel Vocal Tract */ static void reson3p _((void)); static void reson3p() { long temp3, temp4; temp4 = r3pc * r3p_2; r3p_2 = r3p_1; temp3 = r3pb * r3p_1; temp4 += temp3; temp3 = r3pa * sourc; r3p_1 = temp4 + temp3; } /* Second Formant of Parallel Vocal Tract */ static void reson2p _((void)); static void reson2p() { long temp3, temp4; temp4 = r2pc * r2p_2; r2p_2 = r2p_1; temp3 = r2pb * r2p_1; temp4 += temp3; temp3 = r2pa * sourc; r2p_1 = temp4 + temp3; } /* First Formant of Parallel Vocal Tract */ static void reson1p _((void)); static void reson1p() { long temp3, temp4; temp4 = r1pc * r1p_2; r1p_2 = r1p_1; temp3 = r1pb * r1p_1; temp4 += temp3; temp3 = r1pa * sourc; r1p_1 = temp4 + temp3; } /* Nasal Formant of Parallel Vocal Tract */ static void resonnpp _((void)); static void resonnpp() { long temp3, temp4; temp4 = rnppc * rnpp_2; rnpp_2 = rnpp_1; temp3 = rnppb * rnpp_1; temp4 += temp3; temp3 = rnppa * sourc; rnpp_1 = temp4 + temp3; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* S U B R O U T I N E N O - R A D - C H A R */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #define ACOEF 0.005 #define BCOEF (1.0 - ACOEF) /* Slight decay to remove dc */ static void no_rad_char _((double)); static void no_rad_char(in) double in; { static double lastin; out = (ACOEF * in) + (BCOEF * lastin); lastin = out; out = -100. * out; /* Scale up to make visible */ } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* S U B R O U T I N E G E T M A X */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Find absolute maximum of arg1 & arg2, save in arg2 */ static void getmax _((long, long *)); static void getmax(arg1, arg2) long arg1; long *arg2; { if (arg1 < 0) arg1 = -arg1; if (arg1 > *arg2) *arg2 = arg1; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* S U B R O U T I N E P R - P A R S */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ static void pr_pars _((pars_ty *)); static void pr_pars(pp) pars_ty *pp; { static int esd; if (!esd) { esd++; error("Speaker-defining Constants:"); error("OUTs = %ld", spkrdef.OUTs); error("Srat = %ld", spkrdef.Srat); error("NSfr = %ld", spkrdef.NSfr); error("Flp = %ld", spkrdef.Flp); error("BWlp = %ld", spkrdef.BWlp); error("NFca = %ld", spkrdef.NFca); error("VSsw = %ld", spkrdef.VSsw); } error("Par values for this frame:"); error("F0 = %hd", pp->F0hz10); error("AV = %hd", pp->AVdb); error("F1 = %hd", pp->F1hz); error("BW1 = %hd", pp->B1hz); error("F2 = %hd", pp->F2hz); error("BW2 = %hd", pp->B2hz); error("F3 = %hd", pp->F3hz); error("BW3 = %hd", pp->B3hz); error("F4 = %hd", pp->F4hz); error("BW4 = %hd", pp->B4hz); error("F5 = %hd", pp->F5hz); error("BW5 = %hd", pp->B5hz); error("F6 = %hd", pp->F6hz); error("BW6 = %hd", pp->B6hz); error("Fnz = %hd", pp->FNZhz); error("BWnz = %hd", pp->BNZhz); error("Fnp = %hd", pp->FNPhz); error("BWnp = %hd", pp->BNPhz); error("Aasp = %hd", pp->AP); error("Nopn = %hd", pp->Kopen); error("Atur = %hd", pp->Aturb); error("tilt = %hd", pp->TLTdb); error("Afrc = %hd", pp->AF); error("skew = %hd", pp->Kskew); error("A1 = %hd", pp->A1); error("BWp1 = %hd", pp->B1phz); error("A2 = %hd", pp->A2); error("BWp2 = %hd", pp->B2phz); error("A3 = %hd", pp->A3); error("BWp3 = %hd", pp->B3phz); error("A4 = %hd", pp->A4); error("BWp4 = %hd", pp->B4phz); error("A5 = %hd", pp->A5); error("BWp5 = %hd", pp->B5phz); error("A6 = %hd", pp->A6); error("BWp6 = %hd", pp->B6phz); error("AN = %hd", pp->ANP); error("AB = %hd", pp->AB); error("AVpa = %hd", pp->AVpdb); error("G0 = %hd", pp->Gain0); } static double dBconvert _((long)); static double dBconvert(arg) long arg; { double x; double db; x = arg / 32767.; x = log10(x); db = 20. * x; return (db); } static void overload_warning _((long)); static void overload_warning(arg) long arg; { static int warnsw; if (!warnsw) { warnsw++; error ( "warning: signal at output of synthesizer (+%3.1f dB) exceeds \ 0 dB at synthesis parameter frame %d", dBconvert(arg), disptcum / nspfr ); #if 0 pr_pars(); #endif } } /* * NAME * truncate * * SYNOPSIS * long truncate(long n); * * DESCRIPTION * The truncate funtion is used to * truncate arg to fit into 16-bit word */ static long truncate _((long)); static long truncate(arg) long arg; { if (arg < -32768) { overload_warning(-arg); arg = -32768; } if (arg > 32767) { overload_warning(arg); arg = 32767; } return arg; } static void resoncOut _((void)); static void resoncOut() { long temp3; long temp4; temp4 = routc * rout_2; /* (ccoef * old2) */ rout_2 = rout_1; temp3 = routb * rout_1; /* + (bcoef * old1) */ temp4 += temp3; temp3 = routa * casc_next_in; /* + (acoef * input) */ rout_1 = temp4 + temp3; } /* * NAME * parwav * * SYNOPSIS * void parwav(pars_ty *pars, char *jwave); * * DESCRIPTION * The parwav function is used to * convert a frame of parameter data to a waveform chunk */ void parwav(pars, jwave) pars_ty *pars; short *jwave; { trace(("parwav()\n{\n"/*}*/)); /* * Initialize synthesizer and get specification for current speech * frame from host microcomputer */ gethost(pars); /* * for each output sample of current frame: */ for (ns = 0; ns < nspfr; ns++) { /* * Get low-passed random number for * aspiration and frication noise * * output variable is 'noise' */ gen_noise(); /* * Amplitude modulate noise (reduce noise amplitude during * second half of glottal period) if voicing simultaneously * present */ if (nper > nmod) noise *= 0.5; /* * Compute frication noise */ frics = amp_frica * noise; /* * Compute voicing waveform * * (run glottal source simulation at 4 times normal * sample rate to minimize quantization noise in period * of female voice) */ for (n4 = 0; n4 < 4; n4++) { /* * Use impulsive glottal source */ if (glsource == IMPULSIVE) voice = impulsive_source(); /* * Or use a more-natural-shaped source waveform with * excitation occurring both upon opening and upon * closure, strongest at closure */ else voice = natural_source(); /* * Reset period when counter 'nper' reaches T0 */ if (nper >= T0) { nper = 0; pitch_synch_par_reset(); } /* * Low-pass filter voicing waveform before downsampling * from 4*samrate to samrate samples/sec. * Resonator f=.09*samrate, bw=.06*samrate * * in=voice, out=voice */ resonlp(); /* * Increment counter that keeps track * of 4*samrate samples/sec */ nper++; } /* * Tilt spectrum of voicing source down by soft low-pass * filtering, amount of tilt determined by TLTdb */ voice = (voice * onemd) + (vlast * decay); vlast = voice; /* * Add breathiness during glottal open phase */ if (nper < nopen) { /* * Amount of breathiness determined by parameter * Aturb. Use nrand rather than noise because * noise is low-passed */ voice += amp_breth * nrand; } /* * Set amplitude of voicing */ glotout = amp_voice * voice; par_glotout = par_amp_voice * voice; /* * Compute aspiration amplitude and add to voicing source */ aspiration = amp_aspir * noise; glotout += aspiration; par_glotout += aspiration; /* * Cascade vocal tract, excited by laryngeal sources. * Nasal antiresonator, then * formants FNP, F5, F4, F3, F2, F1 * * in=glotout, out=rnzout */ resoncnz(); /* in=rnzout, out=rnpc_1 */ resoncnp(); casc_next_in = rnpc_1; if (nfcascade >= 8) { /* Do not use unless samrat = 16000 */ resonc8(); casc_next_in = r8c_1; } if (nfcascade >= 7) { /* Do not use unless samrat = 16000 */ resonc7(); casc_next_in = r7c_1; } if (nfcascade >= 6) { /* Do not use unless long vocal tract or */ resonc6(); /* samrat increased */ casc_next_in = r6c_1; } if (nfcascade >= 5) { resonc5(); casc_next_in = r5c_1; } if (nfcascade >= 4) { resonc4(); casc_next_in = r4c_1; } if (nfcascade >= 3) { resonc3(); casc_next_in = r3c_1; } if (nfcascade >= 2) { resonc2(); casc_next_in = r2c_1; } if (nfcascade >= 1) { resonc1(); } if (outsl > 0) { if (outsl < 13) { if (outsl == 1) out = voice; if (outsl == 2) out = aspiration; if (outsl == 3) out = frics; if (outsl == 4) out = glotout * 2.0; if (outsl == 5) out = par_glotout; if (outsl == 6) out = rnzout; if (outsl == 7) out = rnpc_1; if (outsl == 8) out = r5c_1; if (outsl == 9) out = r4c_1; if (outsl == 10) out = r3c_1; if (outsl == 11) out = r2c_1; if (outsl == 12) out = r1c_1; if (outsl <= 4) { /* * Take out effects of * radiation char */ no_rad_char(out); } goto skip; } } out = r1c_1; /* * Excite parallel F1 and FNP by voicing waveform */ /* Source is voicing plus aspiration */ sourc = par_glotout; /* in=sourc, out=rnpp_1 */ reson1p(); /* in=sourc, out=r1c_1 */ resonnpp(); /* Add in phase, boost lows for nasalized */ out += rnpp_1 + r1p_1; trace(("count = %d, out = %f\n", count, out)); /* * Standard parallel vocal tract * Formants F6, F5, F4, F3, F2, * outputs added with alternating sign * * Sound sourc for other parallel resonators is * frication plus first difference of voicing waveform */ sourc = frics + par_glotout - glotlast; glotlast = par_glotout; trace(("count = %d sourc = %f\n", count, sourc)); /* ??? */ count++; reson6p(); /* in=sourc, out=r6p_1 */ out = r6p_1 - out; reson5p(); /* in=sourc, out=r5p_1 */ out = r5p_1 - out; reson4p(); /* in=sourc, out=r4p_1 */ out = r4p_1 - out; reson3p(); /* in=sourc, out=r3p_1 */ out = r3p_1 - out; reson2p(); /* in=sourc, out=r2p_1 */ out = r2p_1 - out; outbypas = amp_bypas * sourc; out = outbypas - out; if (outsl > 12) { if (outsl == 13) out = r6p_1; if (outsl == 14) out = r5p_1; if (outsl == 15) out = r4p_1; if (outsl == 16) out = r3p_1; if (outsl == 17) out = r2p_1; if (outsl == 18) out = r1p_1; if (outsl == 19) out = rnpp_1; if (outsl == 20) out = outbypas; } casc_next_in = out; resoncOut(); out = rout_1; skip: temp = out * amp_gain0; /* Convert back to integer */ getmax(temp, &sigmx); #if 0 if (abs(temp) > 4500) temp = 4500; #endif /* Truncate if exceeds 16 bits */ *jwave++ = truncate(temp); } trace((/*{*/"}\n")); } c */ nper++; } /* * Tilt spectrum of voicing source down by soft low-pass * filtering, amount of tilt determined by TLTdb */ voice = (voice * onemd) + (vlast * decay); vlast = voice; /* * Add breathiness during glottal open phase */ if (nper < nopen) { /* * Amount of breathiness determined by parameter * Aturb. Use nrand rather than noise because * noise is low-passed */ voice += amp_breth * nrand; } /* * Set amplitrecite.1.0/klatt/parwave.h 644 0 0 4432 5432053507 14744ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: interface definition for klatt/parwave.c */ #ifndef PARWAVE_H #define PARWAVE_H #include #define SAMP_RATE 8000 /* samples/second */ #define N_MSEC_FRAME 10 /* ms/frame */ #define NSAMP_PER_FRAME (SAMP_RATE * N_MSEC_FRAME / 1000) typedef struct pars_ty pars_ty; struct pars_ty { short F0hz10; /* 0 */ short AVdb; /* 1 */ short F1hz; /* 2 */ short B1hz; /* 3 */ short F2hz; /* 4 */ short B2hz; /* 5 */ short F3hz; /* 6 */ short B3hz; /* 7 */ short F4hz; /* 8 */ short B4hz; /* 9 */ short F5hz; /* 10 */ short B5hz; /* 11 */ short F6hz; /* 12 */ short B6hz; /* 13 */ short FNZhz; /* 14 */ short BNZhz; /* 15 */ short FNPhz; /* 16 */ short BNPhz; /* 17 */ short AP; /* 18 */ short Kopen; /* 19 */ short Aturb; /* 20 */ short TLTdb; /* 21 */ short AF; /* 22 */ short Kskew; /* 23 */ short A1; /* 24 */ short B1phz; /* 25 */ short A2; /* 26 */ short B2phz; /* 27 */ short A3; /* 28 */ short B3phz; /* 29 */ short A4; /* 30 */ short B4phz; /* 31 */ short A5; /* 32 */ short B5phz; /* 33 */ short A6; /* 34 */ short B6phz; /* 35 */ short ANP; /* 36 */ short AB; /* 37 */ short AVpdb; /* 38 */ short Gain0; /* 39 */ }; typedef struct spkrdef_ty spkrdef_ty; struct spkrdef_ty { long OUTs; /* 0 */ long Srat; /* 1 */ long NSfr; /* 2 */ long Flp; /* 3 */ long BWlp; /* 4 */ long NFca; /* 6 */ long VSsw; /* 7 */ }; /* spkrdef.VSsw choices */ #define IMPULSIVE 1 #define NATURAL 2 extern spkrdef_ty spkrdef; void parwav _((pars_ty *, short *)); #endif /* PARWAVE_H */ rnating sign * * Sound sourc for other parallel resonators is * frication plus first difference of voicing waveform */ sourc = frics + par_glotout - glotlast; glotlast = par_glotout; trace(("count = %d sourc = %recite.1.0/klatt/r250.c 644 0 0 3774 5432053507 13772ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: functions to implement a 32bit parallel period 2^250 PBRS * * from Kirkpatrick, S. and E. Stoll, * "A Very Fast Shift-Register Sequence Random Number Generator", * Journal of Computational Physics, vol. 40, p. 157 (1981). */ #include static unsigned long buf[250]; static unsigned long *pos; #define rand8() ((rand() >> 7) & 255) void r250_init() { unsigned long bit; unsigned long *bp; /* * initialize crummy linear congruential */ srand(time((long *)0) + getpid()); /* * position to start of array */ pos = buf; /* * initialise contents of array */ for (bp = buf; bp < ENDOF(buf); ++bp) { *bp = ( ((unsigned long)rand8() << 24) | ((unsigned long)rand8() << 16) | ((unsigned long)rand8() << 8) | (unsigned long)rand8() ); } /* * make sure the bits are linearly independent */ for (bit = 1, bp = buf + 3; bit; bp += 11, bit <<= 1) { if (bp >= ENDOF(buf)) bp -= SIZEOF(buf); *bp = (*bp & ~(bit - 1)) | bit; } } unsigned long r250() { unsigned long result; unsigned long *other; other = pos + 103; if (other >= ENDOF(buf)) other -= SIZEOF(buf); *pos ^= *other; result = *pos++; if (pos >= ENDOF(buf)) pos = buf; return result; } */ recite.1.0/klatt/r250.h 644 0 0 1722 5432053507 13766ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: interface definition for klatt/r250.c */ #ifndef R250_H #define R250_H #include void r250_init _((void)); unsigned long r250 _((void)); #endif /* R250_H */ | ((unsigned long)rand8() << 16) | recite.1.0/man1/recite.1 644 0 0 5723 5432053507 14204ustar PeterMiller 0 0'\" t .\" recite - english text speech synthesizer .\" Copyright (C) 1993 Peter Miller. .\" All rights reserved. .\" .\" This program is free software; you can redistribute it and/or modify .\" it under the terms of the GNU General Public License as published by .\" the Free Software Foundation; either version 1, or (at your option) .\" any later version. .\" .\" This program is distributed in the hope that it will be useful, .\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the .\" GNU General Public License for more details. .\" .\" You should have received a copy of the GNU General Public License .\" along with this program; if not, write to the Free Software .\" Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. .\" .\" MANIFEST: manual page describing recite command .\" .TH recite 1 .if n .ad l .if n .hy 0 .if n .nr IN 8n .SH NAME recite \- english text speech synthesizer .SH SYNOPSIS .B recite [ .IR option \&... ][ .IR infile [ .I outfile ]] .br .B recite .B -Help .br .B recite .B -VERSion .SH DESCRIPTION The .I recite program is used to read english text and speak the words from the workstation's speaker. .PP By default, the standard input is read and the english text is spoken from the speaker. If a file name is given on the command line, the text is taken from the file rather than the standard input. If a second file is named, a .I ulaw encoded file is written to the named file, rather then emitting it from the speaker. This file will be compatible with Sun's .IR audiotool (1). .SH OPTIONS The following options are understood: .TP 8n .B -Write_Phonemes .br The option may be used to cause the translation process to cease after the text has been translated into phonemes. The phonemes will be emitted on the standard output, or to the appropriate file if an output file has been specified. .TP 8n .B -Help .br Provide some help with using the .I recite program. .TP 8n .B -VERSion .br Print the version of the .I recite program being executed. .PP All other options will produce a diagnostic error. Options may be abbreviated, the minimum abbreviation is shown in upper-case. Options are case insensitive. Options and file names may be mixed arbitrarily on the command line. .br .ne 1i .SH EXIT STATUS The .I recite program will exit with a status of 1 on any error. The .I recite program will only exit with a status of 0 if there are no errors. .br .ne 2i .SH COPYRIGHT .if t .ds C) \(co .if n .ds C) (C) The .I recite program is .br Copyright \*(C) 1993 Peter Miller. .br All rights reserved. .PP The .I recite program comes with ABSOLUTELY NO WARRANTY; for details use the '\fIrecite -VERSion Warranty\fP' command. This is free software and you are welcome to redistribute it under certain conditions; for details use the '\fIrecite -VERSion Redistribution\fP' command. .br .ne 1i .SH AUTHOR .TS tab(;); l l l. Peter Miller;UUCP;uunet!munnari!bmr.gov.au!pmiller /\e/\e*;Internet;pmiller@bmr.gov.au .TE Tx.ps(dnewnamexrecite.1.0/phonemes/features.c 644 0 0 31020 5432053507 15620ustar PeterMiller 0 0#include int InhDur[ALL_END + 1] = { 240, 230, 140, 240, 260, /* AA - AW */ 120, 260, 250, 150, 180, /* AX - ER */ 270, 190, 135, 110, 230, /* EXR - IXR */ 155, 220, 240, 280, 160, /* IY - UH */ 210, 230, 230, 260, 80, /* UW - HH */ 70, 100, 90, 80, 80, /* HX - RX */ 100, 70, 80, 170, 170, /* WW - EN */ 100, 110, 95, 80, 100, /* MM - FF */ 105, 105, 90, 70, 100, /* SS - ZZ */ 90, 50, 40, 40, 40, /* ZH - GP */ 70, 70, 70, 45, 40, /* KK - TT */ 75, 70, 70, 70 /* TQ - AXP */ }; int MinDur[ALL_END + 1] = { 100, 80, 60, 100, 100, /* AA - AW */ 60, 120, 150, 70, 80, /* AX - ER */ 130, 100, 40, 60, 80, /* EXR - IXR */ 55, 80, 130, 150, 60, /* IY - UH */ 70, 110, 150, 110, 20, /* UW - HH */ 25, 40, 70, 30, 70, /* HX - RX */ 60, 60, 40, 110, 100, /* WW - EN */ 60, 50, 60, 50, 80, /* MM - FF */ 60, 80, 60, 40, 60, /* SS - ZZ */ 60, 60, 50, 20, 60, /* ZH - GP */ 40, 40, 40, 50, 40, /* KK - TT */ 50, 50, 50, 70, /* TQ - AXP */ }; unsigned long Features[ALL_END + 1] = { VOWEL | VOICE | SYLLA | SONOR | LOW, /* AA */ VOWEL | VOICE | SYLLA | SONOR | LOW | LAX | FRONT | DIPTH, /* AE */ VOWEL | VOICE | SYLLA | SONOR, /* AH */ VOWEL | VOICE | SYLLA | SONOR | LOW | ROUND | LAX | DIPTH, /* AO */ VOWEL | VOICE | SYLLA | SONOR | LOW | WGLID | DIPTH, /* AW */ VOWEL | VOICE | SYLLA | SONOR | SCHWA | LAX, /* AX */ VOWEL | VOICE | SYLLA | SONOR | LOW | RGLID | DIPTH, /* AXR */ VOWEL | VOICE | SYLLA | SONOR | LOW | YGLID | DIPTH, /* AY */ VOWEL | VOICE | SYLLA | SONOR | FRONT | DIPTH, /* EH */ VOWEL | VOICE | SYLLA | SONOR | RETRO, /* ER */ VOWEL | VOICE | SYLLA | SONOR | RGLID | FRONT | DIPTH, /* EXR */ VOWEL | VOICE | SYLLA | SONOR | YGLID | FRONT | DIPTH, /* EY */ VOWEL | VOICE | SYLLA | SONOR | LAX | HIGH | FRONT | DIPTH, /* IH */ VOWEL | VOICE | SYLLA | SONOR | SCHWA | LAX | HIGH | FRONT, /* IX */ VOWEL | VOICE | SYLLA | SONOR | RGLID | HIGH | FRONT | DIPTH, /* IXR */ VOWEL | VOICE | SYLLA | SONOR | YGLID | HIGH | FRONT | F2BAC | DIPTH, /* IY */ VOWEL | VOICE | SYLLA | SONOR | WGLID | ROUND | DIPTH, /* OW */ VOWEL | VOICE | SYLLA | SONOR | ROUND | RGLID | DIPTH, /* OXR */ VOWEL | VOICE | SYLLA | SONOR | YGLID | ROUND | DIPTH, /* OY */ VOWEL | VOICE | SYLLA | SONOR | LAX | DIPTH, /* UH */ VOWEL | VOICE | SYLLA | SONOR | WGLID | ROUND | HIGH | DIPTH, /* UW */ VOWEL | VOICE | SYLLA | SONOR | RGLID | HIGH, /* UXR */ VOWEL | VOICE | SYLLA | SONOR | WGLID | ROUND | HIGH | FRONT | F2BAC | DIPTH, /* YU */ VOICE | SYLLA | SONOR | LATER, /* EL */ SONOR | ASPSE, /* HH */ VOICE | SONOR | ASPSE, /* HX */ VOICE | SONOR | LIQGL | LATER, /* LL */ VOICE | SONOR | LIQGL | LATER, /* LX */ VOICE | SONOR | LIQGL | RETRO, /* RR */ VOICE | SONOR | LIQGL | RETRO, /* RX */ VOICE | SONOR | ROUND | LIQGL | HIGH | LABIA, /* WW */ VOICE | SONOR | ROUND | LIQGL | HIGH | LABIA | ASPSE, /* WH */ VOICE | SONOR | PALAT | LIQGL | HIGH | F2BAC, /* YY */ VOICE | SYLLA | STOP | SONOR | NASAL | LABIA, /* EM */ VOICE | SYLLA | STOP | SONOR | NASAL | ALVEO, /* EN */ VOICE | STOP | SONOR | NASAL | LABIA, /* MM */ VOICE | STOP | SONOR | NASAL | ALVEO, /* NN */ VOICE | STOP | SONOR | NASAL, /* NG */ VOICE | STOP | FRICA | ALVEO, /* DH */ LABIA | FRICA, /* FF */ FRICA | ALVEO, /* SS */ PALAT | FRICA, /* SH */ FRICA | DENTA, /* TH */ VOICE | LABIA | FRICA, /* VV */ VOICE | FRICA, /* ZZ */ VOICE | FRICA, /* ZH */ VOICE | STOP | LABIA | PLOSI, /* BB */ VOICE | STOP | PLOSI | ALVEO, /* DD */ VOICE | STOP | ALVEO, /* DX */ VOICE | STOP | VELAR | PLOSI, /* GG */ VOICE | STOP | PLOSI, /* GP */ STOP | VELAR | PLOSI, /* KK */ STOP | PLOSI | PALVE, /* KP */ STOP | PLOSI | LABIA, /* PP */ STOP | PLOSI | ALVEO, /* TT */ STOP | PLOSI | ALVEO, /* TQ */ STOP | PLOSI | PALAT | AFFRI, /* CH */ VOICE | STOP | PLOSI | PALAT | AFFRI, /* JJ */ LAX }; /* f0 f1 f2 f3 bw1 bw2 bw3 fnz fnp av anp asp af a1 a2 a3 a4 a5 a6 ab */ frame_ty Vowels[23][2] = { { /* AA */ {0,700,1220,2600,130, 70,160,0,0,48,0,0,0,60,60,60,60,60,60,0}, {0,700,1220,2600,130, 70,160,0,0,48,0,0,0,60,60,60,60,60,60,0}, }, { /* AE */ {0,620,1660,2430, 70,130,300,0,0,48,0,0,0,60,60,60,60,60,60,0}, {0,650,1490,2470, 70,100,320,0,0,48,0,0,0,60,60,60,60,60,60,0}, }, { /* AH */ {0,620,1220,2550, 80, 50,140,0,0,48,0,0,0,60,60,60,60,60,60,0}, {0,620,1220,2550, 80, 50,140,0,0,48,0,0,0,60,60,60,60,60,60,0}, }, { /* AO */ {0,600, 990,2570, 90,100, 80,0,0,48,0,0,0,60,60,60,60,60,60,0}, {0,630,1040,2600, 90,100, 80,0,0,48,0,0,0,60,60,60,60,60,60,0}, }, { /* AW */ {0,640,1230,2550, 80, 70,140,0,0,48,0,0,0,60,60,60,60,60,60,0}, {0,420, 940,2350, 80, 70, 80,0,0,48,0,0,0,60,60,60,60,60,60,0}, }, { /* AX */ {0,550,1260,2470, 80, 50,140,0,0,48,0,0,0,60,60,60,60,60,60,0}, {0,550,1260,2470, 80, 50,140,0,0,48,0,0,0,60,60,60,60,60,60,0}, }, { /* AXR */ {0,680,1170,2380, 60, 60,110,0,0,48,0,0,0,60,60,60,60,60,60,0}, {0,520,1400,1650, 60, 60,110,0,0,48,0,0,0,60,60,60,60,60,60,0}, }, { /* AY */ {0,660,1200,2550,100, 70,200,0,0,48,0,0,0,60,60,60,60,60,60,0}, {0,400,1880,2500, 70,100,200,0,0,48,0,0,0,60,60,60,60,60,60,0}, }, { /* EH */ {0,530,1680,2500, 60, 90,200,0,0,48,0,0,0,60,60,60,60,60,60,0}, {0,620,1530,2530, 60, 90,200,0,0,48,0,0,0,60,60,60,60,60,60,0}, }, { /* ER */ {0,470,1270,1540,100, 60,110,0,0,48,0,0,0,60,60,60,60,60,60,0}, {0,420,1310,1540,100, 60,110,0,0,48,0,0,0,60,60,60,60,60,60,0}, }, { /* EXR */ {0,460,1650,2400, 60, 80,140,0,0,48,0,0,0,60,60,60,60,60,60,0}, {0,450,1500,1700, 60, 80,140,0,0,48,0,0,0,60,60,60,60,60,60,0}, }, { /* EY */ {0,480,1720,2520, 70,100,200,0,0,48,0,0,0,60,60,60,60,60,60,0}, {0,330,2200,2600, 55,100,200,0,0,48,0,0,0,60,60,60,60,60,60,0}, }, { /* IH */ {0,400,1800,2670, 50,100,140,0,0,48,0,0,0,60,60,60,60,60,60,0}, {0,470,1600,2600, 50,100,140,0,0,48,0,0,0,60,60,60,60,60,60,0}, }, { /* IX */ {0,420,1680,2520, 50,100,140,0,0,48,0,0,0,60,60,60,60,60,60,0}, {0,420,1680,2520, 50,100,140,0,0,48,0,0,0,60,60,60,60,60,60,0}, }, { /* IXR */ {0,320,1900,2900, 70, 80,120,0,0,48,0,0,0,60,60,60,60,60,60,0}, {0,420,1550,1750, 70, 80,120,0,0,48,0,0,0,60,60,60,60,60,60,0}, }, { /* IY */ {0,310,2200,2960, 50,200,400,0,0,48,0,0,0,60,60,60,60,60,60,0}, {0,290,2070,2980, 60,200,400,0,0,48,0,0,0,60,60,60,60,60,60,0}, }, { /* OW */ {0,540,1100,2300, 80, 70, 70,0,0,48,0,0,0,60,60,60,60,60,60,0}, {0,450, 900,2300, 80, 70, 70,0,0,48,0,0,0,60,60,60,60,60,60,0}, }, { /* OXR */ {0,550, 820,2200, 60, 60, 60,0,0,48,0,0,0,60,60,60,60,60,60,0}, {0,490,1300,1500, 60, 60, 60,0,0,48,0,0,0,60,60,60,60,60,60,0}, }, { /* OY */ {0,550, 960,2400, 80, 50,130,0,0,48,0,0,0,60,60,60,60,60,60,0}, {0,360,1820,2450, 60, 50,160,0,0,48,0,0,0,60,60,60,60,60,60,0}, }, { /* UH */ {0,450,1100,2350, 80,100, 80,0,0,48,0,0,0,60,60,60,60,60,60,0}, {0,500,1180,2390, 80,100, 80,0,0,48,0,0,0,60,60,60,60,60,60,0}, }, { /* UW */ {0,350,1250,2200, 65,110,140,0,0,48,0,0,0,60,60,60,60,60,60,0}, {0,320, 900,2200, 65,110,140,0,0,48,0,0,0,60,60,60,60,60,60,0}, }, { /* UXR */ {0,360, 800,2000, 60, 60, 80,0,0,48,0,0,0,60,60,60,60,60,60,0}, {0,390,1150,1500, 60, 60, 80,0,0,48,0,0,0,60,60,60,60,60,60,0}, }, { /* YU */ {0,290,1900,2600, 70,160,220,0,0,48,0,0,0,60,60,60,60,60,60,0}, {0,330,1200,2100, 70,160,220,0,0,48,0,0,0,60,60,60,60,60,60,0}, }, }; /* f0 f1 f2 f3 bw1 bw2 bw3 fnz fnp av anp asp af a1 a2 a3 a4 a5 a6 ab */ frame_ty Sonorants[10] = { {0,450, 800,2850, 65, 60, 80,0,0,47,0, 0,0,0,0,0,0,0,0,0},/* EL */ {0,450,1450,2450,300,160,300,0,0, 0,0,45,0,0,0,0,0,0,0,0},/* HH */ {0,450,1450,2450,200,120,200,0,0,55,0,53,0,0,0,0,0,0,0,0},/* HX */ {0,330,1050,2800, 50,100,280,0,0,51,0, 0,0,0,0,0,0,0,0,0},/* LL */ {0,450, 800,2850, 65, 60, 80,0,0,51,0, 0,0,0,0,0,0,0,0,0},/* LX */ {0,330,1060,1380, 70,100,120,0,0,51,0, 0,0,0,0,0,0,0,0,0},/* RR */ {0,460,1260,1560, 60, 60, 70,0,0,53,0, 0,0,0,0,0,0,0,0,0},/* RX */ {0,285, 610,2150, 50, 80, 60,0,0,53,0, 0,0,0,0,0,0,0,0,0},/* WW */ {0,330, 600,2100,150, 60, 60,0,0, 0,0,51,0,0,0,0,0,0,0,0},/* WH */ {0,240,2070,3020, 40,250,500,0,0,53,0, 0,0,0,0,0,0,0,0,0},/* YY */ }; /* doesthe datain the fnz and fnp columns need to be swapped? */ /* f0 f1 f2 f3 bw1 bw2 bw3 fnz fnp av anp asp af a1 a2 a3 a4 a5 a6 ab */ frame_ty Nasals[5] = { {0,200, 900,2100,120, 60, 70,450,270,55,0,0,0,0,0,0,0,0,0,0},/* EM */ {0,200,1600,2700,120, 70,110,450,270,55,0,0,0,0,0,0,0,0,0,0},/* EN */ {0,480,1270,2130, 40,200,200,450,270,55,0,0,0,0,0,0,0,0,0,0},/* MM */ {0,480,1340,2470, 40,300,300,450,270,55,0,0,0,0,0,0,0,0,0,0},/* NN */ {0,480,1600,2050,160,150,100,450,270,51,0,0,0,0,0,0,0,0,0,0},/* NG */ }; /* f0 f1 f2 f3 bw1 bw2 bw3 fnz fnp av anp asp af a1 a2 a3 a4 a5 a6 ab */ frame_ty Fricatives[8] = { {0,300,1150,2700, 60, 95,185,0,0,47,0, 0,50,0,0, 0, 0, 0,30,54},/* DH */ {0,400,1130,2100,225,120,175,0,0, 0,0,31,60,0,0, 0, 0, 0, 0,64},/* FF */ {0,400,1400,2700,200, 95,220,0,0, 0,0,10,40,0,0, 0, 0,50,82, 0},/* SS */ {0,400,1650,2400,200,110,280,0,0, 0,0,31,45,0,0,60,75,70,70, 0},/* SH */ {0,320,1290,2540,200, 90,200,0,0, 0,0,41,60,0,0, 0, 0, 0,30,54},/* TH */ {0,300,1130,2100, 55, 95,125,0,0,60,0, 0,60,0,0, 0, 0, 0, 0,64},/* VV */ {0,240,1390,2530, 70, 60,180,0,0,60,0, 0,50,0,0, 0, 0, 0,52, 0},/* ZZ */ {0,300,1840,2750,200,100,300,0,0,60,0, 0,50,0,0,57,48,48,46, 0} /* ZH */ }; /* f0 f1 f2 f3 bw1 bw2 bw3 fnz fnp av anp asp af a1 a2 a3 a4 a5 a6 ab */ frame_ty Plosives[10] = { {0,200, 900,2100, 65, 90,125,0,0,70,0,0, 0,0, 0, 0, 0,50,72, 0},/* BB */ {0,200,1600,2600, 60,100,170,0,0,65,0,0,50,0, 0,47,60,62,60, 0},/* DD */ {0,200,1600,2700,120,140,250,0,0,44,0,0, 0,0,60,60,60,60,60, 0},/* DX */ {0,270,1400,1900, 70,145,190,0,0,60,0,0,50,0,60,45,40, 0, 0, 0},/* GG */ {0,200,1950,2800,120,140,250,0,0,60,0,0, 0,0,30,70,60,62,62, 0},/* GP */ {0,350,1600,1900,280,220,250,0,0, 0,0,0, 0,0,70,30,30,60,10, 0},/* KK */ {0,300,1950,2800,150,140,250,0,0, 0,0,0, 0,0,30,70,60,62,62, 0},/* KP */ {0,300, 900,2100,300,190,185,0,0, 0,0,0, 0,0, 0, 0, 0, 0, 0,72},/* PP */ {0,300,1400,2700,300,180,220,0,0, 0,0,0, 0,0, 0, 0, 0,50,82, 0},/* TT */ {0,200,1400,2700,120,140,250,0,0, 0,0,0, 0,0, 0, 0, 0,50,82, 0},/* TQ */ }; /* f0 f1 f2 f3 bw1 bw2 bw3 fnz fnp av anp asp af a1 a2 a3 a4 a5 a6 ab */ frame_ty Affricates[2] = { {0,300,1700,2400,200,110,270,0,0,0,0,0,0,0,0,60,75,70,70,0},/* CH */ {0,200,1700,2400, 50,110,270,0,0,0,0,0,0,0,0,60,75,70,70,0},/* JJ */ }; /* f0 f1 f2 f3 bw1 bw2 bw3 fnz fnp av anp asp af a1 a2 a3 a4 a5 a6 ab */ frame_ty Psuedo_vowels[1] = { {0,430,1500,2500,120,60,120,0,0,57,0,0,0,0,60,60,60,60,60,0},/* AXP */ }; char * phonemes_type_name(n) int n; { static char name[8]; switch (n) { case VOWEL_TYPE: return "vowel"; case SONORANT_TYPE: return "sonorant"; case NASAL_TYPE: return "nasal"; case FRICATIVE_TYPE: return "fricative"; case PLOSIVE_TYPE: return "plosive"; case AFFRICATE_TYPE: return "affricate"; case PSUEDO_VOWEL_TYPE: return "psuedo_vowel"; } sprintf(name, "%d", n); return name; } char * phonemes_name(n) int n; { static char name[8]; switch (n) { case AA: return "AA"; case AE: return "AE"; case AH: return "AH"; case AO: return "AO"; case AW: return "AW"; case AX: return "AX"; case AXR: return "AXR"; case AY: return "AY"; case EH: return "EH"; case ER: return "ER"; case EXR: return "EXR"; case EY: return "EY"; case IH: return "IH"; case IX: return "IX"; case IXR: return "IXR"; case IY: return "IY"; case OW: return "OW"; case OXR: return "OXR"; case OY: return "OY"; case UH: return "UH"; case UW: return "UW"; case UXR: return "UXR"; case YU: return "YU"; case EL: return "EL"; case HH: return "HH"; case HX: return "HX"; case LL: return "LL"; case LX: return "LX"; case RR: return "RR"; case RX: return "RX"; case WW: return "WW"; case WH: return "WH"; case YY: return "YY"; case EM: return "EM"; case EN: return "EN"; case MM: return "MM"; case NN: return "NN"; case NG: return "NG"; case DH: return "DH"; case FF: return "FF"; case SS: return "SS"; case SH: return "SH"; case TH: return "TH"; case VV: return "VV"; case ZZ: return "ZZ"; case ZH: return "ZH"; case BB: return "BB"; case DD: return "DD"; case DX: return "DX"; case GG: return "GG"; case GP: return "GP"; case KK: return "KK"; case KP: return "KP"; case PP: return "PP"; case TT: return "TT"; case TQ: return "TQ"; case CH: return "CH"; case JJ: return "JJ"; case AXP: return "AXP"; case WORD_BREAK: return "WORD_BREAK"; } sprintf(name, "%d", n); return name; } 450,270,55,0,0,0,0,0,0,0,0,0,0},/* MM */ {0,480,1340,2470, 40,300,300,450,270,55,0,0,0,0,0,0,0,0,0,0},/* NN */ {0,480,1600,2050,160,150,100,450,270,51,0,0,0,0,0,0,0,0,0,0},/* NG */ }; /* f0 f1 f2 f3 bw1 bw2 bw3 fnz fnp av anp asp af a1 a2 a3 a4 a5 a6 ab */ frame_ty Fricatives[8] = { {0,300,1150,2700, 60, 95,185,0,0,47,0, 0,50,0,0, 0, 0, 0,30,54},/* DH */ {0,400,1130,2100,225,120,175,0,0, 0,0,31,60,0,0, 0, 0, 0, 0,64},/* FF */ {0,400,1400,2700,200, 95,220,0,0, 0,0,10,40,0,0, 0, 0,50,82,recite.1.0/phonemes/features.h 644 0 0 7733 5432053507 15623ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: interface definition for phonemes/features.c */ #ifndef FEATURES_H #define FEATURES_H #include #define VOWEL_TYPE 0 #define SONORANT_TYPE 1 #define NASAL_TYPE 2 #define FRICATIVE_TYPE 3 #define PLOSIVE_TYPE 4 #define AFFRICATE_TYPE 5 #define PSUEDO_VOWEL_TYPE 6 #define VOWELS_START 0 #define AA 0 #define AE 1 #define AH 2 #define AO 3 #define AW 4 #define AX 5 #define AXR 6 #define AY 7 #define EH 8 #define ER 9 #define EXR 10 #define EY 11 #define IH 12 #define IX 13 #define IXR 14 #define IY 15 #define OW 16 #define OXR 17 #define OY 18 #define UH 19 #define UW 20 #define UXR 21 #define YU 22 #define VOWELS_END 22 #define SONORANTS_START 23 #define EL 23 #define HH 24 #define HX 25 #define LL 26 #define LX 27 #define RR 28 #define RX 29 #define WW 30 #define WH 31 #define YY 32 #define SONORANTS_END 32 #define NASALS_START 33 #define EM 33 #define EN 34 #define MM 35 #define NN 36 #define NG 37 #define NASALS_END 37 #define FRICATIVES_START 38 #define DH 38 #define FF 39 #define SS 40 #define SH 41 #define TH 42 #define VV 43 #define ZZ 44 #define ZH 45 #define FRICATIVES_END 45 #define PLOSIVES_START 46 #define BB 46 #define DD 47 #define DX 48 #define GG 49 #define GP 50 #define KK 51 #define KP 52 #define PP 53 #define TT 54 #define TQ 55 #define PLOSIVES_END 55 #define AFFRICATES_START 56 #define CH 56 #define JJ 57 #define AFFRICATES_END 56 #define PSUEDO_VOWELS_START 58 #define AXP 58 #define PSUEDO_VOWELS_END 58 #define ALL_END 58 #define WORD_BREAK (ALL_END + 1) #define VOWEL ((unsigned long)1 << 0) #define SONOR ((unsigned long)1 << 1) #define NASAL ((unsigned long)1 << 2) #define FRICA ((unsigned long)1 << 3) #define PLOSI ((unsigned long)1 << 4) #define AFFRI ((unsigned long)1 << 5) #define PSUED ((unsigned long)1 << 6) #define ALVEO ((unsigned long)1 << 7) #define ASPSE ((unsigned long)1 << 8) #define DENTA ((unsigned long)1 << 9) #define DIPTH ((unsigned long)1 << 10) #define F2BAC ((unsigned long)1 << 11) #define FRONT ((unsigned long)1 << 12) #define GLOTT ((unsigned long)1 << 13) #define HIGH ((unsigned long)1 << 14) #define LABIA ((unsigned long)1 << 15) #define LATER ((unsigned long)1 << 16) #define LAX ((unsigned long)1 << 17) #define LIQGL ((unsigned long)1 << 18) #define LOW ((unsigned long)1 << 19) #define PALAT ((unsigned long)1 << 20) #define PALVE ((unsigned long)1 << 21) #define RETRO ((unsigned long)1 << 22) #define RGLID ((unsigned long)1 << 23) #define ROUND ((unsigned long)1 << 24) #define SCHWA ((unsigned long)1 << 25) #define STOP ((unsigned long)1 << 26) #define YGLID ((unsigned long)1 << 27) #define SYLLA ((unsigned long)1 << 28) #define VELAR ((unsigned long)1 << 29) #define VOICE ((unsigned long)1 << 30) #define WGLID ((unsigned long)1 << 31) #define VOWEL_AV 48.0 extern int InhDur[ALL_END + 1]; extern int MinDur[ALL_END + 1]; extern unsigned long Features[ALL_END + 1]; extern frame_ty Vowels[][2]; extern frame_ty Sonorants[]; extern frame_ty Nasals[]; extern frame_ty Fricatives[]; extern frame_ty Fricatives[]; extern frame_ty Plosives[]; extern frame_ty Affricates[]; extern frame_ty Psuedo_vowels[]; #define WORD_BREAK_TIME 100 /* ms */ char *phonemes_type_name _((int)); char *phonemes_name _((int)); #endif /* FEATURES_H */ anty of * MERCHANTABILITY or FITNESSrecite.1.0/phonemes/fricatives.c 644 0 0 4773 5432053507 16140ustar PeterMiller 0 0 #include #include #include #include #include void gen_fricative(phone, segdur, prev_phone, next_phone) int phone; int segdur; int prev_phone; int next_phone; { int j; unsigned long features; unsigned long next_feat=-1; unsigned long prev_feat=-1; double f0_temp; double f1_temp; double f2_temp; double f3_temp; double bw1_temp; double bw2_temp; double bw3_temp; double av_temp; int time_const; int time_count; int interp=0; int off; trace(("gen_fricative(phone = %s, segdur = %d, prev_phone = %s, next_phone = %s)\n{\n"/*}*/, phonemes_name(phone), segdur, phonemes_name(prev_phone), phonemes_name(next_phone))); features = Features[phone]; if (prev_phone != -1) prev_feat = Features[prev_phone]; if (next_phone != -1) next_feat = Features[next_phone]; if (next_feat != -1) { if ((next_feat & VOWEL) && (features & VOICE)) { translate_phone(next_phone,&off); av[1] = VOWEL_AV; f1[1] = Vowels[off][0].f1; f2[1] = Vowels[off][0].f2; f3[1] = Vowels[off][0].f3; bw1[1] = Vowels[off][0].bw1; bw2[1] = Vowels[off][0].bw2; bw3[1] = Vowels[off][0].bw3; interp = 1; } } f0_temp = f0[0]; f1_temp = f1[0]; f2_temp = f2[0]; f3_temp = f3[0]; bw1_temp = bw1[0]; bw2_temp = bw2[0]; bw3_temp = bw3[0]; av_temp = av[0]; if ((prev_phone & VOWEL) && (features & VOICE) && (next_feat & VOWEL)) av[0] = 60; time_const = segdur-70; time_count = 0; for (j=0;j < segdur;j+=10) { frame_ty frame; frame.f0 = f0_temp; frame.f1 = f1_temp; frame.f2 = f2_temp; frame.f3 = f3_temp; frame.bw1 = bw1_temp; frame.bw2 = bw2_temp; frame.bw3 = bw3_temp; frame.fnz = fnz; frame.fnp = fnp; frame.av = av_temp; frame.anp = 0; frame.asp = asp; frame.af = af; frame.a1 = a1; frame.a2 = a2; frame.a3 = a3; frame.a4 = a4; frame.a5 = a5; frame.a6 = a6; frame.ab = ab; frame_out(&frame); LastTarget = frame; if (interp && j > 70) { f0_temp = gen_curve(f0_temp,f0[1],time_const/4,time_count); f1_temp = gen_curve(f1_temp,f1[1],time_const/4,time_count); f2_temp = gen_curve(f2_temp,f2[1],time_const/4,time_count); f3_temp = gen_curve(f3_temp,f3[1],time_const/4,time_count); bw1_temp = gen_curve(bw1_temp,bw1[1],time_const/4,time_count); bw2_temp = gen_curve(bw2_temp,bw2[1],time_const/4,time_count); bw3_temp = gen_curve(bw3_temp,bw3[1],time_const/4,time_count); av_temp = gen_curve(av_temp,av[1],time_const/4,time_count); } time_count += 10; } } 5) #recite.1.0/phonemes/fricatives.h 644 0 0 2004 5432053507 16126ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: interface definition for phonemes/fricatives.c */ #ifndef FRICATIVES_H #define FRICATIVES_H #include void gen_fricative _((int phone, int segdur, int prev_phone, int next_phone)); #endif /* FRICATIVES_H */ f2[1] = Vowels[off][0].f2; f3[1] = Vowels[off][0].f3; bw1[1] = Vowels[off][0].bw1; bw2[1] = Vowels[off][0].bw2; bw3[1] = Vowels[off][0].bw3; interp = 1; } } f0_temp = f0[0]; f1_temp = f1[0]; f2_temp = f2[0]; f3_temp = f3[0]; bw1_temp = bw1[0]; bw2_temp = bw2[0]; bw3_temp = bw3[0]; av_temp = av[0]; if ((prev_phone & VOWEL) && (features & VOICE) && (next_feat & VOWEL)) av[0] = 60; time_const = segdur-70; time_count = 0; for (j=0;j < segdur;j+=10) { frame_ty framrecite.1.0/phonemes/phonemes.c 644 0 0 40602 5432053507 15626ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: functions to conver phonmes to klatt */ #include #include #include #include #include #include #include #include #include #include #include #include #include static char *get_byte_data; static long get_byte_pos; static long get_byte_len; #define THE_END -256 static int get_byte _((void)); static int get_byte() { if (get_byte_pos >= get_byte_len) return THE_END; return (unsigned char)get_byte_data[get_byte_pos++]; } static void get_byte_undo _((void)); static void get_byte_undo() { if (get_byte_pos > 0) --get_byte_pos; } #define SINGLE(a) ((long)(a)) #define PAIR(a, b) ((long)(a) | ((long)(b) << 8)) #define TRIPPLE(a, b, c) ((long)(a) | ((long)(b) << 8) | ((long)(c) << 16)) #define QUAD(a, b, c, d) ((long)(a) | ((long)(b) << 8) | ((long)(c) << 16) | ((long)(d) << 24)) static segment_ty get_phoneme _((void)); static segment_ty get_phoneme() { int cc; char c[4]; segment_ty result; int n; trace(("get_phoneme()\n{\n"/*}*/)); for (n = 0; n < SIZEOF(c); ++n) c[n] = 0; cc = get_byte(); if (cc == THE_END) { result.phone = THE_END; result.duration = 0; goto done; } if (islower(cc)) c[0] = toupper(cc); else if (isupper(cc)) { c[0] = cc; cc = get_byte(); if (cc != THE_END) { if (islower(cc)) cc = toupper(cc); c[1] = cc; } } else if (cc == '('/*)*/) { for (n = 0; ; ++n) { cc = get_byte(); if (cc == THE_END) break; if (cc == /*(*/')') break; if (islower(cc)) cc = toupper(cc); if (n < SIZEOF(c)) c[n] = cc; } } else c[0] = cc; switch (QUAD(c[0], c[1], c[2], c[3])) { case SINGLE('A'): case PAIR('A', 'A'): case PAIR('O', 'H'): result.phone = AA; break; case PAIR('A', 'E'): result.phone = AE; break; case PAIR('A', 'H'): result.phone = AH; break; case PAIR('A', 'O'): result.phone = AO; break; case PAIR('A', 'W'): result.phone = AW; break; case PAIR('A', 'X'): result.phone = AX; break; case TRIPPLE('A', 'X', 'R'): result.phone = AXR; break; case PAIR('A', 'Y'): result.phone = AY; break; case SINGLE('B'): result.phone = BB; break; case PAIR('B', 'B'): result.phone = BB; break; case PAIR('C', 'H'): result.phone = CH; break; case SINGLE('D'): result.phone = DD; break; case PAIR('D', 'D'): result.phone = DD; break; case PAIR('D', 'H'): result.phone = DH; break; case PAIR('D', 'X'): result.phone = DX; break; case PAIR('E', 'H'): result.phone = EH; break; case PAIR('E', 'L'): result.phone = EL; break; case PAIR('E', 'M'): result.phone = EM; break; case PAIR('E', 'N'): result.phone = EN; break; case PAIR('E', 'R'): result.phone = ER; break; case TRIPPLE('E', 'X', 'R'): result.phone = EXR; break; case PAIR('E', 'Y'): result.phone = EY; break; case SINGLE('F'): result.phone = FF; break; case PAIR('F', 'F'): result.phone = FF; break; case SINGLE('G'): result.phone = GG; break; case PAIR('G', 'G'): result.phone = GG; break; case PAIR('G', 'P'): result.phone = GP; break; case SINGLE('H'): result.phone = HH; break; case PAIR('H', 'H'): result.phone = HH; break; case PAIR('H', 'X'): result.phone = HX; break; case PAIR('I', 'H'): result.phone = IH; break; case PAIR('I', 'X'): result.phone = IX; break; case TRIPPLE('I', 'X', 'R'): result.phone = IXR; break; case PAIR('I', 'Y'): result.phone = IY; break; case SINGLE('J'): result.phone = JJ; break; case PAIR('J', 'J'): result.phone = JJ; break; case SINGLE('K'): result.phone = KK; break; case PAIR('K', 'K'): result.phone = KK; break; case PAIR('K', 'P'): result.phone = KP; break; case SINGLE('L'): result.phone = LL; break; case PAIR('L', 'L'): result.phone = LL; break; case PAIR('L', 'X'): result.phone = LX; break; case SINGLE('M'): result.phone = MM; break; case PAIR('M', 'M'): result.phone = MM; break; case PAIR('N', 'G'): result.phone = NG; break; case SINGLE('N'): result.phone = NN; break; case PAIR('N', 'N'): result.phone = NN; break; case PAIR('O', 'W'): result.phone = OW; break; case TRIPPLE('O', 'X', 'R'): result.phone = OXR; break; case PAIR('O', 'Y'): result.phone = OY; break; case SINGLE('P'): result.phone = PP; break; case PAIR('P', 'P'): result.phone = PP; break; case SINGLE('R'): result.phone = RR; break; case PAIR('R', 'R'): result.phone = RR; break; case PAIR('R', 'X'): result.phone = RX; break; case SINGLE('S'): result.phone = SS; break; case PAIR('S', 'H'): result.phone = SH; break; case PAIR('S', 'S'): result.phone = SS; break; case SINGLE('T'): result.phone = TT; break; case PAIR('T', 'H'): result.phone = TH; break; case PAIR('T', 'Q'): result.phone = TQ; break; case PAIR('T', 'T'): result.phone = TT; break; case PAIR('U', 'H'): result.phone = UH; break; case PAIR('U', 'W'): result.phone = UW; break; case TRIPPLE('U', 'X', 'R'): result.phone = UXR; break; case SINGLE('V'): result.phone = VV; break; case PAIR('V', 'V'): result.phone = VV; break; case SINGLE('W'): result.phone = WW; break; case PAIR('W', 'H'): result.phone = WH; break; case PAIR('W', 'W'): result.phone = WW; break; case SINGLE('Y'): result.phone = YY; break; case PAIR('Y', 'U'): result.phone = YU; break; case PAIR('Y', 'Y'): result.phone = YY; break; case SINGLE('Z'): result.phone = ZZ; break; case PAIR('Z', 'H'): result.phone = ZH; break; case PAIR('Z', 'Z'): result.phone = ZZ; break; case SINGLE(' '): case SINGLE('\t'): case SINGLE('\n'): result.phone = WORD_BREAK; result.duration = 1; goto done; case SINGLE(','): result.phone = WORD_BREAK; result.duration = 2; goto done; case SINGLE('-'): result.phone = WORD_BREAK; result.duration = 3; goto done; case SINGLE('.'): result.phone = WORD_BREAK; result.duration = 4; goto done; default: fatal("unknown \"%.*s\" phoneme", SIZEOF(c), c); result.phone = THE_END; result.duration = 0; goto done; } cc = get_byte(); if (cc == THE_END) result.duration = 1; else if (isdigit(cc)) result.duration = cc - '0' + 1; else { get_byte_undo(); result.duration = 1; } done: trace(("return %s; /* %d */\n", phonemes_name(result.phone), result.duration)); trace((/*{*/"}\n")); return result; } static void gen_pause _((void)); static void gen_pause() { int k; static frame_ty frame = { 100, 100, 200, 300, 100, 200, 300, 200, 200, }; for (k = 0; k < 50; k++) frame_out(&frame); } /* * the following looks up initial values for each of the parameters in the * database. If the phoneme is a vowel with a dipthong, f[1] is filled with * the dipthong target. Otherwise, f[1] = f[0]. */ static int set_params _((int type, int off, int next_phone)); static int set_params(type, off, next_phone) int type; int off; int next_phone; { int return_val = 0; trace(("set_params(type = %s, off = %d, next_phone = %s)\n{\n"/*}*/, phonemes_type_name(type), off, phonemes_name(next_phone))); fnp = 250; fnz = 250; switch (type) { case VOWEL_TYPE: asp = ab = af = 0; a1 = a2 = a3 = a4 = a5 = a6 = 60; /* START = 0, END = 1 */ av[0] = Vowels[off][0].av; av[1] = Vowels[off][1].av; f1[0] = Vowels[off][0].f1; f1[1] = Vowels[off][1].f1; f2[0] = Vowels[off][0].f2; f2[1] = Vowels[off][1].f2; f3[0] = Vowels[off][0].f3; f3[1] = Vowels[off][1].f3; bw1[0] = Vowels[off][0].bw1; bw1[1] = Vowels[off][1].bw1; bw2[0] = Vowels[off][0].bw2; bw2[1] = Vowels[off][1].bw2; bw3[0] = Vowels[off][0].bw3; bw3[1] = Vowels[off][1].bw3; s_f0 = (f0[1] - f0[0]) / (float) length; s_f1 = (f1[1] - f1[0]) / (float) length; s_f2 = (f2[1] - f2[0]) / (float) length; s_f3 = (f3[1] - f3[0]) / (float) length; s_bw1 = (bw1[1] - bw1[0]) / (float) length; s_bw2 = (bw2[1] - bw2[0]) / (float) length; s_bw3 = (bw3[1] - bw3[0]) / (float) length; s_av = (av[1] - av[0]) / (float) length; return_val = 1; break; case SONORANT_TYPE: a1 = a2 = a3 = a4 = a5 = a6 = 60; ab = 0; af = 0; asp = Sonorants[off].asp; av[0] = Sonorants[off].av; f1[0] = Sonorants[off].f1; f2[0] = Sonorants[off].f2; f3[0] = Sonorants[off].f3; bw1[0] = Sonorants[off].bw1; bw2[0] = Sonorants[off].bw2; bw3[0] = Sonorants[off].bw3; fnp = 250.0; fnz = 250.0; break; case NASAL_TYPE: a1 = a2 = a3 = a4 = a5 = a6 = 60; ab = af = asp = 0; av[0] = Nasals[off].av; f1[0] = Nasals[off].f1; f2[0] = Nasals[off].f2; f3[0] = Nasals[off].f3; bw1[0] = Nasals[off].bw1; bw2[0] = Nasals[off].bw2; bw3[0] = Nasals[off].bw3; fnp = Nasals[off].fnp; fnz = Nasals[off].fnz; break; case FRICATIVE_TYPE: a1 = 0; a2 = Fricatives[off].a2; a3 = Fricatives[off].a3; a4 = Fricatives[off].a4; a5 = Fricatives[off].a5; a6 = Fricatives[off].a6; ab = Fricatives[off].ab; av[0] = Fricatives[off].av; f1[0] = Fricatives[off].f1; f2[0] = Fricatives[off].f2; f3[0] = Fricatives[off].f3; bw1[0] = Fricatives[off].bw1; bw2[0] = Fricatives[off].bw2; bw3[0] = Fricatives[off].bw3; asp = Fricatives[off].asp; af = Fricatives[off].af; break; case PLOSIVE_TYPE: a1 = 0; a2 = Plosives[off].a2; a3 = Plosives[off].a3; a4 = Plosives[off].a4; a5 = Plosives[off].a5; a6 = Plosives[off].a6; ab = Plosives[off].ab; av[0] = Plosives[off].av; f1[0] = Plosives[off].f1; f2[0] = Plosives[off].f2; f3[0] = Plosives[off].f3; bw1[0] = Plosives[off].bw1; bw2[0] = Plosives[off].bw2; bw3[0] = Plosives[off].bw3; asp = Plosives[off].asp; af = Plosives[off].af; break; case AFFRICATE_TYPE: a1 = 0; a2 = Affricates[off].a2; a3 = Affricates[off].a3; a4 = Affricates[off].a4; a5 = Affricates[off].a5; a6 = Affricates[off].a6; ab = Affricates[off].ab; av[0] = Affricates[off].av; f1[0] = Affricates[off].f1; f2[0] = Affricates[off].f2; f3[0] = Affricates[off].f3; bw1[0] = Affricates[off].bw1; bw2[0] = Affricates[off].bw2; bw3[0] = Affricates[off].bw3; asp = Affricates[off].asp; af = Affricates[off].af; break; case PSUEDO_VOWEL_TYPE: a1 = 0; a2 = Psuedo_vowels[off].a2; a3 = Psuedo_vowels[off].a3; a4 = Psuedo_vowels[off].a4; a5 = Psuedo_vowels[off].a5; a6 = Psuedo_vowels[off].a6; ab = Psuedo_vowels[off].ab; av[0] = Psuedo_vowels[off].av; f1[0] = Psuedo_vowels[off].f1; f2[0] = Psuedo_vowels[off].f2; f3[0] = Psuedo_vowels[off].f3; bw1[0] = Psuedo_vowels[off].bw1; bw2[0] = Psuedo_vowels[off].bw2; bw3[0] = Psuedo_vowels[off].bw3; asp = Psuedo_vowels[off].asp; break; default: fatal("unknown type"); } trace(("return %d;\n", return_val)); trace((/*{*/"}\n")); return return_val; } void phonemes_to_klatt(in, inlen, out_p, outlen_p) char *in; long inlen; char **out_p; long *outlen_p; { long j; long k; int next_phone; int last_phone; int type; int off; int interp = 0; unsigned long features; long i; long new_word; long s_count; long count; long h; long list_count; long ph_list_max; long ph_list_pos; segment_ty *ph_list; long *syll_count; long syll_count_max; long word_count; trace(("phonemes_to_klatt()\n{\n"/*}*/)); get_byte_data = in; get_byte_pos = 0; get_byte_len = inlen; /* * read the phonemes */ ph_list_max = (1L << 15); ph_list_pos = 0; ph_list = (segment_ty *)mem_alloc(ph_list_max * sizeof(segment_ty)); for (;;) { segment_ty p; if (ph_list_pos >= ph_list_max) { ph_list_max += (1L << 15); mem_change_size((char **)&ph_list, ph_list_max * sizeof(segment_ty)); } p = get_phoneme(); if (p.phone == THE_END) { p.phone = WORD_BREAK; p.duration = 1; ph_list[ph_list_pos++] = p; break; } ph_list[ph_list_pos++] = p; } trace(("mark\n")); if (!ph_list_pos) { *out_p = 0; *outlen_p = 0; goto done; } trace(("mark\n")); count = ph_list_pos; a1 = 0; /* inital F0 */ f0[0] = 1300; f0[1] = 1300; /* calculate the length of each segment */ trace(("mark\n")); segdur(ph_list, count); /* * break the input string into words */ trace(("mark\n")); syll_count_max = (1L << 13); syll_count = (long *)mem_alloc(syll_count_max * sizeof(long)); word_count = 0; s_count = 0; for (i = 0; i < count; i++) { if (ph_list[i].phone == WORD_BREAK) { if (word_count >= syll_count_max) { syll_count_max += (1L << 13); mem_change_size((char **)&syll_count, syll_count_max * sizeof(long)); } syll_count[word_count++] = s_count; s_count = 0; } else s_count++; } /* generation loop */ trace(("mark\n")); h = 0; list_count = 0; while (h < word_count) { new_word = 1; i = 0; while (i < syll_count[h]) { if (i == syll_count[h] - 1 && h == word_count-1) f0_change = -1000; else f0_change = 0; /* translate to array type and offset */ if (ph_list[list_count].phone == WORD_BREAK) { list_count++; continue; } trace(("mark\n")); type = translate_phone(ph_list[list_count].phone, &off); length = ph_list[list_count].duration / 10; interp = 0; if (i < (syll_count[h]-1)) interp = set_params(type, off, ph_list[list_count + 1].phone); else interp = set_params(type, off, -1); features = Features[ph_list[list_count].phone]; next_phone = -1; last_phone = -1; /* calculate previous and next phones if they exist */ if (i < (syll_count[h]-1)) next_phone = ph_list[list_count + 1].phone; if (!new_word) last_phone = ph_list[list_count - 1].phone; /* generate according to phoneme type */ if (features & PLOSI) { gen_plosive ( ph_list[list_count].phone, ph_list[list_count].duration, last_phone, next_phone ); } else if (features & FRICA) { gen_fricative ( ph_list[list_count].phone, ph_list[list_count].duration, last_phone, next_phone ); } else if (features & VOWEL) { gen_vowel ( ph_list[list_count].phone, ph_list[list_count].duration, last_phone, next_phone ); } else if (features & SONOR) { gen_sonorant ( ph_list[list_count].phone, ph_list[list_count].duration, last_phone, next_phone ); } else { for (j = 0; j < length; j++) { frame_ty frame; frame.f0 = f0[0]; frame.f1 = f1[0]; frame.f2 = f2[0]; frame.f3 = f3[0]; frame.bw1 = bw1[0]; frame.bw2 = bw2[0]; frame.bw3 = bw3[0]; frame.fnz = fnz; frame.fnp = fnp; frame.av = av[0]; frame.anp = 0; frame.asp = asp; frame.af = af; frame.a1 = a1; frame.a2 = a2; frame.a3 = a3; frame.a4 = a4; frame.a5 = a5; frame.a6 = a6; frame.ab = ab; frame_out(&frame); #if 0 /* * the following is a hack * to give the F0 some life */ if (j < length / 3) f0[0] += 10; else f0[0] -= 10; #endif if (interp) { f0[0] += s_f0; f1[0] += s_f1; f2[0] += s_f2; f3[0] += s_f3; bw1[0] += s_bw1; bw2[0] += s_bw2; bw3[0] += s_bw3; av[0] += s_av; } } } i++; list_count++; new_word = 0; } /* give a WORD_BREAK_TIME pause in between words */ trace(("mark\n")); if (++h < word_count) { frame_ty frame; frame.f0 = LastTarget.f0; frame.f1 = LastTarget.f1; frame.f2 = LastTarget.f2; frame.f3 = LastTarget.f3; frame.bw1 = LastTarget.bw1; frame.bw2 = LastTarget.bw2; frame.bw3 = LastTarget.bw3; frame.fnz = LastTarget.fnz; frame.fnp = LastTarget.fnp; frame.av = 0; frame.anp = LastTarget.anp; frame.asp = 0; frame.af = 0; frame.a1 = LastTarget.a1; frame.a2 = LastTarget.a2; frame.a3 = LastTarget.a3; frame.a4 = LastTarget.a4; frame.a5 = LastTarget.a5; frame.a6 = LastTarget.a6; frame.ab = LastTarget.ab; for (k = 0; k < WORD_BREAK_TIME/10; k++) frame_out(&frame); } } trace(("mark\n")); done: mem_free((char *)ph_list); frame_out_collect(out_p, outlen_p); trace((/*{*/"}\n")); } / trace(("mark\n")); segdur(ph_list, count); /* * break the input string into words */ trace(("mark\n")); syll_counrecite.1.0/phonemes/phonemes.h 644 0 0 1771 5432053507 15617ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: interface definition for phonemes/phonemes.c */ #ifndef PHONEMES_H #define PHONEMES_H #include void phonemes_to_klatt _((char *in, long inlen, char **out, long *outlen)); #endif /* PHONEMES_H */ .a3 = arecite.1.0/phonemes/plosives.c 644 0 0 11431 5432053507 15652ustar PeterMiller 0 0#include #include #include #include #include void gen_plosive(phone, segdur, prev_phone, next_phone) int phone; int segdur; int prev_phone; int next_phone; { int j; unsigned long features; unsigned long next_feat; unsigned long prev_feat; int time_count; int time_const; int off; double f0_temp; double f1_temp; double f2_temp; double f3_temp; double bw1_temp; double bw2_temp; double bw3_temp; double av_temp; trace(("gen_plosive(phone = %s, segdur = %d, prev_phone = %s, next_phone = %s)\n{\n"/*}*/, phonemes_name(phone), segdur, phonemes_name(prev_phone), phonemes_name(next_phone))); features = Features[phone]; prev_feat = prev_phone >= 0 ? Features[prev_phone] : -1; next_feat = next_phone >= 0 ? Features[next_phone] : -1; if ((features & VOICE) && (!next_feat & VOWEL)) av[0] -= 20; if (phone == GG || phone == GP) av[0] -= 10; if (next_feat != -1) { if (next_feat & VOWEL) { translate_phone(next_phone, &off); f1[1] = Vowels[off][0].f1; f2[1] = Vowels[off][0].f2; f3[1] = Vowels[off][0].f3; bw1[1] = Vowels[off][0].bw1; bw2[1] = Vowels[off][0].bw2; bw3[1] = Vowels[off][0].bw3; } else if (next_feat & SONOR) { translate_phone(next_phone, &off); f1[1] = Sonorants[off].f1; f2[1] = Sonorants[off].f2; f3[1] = Sonorants[off].f3; bw1[1] = Sonorants[off].bw1; bw2[1] = Sonorants[off].bw2; bw3[1] = Sonorants[off].bw3; } } if (prev_feat != -1) { /* voice onset time = 4 frames = 40 ms*/ if (prev_feat & VOICE) { frame_ty frame; frame.f0 = LastTarget.f0; frame.f1 = LastTarget.f1; frame.f2 = LastTarget.f2; frame.f3 = LastTarget.f3; frame.bw1 = LastTarget.bw1; frame.bw2 = LastTarget.bw2; frame.bw3 = LastTarget.bw3; frame.fnz = LastTarget.fnz; frame.fnp = LastTarget.fnp; frame.av = 0; frame.anp = 0; frame.asp = 0; frame.af = 0; frame.a1 = LastTarget.a1; frame.a2 = LastTarget.a2; frame.a3 = LastTarget.a3; frame.a4 = LastTarget.a4; frame.a5 = LastTarget.a5; frame.a6 = LastTarget.a6; frame.ab = LastTarget.ab; for (j = 0; j < 4; j++) frame_out(&frame); } } if (phone == BB || phone == DD) time_const = segdur * 2; else time_const = segdur; time_count = 0; f0_temp = f0[0]; f1_temp = f1[0]; f2_temp = f2[0]; f3_temp = f3[0]; bw1_temp = bw1[0]; bw2_temp = bw2[0]; bw3_temp = bw3[0]; av_temp = av[0]; for (j = 0; j < segdur; j += 10) { frame_ty frame; frame.f0 = f0_temp; frame.f1 = f1_temp; frame.f2 = f2_temp; frame.f3 = f3_temp; frame.bw1 = bw1_temp; frame.bw2 = bw2_temp; frame.bw3 = bw3_temp; frame.fnz = fnz; frame.fnp = fnp; frame.av = av_temp; frame.anp = 0; frame.asp = asp; frame.af = af; frame.a1 = a1; frame.a2 = a2; frame.a3 = a3; frame.a4 = a4; frame.a5 = a5; frame.a6 = a6; frame.ab = ab; if (next_feat != -1) if (next_feat & (VOWEL | SONOR)) { if (phone == GP || phone == GG) av_temp -= 3; if (phone == BB || phone == DD) av_temp -= 5; f0_temp = gen_curve(f0[0], f0[1], time_const/4, time_count); f1_temp = gen_curve(f1[0], f1[1], time_const/4, time_count); f2_temp = gen_curve(f2[0], f2[1], time_const/4, time_count); f3_temp = gen_curve(f3[0], f3[1], time_const/4, time_count); bw1_temp = gen_curve(bw1[0], bw1[1], time_const/4, time_count); bw2_temp = gen_curve(bw2[0], bw2[1], time_const/4, time_count); bw3_temp = gen_curve(bw3[0], bw3[1], time_const/4, time_count); time_count += 10; } if (phone == PP) { if (j == 20) frame.af = 60; else if (j > 30 && j < 60) frame.asp = 60; } else if (phone == TT) { if (j == 10) frame.af = 55; if (j >= 10) frame.asp = 45; } else if (phone == TQ) { if (j == 20) frame.af = 51; if (j >= 20) frame.asp = 51; } else if (phone == KK) { if (j == 0) frame.af = 45; } else if (phone == KP) { /* voice onset for /Kh/ = 60ms */ if (j == 0) frame.af = 55; else frame.asp = 50; } else if (phone == GG) { /* voice onset = 10ms */ if (j >= (segdur - 10)) frame.av = 0; } else if (phone == GP) { /* voice onset = 10ms */ if (j >= (segdur - 10)) { frame.av = 0; frame.asp = 55; } } else if (phone == BB) { if (j < 10 || j > 40) frame.av = 0; if (j >= 20) frame.asp = 40; } else if (phone == DD) { if (j < 10) { frame.av = 0; } } else if (phone == JJ) { if (j == 0 || j == 10) { frame.asp = 60; } if (j <= 40 && j > 0) { frame.av = 60; } } else if (phone == CH) { /* voice onset for /Kh/ = 60ms */ if (j == 0) frame.af = 55; else frame.asp = 50; } frame_out(&frame); LastTarget = frame; } trace((/*{*/"}\n")); } Sonorants[off].f1; f2[1] = Sonorants[off].f2; f3[1] = Sonorants[off].f3; bw1[1] = Sonorants[off].bw1; bw2[1] = Sonorants[off].bw2; bw3[1] = Sonorants[off].bw3; } } if (prev_feat != -1) { /* voice onset time = recite.1.0/phonemes/plosives.h 644 0 0 1772 5432053507 15646ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: interface definition for phonemes/plosives.c */ #ifndef PLOSIVES_H #define PLOSIVES_H #include void gen_plosive _((int phone, int segdur, int prev_phone, int next_phone)); #endif /* PLOSIVES_H */ frecite.1.0/phonemes/rules.c 644 0 0 12765 5432053507 15153ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: functions to translate phonemes to frames */ #include #include #include #include void segdur(seg_list, count) segment_ty *seg_list; long count; { unsigned long type; int num_syllables=1; int phone; int phone_count; int inhdur; int mindur; unsigned long next_feature; unsigned long prev_feature; int off; trace(("segdur(seg_list = %08lX, = %08lX, count = %ld)\n{\n"/*}*/, (long)seg_list, count)); off = 0; for (phone_count = 0; phone_count < count; phone_count++) seg_list[phone_count].duration = 100 + 25 * (seg_list[phone_count].duration - 1); num_syllables = 1; for (phone_count = 0; phone_count < count; phone_count++) { phone = seg_list[phone_count].phone; #ifdef SYLLABLE_MARKER if (phone == SYLLABLE_MARKER) { if (phone_count > 0) seg_list[phone_count - 1].duration += 20; syllable++; continue; } #endif if (phone == WORD_BREAK) { continue; } type = Features[phone]; if ( (type & SYLLA) && seg_list[phone_count + 1].phone != WORD_BREAK ) { /* rule 4 */ seg_list[phone_count].duration = (seg_list[phone_count].duration * 85) / 100; } if ((type & SYLLA) && num_syllables > 1) { /* rule 5 */ seg_list[phone_count].duration = (seg_list[phone_count].duration * 80) / 100; } if ((!type & VOWEL) && phone_count != 0) { /* rule 6 */ seg_list[phone_count].duration = (seg_list[phone_count].duration * 85) / 100; } if (type & VOWEL) { /* rule 9 */ if (seg_list[phone_count + 1].phone != WORD_BREAK) off = phone_count + 1; else off = phone_count + 2; if ( (Features[seg_list[off].phone] & FRICA) && (Features[seg_list[off].phone] & VOICE) ) { seg_list[phone_count].duration = (seg_list[phone_count].phone * 16) / 10; } if ( (Features[seg_list[off].phone] & PLOSI) && (Features[seg_list[off].phone] & VOICE) ) { seg_list[phone_count].duration = (seg_list[phone_count].duration * 12) / 10; } if (Features[seg_list[off].phone] & NASAL) { seg_list[phone_count].duration = (seg_list[phone_count].duration * 85) / 100; } if (Features[seg_list[off].phone] & PLOSI) { seg_list[phone_count].duration = (seg_list[phone_count].duration * 70) / 100; } } /* rule 10 */ if (seg_list[phone_count+1].phone != WORD_BREAK) off = phone_count + 1; else off = phone_count + 2; next_feature = Features[seg_list[off].phone]; prev_feature = Features[seg_list[phone_count - 1].phone]; if ((type & VOWEL) && (next_feature & VOWEL)) { seg_list[phone_count].duration = (seg_list[phone_count].duration * 120) / 100; } if ((type & VOWEL) && (prev_feature & VOWEL)) { seg_list[phone_count].duration = (seg_list[phone_count].duration * 70) / 100; } if ( (!type & VOWEL) && (!next_feature & VOWEL) && (!prev_feature & VOWEL) ) { seg_list[phone_count].duration = (seg_list[phone_count].duration * 50) / 100; } else if ((!type & VOWEL) && (!prev_feature & VOWEL)) { seg_list[phone_count].duration = (seg_list[phone_count].duration * 70) / 100; } else if ((!type & VOWEL) && (!next_feature & VOWEL)) { seg_list[phone_count].duration = (seg_list[phone_count].duration * 70) / 100; } } for (phone_count = 0; phone_count < count; phone_count++) { phone = seg_list[phone_count].phone; if (phone == WORD_BREAK) { seg_list[phone_count].duration = 0; continue; } mindur = MinDur[phone]; inhdur = InhDur[phone]; if (seg_list[phone_count].duration > 0) seg_list[phone_count].duration = ((inhdur - mindur) * seg_list[phone_count].duration) / 100 + mindur; else seg_list[phone_count].duration = 0; trace (( "Phone%4ld %s len:%4ld\n", phone_count, phonemes_name(seg_list[phone_count].phone), seg_list[phone_count].duration )); } trace((/*{*/"}\n")); } int gen_curve(Ai, Af, time_const, t) double Ai; double Af; int time_const; int t; { double temp1; temp1 = exp(-1 * (double)t / (double)time_const); temp1 *= (Ai - Af) * (1.0 + ((double)t / (double)time_const)); return (temp1 + Af); } int translate_phone(ph,offset) int ph; int *offset; { if (ph <= VOWELS_END) { *offset = ph; return VOWEL_TYPE; } if (ph <= SONORANTS_END) { *offset = ph - SONORANTS_START; return SONORANT_TYPE; } if (ph <= NASALS_END) { *offset = ph - NASALS_START; return NASAL_TYPE; } if (ph <= FRICATIVES_END) { *offset = ph - PLOSIVES_START; return PLOSIVE_TYPE; } if (ph <= AFFRICATES_END) { *offset = ph - AFFRICATES_START; return AFFRICATE_TYPE; } if (ph <= PSUEDO_VOWELS_END) { *offset = ph - PSUEDO_VOWELS_START; return PSUEDO_VOWEL_TYPE; } *offset = -1; return -1; } _list[phonerecite.1.0/phonemes/rules.h 644 0 0 2206 5432053507 15125ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: interface definition for phonemes/rules.c */ #ifndef RULES_H #define RULES_H #include typedef struct segment_ty segment_ty; struct segment_ty { short phone; short duration; }; void segdur _((segment_ty *seg, long count)); int gen_curve _((double, double, int, int)); int translate_phone _((int ph, int *ofset)); #endif /* RULES_H */ on += 20; syllable++; continue; } #endif if (phone == WORD_BREAK) { continue; } type = Features[phone]; if ( (type & SYLLA) && seg_list[phone_count + 1].phone != WORD_BREAK ) { /* rule 4 */ seg_list[phone_count].duration = (seg_list[phone_count].duration * 85) / 100; } if ((type & SYLLA) && num_syllables > 1) { /* rule 5 *recite.1.0/phonemes/sonorants.c 644 0 0 7361 5432053507 16023ustar PeterMiller 0 0#include #include #include #include #include void gen_sonorant(phone, segdur, prev_phone, next_phone) int phone; int segdur; int prev_phone; int next_phone; { int j; unsigned long features; unsigned long next_feat=-1; unsigned long prev_feat=-1; int off; int interp2=0; int interp=0; int length; int time_count; int time_const; double f1_temp; double f2_temp; double f3_temp; double bw1_temp; double bw2_temp; double bw3_temp; double av_temp; trace(("gen_sonorant(phone = %s, segdur = %d, prev_phone = %s, next_phone = %s)\n{\n"/*}*/, phonemes_name(phone), segdur, phonemes_name(prev_phone), phonemes_name(next_phone))); length = segdur/10; features = Features[phone]; if (prev_phone != -1) prev_feat = Features[prev_phone]; if (next_phone != -1) next_feat = Features[next_phone]; if (next_feat != -1) { if (next_feat & VOWEL) { trace(("mark\n")); /* sonorants move to a following voiced segment */ translate_phone(next_phone,&off); av[1] = VOWEL_AV; f1[1] = Vowels[off][0].f1; f2[1] = Vowels[off][0].f2; f3[1] = Vowels[off][0].f3; bw1[1] = Vowels[off][0].bw1; bw2[1] = Vowels[off][0].bw2; bw3[1] = Vowels[off][0].bw3; interp = 1; interp2 = 1; } else if (next_feat & NASAL) { trace(("mark\n")); translate_phone(next_phone,&off); av[1] = Nasals[off].av; f1[1] = Nasals[off].f1; f2[1] = Nasals[off].f2; f3[1] = Nasals[off].f3; bw1[1] = Nasals[off].bw1; bw2[1] = Nasals[off].bw2; bw3[1] = Nasals[off].bw3; interp = 1; } } trace(("mark\n")); f1_temp = f1[0]; f2_temp = f2[0]; f3_temp = f3[0]; bw1_temp = bw1[0]; bw2_temp = bw2[0]; bw3_temp = bw3[0]; av_temp = av[0]; time_const = segdur; time_count = 0; for (j = 0; j < segdur; j += 10) { frame_ty frame; trace(("mark\n")); frame.f0 = f0[0]; frame.f1 = f1_temp; frame.f2 = f2_temp; frame.f3 = f3_temp; frame.bw1 = bw1_temp; frame.bw2 = bw2_temp; frame.bw3 = bw3_temp; frame.fnz = fnz; frame.fnp = fnp; frame.av = av_temp; frame.anp = 0; frame.asp = asp; frame.af = af; frame.a1 = a1; frame.a2 = a2; frame.a3 = a3; frame.a4 = a4; frame.a5 = a5; frame.a6 = a6; frame.ab = ab; if (f0_change != -1000) f0[0] += f0_change; else f0[0] -= 20; if (interp && interp2) { if (next_feat & NASAL) { trace(("mark\n")); f1_temp = gen_curve(f1[0],f1[1],10,time_count); f2_temp = gen_curve(f2[0],f2[1],10,time_count); f3_temp = gen_curve(f3[0],f3[1],10,time_count); bw1_temp = gen_curve(bw1[0],bw1[1],10,time_count); bw2_temp = gen_curve(bw2[0],bw2[1],10,time_count); bw3_temp = gen_curve(bw3[0],bw3[1],10,time_count); av_temp = gen_curve(av[0],av[1],10,time_count); } else { trace(("mark\n")); f1_temp = gen_curve(f1[0],f1[1],time_const/4,time_count); f2_temp = gen_curve(f2[0],f2[1],time_const/4,time_count); f3_temp = gen_curve(f3[0],f3[1],time_const/4,time_count); bw1_temp = gen_curve(bw1[0],bw1[1],time_const/4,time_count); bw2_temp = gen_curve(bw2[0],bw2[1],time_const/4,time_count); bw3_temp = gen_curve(bw3[0],bw3[1],time_const/4,time_count); av_temp = gen_curve(av[0],av[1],time_const/4,time_count); } } if ((j > 60) && (features & NASAL)) interp2 = 1; else if ((j > 10) && (!features & NASAL)) interp2 = 1; if (next_feat != -1) { if ((next_feat & NASAL) && (j == segdur-50)) { trace(("mark\n")); f1[0] = f1_temp; f2[0] = f2_temp; f3[0] = f3_temp; bw1[0] = bw1_temp; bw2[0] = bw2_temp; bw3[0] = bw3_temp; av[0] = av_temp; interp2 = 1; time_count = -10; } } time_count += 10; frame_out(&frame); LastTarget = frame; } trace((/*{*/"}\n")); } ].duration * 50) / 100; } else if ((!type & VOWEL) && (!prev_feature & VOWEL)) { seg_list[phone_count].duration = (seg_list[phone_count].duration * 70) / 100; } else if ((!type & VOWEL) && (!next_feature & VOWEL)) { seg_list[phone_count].duration = recite.1.0/phonemes/sonorants.h 644 0 0 1777 5432053507 16035ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: interface definition for phonemes/sonorants.c */ #ifndef SONORANTS_H #define SONORANTS_H #include void gen_sonorant _((int phone, int segdur, int prev_phone, int next_phone)); #endif /* SONORANTS_H */ wrecite.1.0/phonemes/var.c 644 0 0 2363 5432053507 14562ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: variable instances */ #include frame_ty LastTarget; double f0[2]; double f1[2]; double f2[2]; double f3[2]; double bw1[2]; double bw2[2]; double bw3[2]; double av[2]; double length; double s_f0; double s_f1,s_f2; double s_f3; double s_bw1; double s_bw2; double s_bw3; double s_av; double fnp; double fnz; double af; double ab; double a1; double a2; double a3; double a4; double a5; double a6; double asp; int f0_change; = segdur; time_count = 0; for (j = 0; j < segdur; j += 10) { frame_ty frame; trace(("mark\n")); frame.f0 = f0[0]; frame.f1 = f1_temp; frame.f2 = f2_temp; frame.f3 = f3_temp; frame.bw1 = bw1_temp; frame.bw2 = bw2_temp; frame.bw3 = bw3_temp; recite.1.0/phonemes/var.h 644 0 0 3031 5432053507 14560ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: interface definition for phonemes/var.c */ #ifndef VAR_H #define VAR_H #include extern frame_ty LastTarget; extern double f0[2]; extern double f1[2]; extern double f2[2]; extern double f3[2]; extern double bw1[2]; extern double bw2[2]; extern double bw3[2]; extern double av[2]; extern double length; extern double s_f0; extern double s_f1; extern double s_f2; extern double s_f3; extern double s_bw1; extern double s_bw2; extern double s_bw3; extern double s_av; extern double fnp; extern double fnz; extern double af; extern double ab; extern double a1; extern double a2; extern double a3; extern double a4; extern double a5; extern double a6; extern double asp; extern int f0_change; #endif /* VAR_H */ s_f3; double s_bw1; double s_bw2; double s_bw3; double s_av; double fnp; double fnz; double af; double ab; double a1; double a2; double a3; double a4; double a5; double a6; double asp; int f0_change; = segdur; time_count = 0; for (j = 0; j < segdur; j += 10) { frame_ty frame; trace(("mark\n")); frame.f0 = f0[0]; frame.f1 = f1_temp; frame.f2 = f2_temp; frame.f3 = f3_temp; frame.bw1 = bw1_temp; frame.bw2 = bw2_temp; frame.bw3 = bw3_temp; recite.1.0/phonemes/vowel.c 644 0 0 7015 5432053507 15125ustar PeterMiller 0 0#include #include #include #include #include void gen_vowel(phone, segdur, prev_phone, next_phone) int phone; int segdur; int prev_phone; int next_phone; { int j; unsigned long features; unsigned long next_feat=-1; unsigned long prev_feat=-1; int off; int interp=0; double prcnt; double f0_temp; double f1_temp; double f2_temp; double f3_temp; double bw1_temp; double bw2_temp; double bw3_temp; double av_temp; double n_av = 0; double n_f1 = 0; double n_f2 = 0; double n_f3 = 0; double n_bw1 = 0; double n_bw2 = 0; double n_bw3 = 0; int time_const; int time_count; trace(("gen_vowel(phone = %s, segdur = %d, prev_phone = %s, next_phone = %s)\n{\n"/*}*/, phonemes_name(phone), segdur, phonemes_name(prev_phone), phonemes_name(next_phone))); features = Features[phone]; if (prev_phone != -1) prev_feat = Features[prev_phone]; if (next_phone != -1) next_feat = Features[next_phone]; if (prev_feat != -1) { if (prev_feat & VOWEL || prev_feat & SONOR) { if (prev_feat & FRICA) prcnt = .30; else prcnt = .95; f1[0] -= (f1[0] - LastTarget.f1) * prcnt; f2[0] -= (f2[0] - LastTarget.f2) * prcnt; f3[0] -= (f3[0] - LastTarget.f3) * prcnt; bw1[0] -= (bw1[0] - LastTarget.bw1) * prcnt; bw2[0] -= (bw2[0] - LastTarget.bw2) * prcnt; bw3[0] -= (bw3[0] - LastTarget.bw3) * prcnt; } } if (next_feat != -1) { if (next_feat & NASAL) { translate_phone(next_phone,&off); n_av = Nasals[off].av; n_f1 = Nasals[off].f1; n_f2 = Nasals[off].f2; n_f3 = Nasals[off].f3; n_bw1 = Nasals[off].bw1; n_bw2 = Nasals[off].bw2; n_bw3 = Nasals[off].bw3; } } f0_temp = f0[0]; f1_temp = f1[0]; f2_temp = f2[0]; f3_temp = f3[0]; bw1_temp = bw1[0]; bw2_temp = bw2[0]; bw3_temp = bw3[0]; av_temp = av[0]; time_const = segdur; time_count = 0; for (j=0;j < segdur;j+=10) { frame_ty frame; frame.f0 = f0_temp; frame.f1 = f1_temp; frame.f2 = f2_temp; frame.f3 = f3_temp; frame.bw1 = bw1_temp; frame.bw2 = bw2_temp; frame.bw3 = bw3_temp; frame.fnz = fnz; frame.fnp = fnp; frame.av = av_temp; frame.anp = 0; frame.asp = asp; frame.af = af; frame.a1 = a1; frame.a2 = a2; frame.a3 = a3; frame.a4 = a4; frame.a5 = a5; frame.a6 = a6; frame.ab = ab; if (j < (segdur/3)) f0[0] += 40; else { if (f0_change != -1000) f0[0] -= 25; else f0[0] -= 10; } f0_temp = f0[0]; if (next_feat != -1) { if ((next_feat & NASAL) && (j >= segdur-35 && j < segdur-25)) { f1[0] = f1_temp; f2[0] = f2_temp; f3[0] = f3_temp; bw1[0] = bw1_temp; bw2[0] = bw2_temp; bw3[0] = bw3_temp; av[0] = av_temp; f1[1] = n_f1; f2[1] = n_f2; f3[1] = n_f3; bw1[1] = n_bw1; bw2[1] = n_bw2; bw3[1] = n_bw3; av[1] = n_av; time_const = 10; time_count = 0; interp = 1; } } if ((features & DIPTH) || interp) { f0_temp = gen_curve(f0[0],f0[1],time_const/4,time_count); f1_temp = gen_curve(f1[0],f1[1],time_const/4,time_count); f2_temp = gen_curve(f2[0],f2[1],time_const/4,time_count); f3_temp = gen_curve(f3[0],f3[1],time_const/4,time_count); bw1_temp = gen_curve(bw1[0],bw1[1],time_const/4,time_count); bw2_temp = gen_curve(bw2[0],bw2[1],time_const/4,time_count); bw3_temp = gen_curve(bw3[0],bw3[1],time_const/4,time_count); av_temp = gen_curve(av[0],av[1],time_const/4,time_count); } time_count += 10; frame_out(&frame); LastTarget = frame; } trace((/*{*/"}\n")); } n_f1 = Nasals[off].f1; n_f2 = Nasals[off].f2; n_f3 = Nasals[off].f3; n_bw1 = Nasals[off].bw1; n_bw2 = Nasals[off].bw2; n_bw3 = Nasals[off].bw3; } } f0_temp = f0[0]; f1_temp = f1[0]; f2_temp = f2[0]; f3_temp = f3[0]; bw1_temp = bw1[0]; bw2_temp = bw2[0]; bw3_temp = bw3[0]; av_temp = av[0]; time_const = segdur; time_count = 0; for (j=0;j < segdur;j+=10) { frame_ty frame; frame.f0 = f0_temp; frame.f1 = f1_temp; frame.f2 = f2_temp; frame.f3 = f3recite.1.0/phonemes/vowel.h 644 0 0 1753 5432053507 15135ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: interface definition for phonemes/vowel.c */ #ifndef VOWEL_H #define VOWEL_H #include void gen_vowel _((int phone, int segdur, int prev_phone, int next_phone)); #endif /* VOWEL_H */ me_count); f1_temprecite.1.0/recite/file.c 644 0 0 4270 5432053507 14345ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: functions to access binary files */ #include #include #include #include void file_read(filename, data_p, datalen_p) char *filename; char **data_p; long *datalen_p; { FILE *fp; char *data; long datalen; long pos; if (!filename) { fp = stdin; filename = "(standard input)"; } else { fp = fopen(filename, "rb"); if (!fp) nfatal("open \"%s\"", filename); } datalen = (1L << 15); data = mem_alloc(datalen); pos = 0; for (;;) { int c; c = getc(fp); if (c == EOF) { if (ferror(fp)) nfatal("read \"%s\"", filename); break; } if (pos >= datalen) { datalen += (1L << 15); mem_change_size(&data, datalen); } data[pos++] = c; } if (fclose(fp)) nfatal("close \"%s\"", filename); if (pos < datalen) { datalen = pos; mem_change_size(&data, datalen); } *data_p = data; *datalen_p = datalen; } void file_write(filename, data, datalen) char *filename; char *data; long datalen; { FILE *fp; if (!filename) { fp = stdout; filename = "(standard output)"; } else { fp = fopen(filename, "wb"); if (!fp) nfatal("create \"%s\"", filename); } if (fwrite(data, 1, datalen, fp) != datalen) nfatal("write \"%s\"", filename); if (datalen > 0 && data[datalen - 1] != '\n') fputc('\n', fp); if (fflush(fp)) nfatal("write \"%s\"", filename); if (fclose(fp)) nfatal("close \"%s\"", filename); }  .xnews.jade:0on .xnews.lodestone:0i .xvdtl.logp.xvtdlrc fullname!agso_test.tar.Zgpit!xx.ps xrsQncftp , aegis.cstate.picrmp@ newname.cTx.ps(dnewnamexrecite.1.0/recite/file.h 644 0 0 2032 5432053507 14344ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: interface definition for recite/file.c */ #ifndef FILE_H #define FILE_H #include void file_read _((char *filename, char **data, long *datalen)); void file_write _((char *filename, char *data, long datalen)); #endif /* FILE_H */ t speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESSrecite.1.0/recite/main.c 644 0 0 23416 5432053507 14375ustar PeterMiller 0 0/* * recite - english text speech synthesizer * Copyright (C) 1993 Peter Miller. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * MANIFEST: interface definition for recite/file.c */ #include #include #include #include #include #include #include #include #include #include <../english/english.h> #include <../phonemes/phonemes.h> #include <../klatt/klatt.h> #include <../audio/audio.h> enum { arglex_token_trace, arglex_token_volume, arglex_token_input, arglex_token_output, /* group these together, order is important */ arglex_token_read_english, arglex_token_read_phonemes, arglex_token_read_klatt, arglex_token_read_ulaw, /* group these together, order is important */ arglex_token_write_phonemes, arglex_token_write_klatt, arglex_token_write_ulaw, arglex_token_write_speaker, arglex_token_write_jack, }; static arglex_table_t argtab[] = { { "-Input", arglex_token_input, }, { "-Output", arglex_token_output, }, { "-TRace", arglex_token_trace, }, { "-Volume", arglex_token_volume, }, { "-Read_English", arglex_token_read_english, }, { "-Read_Phonemes", arglex_token_read_phonemes, }, { "-Read_Klatt", arglex_token_read_klatt, }, { "-Read_Ulaw", arglex_token_read_ulaw, }, { "-Write_Phonemes", arglex_token_write_phonemes, }, { "-Write_Klatt", arglex_token_write_klatt, }, { "-Write_Ulaw", arglex_token_write_ulaw, }, { "-Write_Speaker", arglex_token_write_speaker, }, { "-Write_Jack", arglex_token_write_jack, }, { 0, 0, }, /* end marker */ }; static void usage _((void)); static void usage() { fprintf ( stderr, "usage: %s [