pax_global_header00006660000000000000000000000064143352100470014511gustar00rootroot0000000000000052 comment=85f47ba8be83d83e0d4520a7e673cef2512a9e5c flite-0.3.3/000077500000000000000000000000001433521004700126175ustar00rootroot00000000000000flite-0.3.3/.cvsignore000066400000000000000000000003301433521004700146130ustar00rootroot00000000000000*~ .*~ *.o *.pd_linux aclocal.m4 Makefile Makefile.in configure config.log config.status .deps install-sh mkinstalldirs missing config.guess config.sub depcomp ltmain.sh stamp-h* config.h config.h.in autom4te.cache flite-0.3.3/.gitmodules000066400000000000000000000001241433521004700147710ustar00rootroot00000000000000[submodule "deps/flite"] path = deps/flite url = https://github.com/festvox/flite flite-0.3.3/CHANGELOG.txt000066400000000000000000000010471433521004700146510ustar00rootroot00000000000000Changelog for pd-flite v0.3.3, dated 16-11-2022 - Remove flite sources (include them via gitmodules) - Allow building against system-installed libflite v0.3.2, dated 24-06-2022 - Better thread coding v0.3.1, dated 21-06-2022 - Add threaded functions for "synth" and "textfile" - Add function to open and use voice files v0.3.0, dated 12-06-2022 - Add Flite sources and include them in the build. - The build includes the 5 built-in "voices" that can be used in the synthesis. - Update pd-lib-builder to 0.6.0 - New method to read from files. flite-0.3.3/COPYING000066400000000000000000000357451433521004700136700ustar00rootroot00000000000000GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS flite-0.3.3/Makefile000066400000000000000000000305211433521004700142600ustar00rootroot00000000000000# Makefile to build class 'flite' for Pure Data. # Needs Makefile.pdlibbuilder as helper makefile for platform-dependent build # settings and rules. # library name lib.name = flite cflags = w32_cflags = BUNDLED_FLITE = ./deps/flite ifneq ($(wildcard $(BUNDLED_FLITE)/include/flite.h),) use_bundled_flite=yes endif ifeq ($(use_bundled_flite), yes) cflags += \ -I$(BUNDLED_FLITE)/include \ -I$(BUNDLED_FLITE)/lang/cmulex \ -I$(BUNDLED_FLITE)/lang/usenglish \ $(empty) # urgh, this is ugly! # we cannot really statically link against flite on Windows, # as some global variables are declared with '__declspec(dllexport)'. # so we just disable the entire __declspec() magic here: w32_cflags += \ -D"__declspec(x)=" \ $(empty) # a much better approach is to just build a static version of flite, # but this requires https://github.com/festvox/flite/pull/84 # to be merged first: w32_cflags += \ -DFLITE_STATIC=1 \ $(empty) else cflags += -DHAVE_FLITE_FLITE_H=1 ldlibs += \ -lflite_cmulex \ -lflite_cmu_grapheme_lang \ -lflite_cmu_grapheme_lex \ -lflite_cmu_indic_lang \ -lflite_cmu_indic_lex \ -lflite_cmu_time_awb \ -lflite_cmu_us_awb \ -lflite_cmu_us_kal \ -lflite_cmu_us_kal16 \ -lflite_cmu_us_rms \ -lflite_cmu_us_slt \ -lflite_usenglish \ -lflite \ $(empty) endif ldlibs += -lm -lpthread cflags += -I . -DVERSION='"0.3.3"' # input source file (class name == source file basename) flite.class.sources = flite.c ifeq ($(use_bundled_flite), yes) flite.class.sources += \ $(BUNDLED_FLITE)/lang/cmulex/cmu_lex.c \ $(BUNDLED_FLITE)/lang/cmulex/cmu_lex_data.c \ $(BUNDLED_FLITE)/lang/cmulex/cmu_lex_entries.c \ $(BUNDLED_FLITE)/lang/cmulex/cmu_lts_model.c \ $(BUNDLED_FLITE)/lang/cmulex/cmu_lts_rules.c \ $(BUNDLED_FLITE)/lang/cmulex/cmu_postlex.c \ $(BUNDLED_FLITE)/lang/cmu_grapheme_lang/cmu_grapheme_lang.c \ $(BUNDLED_FLITE)/lang/cmu_grapheme_lang/cmu_grapheme_phoneset.c \ $(BUNDLED_FLITE)/lang/cmu_grapheme_lang/cmu_grapheme_phrasing_cart.c \ $(BUNDLED_FLITE)/lang/cmu_grapheme_lang/graph_gpos.c \ $(BUNDLED_FLITE)/lang/cmu_grapheme_lex/cmu_grapheme_lex.c \ $(BUNDLED_FLITE)/lang/cmu_grapheme_lex/grapheme_unitran_tables.c \ $(BUNDLED_FLITE)/lang/cmu_indic_lang/cmu_indic_lang.c \ $(BUNDLED_FLITE)/lang/cmu_indic_lang/cmu_indic_phoneset.c \ $(BUNDLED_FLITE)/lang/cmu_indic_lang/cmu_indic_phrasing_cart.c \ $(BUNDLED_FLITE)/lang/cmu_indic_lex/cmu_indic_lex.c \ $(BUNDLED_FLITE)/lang/cmu_time_awb/cmu_time_awb.c \ $(BUNDLED_FLITE)/lang/cmu_time_awb/cmu_time_awb_cart.c \ $(BUNDLED_FLITE)/lang/cmu_time_awb/cmu_time_awb_clunits.c \ $(BUNDLED_FLITE)/lang/cmu_time_awb/cmu_time_awb_lex_entry.c \ $(BUNDLED_FLITE)/lang/cmu_time_awb/cmu_time_awb_lpc.c \ $(BUNDLED_FLITE)/lang/cmu_time_awb/cmu_time_awb_mcep.c \ $(BUNDLED_FLITE)/lang/cmu_us_awb/cmu_us_awb.c \ $(BUNDLED_FLITE)/lang/cmu_us_awb/cmu_us_awb_cg.c \ $(BUNDLED_FLITE)/lang/cmu_us_awb/cmu_us_awb_cg_durmodel.c \ $(BUNDLED_FLITE)/lang/cmu_us_awb/cmu_us_awb_cg_f0_trees.c \ $(BUNDLED_FLITE)/lang/cmu_us_awb/cmu_us_awb_cg_phonestate.c \ $(BUNDLED_FLITE)/lang/cmu_us_awb/cmu_us_awb_cg_single_mcep_trees.c \ $(BUNDLED_FLITE)/lang/cmu_us_awb/cmu_us_awb_cg_single_params.c \ $(BUNDLED_FLITE)/lang/cmu_us_awb/cmu_us_awb_spamf0_accent.c \ $(BUNDLED_FLITE)/lang/cmu_us_awb/cmu_us_awb_spamf0_accent_params.c \ $(BUNDLED_FLITE)/lang/cmu_us_awb/cmu_us_awb_spamf0_phrase.c \ $(BUNDLED_FLITE)/lang/cmu_us_kal/cmu_us_kal.c \ $(BUNDLED_FLITE)/lang/cmu_us_kal/cmu_us_kal_diphone.c \ $(BUNDLED_FLITE)/lang/cmu_us_kal/cmu_us_kal_lpc.c \ $(BUNDLED_FLITE)/lang/cmu_us_kal/cmu_us_kal_res.c \ $(BUNDLED_FLITE)/lang/cmu_us_kal/cmu_us_kal_residx.c \ $(BUNDLED_FLITE)/lang/cmu_us_kal/cmu_us_kal_ressize.c \ $(BUNDLED_FLITE)/lang/cmu_us_kal16/cmu_us_kal16.c \ $(BUNDLED_FLITE)/lang/cmu_us_kal16/cmu_us_kal16_diphone.c \ $(BUNDLED_FLITE)/lang/cmu_us_kal16/cmu_us_kal16_lpc.c \ $(BUNDLED_FLITE)/lang/cmu_us_kal16/cmu_us_kal16_res.c \ $(BUNDLED_FLITE)/lang/cmu_us_kal16/cmu_us_kal16_residx.c \ $(BUNDLED_FLITE)/lang/cmu_us_rms/cmu_us_rms.c \ $(BUNDLED_FLITE)/lang/cmu_us_rms/cmu_us_rms_cg.c \ $(BUNDLED_FLITE)/lang/cmu_us_rms/cmu_us_rms_cg_durmodel.c \ $(BUNDLED_FLITE)/lang/cmu_us_rms/cmu_us_rms_cg_f0_trees.c \ $(BUNDLED_FLITE)/lang/cmu_us_rms/cmu_us_rms_cg_phonestate.c \ $(BUNDLED_FLITE)/lang/cmu_us_rms/cmu_us_rms_cg_single_mcep_trees.c \ $(BUNDLED_FLITE)/lang/cmu_us_rms/cmu_us_rms_cg_single_params.c \ $(BUNDLED_FLITE)/lang/cmu_us_rms/cmu_us_rms_spamf0_accent.c \ $(BUNDLED_FLITE)/lang/cmu_us_rms/cmu_us_rms_spamf0_accent_params.c \ $(BUNDLED_FLITE)/lang/cmu_us_rms/cmu_us_rms_spamf0_phrase.c \ $(BUNDLED_FLITE)/lang/cmu_us_slt/cmu_us_slt.c \ $(BUNDLED_FLITE)/lang/cmu_us_slt/cmu_us_slt_cg.c \ $(BUNDLED_FLITE)/lang/cmu_us_slt/cmu_us_slt_cg_durmodel.c \ $(BUNDLED_FLITE)/lang/cmu_us_slt/cmu_us_slt_cg_f0_trees.c \ $(BUNDLED_FLITE)/lang/cmu_us_slt/cmu_us_slt_cg_phonestate.c \ $(BUNDLED_FLITE)/lang/cmu_us_slt/cmu_us_slt_cg_single_mcep_trees.c \ $(BUNDLED_FLITE)/lang/cmu_us_slt/cmu_us_slt_cg_single_params.c \ $(BUNDLED_FLITE)/lang/cmu_us_slt/cmu_us_slt_spamf0_accent.c \ $(BUNDLED_FLITE)/lang/cmu_us_slt/cmu_us_slt_spamf0_accent_params.c \ $(BUNDLED_FLITE)/lang/cmu_us_slt/cmu_us_slt_spamf0_phrase.c \ $(BUNDLED_FLITE)/lang/usenglish/usenglish.c \ $(BUNDLED_FLITE)/lang/usenglish/us_aswd.c \ $(BUNDLED_FLITE)/lang/usenglish/us_durz_cart.c \ $(BUNDLED_FLITE)/lang/usenglish/us_dur_stats.c \ $(BUNDLED_FLITE)/lang/usenglish/us_expand.c \ $(BUNDLED_FLITE)/lang/usenglish/us_f0lr.c \ $(BUNDLED_FLITE)/lang/usenglish/us_f0_model.c \ $(BUNDLED_FLITE)/lang/usenglish/us_ffeatures.c \ $(BUNDLED_FLITE)/lang/usenglish/us_gpos.c \ $(BUNDLED_FLITE)/lang/usenglish/us_int_accent_cart.c \ $(BUNDLED_FLITE)/lang/usenglish/us_int_tone_cart.c \ $(BUNDLED_FLITE)/lang/usenglish/us_nums_cart.c \ $(BUNDLED_FLITE)/lang/usenglish/us_phoneset.c \ $(BUNDLED_FLITE)/lang/usenglish/us_phrasing_cart.c \ $(BUNDLED_FLITE)/lang/usenglish/us_pos_cart.c \ $(BUNDLED_FLITE)/lang/usenglish/us_text.c \ $(BUNDLED_FLITE)/src/audio/au_none.c \ $(BUNDLED_FLITE)/src/audio/audio.c \ $(BUNDLED_FLITE)/src/audio/au_streaming.c \ $(BUNDLED_FLITE)/src/cg/cst_cg.c \ $(BUNDLED_FLITE)/src/cg/cst_cg_dump_voice.c \ $(BUNDLED_FLITE)/src/cg/cst_cg_load_voice.c \ $(BUNDLED_FLITE)/src/cg/cst_cg_map.c \ $(BUNDLED_FLITE)/src/cg/cst_mlpg.c \ $(BUNDLED_FLITE)/src/cg/cst_mlsa.c \ $(BUNDLED_FLITE)/src/cg/cst_spamf0.c \ $(BUNDLED_FLITE)/src/cg/cst_vc.c \ $(BUNDLED_FLITE)/src/hrg/cst_ffeature.c \ $(BUNDLED_FLITE)/src/hrg/cst_item.c \ $(BUNDLED_FLITE)/src/hrg/cst_relation.c \ $(BUNDLED_FLITE)/src/hrg/cst_rel_io.c \ $(BUNDLED_FLITE)/src/hrg/cst_utterance.c \ $(BUNDLED_FLITE)/src/lexicon/cst_lexicon.c \ $(BUNDLED_FLITE)/src/lexicon/cst_lts.c \ $(BUNDLED_FLITE)/src/lexicon/cst_lts_rewrites.c \ $(BUNDLED_FLITE)/src/regex/cst_regex.c \ $(BUNDLED_FLITE)/src/regex/regexp.c \ $(BUNDLED_FLITE)/src/regex/regsub.c \ $(BUNDLED_FLITE)/src/speech/cst_lpcres.c \ $(BUNDLED_FLITE)/src/speech/cst_track.c \ $(BUNDLED_FLITE)/src/speech/cst_track_io.c \ $(BUNDLED_FLITE)/src/speech/cst_wave.c \ $(BUNDLED_FLITE)/src/speech/cst_wave_io.c \ $(BUNDLED_FLITE)/src/speech/cst_wave_utils.c \ $(BUNDLED_FLITE)/src/speech/g721.c \ $(BUNDLED_FLITE)/src/speech/g723_24.c \ $(BUNDLED_FLITE)/src/speech/g723_40.c \ $(BUNDLED_FLITE)/src/speech/g72x.c \ $(BUNDLED_FLITE)/src/speech/rateconv.c \ $(BUNDLED_FLITE)/src/stats/cst_cart.c \ $(BUNDLED_FLITE)/src/stats/cst_ss.c \ $(BUNDLED_FLITE)/src/stats/cst_viterbi.c \ $(BUNDLED_FLITE)/src/synth/cst_ffeatures.c \ $(BUNDLED_FLITE)/src/synth/cst_phoneset.c \ $(BUNDLED_FLITE)/src/synth/cst_ssml.c \ $(BUNDLED_FLITE)/src/synth/cst_synth.c \ $(BUNDLED_FLITE)/src/synth/cst_utt_utils.c \ $(BUNDLED_FLITE)/src/synth/cst_voice.c \ $(BUNDLED_FLITE)/src/synth/flite.c \ $(BUNDLED_FLITE)/src/utils/cst_alloc.c \ $(BUNDLED_FLITE)/src/utils/cst_args.c \ $(BUNDLED_FLITE)/src/utils/cst_endian.c \ $(BUNDLED_FLITE)/src/utils/cst_error.c \ $(BUNDLED_FLITE)/src/utils/cst_features.c \ $(BUNDLED_FLITE)/src/utils/cst_file_stdio.c \ $(BUNDLED_FLITE)/src/utils/cst_mmap_none.c \ $(BUNDLED_FLITE)/src/utils/cst_socket.c \ $(BUNDLED_FLITE)/src/utils/cst_string.c \ $(BUNDLED_FLITE)/src/utils/cst_tokenstream.c \ $(BUNDLED_FLITE)/src/utils/cst_url.c \ $(BUNDLED_FLITE)/src/utils/cst_val.c \ $(BUNDLED_FLITE)/src/utils/cst_val_const.c \ $(BUNDLED_FLITE)/src/utils/cst_val_user.c \ $(BUNDLED_FLITE)/src/utils/cst_wchar.c \ $(BUNDLED_FLITE)/src/wavesynth/cst_clunits.c \ $(BUNDLED_FLITE)/src/wavesynth/cst_diphone.c \ $(BUNDLED_FLITE)/src/wavesynth/cst_reflpc.c \ $(BUNDLED_FLITE)/src/wavesynth/cst_sigpr.c \ $(BUNDLED_FLITE)/src/wavesynth/cst_sts.c \ $(BUNDLED_FLITE)/src/wavesynth/cst_units.c \ $(empty) # unused sources EXCLUDEDFILES = \ $(BUNDLED_FLITE)/lang/cmulex/cmu_lex_data_raw.c \ $(BUNDLED_FLITE)/lang/cmulex/cmu_lex_entries_huff_table.c \ $(BUNDLED_FLITE)/lang/cmulex/cmu_lex_num_bytes.c \ $(BUNDLED_FLITE)/lang/cmulex/cmu_lex_phones_huff_table.c \ $(BUNDLED_FLITE)/sapi/FliteTTSEngineObj/flite_sapi_usenglish.c \ $(BUNDLED_FLITE)/src/audio/auclient.c \ $(BUNDLED_FLITE)/src/audio/auserver.c \ $(BUNDLED_FLITE)/src/audio/au_alsa.c \ $(BUNDLED_FLITE)/src/audio/au_command.c \ $(BUNDLED_FLITE)/src/audio/au_oss.c \ $(BUNDLED_FLITE)/src/audio/au_palmos.c \ $(BUNDLED_FLITE)/src/audio/au_pulseaudio.c \ $(BUNDLED_FLITE)/src/audio/au_sun.c \ $(BUNDLED_FLITE)/src/audio/au_win.c \ $(BUNDLED_FLITE)/src/audio/au_wince.c \ $(BUNDLED_FLITE)/src/utils/cst_file_palmos.c \ $(BUNDLED_FLITE)/src/utils/cst_file_wince.c \ $(BUNDLED_FLITE)/src/utils/cst_mmap_posix.c \ $(BUNDLED_FLITE)/src/utils/cst_mmap_win32.c \ $(BUNDLED_FLITE)/testsuite/asciiS2U_main.c \ $(BUNDLED_FLITE)/testsuite/asciiU2S_main.c \ $(BUNDLED_FLITE)/testsuite/bin2ascii_main.c \ $(BUNDLED_FLITE)/testsuite/by_word_main.c \ $(BUNDLED_FLITE)/testsuite/combine_waves_main.c \ $(BUNDLED_FLITE)/testsuite/compare_wave_main.c \ $(BUNDLED_FLITE)/testsuite/dcoffset_wave_main.c \ $(BUNDLED_FLITE)/testsuite/flite_test_main.c \ $(BUNDLED_FLITE)/testsuite/hrg_test_main.c \ $(BUNDLED_FLITE)/testsuite/kal_test_main.c \ $(BUNDLED_FLITE)/testsuite/lex_lookup_main.c \ $(BUNDLED_FLITE)/testsuite/lex_test_main.c \ $(BUNDLED_FLITE)/testsuite/lpc_resynth_main.c \ $(BUNDLED_FLITE)/testsuite/lpc_test2_main.c \ $(BUNDLED_FLITE)/testsuite/lpc_test_main.c \ $(BUNDLED_FLITE)/testsuite/multi_thread_main.c \ $(BUNDLED_FLITE)/testsuite/nums_test_main.c \ $(BUNDLED_FLITE)/testsuite/play_client_main.c \ $(BUNDLED_FLITE)/testsuite/play_server_main.c \ $(BUNDLED_FLITE)/testsuite/play_sync_main.c \ $(BUNDLED_FLITE)/testsuite/play_wave_main.c \ $(BUNDLED_FLITE)/testsuite/record_in_noise_main.c \ $(BUNDLED_FLITE)/testsuite/record_wave_main.c \ $(BUNDLED_FLITE)/testsuite/regex_test_main.c \ $(BUNDLED_FLITE)/testsuite/rfc_main.c \ $(BUNDLED_FLITE)/testsuite/token_test_main.c \ $(BUNDLED_FLITE)/testsuite/tris1_main.c \ $(BUNDLED_FLITE)/testsuite/utt_test_main.c \ $(BUNDLED_FLITE)/tools/find_sts_main.c \ $(BUNDLED_FLITE)/tools/flite_sort_main.c \ $(BUNDLED_FLITE)/tools/LANGNAME_lang.c \ $(BUNDLED_FLITE)/tools/LANGNAME_lex.c \ $(BUNDLED_FLITE)/tools/VOICE_cg.c \ $(BUNDLED_FLITE)/tools/VOICE_clunits.c \ $(BUNDLED_FLITE)/tools/VOICE_diphone.c \ $(BUNDLED_FLITE)/tools/VOICE_ldom.c \ $(BUNDLED_FLITE)/wince/flowm_flite.c \ $(BUNDLED_FLITE)/wince/flowm_main.c \ $(BUNDLED_FLITE)/main/compile_regexes.c \ $(BUNDLED_FLITE)/main/flitevox_info_main.c \ $(BUNDLED_FLITE)/main/flite_lang_list.c \ $(BUNDLED_FLITE)/main/flite_main.c \ $(BUNDLED_FLITE)/main/flite_time_main.c \ $(BUNDLED_FLITE)/main/t2p_main.c \ $(BUNDLED_FLITE)/main/word_times_main.c \ $(empty) endif define forWindows cflags += \ -DCST_NO_SOCKETS \ -DUNDER_WINDOWS \ $(w32_cflags) \ $(empty) ldlibs += endef define forDarwin cflags += \ -DCST_AUDIO_NONE \ -no-cpp-precomp \ $(empty) endef # all extra files to be included in binary distribution of the library datafiles = \ flite-help.pd \ flite-numbers.pd flite-test2.pd flite-test.pd \ README.md flite-meta.pd CHANGELOG.txt \ #alldebug: CPPFLAGS+=-DFLITE_DEBUG=1 # include Makefile.pdlibbuilder from submodule directory 'pd-lib-builder' PDLIBBUILDER_DIR=pd-lib-builder/ include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder localdep_windows: install scripts/localdeps.win.sh "$(installpath)/flite.$(extension)" flite-0.3.3/README.md000066400000000000000000000052451433521004700141040ustar00rootroot00000000000000README for Pd external distribution 'pd-flite' Last updated for version 0.3.3 # DESCRIPTION The 'pd-flite' distribution contains a single Pd external ("flite"), which provides a high-level text-to-speech interface for English based on the 'libflite' library by Alan W Black and Kevin A. Lenzo. 'libflite' lives at https://github.com/festvox/flite # linking with libflite To produce a self-contained "flite" external (with no external dependencies on libflite), you can statically link the library. ## git submodules The libflite sources are available via a git submodule in `deps/flite/`. After cloning the pd-flite repository, initialize the submodules via: git submodule update --init If the submodule is updated, re-run `git submodule update` in your local clone to get the lastest and greatest libflite. ## without git If you obtained the 'pd-flite' sources without git (e.g. by downloading a release tarball), there won't be any bundled libflite. Instead, you can manually download flite from https://github.com/festvox/flite and put it into the `deps/flite/` folder (so you have a deps/flite/include/flite.h file) ## use system libraries If you prefer to use system-provided libflite instead (e.g. provided by your favourite package manager), just make sure that deps/flite/ is empty (by not initializing the git-submodules and not downloading libflite manually). If the build process does not detect the deps/flite/include/flite.h file, it will attempt to use a system-provided libflite instead. If you happen to have a local copy of libflite in the deps/ folder, you can force building against the system libraries by adding `use_bundled_flite=no` when calling *make*. # WINDOWS BUILD With MSYS2 install the ntldd package: pacman -S mingw32/mingw-w64-i686-ntldd-git pacman -S mingw64/mingw-w64-x86_64-ntldd-git Then cd MinGW to this repo and do: make or you can also specify more options with: make PDDIR= then do this command that installs and fills the `pthread` dependencies on the output dir: make localdep_windows or with more options: make PDLIBDIR= extension= localdep_windows # ACKNOWLEDGEMENTS Pd by Miller Puckette and others. Flite run-time speech synthesis library by Alan W Black and Kevin A. Lenzo. Ideas, black magic, and other nuggets of information drawn from code by Guenter Geiger, Larry Troxler, and iohannes m zmoelnig. # KNOWN BUGS It gobbles memory, and also processor time on synthesis operations. # AUTHOR Bryan Jurish # MAINTENANCE Since v0.3.0 Lucas Cordiviola https://github.com/pd-externals/flite - Thanks to Christof Ressi for code reviews. flite-0.3.3/deps/000077500000000000000000000000001433521004700135525ustar00rootroot00000000000000flite-0.3.3/deps/flite/000077500000000000000000000000001433521004700146555ustar00rootroot00000000000000flite-0.3.3/extra/000077500000000000000000000000001433521004700137425ustar00rootroot00000000000000flite-0.3.3/extra/flite-1.1-noaudio.patch000066400000000000000000000012121433521004700200130ustar00rootroot00000000000000diff -uNr flite-1.1-release/src/audio/native_audio.h flite-1.1-release-noaudio/src/audio/native_audio.h --- flite-1.1-release/src/audio/native_audio.h Tue Dec 4 19:05:59 2001 +++ flite-1.1-release-noaudio/src/audio/native_audio.h Sun Nov 3 19:12:44 2002 @@ -41,6 +41,16 @@ #ifndef _NATIVE_AUDIO_H__ #define _NATIVE_AUDIO_H__ +/* -- begin HACK: turn off all audio -- */ +#undef CST_AUDIO_COMMAND +#undef CST_AUDIO_SUNOS +#undef CST_AUDIO_LINUX +#undef CST_AUDIO_ALSA +#undef CST_AUDIO_FREEBSD +#undef CST_AUDIO_WINCE +#define CST_AUDIO_NONE +/* -- end HACK -- */ + #ifdef CST_AUDIO_COMMAND #define AUDIO_OPEN_NATIVE audio_open_command flite-0.3.3/extra/windows-dll-exports.patch000066400000000000000000000043431433521004700207340ustar00rootroot00000000000000From a8d89b884736dcf3a9b3c262da2c0e20954c46d8 Mon Sep 17 00:00:00 2001 From: Lucas Cordiviola Date: Thu, 26 May 2022 18:18:05 -0300 Subject: [PATCH] Windows object now works --- deps/flite/include/flite.h | 10 +--------- deps/flite/src/synth/flite.c | 13 ++++--------- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/deps/flite/include/flite.h b/deps/flite/include/flite.h index 8814d97..3a2bd1c 100644 --- a/deps/flite/include/flite.h +++ b/deps/flite/include/flite.h @@ -65,15 +65,7 @@ extern "C" { #include "cst_units.h" #include "cst_tokenstream.h" -#ifdef WIN32 -/* For Visual Studio 2012 global variable definitions */ -#define GLOBALVARDEF __declspec(dllexport) -#else -#define GLOBALVARDEF -#endif - extern GLOBALVARDEF cst_val *flite_voice_list; - extern GLOBALVARDEF cst_lang flite_lang_list[20]; - extern GLOBALVARDEF int flite_lang_list_length; + /* Public functions */ int flite_init(); diff --git a/deps/flite/src/synth/flite.c b/deps/flite/src/synth/flite.c index d85fe1a..ec0e0eb 100644 --- a/deps/flite/src/synth/flite.c +++ b/deps/flite/src/synth/flite.c @@ -44,12 +44,7 @@ #include "cst_clunits.h" #include "cst_cg.h" -#ifdef WIN32 -/* For Visual Studio 2012 global variable definitions */ -#define GLOBALVARDEF __declspec(dllexport) -#else -#define GLOBALVARDEF -#endif + /* This is a global, which isn't ideal, this may change */ /* It is set when flite_set_voice_list() is called which happens in */ @@ -59,14 +54,14 @@ /* Note these voices remain loaded, there is currently no automatic */ /* garbage collection, that would be necessary in the long run */ /* delete_voice will work, but you'd need to know when to call it */ -GLOBALVARDEF cst_val *flite_voice_list = NULL; +cst_val *flite_voice_list = NULL; /* Another global with hold pointers to the language and lexicon */ /* initalization functions, we limiting to 20 but it could be bigger */ /* if we really did support over 20 different languages */ #define FLITE_MAX_LANGS 20 -GLOBALVARDEF cst_lang flite_lang_list[FLITE_MAX_LANGS]; -GLOBALVARDEF int flite_lang_list_length = 0; +cst_lang flite_lang_list[FLITE_MAX_LANGS]; +int flite_lang_list_length = 0; int flite_init() { -- 2.36.0.windows.1 flite-0.3.3/flite-help.pd000066400000000000000000000167321433521004700152060ustar00rootroot00000000000000#N canvas 297 24 793 679 10; #X text 25 4 flite : text-to-speech synthesis with libflite; #N canvas 0 0 450 300 (subpatch) 0; #X array words2 1.60234e+07 float 0; #X coords 0 1 1.60234e+07 -1 100 70 1; #X restore 648 276 graph; #X obj 29 640 print flite-synth-done; #X text 51 35 ARRAYNAME - initial array name; #X text 352 16 1 - control messages; #X text 30 22 ARGUMENTS:; #X text 336 2 INLETS:; #X text 329 29 OUTLETS:; #X msg 26 77 set words1; #X msg 33 95 set words2; #X msg 66 144 synth; #X text 106 147 "synth" message synthesizes current text-buffer; #X text 159 122 "text" message sets input text-buffer; #X text 104 83 "set" message selects the output array; #X text 246 267 "list" messages set text and synthesize; #X obj 516 253 dac~; #X msg 601 85 \; pd dsp 1; #X msg 667 85 \; pd dsp 0; #X text 495 135 For playback \, you can use 'tabplay~':; #X msg 517 165 set words1; #X msg 527 185 set words2; #X msg 635 189 bang; #X msg 686 190 stop; #X msg 635 167 start; #X text 411 563 ACKNOWLEDGEMENTS:; #X text 429 578 Flite runtime speech synthesis library by Alan W Black and Kevin A. Lenzo.; #X msg 94 271 list bang bahda boobop; #N canvas 260 141 629 360 META 0; #X text 12 125 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v2; #X text 12 45 DESCRIPTION text-to-speech synthesis with libflite; #X text 12 5 KEYWORDS control array; #X text 12 85 OUTLET_0 bang; #X text 12 105 AUTHOR Bryan Jurish ; #X text 12 65 INLET_0 set text synth list thrd_synth voice_file thrd_voice_file textfile thrd_textfile, f 89; #X restore 727 636 pd META; #X msg 60 122 text test 123; #X text 412 607 Bryan Jurish ; #X msg 110 301 awb; #X msg 143 301 kal; #X msg 178 300 kal16; #X msg 220 300 rms; #X msg 253 301 slt; #X msg 111 345 voice \$1; #X obj 110 326 symbol; #X obj 185 448 openpanel; #X obj 164 448 bng 15 250 50 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000; #X msg 184 538 textfile \$1; #N canvas 26 26 633 528 longtext 0; #X obj 241 -91 inlet; #X obj 239 355 outlet; #X msg 241 -68 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123 test 123; #X connect 0 0 2 0; #X connect 2 0 1 0; #X restore 99 171 pd longtext; #X obj 82 171 bng 15 250 50 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000; #X msg 90 242 thrd_synth; #X msg 210 583 thrd_textfile \$1; #X obj 184 493 route 0 1; #X obj 184 516 symbol; #X obj 210 563 symbol; #X obj 281 471 tgl 15 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000 0 1; #X text 160 242 "threaded" synthesis of the current text buffer; #X text 322 579 threaded version, f 9; #X text 298 471 threaded, f 10; #X obj 184 473 list prepend 0; #X text 502 356 Warnings: better not use graphical arrays for threaded synthesis. Also be careful to not synthesize to an array which is currently playing., f 46; #X obj 82 212 list trim; #X msg 123 393 voice_file \$1; #X msg 139 369 symbol cmu_us_ljm.flitevox; #X msg 253 448 ./README.md; #X obj 83 192 list prepend text; #X obj 516 297 array define words1; #X obj 28 615 flite words1; #X obj 517 230 tabplay~ words1; #X text 174 344 "voice" messages sets one of the built-in voices; #X text 227 391 load a .flitevox voice file (english), f 38; #N canvas 26 26 450 300 get-voices 0; #X obj 116 192 pdcontrol; #X msg 117 165 browse http://cmuflite.org/packed/flite-2.0/voices/ ; #X obj 171 105 bng 15 250 50 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000; #X text 103 104 get voices; #X connect 1 0 0 0; #X connect 2 0 1 0; #X coords 0 -1 1 1 90 25 2 100 100; #X restore 369 408 pd get-voices; #N canvas 488 193 533 410 typical 0; #X listbox 132 44 42 0 0 0 - - - 0; #X obj 148 86 t b l, f 14; #X msg 148 154 thrd_synth; #X obj 147 360 dac~; #X obj 229 113 list prepend text; #X obj 229 136 list trim; #X obj 148 229 t b b; #X obj 148 328 tabplay~ \$0-foo; #X obj 148 206 flite \$0-foo; #X obj 387 8 array define \$0-foo; #X text 33 37 type here and press enter, f 15; #X obj 175 254 \$0; #X msg 175 282 \; \$1-foo normalize 0.7 \;; #X text 33 68 (commas are not allowed in the list box), f 13; #X connect 0 0 1 0; #X connect 1 0 2 0; #X connect 1 1 4 0; #X connect 2 0 8 0; #X connect 4 0 5 0; #X connect 5 0 8 0; #X connect 6 0 7 0; #X connect 6 1 11 0; #X connect 7 0 3 0; #X connect 7 0 3 1; #X connect 8 0 6 0; #X connect 11 0 12 0; #X restore 566 454 pd typical; #X text 541 436 open this sub patch; #X text 345 43 1 - bang on completed synthesis; #X text 264 538 "textfile" message reads a text file and synthesize it; #X msg 137 415 thrd_voice_file \$1; #X text 262 410 threaded version, f 9; #X text 412 630 v0.3.3 updated by Lucas Cordiviola https://github.com/pd-externals/flite ; #X connect 8 0 59 0; #X connect 9 0 59 0; #X connect 10 0 59 0; #X connect 19 0 60 0; #X connect 20 0 60 0; #X connect 21 0 60 0; #X connect 22 0 60 0; #X connect 23 0 21 0; #X connect 26 0 59 0; #X connect 28 0 59 0; #X connect 30 0 36 0; #X connect 31 0 36 0; #X connect 32 0 36 0; #X connect 33 0 36 0; #X connect 34 0 36 0; #X connect 35 0 59 0; #X connect 36 0 35 0; #X connect 37 0 51 0; #X connect 38 0 37 0; #X connect 39 0 59 0; #X connect 40 0 57 0; #X connect 41 0 40 0; #X connect 42 0 59 0; #X connect 43 0 59 0; #X connect 44 0 45 0; #X connect 44 1 46 0; #X connect 45 0 39 0; #X connect 46 0 43 0; #X connect 47 0 51 1; #X connect 51 0 44 0; #X connect 53 0 59 0; #X connect 54 0 59 0; #X connect 55 0 68 0; #X connect 56 0 51 0; #X connect 57 0 53 0; #X connect 59 0 2 0; #X connect 60 0 15 0; #X connect 60 0 15 1; #X connect 68 0 59 0; flite-0.3.3/flite-meta.pd000066400000000000000000000004321433521004700151720ustar00rootroot00000000000000#N canvas 169 49 432 242 10; #N canvas 25 49 420 300 META 1; #X text 10 10 VERSION 0.3.3; #X text 10 30 AUTHOR Bryan Jurish ; #X text 10 50 NAME flite; #X text 10 70 LICENSE GPL-2; #X text 9 91 DESCRIPTION Speech synthesis for Pd; #X restore 20 20 pd META; flite-0.3.3/flite-numbers.pd000066400000000000000000000021351433521004700157210ustar00rootroot00000000000000#N canvas 47 239 465 419 10; #X obj 69 219 random; #X floatatom 105 199 10 0 0; #X msg 105 176 65535; #X obj 105 153 loadbang; #X msg 14 13 start; #X msg 57 13 stop; #X msg 172 19 \; pd dsp 1; #X msg 238 19 \; pd dsp 0; #X msg 85 245 text \$1; #X obj 319 14 table \$0-numtab; #X obj 85 324 tabplay~ \$0-numtab; #X obj 85 277 flite \$0-numtab; #X obj 14 58 s \$0-start; #X obj 57 35 s \$0-stop; #X obj 39 124 r \$0-start; #X obj 39 148 t b b; #X msg 39 245 synth; #X obj 73 359 dac~; #X obj 206 371 s \$0-start; #X obj 206 347 spigot; #X msg 276 305 1; #X msg 243 305 0; #X obj 276 281 r \$0-start; #X obj 243 261 r \$0-stop; #X msg 210 295 0 1; #X connect 0 0 8 0; #X connect 1 0 0 1; #X connect 2 0 1 0; #X connect 3 0 2 0; #X connect 4 0 12 0; #X connect 5 0 13 0; #X connect 8 0 11 0; #X connect 10 0 17 0; #X connect 10 0 17 1; #X connect 10 1 19 0; #X connect 11 0 10 0; #X connect 14 0 15 0; #X connect 15 0 16 0; #X connect 15 1 0 0; #X connect 16 0 11 0; #X connect 19 0 18 0; #X connect 20 0 19 1; #X connect 21 0 19 1; #X connect 22 0 20 0; #X connect 23 0 21 0; #X connect 23 0 24 0; #X connect 24 0 10 0; flite-0.3.3/flite-test.pd000066400000000000000000000033271433521004700152310ustar00rootroot00000000000000#N canvas 164 1 726 560 10; #X msg 36 43 set ary2; #X msg 13 22 set ary1; #N canvas 0 0 450 300 graph1 0; #X array ary1 42489 float 0; #X coords 0 1 42488 -1 200 140 1; #X restore 41 223 graph; #N canvas 0 0 450 300 graph2 0; #X array ary2 10 float 0; #X coords 0 1 9 -1 200 140 1; #X restore 277 221 graph; #X obj 122 164 flite ary1; #X msg 121 16 text moo the cow; #X msg 133 38 text 42 marmosets; #X msg 149 83 synth; #X obj 390 418 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 8 -262144 -1 -1 11000 1; #X obj 388 442 dbtorms; #X obj 356 497 dac~; #X obj 365 472 *~ 0; #X msg 208 406 bang; #X msg 264 405 0 1; #X msg 264 384 stop; #X msg 208 384 start; #X obj 12 79 s aryset; #X obj 249 438 tabplay~ ary1; #X obj 302 405 r aryset; #X msg 46 390 set ary1; #X msg 111 389 set ary2; #X msg 472 452 \; pd dsp 1; #X msg 473 486 \; pd dsp 0; #X msg 145 61 text text; #X obj 108 471 spigot; #X obj 145 449 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; #X text 87 450 Loop; #X msg 285 15 list moo the cow; #X msg 287 40 list 42 marmosets; #X msg 289 66 list list; #X msg 291 91 list bang; #X obj 122 187 print flite-synth-done; #X connect 0 0 4 0; #X connect 0 0 16 0; #X connect 1 0 4 0; #X connect 1 0 16 0; #X connect 4 0 31 0; #X connect 5 0 4 0; #X connect 6 0 4 0; #X connect 7 0 4 0; #X connect 8 0 9 0; #X connect 9 0 11 1; #X connect 11 0 10 0; #X connect 11 0 10 1; #X connect 12 0 17 0; #X connect 13 0 17 0; #X connect 13 0 25 0; #X connect 14 0 13 0; #X connect 15 0 12 0; #X connect 17 0 11 0; #X connect 17 1 24 0; #X connect 18 0 17 0; #X connect 19 0 17 0; #X connect 20 0 17 0; #X connect 23 0 4 0; #X connect 24 0 17 0; #X connect 25 0 24 1; #X connect 27 0 4 0; #X connect 28 0 4 0; #X connect 29 0 4 0; #X connect 30 0 4 0; flite-0.3.3/flite-test2.pd000066400000000000000000000015001433521004700153020ustar00rootroot00000000000000#N canvas 489 199 450 300 10; #X obj 72 150 flite testary; #X obj 312 53 table testary; #X msg 54 13 moo; #X msg 91 14 is; #X msg 127 13 a; #X msg 175 13 cow; #X msg 175 62 marmoset; #X msg 176 38 bovine; #X obj 72 174 tabplay~ testary; #X obj 181 199 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 110 222 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 8 -262144 -1 -1 8100 1; #X obj 107 245 dbtorms; #X obj 63 247 dac~; #X obj 72 222 *~ 0; #X msg 72 109 text \$1 \, synth; #X obj 72 87 pack s; #X connect 0 0 8 0; #X connect 2 0 15 0; #X connect 3 0 15 0; #X connect 4 0 15 0; #X connect 5 0 15 0; #X connect 6 0 15 0; #X connect 7 0 15 0; #X connect 8 0 13 0; #X connect 8 1 9 0; #X connect 10 0 11 0; #X connect 11 0 13 1; #X connect 13 0 12 0; #X connect 13 0 12 1; #X connect 14 0 0 0; #X connect 15 0 14 0; flite-0.3.3/flite.c000066400000000000000000000515461433521004700141010ustar00rootroot00000000000000/* -*- Mode: C -*- */ /*=============================================================================*\ * File: flite.c * Author: Bryan Jurish * Description: speech synthesis for PD * * PD interface to 'flite' C libraries. * * v0.3.1 updated by Lucas Cordiviola * *=============================================================================*/ #include #include #include #include #include #include /* black magic for Microsoft's compiler */ #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif #ifdef __GNUC__ # define MOO_UNUSED __attribute__((unused)) #else # define MOO_UNUSED #endif #define debug(fmt, args...) fprintf(stderr, fmt, ##args); #include #if HAVE_FLITE_FLITE_H # include # include #else # include # include #endif /*-------------------------------------------------------------------- * DEBUG *--------------------------------------------------------------------*/ //#define FLITE_DEBUG 1 //#undef FLITE_DEBUG /*-------------------------------------------------------------------- * Globals *--------------------------------------------------------------------*/ cst_voice *register_cmu_us_awb(); cst_voice *register_cmu_us_kal(); cst_voice *register_cmu_us_kal16(); cst_voice *register_cmu_us_rms(); cst_voice *register_cmu_us_slt(); void usenglish_init(cst_voice *v); cst_lexicon *cmulex_init(void); /*===================================================================== * Structures and Types *=====================================================================*/ static const char *flite_description = "flite: Text-to-Speech external v" VERSION " \n"; static const char *thread_waiting = "flite: Wait for the running thread to finish"; //static char *flite_acknowledge = "flite: based on code by "; //static char *flite_version = "flite: PD external v%s by Bryan Jurish"; // "flite: Text-to-Speech external v" VERSION " by Bryan Jurish\n" /*--------------------------------------------------------------------- * flite *---------------------------------------------------------------------*/ static t_class *flite_class; typedef enum _thrd_request { IDLE = 0, TEXTFILE = 1, SYNTH = 2, VOXFILE = 3, QUIT = 4, } t_thrd_request; typedef enum _thrd_tick { FINISHSYNTH = 0, ARRAYERR = 1, BUFFERERR = 2, FAIL = 3, VOXFILEDONE = 4, INPROGRESS = 5, } t_thrd_tick; typedef struct _flite { t_object x_obj; /* black magic (probably inheritance-related) */ t_canvas *x_canvas; t_symbol *x_arrayname; /* arrayname (from '_tabwrite' code in $PD_SRC/d_array.c) */ char *x_textbuf; /* text buffer (hack) */ char x_reqfile[MAXPDSTRING]; char x_inprogress; t_outlet *x_bangout; t_clock *x_clock; t_thrd_request x_requestcode; t_thrd_tick x_tick_ctl; pthread_mutex_t x_mutex; pthread_cond_t x_requestcondition; pthread_t x_tid; int x_argc; t_atom *x_argv; cst_voice *x_voice; cst_wave *x_wave; int x_vecsize; t_garray *x_a; t_word *x_vec; } t_flite; static void flite_set(t_flite *x, t_symbol *ary); static int flite_filer(t_flite *x, t_symbol *name); static void flite_voice(t_flite *x, t_symbol *vox); static void flite_voice_file(t_flite *x, t_symbol *filename); static void flite_thrd_voice_file(t_flite *x, t_symbol *filename); static void flite_threaded_voice_file(t_flite *x); static void flite_do_voice_file(t_flite *x); static void flite_do_textbuffer(t_flite *x); static void flite_text(t_flite *x, MOO_UNUSED t_symbol *s, int argc, t_atom *argv); static void flite_textfile(t_flite *x, t_symbol *filename); static void flite_thrd_textfile(t_flite *x, t_symbol *filename); static void flite_read_textfile(t_flite *x); static void flite_list(t_flite *x, t_symbol *s, int argc, t_atom *argv); static void flite_synth(t_flite *x); static void flite_thread_synth(t_flite *x); static void flite_thrd_synth(t_flite *x); static void flite_clock_tick(t_flite *x); static void flite_thread(t_flite *x); /*-------------------------------------------------------------------- * flite_set : set arrayname *--------------------------------------------------------------------*/ static void flite_set(t_flite *x, t_symbol *ary) { if (x->x_inprogress) { pd_error(x,"%s", thread_waiting); return; } #ifdef FLITE_DEBUG debug("flite_set: called with arg='%s'\n", ary->s_name); #endif x->x_arrayname = ary; return; } /*-------------------------------------------------------------------- * flite_filer : get the full path of the file if it exists * and place it's full path on the struct. *--------------------------------------------------------------------*/ static int flite_filer(t_flite *x, t_symbol *name) { char completefilename[MAXPDSTRING]; const char* filename = name->s_name; char realdir[MAXPDSTRING], *realname = NULL; int fd; fd = canvas_open(x->x_canvas, filename, "", realdir, &realname, MAXPDSTRING, 0); if(fd < 0){ pd_error(x, "flite: can't find file: %s", filename); x->x_inprogress = 0; return 0; } strcpy(completefilename, realdir); strcat(completefilename, "/"); strcat(completefilename, realname); strcpy(x->x_reqfile, completefilename); return 1; } /*-------------------------------------------------------------------- * flite_voice : set one of the built-in voices for the synthesizer. *--------------------------------------------------------------------*/ static void flite_voice(t_flite *x, t_symbol *vox) { if (x->x_inprogress) { pd_error(x,"%s", thread_waiting); return; } #ifdef FLITE_DEBUG debug("flite_voice: called with arg='%s'\n", vox->s_name); #endif const char *voxstring = vox->s_name; if (!strcmp(voxstring, "awb")) { x->x_voice = register_cmu_us_awb(); } else if (!strcmp(voxstring, "kal")) { x->x_voice = register_cmu_us_kal(); } else if (!strcmp(voxstring, "kal16")) { x->x_voice = register_cmu_us_kal16(); } else if (!strcmp(voxstring, "rms")) { x->x_voice = register_cmu_us_rms(); } else if (!strcmp(voxstring, "slt")) { x->x_voice = register_cmu_us_slt(); } else { pd_error(x,"flite: unknown voice '%s'. Possible voices are: 'awb', 'kal', 'kal16', 'rms' or 'slt'.", voxstring ); return; } return; } /*-------------------------------------------------------------------- * flite_voice_file : check for the voice file and open it. *--------------------------------------------------------------------*/ static void flite_voice_file(t_flite *x, t_symbol *filename) { if (x->x_inprogress) { pd_error(x,"%s", thread_waiting); return; } if(!flite_filer(x, filename)) { return; } flite_do_voice_file(x); x->x_tick_ctl = VOXFILEDONE; flite_clock_tick(x); return; } /*-------------------------------------------------------------------- * flite_voice_file : check for the voice file and signal the thread to open it. *--------------------------------------------------------------------*/ static void flite_thrd_voice_file(t_flite *x, t_symbol *filename) { if (x->x_inprogress) { pd_error(x,"%s", thread_waiting); return; } if(!flite_filer(x, filename)) { return; } x->x_inprogress = 1; pthread_mutex_lock(&x->x_mutex); x->x_requestcode = VOXFILE; pthread_mutex_unlock(&x->x_mutex); pthread_cond_signal(&x->x_requestcondition); return; } /*-------------------------------------------------------------------- * flite_threaded_voice_file : thread opens the voice file. *--------------------------------------------------------------------*/ static void flite_threaded_voice_file(t_flite *x) { flite_do_voice_file(x); pthread_mutex_lock(&x->x_mutex); if (x->x_requestcode != QUIT) { sys_lock(); x->x_tick_ctl = VOXFILEDONE; clock_delay(x->x_clock, 0); sys_unlock(); } pthread_mutex_unlock(&x->x_mutex); return; } /*-------------------------------------------------------------------- * flite_do_voice_file : open the voice file for the synthesizer. *--------------------------------------------------------------------*/ static void flite_do_voice_file(t_flite *x) { #ifdef FLITE_DEBUG debug("flite_thrd_voice_file: called with arg='%s'\n", x->x_reqfile); #endif flite_add_lang("eng",usenglish_init,cmulex_init); flite_add_lang("usenglish",usenglish_init,cmulex_init); x->x_voice = flite_voice_load(x->x_reqfile); } /*-------------------------------------------------------------------- * flite_do_textbuffer : text-buffer *--------------------------------------------------------------------*/ static void flite_do_textbuffer(t_flite *x) { char *buf; int length; if (x->x_inprogress) { pd_error(x,"%s", thread_waiting); return; } t_binbuf*bbuf = binbuf_new(); binbuf_add(bbuf, x->x_argc, x->x_argv); binbuf_gettext(bbuf, &buf, &length); binbuf_free(bbuf); x->x_textbuf = (char *) calloc(length+1, sizeof(char)); memcpy(x->x_textbuf, buf, length); freebytes(buf, length+1); #ifdef FLITE_DEBUG debug("flite_debug: got text='%s'\n", x->x_textbuf); #endif return; } /*-------------------------------------------------------------------- * flite_text : set the text-buffer *--------------------------------------------------------------------*/ static void flite_text(t_flite *x, MOO_UNUSED t_symbol *s, int argc, t_atom *argv) { if (x->x_inprogress) { pd_error(x,"%s", thread_waiting); return; } x->x_argc = argc; x->x_argv = argv; flite_do_textbuffer(x); return; } /*-------------------------------------------------------------------- * flite_textfile : if the file exists read it into the text-buffer and * synthesize it. *--------------------------------------------------------------------*/ static void flite_textfile(t_flite *x, t_symbol *filename) { if (x->x_inprogress) { pd_error(x,"%s", thread_waiting); return; } if(!flite_filer(x, filename)) { return; } flite_read_textfile(x); flite_synth(x); return; } /*-------------------------------------------------------------------- * flite_thrd_textfile : if the file exists call the thread to read it * into the text-buffer and synthesize it. *--------------------------------------------------------------------*/ static void flite_thrd_textfile(t_flite *x, t_symbol *filename) { if (x->x_inprogress) { pd_error(x,"%s", thread_waiting); return; } if(!flite_filer(x, filename)) { return; } // -- sanity checks if (!(x->x_a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class))) { pd_error(x,"flite: no such array '%s'", x->x_arrayname->s_name); return; } x->x_inprogress = 1; pthread_mutex_lock(&x->x_mutex); x->x_requestcode = TEXTFILE; pthread_mutex_unlock(&x->x_mutex); pthread_cond_signal(&x->x_requestcondition); return; } /*-------------------------------------------------------------------- * flite_read_textfile : read the text file into the text-buffer *--------------------------------------------------------------------*/ static void flite_read_textfile(t_flite *x) { FILE *fp; fp = fopen(x->x_reqfile, "r"); fseek(fp, 0, SEEK_END); int len; len = ftell(fp); fseek(fp, 0, SEEK_SET); x->x_textbuf = (char *) calloc(len+1, sizeof(char)); fread(x->x_textbuf, 1, len, fp); fclose(fp); return; } /*-------------------------------------------------------------------- * flite_list : parse & synthesize text in one swell foop *--------------------------------------------------------------------*/ static void flite_list(t_flite *x, t_symbol *s, int argc, t_atom *argv) { if (x->x_inprogress) { pd_error(x,"%s", thread_waiting); return; } flite_text(x,s,argc,argv); flite_synth(x); return; } /*-------------------------------------------------------------------- * flite_synth : synthesize current text-buffer *--------------------------------------------------------------------*/ static void flite_synth(t_flite *x) { if (x->x_inprogress) { pd_error(x,"%s", thread_waiting); return; } #ifdef FLITE_DEBUG debug("flite: got message 'synth'\n"); #endif // -- sanity checks if (!(x->x_a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class))) { x->x_tick_ctl = ARRAYERR; flite_clock_tick(x); return; } if (!x->x_textbuf) { x->x_tick_ctl = BUFFERERR; flite_clock_tick(x); return; } #ifdef FLITE_DEBUG debug("flite: flite_text_to_wave()\n"); #endif x->x_wave = flite_text_to_wave(x->x_textbuf, x->x_voice); if (!x->x_wave) { x->x_tick_ctl = FAIL; flite_clock_tick(x); return; } // -- resample #ifdef FLITE_DEBUG debug("flite: cst_wave_resample()\n"); #endif cst_wave_resample(x->x_wave, sys_getsr()); x->x_tick_ctl = FINISHSYNTH; flite_clock_tick(x); return; } /*-------------------------------------------------------------------- * flite_thread_synth : thread synthesizes the current text-buffer. *--------------------------------------------------------------------*/ static void flite_thread_synth(t_flite *x) { #ifdef FLITE_DEBUG debug("flite: got message 'synth'\n"); #endif if (!x->x_textbuf) { pthread_mutex_lock(&x->x_mutex); if (x->x_requestcode != QUIT) { sys_lock(); x->x_tick_ctl = BUFFERERR; clock_delay(x->x_clock, 0); sys_unlock(); pthread_mutex_unlock(&x->x_mutex); return; } } #ifdef FLITE_DEBUG debug("flite: flite_text_to_wave()\n"); #endif x->x_wave = flite_text_to_wave(x->x_textbuf, x->x_voice); if (!x->x_wave) { pthread_mutex_lock(&x->x_mutex); if (x->x_requestcode != QUIT) { sys_lock(); x->x_tick_ctl = FAIL; clock_delay(x->x_clock, 0); sys_unlock(); pthread_mutex_unlock(&x->x_mutex); return; } } // -- resample #ifdef FLITE_DEBUG debug("flite: cst_wave_resample()\n"); #endif cst_wave_resample(x->x_wave, sys_getsr()); pthread_mutex_lock(&x->x_mutex); if (x->x_requestcode != QUIT) { sys_lock(); x->x_tick_ctl = FINISHSYNTH; clock_delay(x->x_clock, 0); sys_unlock(); } pthread_mutex_unlock(&x->x_mutex); return; } /*-------------------------------------------------------------------- * flite_thrd_synth : call the thread to synthesize the text-buffer. *--------------------------------------------------------------------*/ static void flite_thrd_synth(t_flite *x) { if (x->x_inprogress) { pd_error(x,"%s", thread_waiting); return; } // -- sanity checks if (!(x->x_a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class))) { pd_error(x,"flite: no such array '%s'", x->x_arrayname->s_name); return; } x->x_inprogress = 1; pthread_mutex_lock(&x->x_mutex); x->x_requestcode = SYNTH; pthread_mutex_unlock(&x->x_mutex); pthread_cond_signal(&x->x_requestcondition); return; } /*-------------------------------------------------------------------- * flite_clock_tick : clock *--------------------------------------------------------------------*/ static void flite_clock_tick(t_flite *x) { if (x->x_tick_ctl == FINISHSYNTH) { int i; // -- resize & write to our array #ifdef FLITE_DEBUG debug("flite: garray_resize(%d)\n", x->x_wave->num_samples); #endif garray_resize_long(x->x_a, (long) x->x_wave->num_samples); if (!garray_getfloatwords(x->x_a, &x->x_vecsize, &x->x_vec)) { pd_error(x,"flite: bad template for write to array '%s'", x->x_arrayname->s_name); x->x_inprogress = 0; return; } #ifdef FLITE_DEBUG debug("flite: ->write to garray loop<-\n"); #endif for (i = 0; i < x->x_wave->num_samples; i++) { x->x_vec->w_float = x->x_wave->samples[i]/32767.0; x->x_vec++; } // -- cleanup delete_wave(x->x_wave); // -- redraw garray_redraw(x->x_a); outlet_bang(x->x_bangout); } else if (x->x_tick_ctl == ARRAYERR) { pd_error(x,"flite: no such array '%s'", x->x_arrayname->s_name); } else if (x->x_tick_ctl == BUFFERERR) { pd_error(x,"flite: attempt to synthesize empty text-buffer!"); } else if (x->x_tick_ctl == FAIL) { pd_error(x,"flite: synthesis failed for text '%s'", x->x_textbuf); } else if (x->x_tick_ctl == INPROGRESS) { pd_error(x,"%s", thread_waiting); } else if (x->x_tick_ctl == VOXFILEDONE) { logpost(x,2,"Flite: successfully loaded '%s'", x->x_reqfile); } x->x_inprogress = 0; return; } /*-------------------------------------------------------------------- * flite_thread : thread *--------------------------------------------------------------------*/ static void flite_thread(t_flite *x) { while (1) { pthread_mutex_lock(&x->x_mutex); while (x->x_requestcode == IDLE) { #ifdef FLITE_DEBUG debug("pthread_cond_wait(\n"); #endif pthread_cond_wait(&x->x_requestcondition, &x->x_mutex); } if (x->x_requestcode == SYNTH) { pthread_mutex_unlock(&x->x_mutex); #ifdef FLITE_DEBUG debug("thread synth\n"); #endif flite_thread_synth(x); pthread_mutex_lock(&x->x_mutex); if (x->x_requestcode == SYNTH) x->x_requestcode = IDLE; pthread_mutex_unlock(&x->x_mutex); } else if (x->x_requestcode == TEXTFILE) { pthread_mutex_unlock(&x->x_mutex); flite_read_textfile(x); flite_thread_synth(x); pthread_mutex_lock(&x->x_mutex); if (x->x_requestcode == TEXTFILE) x->x_requestcode = IDLE; pthread_mutex_unlock(&x->x_mutex); } else if (x->x_requestcode == VOXFILE) { pthread_mutex_unlock(&x->x_mutex); flite_threaded_voice_file(x); pthread_mutex_lock(&x->x_mutex); if (x->x_requestcode == VOXFILE) x->x_requestcode = IDLE; pthread_mutex_unlock(&x->x_mutex); } else if (x->x_requestcode == QUIT) { pthread_mutex_unlock(&x->x_mutex); break; } } #ifdef FLITE_DEBUG debug("thread quit\n"); #endif return; } /*-------------------------------------------------------------------- * constructor *--------------------------------------------------------------------*/ static void *flite_new(t_symbol *ary) { t_flite *x; x = (t_flite *)pd_new(flite_class); x->x_clock = clock_new(x, (t_method)flite_clock_tick); // set initial arrayname x->x_arrayname = ary; // init x_textbuf x->x_textbuf = NULL; // create bang-on-done outlet x->x_bangout = outlet_new(&x->x_obj, &s_bang); // default voice x->x_voice = register_cmu_us_kal16(); x->x_canvas = canvas_getcurrent(); x->x_inprogress = 0; x->x_requestcode = IDLE; pthread_mutex_init(&x->x_mutex, 0); pthread_cond_init(&x->x_requestcondition, 0); pthread_create(&x->x_tid, 0, flite_thread, x); return (void *)x; } /*-------------------------------------------------------------------- * destructor *--------------------------------------------------------------------*/ static void flite_free(t_flite *x) { #ifdef FLITE_DEBUG debug("free\n"); #endif pthread_mutex_lock(&x->x_mutex); x->x_requestcode = QUIT; pthread_mutex_unlock(&x->x_mutex); pthread_cond_signal(&x->x_requestcondition); pthread_join(x->x_tid, NULL); pthread_cond_destroy(&x->x_requestcondition); pthread_mutex_destroy(&x->x_mutex); free(x->x_textbuf); clock_free(x->x_clock); } /*-------------------------------------------------------------------- * setup *--------------------------------------------------------------------*/ void flite_setup(void) { post(""); post(flite_description); post(""); // --- setup synth flite_init(); // --- register class flite_class = class_new(gensym("flite"), (t_newmethod)flite_new, // newmethod (t_method)flite_free, // freemethod sizeof(t_flite), // size CLASS_DEFAULT, // flags A_DEFSYM, // arg1: table-name 0); // --- class methods class_addlist(flite_class, flite_list); class_addmethod(flite_class, (t_method)flite_set, gensym("set"), A_DEFSYM, 0); class_addmethod(flite_class, (t_method)flite_text, gensym("text"), A_GIMME, 0); class_addmethod(flite_class, (t_method)flite_synth, gensym("synth"), 0); class_addmethod(flite_class, (t_method)flite_voice, gensym("voice"), A_DEFSYM, 0); class_addmethod(flite_class, (t_method)flite_voice_file, gensym("voice_file"), A_DEFSYM, 0); class_addmethod(flite_class, (t_method)flite_thrd_voice_file, gensym("thrd_voice_file"), A_DEFSYM, 0); class_addmethod(flite_class, (t_method)flite_textfile, gensym("textfile"), A_DEFSYM, 0); class_addmethod(flite_class, (t_method)flite_thrd_synth, gensym("thrd_synth"), 0); class_addmethod(flite_class, (t_method)flite_thrd_textfile, gensym("thrd_textfile"), A_DEFSYM, 0); // --- help patch //class_sethelpsymbol(flite_class, gensym("flite-help.pd")); /* breaks pd-extended help lookup */ } flite-0.3.3/pd-lib-builder/000077500000000000000000000000001433521004700154125ustar00rootroot00000000000000flite-0.3.3/pd-lib-builder/CHANGELOG.txt000066400000000000000000000066431433521004700174530ustar00rootroot00000000000000Changelog for Makefile.pdlibbuilder. v0.6.0, dated 2019-12-21 - detect target platform (OS and architecture) rather than build platform (#55) - introduce optional user variable 'PLATFORM' for cross compilation - no longer build OSX/MacOS fat binaries by default (#21, #50) - do build fat binaries when 'extension=d_fat' is specified for OSX/MacOS - fix bug where minimum OSX/MacOS version wasn't defined, and set it to 10.6 v0.5.1, dated 2018-03-15 Fixes and improvements for Windows builds: - properly evaluate variables 'PDDIR' and 'PDBINDIR' to find pd.dll - define default path of 32 bit Pd on 64 bit Windows - link C++ externals with standard C libs on Windows, they don't load otherwise - strip installed Windows binaries by default (issues #34, #39, #41, #42 respectively) Warning for all platforms: variable 'PD_PATH' is no longer supported, use the equivalent 'PDDIR'. v0.5.0, dated 2018-01-23 Implement target architecture detection for Windows builds, and set appropriate options for 32 and 64 bit (used to be for 32 bit only). (feature, issue #37 #38, merge commit 215bf3e) v0.4.4, dated 2016-11-22 Use variable 'system' when evaluating 'for{Linux,Darwin,Windows}' (bugfix, issue #31, commit 2c14110) v0.4.3, dated 2016-11-02 Replace flags '-fpic' by 'fPIC'. (bugfix, issue #29, commit 426b38b) v0.4.2, dated 2016-10-30 Fix issue where incorrect message about m_pd.h is given. (bugfix, commit 2e13d8f) v0.4.1, dated 2016-10-27 Respect cflag for minimum OSX version when defined by lib makefile. (bugfix, pull request #22, commit 48c4127) v0.4.0, dated 2016-10-14 Introduced path variables PDDIR, PDINCLUDEDIR, PDBINDIR, PDLIBDIR which can also be defined in environment. (feature, issue #27, commit b0dab72) v0.3.1, dated 2016-10-13 Fix bug where pd.dll wouldn't be found. (bugfix, commit a0c87be) v0.3.0, dated 2016-10-09 Variable 'PD_PATH' introduced for pd-extended / pd-l2ork compatibility. (feature, issue #26, commit 41e9743) v0.2.8, dated 2016-10-09 Allow installed files to contain weird characters (notably '$'). (bugfix, pull request #20, commit 5b920b1) v0.2.7, dated 2016-10-04 Remove all default pd search paths except vanilla's. (discussion, issue #25, commit a6a89dc) v0.2.6, dated 2016-09-20 Redefined dependency checking so it won't stall rebuilds on OSX. (bugfix, issue #16, commit 9fd1795) v0.2.5, dated 2016-06-26 Fixed dependency checking for object files in other directories. (bugfix, commit f06e550) v0.2.4, dated 2016-06-25 Fixed regression bug that disabled all dependency checking. (bugfix, commit 1d7bb5e) v0.2.3, dated 2016-03-29 Disabled dependency checking for OSX <= 10.5 because it stalled rebuilds. (bugfix, issue #16, commit eb614fd) v0.2.2, dated 2016-03-28 Removed target 'pre' because it forced rebuild of everything in 'all'. (bugfix, issue #17, commit c989c8e) v0.2.1, dated 2015-12-27 Implement / respect 'CPPFLAGS','CFLAGS'and 'LDFLAGS'. (bugfix, issue #5, commit 98f3582) v0.2.0, dated 2015-12-19 Added per-platform multiline defines 'forLinux', 'forDarwin', 'forWindows'. (feature, pull request #9, commit 3946ea5) v0.1.0, dated 2015-12-08 Added targets 'pre' and 'post' to automatically run before and after 'all'. (feature, pull request #4, commit a5678ac) v0.0.2, dated 2015-12-06 Improved methods for searching pd paths. (bugfix, commit ed37e6b) v0.0.1, dated 2015-10-31 Fixed expansion of variable 'lib.version'. (bugfix, issue #1, commit 974b617) v0.0.0, dated 2015-06-24 Initial version. (commit 16517a2) flite-0.3.3/pd-lib-builder/Makefile.pdlibbuilder000066400000000000000000001266041433521004700215230ustar00rootroot00000000000000# Makefile.pdlibbuilder dated 2019-12-21 version = 0.6.0 # Helper makefile for Pure Data external libraries. # Written by Katja Vetter March-June 2015 for the public domain. No warranties. # Inspired by Hans Christoph Steiner's Makefile Template and Stephan Beal's # ShakeNMake. # # Grab the newest version of Makefile.pdlibbuilder from # https://github.com/pure-data/pd-lib-builder/ # # GNU make version >= 3.81 required. # # #=== characteristics =========================================================== # # # - defines build settings based on autodetected OS and architecture # - defines rules to build Pd class- or lib executables from C or C++ sources # - defines rules for libdir installation # - defines convenience targets for developer and user # - evaluates implicit dependencies for non-clean builds # # #=== basic usage =============================================================== # # # In your Makefile, define your Pd lib name and class files, and include # Makefile.pdlibbuilder at the end of the Makefile. Like so: # # ________________________________________________________________________ # # # Makefile for mylib # # lib.name = mylib # # class.sources = myclass1.c myclass2.c # # datafiles = myclass1-help.pd myclass2-help.pd README.txt LICENSE.txt # # include Makefile.pdlibbuilder # ________________________________________________________________________ # # # For files in class.sources it is assumed that class basename == source file # basename. The default target builds all classes as individual executables # with Pd's default extension for the platform. For anything more than the # most basic usage, continue reading. # # #=== list of Makefile.pdlibbuilder API variables =============================== # # # Variables available for definition in your library Makefile: # # - lib.name # - lib.setup.sources # - class.sources # - common.sources # - shared.sources # - .class.sources # - .class.ldflags # - .class.ldlibs # - cflags # - ldflags # - ldlibs # - datafiles # - datadirs # - makefiles # - makefiledirs # - externalsdir # # Optional multiline defines evaluated per operating system: # # - forLinux # - forDarwin # - forWindows # # Variables available for your makefile or make command line: # # - make-lib-executable # - suppress-wunused # # Path variables for make command line or environment: # # - PDDIR # - PDINCLUDEDIR # - PDBINDIR # - PDLIBDIR # # Standard make variables for make command line or environment: # # - CPPFLAGS # - CFLAGS # - LDFLAGS # - CC # - CXX # - INSTALL # - STRIP # - DESTDIR # # Optional user variables for make command line or environment: # # - PLATFORM # # Deprecated path variables: # # - pdincludepath # - pdbinpath # - objectsdir # # #=== descriptions of Makefile.pdlibbuilder API variables ======================= # # # lib.name: # Name of the library directory as it will be installed / distributed. Also the # name of the lib executable in the case where all classes are linked into # a single binary. # # lib.setup.sources: # Source file(s) (C or C++) which must be compiled only when linking all classes # into a single lib binary. # # class.sources: # All sources files (C or C++) for which the condition holds that # class name == source file basename. # # .class.sources: # Source file(s) (C or C++) specific to class . Use this for # multiple-source classes or when class name != source file basename. # # common.sources: # Source file(s) which must be statically linked to each class in the library. # # shared.sources: # Source file(s) (C or C++) to build a shared dynamic link lib, to be linked # with all class executables. # # cflags, ldflags, ldlibs: # Define cflags (preprocessor&compiler), ldflags (linker) and ldlibs (dynamic # link libs) for the whole library. These flags are added to platform-specific # flags defined by Makefile.pdlibbuilder. # # .class.ldflags and .class.ldlibs: # Define ldflags resp. ldlibs specific to class . These flags are # added to platform-specific flags defined by Makefile.pdlibbuilder, and flags # defined in your Makefile for the whole library. Note: cflags can not be # defined per class in the current implementation. # # datafiles and datadirs: # All extra files you want to include in binary distributions of the # library: abstractions and help patches, example patches, meta patch, readme # and license texts, manuals, sound files, etcetera. Use 'datafiles' for all # files that should go into your lib rootdir and 'datadirs' for complete # directories you want to copy from source to distribution. # # forLinux, forDarwin, forWindows: # Shorthand for 'variable definitions for Linux only' etc. Use like: # define forLinux # cflags += -DLINUX # class.sources += linuxthing.c # endef # # makefiles and makefiledirs: # Extra makefiles or directories with makefiles that should be made in sub-make # processes. # # make-lib-executable: # When this variable is defined 'yes' in your makefile or as command argument, # Makefile.pdlibbuilder will try to build all classes into a single library # executable (but it will force exit if lib.setup.sources is undefined). # If your makefile defines 'make-lib-executable=yes' as the library default, # this can still be overridden with 'make-lib-executable=no' as command argument # to build individual class executables (the Makefile.pdlibbuilder default.) # # suppress-wunused: # When this variable is defined ('yes' or any other value), -Wunused-variable, # -Wunused-parameter, -Wunused-value and -Wunused-function are suppressed, # but the other warnings from -Wall are retained. # # PDDIR: # Root directory of 'portable' pd package. When defined, PDINCLUDEDIR and # PDBINDIR will be evaluated as $(PDDIR)/src and $(PDDIR)/bin. # # PDINCLUDEDIR: # Directory where Pd API m_pd.h should be found, and other Pd header files. # Overrides the default search path. # # PDBINDIR: # Directory where pd.dll should be found for linking (Windows only). Overrides # the default search path. # # PDLIBDIR: # Root directory for installation of Pd library directories. Overrides the # default install location. # # DESTDIR: # Prepended path component for staged install. # # PLATFORM: # Target platform for cross compilation in the form of GNU triplet: # cpu-vendor-os. Example: x86_64-w64-mingw32. This specifies the tool chain that # pdlibbuilder will use, if installed and locatable. System and architecture # will then be autodefined accordingly. In most cases no other variables need to # be overridden. # # CPPFLAGS: # Preprocessor flags which are not strictly required for building. # # CFLAGS: # Compiler flags which are not strictly required for building. Compiler flags # defined by Makefile.pdlibbuilder for warning, optimization and architecture # specification are overriden by CFLAGS. # # LDFLAGS: # Linker flags which are not strictly required for building. Linker flags # defined by Makefile.pdlibbuilder for architecture specification are overriden # by LDFLAGS. # # CC and CXX: # C and C++ compiler programs as defined in your build environment. # # INSTALL # Definition of install program. # # STRIP # Name of strip program. Default 'strip' can be overridden in cross compilation # environments. # # objectsdir: # Root directory for installation of Pd library directories, like PDLIBDIR but # not overridable by environment. Supported for compatibility with pd-extended # central makefile, but deprecated otherwise. # # pdincludepath, pdbinpath: # As PDINCLUDEDIR and PDBINDIR but not overridable by environment. Deprecated # as user variables. # # #=== paths ===================================================================== # # # Source files in directories other than current working directory must be # prefixed with their relative path. Do not rely on VPATH or vpath. # Object (.o) files are built in the directory of their source files. # Executables are built in current working directory. # # Default search path for m_pd.h and other API header files is platform # dependent, and overridable by PDINCLUDEDIR: # # Linux: /usr/include/pd # # OSX: /Applications/Pd*.app/Contents/Resources/src # # Windows: %PROGRAMFILES%/Pd/src # %PROGRAMFILES(X86)%/Pd/src (32 bit builds on 64 bit Windows) # # Default search path for binary pd.dll (Windows), overridable by PDBINDIR # # %PROGRAMFILES%/Pd/bin # %PROGRAMFILES(X86)%/Pd/bin (32 bit builds on 64 bit Windows) # # Default location to install pd libraries is platform dependent, and # overridable by PDLIBDIR: # # Linux: /usr/local/lib/pd-externals # OSX: ~/Library/Pd # Windows: %APPDATA%/Pd # # https://puredata.info/docs/faq/how-do-i-install-externals-and-help-files # The rationale for not installing to ~/pd-externals by default on Linux # is that some people share the home dir between 32 and 64 bit installations. # # #=== targets =================================================================== # # # all: build $(executables) plus optional post target # post: target to build after $(executables) # alldebug: build all with -g option turned on for debug symbols # : force clean build of an individual class # .pre: make preprocessor output file in current working directory # .lst: make asm/source output file in current working directory # # install: install executables and data files # clean: remove build products from source tree # # help: print help text # vars: print makefile variables # allvars: print all variables # depend: print generated prerequisites # dumpmachine: print compiler output of option '-dumpmachine' # coffee: dummy target # # Variable $(executables) expands to class executables plus optional shared lib, # or alternatively to single lib executable when make-lib-executable=true. # Targets pre and post can be defined by library makefile. Make sure to include # Makefile.pdlibbuilder first so default target all will not be redefined. # # #=== Pd-extended libdir concept ================================================ # # # For libdir layout as conceived by Hans-Christoph Steiner, see: # # https://puredata.info/docs/developer/Libdir # # Files README.txt, LICENSE.txt and -meta.pd are part of the libdir # convention. Help patches for each class and abstraction are supposed to be # available. Makefile.pdlibbuilder does not force the presence of these files # however. It does not automatically include such files in libdir installations. # Data files you want to include in distributions must be defined explicitly in # your Makefile. # # #=== Makefile.pdlibbuilder syntax conventions ================================== # # # Makefile.pdlibbuilder variable names are lower case. Default make variables, # environment variables, and standard user variables (CC, CXX, CFLAGS, DESTDIR) # are upper case. Use target 'allvars' to print all variables and their values. # # 'Fields' in data variables are separated by dots, like in 'foo.class.sources'. # Words in variables expressing a function or command are separated by dashes, # like in 'make-lib-executable'. # # #=== useful make options ======================================================= # # # Use 'make -d ' to print debug details of the make process. # Use 'make -p ' to print make's database. # # #=== TODO ====================================================================== # # # - decide whether to use -static-libgcc or shared dll in MinGW # - cygwin support # - android support # - figure out how to handle '$' in filenames # - add makefile template targets dpkg-source dist libdir distclean tags? # # #=== end of documentation sections ============================================= # # ################################################################################ ################################################################################ ################################################################################ # GNU make version 3.81 (2006) or higher is required because of the following: # - function 'info' # - variable '.DEFAULT_GOAL' # force exit when make version is < 3.81 ifneq ($(firstword $(sort 3.81 $(MAKE_VERSION))), 3.81) $(error GNU make version 3.81 or higher is required) endif # Relative path to externals root dir in multi-lib source tree like # pd-extended SVN. Default is parent of current working directory. May be # defined differently in including makefile. externalsdir ?= .. # variable you can use to check if Makefile.pdlibbuilder is already included Makefile.pdlibbuilder = true ################################################################################ ### variables: library name and version ######################################## ################################################################################ # strip possibles spaces from lib.name, they mess up calculated file names lib.name := $(strip $(lib.name)) # if meta file exists, check library version metafile := $(wildcard $(lib.name)-meta.pd) ifdef metafile lib.version := $(shell sed -n \ 's|^\#X text [0-9][0-9]* [0-9][0-9]* VERSION \(.*\);|\1|p' \ $(metafile)) endif ################################################################################ ### variables: files ########################################################### ################################################################################ #=== sources =================================================================== # (re)define .class.sources using file names in class.sources define add-class-source $(notdir $(basename $v)).class.sources += $v endef $(foreach v, $(class.sources), $(eval $(add-class-source))) # derive class names from .class.sources variables sourcevariables := $(filter %.class.sources, $(.VARIABLES)) classes := $(basename $(basename $(sourcevariables))) # accumulate all source files specified in makefile classes.sources := $(sort $(foreach v, $(sourcevariables), $($v))) all.sources := $(classes.sources) $(lib.setup.sources) \ $(shared.sources) $(common.sources) #=== object files ============================================================== # construct object filenames from all C and C++ source file names classes.objects := $(addsuffix .o, $(basename $(classes.sources))) common.objects := $(addsuffix .o, $(basename $(common.sources))) shared.objects := $(addsuffix .o, $(basename $(shared.sources))) lib.setup.objects := $(addsuffix .o, $(basename $(lib.setup.sources))) all.objects = $(classes.objects) $(common.objects) $(shared.objects) \ $(lib.setup.objects) #=== executables =============================================================== # use recursive variables here because executable extension is not yet known # construct class executable names from class names classes.executables = $(addsuffix .$(extension), $(classes)) # construct shared lib executable name if shared sources are defined ifdef shared.sources shared.lib = lib$(lib.name).$(shared.extension) else shared.lib = endif ################################################################################ ### target platform detection ################################################## ################################################################################ #=== target platform =========================================================== # PLATFORM: optional user variable to define target platform for cross # compilation. Redefine build tools accordingly. PLATFORM should match # the exact target prefix of tools present in $PATH, like x86_64-w64-mingw32, # x86_64-apple-darwin12 etc. Tool definitions are exported to ensure submakes # will get the same. ifneq ($(PLATFORM),) ifneq ($(findstring darwin, $(PLATFORM)),) export CC = $(PLATFORM)-cc export CXX = $(PLATFORM)-c++ export CPP = $(PLATFORM)-cc else export CC = $(PLATFORM)-gcc export CXX = $(PLATFORM)-g++ export CPP = $(PLATFORM)-cpp endif STRIP = $(PLATFORM)-strip endif # Let (native or cross-) compiler report target triplet and isolate individual # words therein to facilitate later processing. target.triplet := $(subst -, ,$(shell $(CC) -dumpmachine)) #=== operating system ========================================================== # The following systems are defined: Linux, Darwin, Windows. GNU and # GNU/kFreeBSD are treated as Linux to get the same options. ifneq ($(filter linux gnu% kfreebsd, $(target.triplet)),) system = Linux endif ifneq ($(filter darwin%, $(target.triplet)),) system = Darwin endif ifneq ($(filter mingw% cygwin%, $(target.triplet)),) system = Windows endif # evaluate possible system-specific multiline defines from library makefile $(eval $(for$(system))) # TODO: Cygwin, Android #=== architecture ============================================================== # The following CPU names can be processed by pdlibbuilder: # i*86 Intel 32 bit # x86_64 Intel 64 bit # arm ARM 32 bit # aarch64 ARM 64 bit target.arch := $(firstword $(target.triplet)) ################################################################################ ### variables per platform ##################################################### ################################################################################ #=== flags per architecture ==================================================== # Set architecture-dependent cflags, mainly for Linux. For Mac and Windows, # arch.c.flags are overriden below. To see gcc's default architecture flags: # $ gcc -Q --help=target # ARMv6: Raspberry Pi 1st gen, not detectable from target.arch ifeq ($(shell uname), armv6l) arch.c.flags = -march=armv6 -mfpu=vfp -mfloat-abi=hard # ARMv7: Beagle, Udoo, RPi2 etc. else ifeq ($(target.arch), arm) arch.c.flags = -march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard # ARMv8 64 bit, not tested yet else ifeq ($(target.arch), aarch64) arch.c.flags = -mcpu=cortex-a53 # Intel 32 bit, build with SSE and SSE2 instructions else ifneq ($(filter i%86, $(target.arch)),) arch.c.flags = -march=pentium4 -mfpmath=sse -msse -msse2 # Intel/AMD 64 bit, build with SSE, SSE2 and SSE3 instructions else ifeq ($(target.arch), x86_64) arch.c.flags = -march=core2 -mfpmath=sse -msse -msse2 -msse3 # if none of the above architectures detected else arch.c.flags = endif #=== flags and paths for Linux ================================================= ifeq ($(system), Linux) prefix = /usr/local libdir := $(prefix)/lib pkglibdir = $(libdir)/pd-externals pdincludepath := $(wildcard /usr/include/pd) extension = pd_linux cpp.flags := -DUNIX c.flags := -fPIC c.ldflags := -rdynamic -shared -fPIC -Wl,-rpath,"\$$ORIGIN",--enable-new-dtags c.ldlibs := -lc -lm cxx.flags := -fPIC -fcheck-new cxx.ldflags := -rdynamic -shared -fPIC -Wl,-rpath,"\$$ORIGIN",--enable-new-dtags cxx.ldlibs := -lc -lm -lstdc++ shared.extension = so shared.ldflags := -rdynamic -fPIC -shared -Wl,-soname,$(shared.lib) endif #=== flags and paths for Darwin ================================================ # LLVM-clang doesn't support -fcheck-new, therefore this flag is only used when # compiling with g++. ifeq ($(system), Darwin) pkglibdir = $(HOME)/Library/Pd pdincludepath := $(firstword $(wildcard \ /Applications/Pd*.app/Contents/Resources/src)) extension = pd_darwin cpp.flags := -DUNIX -DMACOSX -I /sw/include c.flags := c.ldflags := -undefined suppress -flat_namespace -bundle c.ldlibs := -lc cxx.ldflags := -undefined suppress -flat_namespace -bundle cxx.ldlibs := -lc shared.extension = dylib shared.ldflags = -dynamiclib -undefined dynamic_lookup \ -install_name @loader_path/$(shared.lib) \ -compatibility_version 1 -current_version 1.0 ifneq ($(filter %g++, $(CXX)),) cxx.flags := -fcheck-new endif ifeq ($(extension), d_fat) arch := i386 x86_64 else arch := $(target.arch) endif ifneq ($(filter -mmacosx-version-min=%, $(cflags)),) version.flag := $(filter -mmacosx-version-min=%, $(cflags)) else version.flag = -mmacosx-version-min=10.6 endif arch.c.flags := $(addprefix -arch , $(arch)) $(version.flag) arch.ld.flags := $(arch.c.flags) endif #=== flags and paths for Windows =============================================== # Standard paths on Windows contain spaces, and GNU make functions treat such # paths as lists, with unintended effects. Therefore we must use shell function # ls instead of make's wildcard when probing for a path, and use double quotes # when specifying a path in a command argument. # Default paths in Mingw / Mingw-w64 environments. 'PROGRAMFILES' is standard # location for builds with native architecture, 'ProgramFiles(x86)' for i686 # builds on x86_64 Windows (detection method by Lucas Cordiviola). Curly braces # required because of parentheses in variable name. ifeq ($(system), Windows) pkglibdir := $(APPDATA)/Pd ifeq ($(target.arch), i686) programfiles := ${ProgramFiles(x86)} else programfiles := $(PROGRAMFILES) endif pdbinpath := $(programfiles)/Pd/bin pdincludepath := $(programfiles)/Pd/src endif # Store default path to pd.dll in PDBINDIR if the latter is not user-defined. # For include path this is done in the platform-independent paths section below, # but for PDBINDIR it is done here so ld flags can be evaluated as immediate # variables. ifeq ($(system), Windows) ifdef PDDIR PDBINDIR := $(PDDIR)/bin endif PDBINDIR ?= $(pdbinpath) endif # TODO: decide whether -mms-bitfields should be specified. ifeq ($(system), Windows) cpp.flags := -DMSW -DNT ifeq ($(target.arch), i686) arch.c.flags := -march=pentium4 -msse -msse2 -mfpmath=sse else ifeq ($(target.arch), x86_64) cpp.flags := -DMSW -DNT -DPD_LONGINTTYPE=__int64 arch.c.flags := -march=core2 -msse -msse2 -msse3 -mfpmath=sse else arch.c.flags = endif extension = dll c.flags := c.ldflags := -static-libgcc -shared \ -Wl,--enable-auto-import "$(PDBINDIR)/pd.dll" c.ldlibs := cxx.flags := -fcheck-new cxx.ldflags := -static-libgcc -static-libstdc++ -shared \ -Wl,--enable-auto-import "$(PDBINDIR)/pd.dll" cxx.ldlibs := shared.extension = dll shared.ldflags := -static-libgcc -shared "$(PDBINDIR)/pd.dll" stripflags = --strip-all endif #=== paths ===================================================================== # Platform-dependent default paths are specified above, but overridable. # Path variables in upper case can be defined as make command argument or in the # environment. Variable 'objectsdir' is supported for compatibility with # the build system that pd-l2ork has inherited from pd-extended. PDINCLUDEDIR ?= $(pdincludepath) PDLIBDIR ?= $(firstword $(objectsdir) $(pkglibdir)) ifdef PDDIR PDINCLUDEDIR := $(wildcard $(PDDIR)/src) endif # base path where all components of the lib will be installed by default installpath := $(DESTDIR)$(PDLIBDIR)/$(lib.name) # check if include path contains spaces (as is often the case on Windows) # if so, store the path so we can later do checks with it pdincludepathwithspaces := $(if $(word 2, $(PDINCLUDEDIR)), $(PDINCLUDEDIR)) #=== accumulated build flags =================================================== # From GNU make docs: 'Users expect to be able to specify CFLAGS freely # themselves.' So we use CFLAGS to define options which are not strictly # required for compilation: optimizations, architecture specifications, and # warnings. CFLAGS can be safely overriden using a make command argument. # Variables cflags, ldflags and ldlibs may be defined in including makefile. optimization.flags = -O3 -ffast-math -funroll-loops -fomit-frame-pointer warn.flags = -Wall -Wextra -Wshadow -Winline -Wstrict-aliasing # suppress -Wunused-variable & Co if you don't want to clutter a build log ifdef suppress-wunused warn.flags += $(addprefix -Wno-unused-, function parameter value variable) endif CFLAGS = $(warn.flags) $(optimization.flags) $(arch.c.flags) # preprocessor flags cpp.flags := -DPD -I "$(PDINCLUDEDIR)" $(cpp.flags) $(CPPFLAGS) # flags for dependency checking (cflags from makefile may define -I options) depcheck.flags := $(cpp.flags) $(cflags) # architecture specifications for linker are overridable by LDFLAGS LDFLAGS := $(arch.ld.flags) # now add the same ld flags to shared dynamic lib shared.ldflags := $(shared.ldflags) $(LDFLAGS) # accumulated flags for C compiler / linker c.flags := $(cpp.flags) $(c.flags) $(cflags) $(CFLAGS) c.ldflags := $(c.ldflags) $(ldflags) $(LDFLAGS) c.ldlibs := $(c.ldlibs) $(ldlibs) # accumulated flags for C++ compiler / linker cxx.flags := $(cpp.flags) $(cxx.flags) $(cflags) $(CFLAGS) cxx.ldflags := $(cxx.ldflags) $(ldflags) $(LDFLAGS) cxx.ldlibs := $(cxx.ldlibs) $(ldlibs) ################################################################################ ### variables: tools ########################################################### ################################################################################ # aliases so we can later define 'compile-$1' and set 'c' or 'cxx' as argument compile-c := $(CC) compile-cxx := $(CXX) ################################################################################ ### checks ##################################################################### ################################################################################ # At this point most variables are defined. Now do some checks and info's # before rules begin. # print Makefile.pdlibbuilder version before possible termination $(info ++++ info: using Makefile.pdlibbuilder version $(version)) # Terminate if target triplet remained empty, to avoid all sorts of confusing # scenarios and spurious bugs. ifeq ($(target.triplet),) $(error Command "$(CC) -dumpmachine" did not return a target triplet, \ needed for a build. \ Is compiler "$(CC)" installed in your PATH? ($(PATH)). \ Does compiler "$(CC)" support option "-dumpmachine"?) endif # 'forward declaration' of default target, needed to do checks all: # To avoid unpredictable results, make sure the default target is not redefined # by including makefile. ifneq ($(.DEFAULT_GOAL), all) $(error Default target must be 'all'.) endif # find out which target(s) will be made ifdef MAKECMDGOALS goals := $(MAKECMDGOALS) else goals := all endif # store path to Pd API m_pd.h if it is found ifdef PDINCLUDEDIR mpdh := $(shell ls "$(PDINCLUDEDIR)/m_pd.h") endif # store path to pd.dll; if not found, ls will give a useful error ifeq ($(system), Windows) pddll := $(shell ls "$(PDBINDIR)/pd.dll") endif # when making target all, check if m_pd.h is found and print info about it ifeq ($(goals), all) $(if $(mpdh), \ $(info ++++ info: using Pd API $(mpdh)), \ $(warning Where is Pd API m_pd.h? Do 'make help' for info.)) endif # print target info $(info ++++ info: making target $(goals) $(if $(lib.name),in lib $(lib.name))) # when installing, print installpath info $(if $(filter install install-lib, $(goals)), $(info ++++ info: \ installpath is '$(installpath)')) #=== define executables ======================================================== # By default we build class executables, and optionally a shared dynamic link # lib. When make-lib-executable=yes we build all classes into a single lib # executable, on the condition that variable lib.setup.sources is defined. ifeq ($(make-lib-executable),yes) $(if $(lib.setup.sources), ,\ $(error Can not build library blob because lib.setup.sources is undefined)) executables := $(lib.name).$(extension) else executables := $(classes.executables) $(shared.lib) endif ################################################################################ ### rules: special targets ##################################################### ################################################################################ # Disable built-in rules. If some target can't be built with the specified # rules, it should not be built at all. MAKEFLAGS += --no-builtin-rules .PRECIOUS: .SUFFIXES: .PHONY: all post build-lib \ $(classes) $(makefiledirs) $(makefiles) \ install install-executables install-datafiles install-datadirs \ force clean vars allvars depend help ################################################################################ ### rules: build targets ####################################################### ################################################################################ # Target all forces the build of targets [$(executables) post] in # deterministic order. Target $(executables) builds class executables plus # optional shared lib or alternatively a single lib executable when # make-lib-executable=true. Target post is optionally defined by # library makefile. all: post post: $(executables) all: $(info ++++info: target all in lib $(lib.name) completed) # build all with -g option turned on for debug symbols alldebug: c.flags += -g alldebug: cxx.flags += -g alldebug: all #=== class executable ========================================================== # recipe for linking objects in class executable # argument $1 = compiler type (c or cxx) # argument $2 = class basename define link-class $(compile-$1) \ $($1.ldflags) $($2.class.ldflags) \ -o $2.$(extension) \ $(addsuffix .o, $(basename $($2.class.sources))) \ $(addsuffix .o, $(basename $(common.sources))) \ $($1.ldlibs) $($2.class.ldlibs) $(shared.lib) endef # general rule for linking object files in class executable %.$(extension): $(shared.lib) $(info ++++ info: linking objects in $@ for lib $(lib.name)) $(if $(filter %.cc %.cpp, $($*.class.sources)), \ $(call link-class,cxx,$*), \ $(call link-class,c,$*)) #=== library blob ============================================================== # build all classes into single executable build-lib: $(lib.name).$(extension) $(info ++++ info: library blob $(lib.name).$(extension) completed) # recipe for linking objects in lib executable # argument $1 = compiler type (c or cxx) define link-lib $(compile-$1) \ $($1.ldflags) $(lib.ldflags) \ -o $(lib.name).$(extension) $(all.objects) \ $($1.ldlibs) $(lib.ldlibs) endef # rule for linking objects in lib executable # declared conditionally to avoid name clashes ifeq ($(make-lib-executable),yes) $(lib.name).$(extension): $(all.objects) $(if $(filter %.cc %.cpp, $(all.sources)), \ $(call link-lib,cxx), \ $(call link-lib,c)) endif #=== shared dynamic lib ======================================================== # recipe for linking objects in shared executable # argument $1 = compiler type (c or cxx) define link-shared $(compile-$1) \ $(shared.ldflags) \ -o lib$(lib.name).$(shared.extension) $(shared.objects) \ $($1.ldlibs) $(shared.ldlibs) endef # rule for linking objects in shared executable # build recipe is in macro 'link-shared' lib$(lib.name).$(shared.extension): $(shared.objects) $(info ++++ info: linking objects in shared lib $@) $(if $(filter %.cc %.cpp, $(shared.sources)), \ $(call link-shared,cxx), \ $(call link-shared,c)) #=== object files ============================================================== # recipe to make .o file from source # argument $1 is compiler type (c or cxx) define make-object-file $(info ++++ info: making $@ in lib $(lib.name)) $(compile-$1) \ $($1.flags) \ -o $@ -c $< endef # Three rules to create .o files. These are double colon 'terminal' rules, # meaning they are the last in a rules chain. %.o:: %.c $(call make-object-file,c) %.o:: %.cc $(call make-object-file,cxx) %.o:: %.cpp $(call make-object-file,cxx) #=== explicit prerequisites for class executables ============================== # For class executables, prerequisite rules are declared in run time. Target # 'depend' prints these rules for debugging purposes. # declare explicit prerequisites rule like 'class: class.extension' # argument $v is class basename define declare-class-target $v: $v.$(extension) endef # declare explicit prerequisites rule like 'class.extension: object1.o object2.o' # argument $v is class basename define declare-class-executable-target $v.$(extension): $(addsuffix .o, $(basename $($v.class.sources))) \ $(addsuffix .o, $(basename $(common.sources))) endef # evaluate explicit prerequisite rules for all classes $(foreach v, $(classes), $(eval $(declare-class-target))) $(foreach v, $(classes), $(eval $(declare-class-executable-target))) #=== implicit prerequisites for class executables ============================== # Evaluating implicit prerequisites (header files) with help from the # preprocessor is 'expensive' so this is done conditionally and selectively. # Note that it is also possible to trigger a build via install targets, in # which case implicit prerequisites are not checked. # When the Pd include path contains spaces it will mess up the implicit # prerequisites rules. disable-dependency-tracking := $(strip $(pdincludepathwithspaces)) ifndef disable-dependency-tracking must-build-everything := $(filter all, $(goals)) must-build-class := $(filter $(classes), $(goals)) must-build-sources := $(foreach v, $(must-build-class), $($v.class.sources)) endif # declare implicit prerequisites rule like 'object.o: header1.h header2.h ...' # argument $1 is input source file(s) # dir is explicitly added because option -MM strips it by default define declare-object-target $(dir $1)$(filter %.o: %.h, $(shell $(CPP) $(depcheck.flags) -MM $1)) $(MAKEFILE_LIST) endef # evaluate implicit prerequisite rules when rebuilding everything ifdef must-build-everything $(if $(wildcard $(all.objects)), \ $(info ++++ info: evaluating implicit prerequisites in lib $(lib.name).....) \ $(foreach v, $(all.sources), $(eval $(call declare-object-target, $v)))) endif # evaluate implicit prerequisite rules when selectively building classes ifdef must-build-class $(foreach v, $(must-build-sources), \ $(eval $(call declare-object-target, $v))) $(foreach v, $(shared.sources), \ $(eval $(call declare-object-target, $v))) endif ################################################################################ ### rules: preprocessor and assembly files ##################################### ################################################################################ # Preprocessor and assembly output files for bug tracing etc. They are not part # of the build processes for executables. By default these files are created in # the current working directory. Dependency tracking is not performed, the build # is forced instead to make sure it's up to date. force: #=== preprocessor file ========================================================= # make preprocessor output file with extension .pre # argument $1 = compiler type (c or cxx) define make-preprocessor-file $(info ++++ info: making preprocessor output file $(notdir $*.pre) \ in current working directory) $(compile-$1) -E $< $(c.flags) $($1.flags) -o $(notdir $*.pre) endef %.pre:: %.c force $(call make-preprocessor-file,c) %.pre:: %.cc force $(call make-preprocessor-file,cxx) %.pre:: %.cpp force $(call make-preprocessor-file,cxx) #=== assembly file ============================================================= # make C / assembly interleaved output file with extension .lst # argument $1 = compiler type (c or cxx) define make-assembly-file $(info ++++ info: making assembly output file $(notdir $*.lst) \ in current working directory) $(compile-$1) \ -c -Wa,-a,-ad -fverbose-asm \ $($1.flags) \ $< > $(notdir $*.lst) endef %.lst:: %.c force $(call make-assembly-file,c) %.lst:: %.cc force $(call make-assembly-file,cxx) %.lst:: %.cpp force $(call make-assembly-file,cxx) ################################################################################ ### rules: installation targets ################################################ ################################################################################ #=== strip ===================================================================== # Stripping of installed binaries will only be done when variable 'stripflags' # is defined non-empty. No default definition is provided except for Windows # where the unstripped binaries are large, especially in the case of Mingw-w64. # Note: while stripping all symbols ('-s' or '--strip-all') is possible for # Linux and Windows, in the case of OSX only non-global symbols can be stripped # (option '-x' or '--discard-all'). # Make definition of strip command overridable so it can be defined in an # environment for cross-compilation. STRIP ?= strip # Commands in 'strip-executables' will be executed conditionally in the rule for # target 'install-executables'. strip-executables = cd "$(installpath)" && \ $(foreach v, $(executables), $(STRIP) $(stripflags) '$v';) #=== install =================================================================== # Install targets depend on successful exit status of target all because nothing # must be installed in case of a build error. # -p = preserve time stamps # -m = set permission mode (as in chmod) # -d = create all components of specified directories INSTALL = install INSTALL_PROGRAM := $(INSTALL) -p -m 644 INSTALL_DATA := $(INSTALL) -p -m 644 INSTALL_DIR := $(INSTALL) -m 755 -d # strip spaces from file names executables := $(strip $(executables)) datafiles := $(strip $(datafiles)) datadirs := $(strip $(datadirs)) # Do not make any install sub-target with empty variable definition because the # install program would exit with an error. install: $(if $(executables), install-executables) install: $(if $(datafiles), install-datafiles) install: $(if $(datadirs), install-datadirs) install-executables: all $(INSTALL_DIR) -v "$(installpath)" $(foreach v, $(executables), \ $(INSTALL_PROGRAM) '$v' "$(installpath)";) $(info ++++ info: executables of lib $(lib.name) installed \ from $(CURDIR) to $(installpath)) $(if $(stripflags), $(strip-executables),) install-datafiles: all $(INSTALL_DIR) -v "$(installpath)" $(foreach v, $(datafiles), \ $(INSTALL_DATA) '$(v)' "$(installpath)";) $(info ++++ info: data files of lib $(lib.name) installed \ from $(CURDIR) to $(installpath)) install-datadirs: all $(foreach v, $(datadirs), $(INSTALL_DIR) "$(installpath)/$v";) $(foreach v, $(datadirs), \ $(INSTALL_DATA) $(wildcard $v/*) "$(installpath)/$v";) $(info ++++ info: data directories of lib $(lib.name) installed \ from $(CURDIR) to $(installpath)) ################################################################################ ### rules: distribution targets ################################################ ################################################################################ # TODO # These targets are implemented in Makefile Template, but I have to figure out # how to do it under the not-so-strict conditions of Makefile.pdlibbuilder. # make source package dist: @echo "target dist not yet implemented" # make Debian source package dpkg-source: @echo "target dpkg-source not yet implemented" $(ORIGDIR): $(DISTDIR): ################################################################################ ### rules: clean targets ####################################################### ################################################################################ # delete build products from build tree clean: rm -f $(all.objects) rm -f $(classes.executables) $(lib.name).$(extension) $(shared.lib) rm -f *.pre *.lst # remove distribution directories and tarballs from build tree distclean: clean @echo "target distclean not yet implemented" ################################################################################ ### rules: submake targets ##################################################### ################################################################################ # Iterate over sub-makefiles or makefiles in other directories. # When 'continue-make=yes' is set, sub-makes will report 'true' to the parent # process regardless of their real exit status. This prevents the parent make # from being aborted by a sub-make error. Useful when you want to quickly find # out which sub-makes from a large set will succeed. ifeq ($(continue-make),yes) continue = || true endif # These targets will trigger sub-make processes for entries in 'makefiledirs' # and 'makefiles'. all alldebug install clean distclean dist dkpg-source: \ $(makefiledirs) $(makefiles) # this expands to identical rules for each entry in 'makefiledirs' $(makefiledirs): $(MAKE) --directory=$@ $(MAKECMDGOALS) $(continue) # this expands to identical rules for each entry in 'makefiles' $(makefiles): $(MAKE) --directory=$(dir $@) --makefile=$(notdir $@) $(MAKECMDGOALS) $(continue) ################################################################################ ### rules: convenience targets ################################################# ################################################################################ #=== show variables ============================================================ # Several 'function' macro's cause errors when expanded within a rule or without # proper arguments. Variables which are set with the define directive are only # shown by name for that reason. functions = \ add-class-source \ declare-class-target \ declare-class-executable-target \ declare-object-target \ link-class \ link-lib \ link-shared \ make-object-file \ make-preprocessor-file \ make-assembly-file # show variables from makefiles vars: $(info ++++ info: showing makefile variables:) $(foreach v,\ $(sort $(filter-out $(functions) functions, $(.VARIABLES))),\ $(if $(filter file, $(origin $v)),\ $(info variable $v = $($v)))) $(foreach v, $(functions), $(info 'function' name: $v)) @echo # show all variables allvars: $(info ++++ info: showing default, automatic and makefile variables:) $(foreach v, \ $(sort $(filter-out $(functions) functions, $(.VARIABLES))), \ $(info variable ($(origin $v)) $v = $($v))) $(foreach v, $(functions), $(info 'function' name: $v)) @echo #=== show dependencies ========================================================= # show generated prerequisites rules depend: $(info ++++ info: generated prerequisite rules) $(foreach v, $(classes), $(info $(declare-class-target))) $(foreach v, $(classes), $(info $(declare-class-executable-target))) $(foreach v, $(all.sources), $(info $(call declare-object-target, $v))) @echo #=== show help text ============================================================ # brief info about targets and paths ifdef mpdh mpdhinfo := $(mpdh) else mpdhinfo := m_pd.h was not found. Is Pd installed? endif help: @echo @echo " Main targets:" @echo " all: build executables (default target)" @echo " install: install all components of the library" @echo " vars: print makefile variables for troubleshooting" @echo " allvars: print all variables for troubleshooting" @echo " help: print this help text" @echo @echo " Pd API m_pd.h:" @echo " $(mpdhinfo)" @echo " You may specify your preferred Pd include directory as argument" @echo " to the make command, like 'PDINCLUDEDIR=path/to/pd/src'." @echo @echo " Path for installation of your libdir(s):" @echo " $(PDLIBDIR)" @echo " Alternatively you may specify your path for installation as argument" @echo " to the make command, like 'PDLIBDIR=path/to/pd-externals'." @echo @echo " Default paths are listed in the doc sections in Makefile.pdlibbuilder." @echo #=== platform test ============================================================= # This target can be used to test if the compiler for specified PLATFORM is # correctly defined and available. dumpmachine: @$(CC) -dumpmachine #=== dummy target ============================================================== coffee: @echo "Makefile.pdlibbuilder: Can not make coffee. Sorry." ################################################################################ ### end of rules sections ###################################################### ################################################################################ # for syntax highlighting in vim and github # vim: set filetype=make: flite-0.3.3/pd-lib-builder/README.md000066400000000000000000000102421433521004700166700ustar00rootroot00000000000000 ### Makefile.pdlibbuilder ### Helper makefile for Pure Data external libraries. Written by Katja Vetter March-June 2015 for the public domain and since then developed as a Pd community project. No warranties. Inspired by Hans Christoph Steiner's Makefile Template and Stephan Beal's ShakeNMake. GNU make version >= 3.81 required. ### characteristics ### * defines build settings based on autodetected target platform * defines rules to build Pd class- or lib executables from C or C++ sources * defines rules for libdir installation * defines convenience targets for developer and user * evaluates implicit dependencies for non-clean builds ### basic usage ### In your Makefile, define your Pd lib name and class files, and include Makefile.pdlibbuilder at the end of the Makefile. Like so: # Makefile for mylib lib.name = mylib class.sources = myclass1.c myclass2.c datafiles = myclass1-help.pd myclass2-help.pd README.txt LICENSE.txt include Makefile.pdlibbuilder For files in class.sources it is assumed that class name == source file basename. The default target builds all classes as individual executables with Pd's default extension for the platform. For anything more than the most basic usage, read the documentation sections in Makefile.pdlibbuilder. ### paths ### Makefile.pdlibbuilder >= v0.4.0 supports pd path variables which can be defined not only as make command argument but also in the environment, to override platform-dependent defaults: PDDIR: Root directory of 'portable' pd package. When defined, PDINCLUDEDIR and PDBINDIR will be evaluated as $(PDDIR)/src and $(PDDIR)/bin. PDINCLUDEDIR: Directory where Pd API m_pd.h should be found, and other Pd header files. Overrides the default search path. PDBINDIR: Directory where pd.dll should be found for linking (Windows only). Overrides the default search path. PDLIBDIR: Root directory for installation of Pd library directories. Overrides the default install location. ### documentation ### This README.md provides only basic information. A large comment section inside Makefile.pdlibbuilder lists and explains the available user variables, default paths, and targets. The internal documentation reflects the exact functionality of the particular version. For suggestions about project maintenance and advanced compilation see tips-tricks.md. ### versioning ### The project is versioned in MAJOR.MINOR.BUGFIX format (see http://semver.org), and maintained at https://github.com/pure-data/pd-lib-builder. Pd lib developers are invited to regulary check for updates, and to contribute and discuss improvements here. If you really need to distribute a personalized version with your library, rename Makefile.pdlibbuilder to avoid confusion. ### examples ### The list of projects using pd-lib-builder can be helpful if you are looking for examples, from the simplest use case to more complex implementations. - helloworld: traditional illustration of simplest use case - pd-windowing: straightforward real world use case of a small library - pd-nilwind / pd-cyclone: more elaborate source tree - zexy: migrated from autotools to pd-lib-builder ### projects using pd-lib-builder ### non-exhaustive list https://github.com/pure-data/helloworld https://github.com/electrickery/pd-nilwind https://github.com/electrickery/pd-maxlib https://github.com/electrickery/pd-sigpack https://github.com/electrickery/pd-tof https://github.com/electrickery/pd-windowing https://github.com/electrickery/pd-smlib https://github.com/porres/pd-cyclone https://github.com/porres/pd-else https://github.com/porres/pd-psycho https://git.iem.at/pd/comport https://git.iem.at/pd/hexloader https://git.iem.at/pd/iemgui https://git.iem.at/pd/iemguts https://git.iem.at/pd/iemlib https://git.iem.at/pd/iemnet https://git.iem.at/pd/iem_ambi https://git.iem.at/pd/iem_tab https://git.iem.at/pd/iem_adaptfilt https://git.iem.at/pd/iem_roomsim https://git.iem.at/pd/iem_spec2 https://git.iem.at/pd/mediasettings https://git.iem.at/pd/zexy https://git.iem.at/pd-gui/punish https://github.com/residuum/PuRestJson https://github.com/libpd/abl_link https://github.com/wbrent/timbreID https://github.com/MetaluNet/moonlib flite-0.3.3/pd-lib-builder/tips-tricks.md000066400000000000000000000162561433521004700202220ustar00rootroot00000000000000pd-lib-builder cheatsheet ========================= # Creating special builds ## cross-compiling on linux x86_64 for other platforms Using pd-lib-builder >=0.6.0 we can define variable `PLATFORM` to specify a target triplet for cross-compilation. Example to build W32 binaries (assuming package `mingw-w64` is installed and a W32 package for Pd is unzipped into a path `${PDWIN32}`: make PLATFORM=x86_64-w64-mingw32 PDDIR="${PDWIN32}" #### older pd-lib-builder versions Using pd-lib-builder < 0.6.0, in the absence of variable `PLATFORM`, you would instead override variables `system`, `target.arch`, `CC` and / or `CXX`, `STRIP`. Example: make system=Windows target.arch=i686 CC=i686-w64-mingw32-gcc STRIP=i686-w64-mingw32-strip PDDIR="${PDWIN32}" #### toolchains Cross toolchains for relevant platforms in Debian Buster (install g++ with dependencies for a given platform to get the whole tool chain): - `arm-linux-gnueabihf` - `aarch64-linux-gnu` - `i686-linux-gnu` - `i686-w64-mingw32` and `x86_64-w64-mingw32` (install `mingw-w64`) OSX/MacOS cross tool chains are not distributed by Debian. Use project `osxcross` from Thomas Poechtraeger to create the tools. ## building double-precision externals At the time of writing (2018-02) there is no official Pd that supports double-precision numbers yet. However, if you do get hold of an experimental double-precision Pd, you can easily build your externals for 64-bit numbers: make CPPFLAGS="-DPD_FLOATSIZE=64" ## building externals for W64 (64-bit Windows) At the time of writing (2018-02) there is no official Pd that supports W64 yet. However, if you do get hold of an experimental W64 Pd, you can easily build your externals for this environment with make CPPFLAGS="-DPD_LONGINTTYPE=__int64" CC=x86_64-w64-mingw32-gcc To build a double-precision external for W64, use something like: make CPPFLAGS="-DPD_LONGINTTYPE=__int64 -DPD_FLOATSIZE=64" CC=x86_64-w64-mingw32-gcc ## TODO universal binaries on OSX # Project management In general it is advised to put the `Makefile.pdlibbuilder` into a separate subdirectory (e.g. `pd-lib-builder/`). This makes it much easier to update the `Makefile.pdlibbuilder` later You *should* also use a variable to the actual path of the Makefile.pdlibbuilder (even if you keep it in the root-directory), as this allows easy experimenting with newer (or older) (or site-specific) versions of the pd-lib-builder Makefile. ~~~make PDLIBBUILDER_DIR=pd-lib-builder/ include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder ~~~ ## Keeping pd-lib-builder up-to-date ### `git subtree` With git-subtrees, you make the pd-lib-builder repository (or any other repository for that matter) part of your own repository - with full history and everything - put nicely into a distinct subdirectory. Support for *manipulating* subtrees has been added with Git-v1.7.11 (May 2012). The nice thing however is, that from "outside" the subtree is part of your repository like any other directory. E.g. older versions of Git can clone your repository with the full subtree (and all it's history) just fine. You can also use git-archive to make a complete snapshot of your repository (including the subtree) - nice, if you e.g. want self-contained downloads of your project from git hosting platforms (like Github, Gitlab, Bitbucket,...) In short, `git subtree` is the better `git submodule`. So here's how to do it: #### Initial setup/check-out This will create a `pd-lib-builder/` directory containing the full history of the pd-lib-builder repository up to its release `v0.5.0` ~~~sh git subtree add --prefix=pd-lib-builder/ https://github.com/pure-data/pd-lib-builder v0.5.0 ~~~ This will automatically merge the `pd-lib-builder/` history into your current branch, so everything is ready to go. #### Cloning your repository with the subtree Nothing special, really. Just clone your repository as always: ~~~sh git clone https://git.example.org/pd/superbonk~.git ~~~ #### Updating the subtree Time passes and sooner or later you will find, that there is a shiny new pd-lib-builder with plenty of bugfixes and new features. To update your local copy to pd-lib-builder's current `master`, simply run: ~~~sh git subtree pull --prefix pd-lib-builder/ https://github.com/pure-data/pd-lib-builder master ~~~ #### Pulling the updated subtree into existing clones Again, nothing special. Just pull as always: ~~~sh git pull ~~~ #### Further reading More on the power of `git subtree` can be found online - https://medium.com/@v/git-subtrees-a-tutorial-6ff568381844 - https://www.atlassian.com/blog/git/alternatives-to-git-submodule-git-subtree - ... ### ~~`git submodule`~~ [DISCOURAGED] #### Initial setup/check-out To add a new submodule to your repository, just run `git submodule add` and commit the changes: ~~~sh git submodule add https://github.com/pure-data/pd-lib-builder git commit .gitmodules pd-lib-builder/ -m "Added pd-lib-builder as git-submodule" ~~~ #### Cloning your repository with the submodule When doing a fresh clone of your repository, pass the `--recursive` option to automatically fetch all submodules: ~~~sh git clone --recursive https://git.example.org/pd/superbonk~.git ~~~ If you've cloned non-recursively, you can initialize and update the submodules manually: ~~~sh git submodule init git submodule update ~~~ #### Updating the submodule Submodules are usually fixed to a given commit in their repository. To update the `pd-lib-builder` submodule to the current `master` do something like: ~~~sh cd pd-lib-builder git checkout master git pull cd .. git status pd-lib-builder git commit pd-lib-builder -m "Updated pd-lib-builder to current master" ~~~ #### Pulling the updated submodule into existing clones After you have pushed the submodule updates in your repository, other clones of the repository can be updated as follows: ~~~sh git pull ~~~ The above will make your repository aware, that the submodule is out-of-sync. ~~~sh $ LANG=C git status pd-lib-builder On branch master Your branch is up to date with 'origin/master'. Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory) modified: pd-lib-builder (new commits) $ ~~~ In order to sync the submodule to the correct commit, run the following: ~~~sh git submodule update ~~~ #### Drawbacks `git submodule` has a number of drawbacks: - it requires special commands to synchronize the submodules, in addition to synching your repository. - you must make sure to use an URL for the submodule that is accessible to your potential users. e.g. using `git@github.com:pure-data/pd-lib-builder` is bad, because it requires everybody who wants to checkout your sources to have a github-account - even if they could checkout *your* repository anonymously. - submodules will be excluded from `git archive`. This means, that if you use a mainstream git provider (like Github, GitLab, Bitbucket,...) and make releases by creating a `git tag`, the automatically generated zipfiles with the sources will lack the submodule - and your users will not be able to compile your source code. In general, I would suggest to **avoid** `git submodule`, and instead use the better `git subtree` (above). flite-0.3.3/scripts/000077500000000000000000000000001433521004700143065ustar00rootroot00000000000000flite-0.3.3/scripts/localdeps.linux.sh000077500000000000000000000154001433521004700177510ustar00rootroot00000000000000#!/bin/sh # # creates local copies of all dependencies (dynamic libraries) # and sets RUNPATH to $ORIGIN on each so they will find # each other. # # usage: $0 verbose=0 include_paths= exclude_paths= #default exclude/include paths exclude_paths="*/libc.so.*:*/libarmmem.*.so.*:*/libdl.so.*:*/libglib-.*.so.*:*/libgomp.so.*:*/libgthread.*.so.*:*/libm.so.*:*/libpthread.*.so.*:*/libpthread.so.*:*/libstdc++.so.*:*/libgcc_s.so.*:*/libpcre.so.*:*/libz.so.*" include_paths="/*" # UTILITIES if [ -e "${0%/*}/localdeps.utilities.source" ]; then . "${0%/*}/localdeps.utilities.source" else # the following section (from @BEGIN_UTILITIES@ to @END_UTILITIES@) # was copied from 'localdeps.utilities.source'. # changes you make to this section will be lost. #@BEGIN_UTILITIES@ verbose=${verbose:-0} error() { echo "$@" 1>&2 } substitute() { # substitutes literal strings # usage: echo foo | substitute foo bar g sed "s/$(echo $1 | sed 's:[]\[^$.*/&]:\\&:g')/$(echo $2 | sed 's:[]\[^$.*/&]:\\&:g')/$3" } check_binaries() { local cmd for cmd in "$@"; do if ! which "${cmd}" > /dev/null; then error "Could not find '${cmd}'. Is it installed?" exit 127 fi done } normalize_path() { # normalize a path specification, e.g. on Windows turn C:\Foo\Bar\ into /c/foo/bar/" # on most system this doesn't do anything, but override it to your needs... # e.g. on Windows use: ${CYGPATH} "$1" | tr "[A-Z]" "[a-z]" echo "$1" } list_dirs() { # local IN="$@" local iter while [ "$IN" ] ;do iter=${IN%%:*} echo "${iter}" [ "$IN" = "$iter" ] && IN='' || IN="${IN#*:}" done } check_in_path() { local needle=$1 local p local patterns shift patterns="$@" while [ "${patterns}" ]; do p=${patterns%%:*} [ "$patterns" = "$p" ] && patterns='' || patterns="${patterns#*:}" case "${needle}" in ${p}) echo "${needle}" break ;; esac done | grep . >/dev/null } check_includedep() { local path=$(normalize_path "$1") local p local result=0 # exclude non-existing files if [ ! -e "${path}" ]; then return 0 fi # skip paths that match one of the patterns in ${exclude_paths} if check_in_path "${path}" "${exclude_paths}"; then return 1 fi # only include paths that match one of the patterns in ${include_paths} if check_in_path "${path}" "${include_paths}"; then echo "${path}" return 0 fi # skip the rest return 1 } usage() { cat >/dev/stderr <] [-X ] [ ...] recursively includes all dependencies of the given binaries -I : adds one include path entry -X : adds one exclude path entry -v: raise verbosity -q: lower verbosity EOF case "$0" in *win*) cat >/dev/stderr </dev/stderr < ' \ | while read _ _ libpath _; do inc=$(check_includedep "${libpath}") if [ "x${inc}" != "x" ]; then echo "${inc}" fi done } install_deps () { # make a local copy of all linked libraries of given binary # and set RUNPATH to $ORIGIN (exclude "standard" libraries) # arg1: binary to check local outdir outdir="$(dirname "$1")/${arch}" local outfile if [ ! -d "${outdir}" ]; then outdir=. fi list_deps "$1" | while read libpath; do libname=$(basename "${libpath}") if [ ! -e "${libpath}" ]; then error "DEP: ${INSTALLDEPS_INDENT} WARNING: could not make copy of '${libpath}'. Not found" continue fi outfile="${outdir}/$(basename ${libpath})" if [ -e "${outfile}" ]; then error "DEP: ${INSTALLDEPS_INDENT} ${libpath} SKIPPED" else error "DEP: ${INSTALLDEPS_INDENT} ${libpath} -> ${outdir}/" cp "${libpath}" "${outfile}" patchelf --set-rpath \$ORIGIN "${outfile}" fi done patchelf --set-rpath \$ORIGIN/${arch} "${1}" } # Check dependencies check_binaries grep ldd patchelf for f in "$@"; do # Check if we can read from given file if ! ldd "${f}" > /dev/null 2>&1; then error "Skipping '${f}'. Is it a binary file?" continue fi depdir="$(dirname ${f})/${arch}" mkdir -p "${depdir}" install_deps "${f}" done flite-0.3.3/scripts/localdeps.macos.sh000077500000000000000000000173461433521004700177270ustar00rootroot00000000000000#!/bin/sh ## puts dependencies besides the binary # LATER: put dependencies into a separate folder ## usage: $0 [...] #default exclude/include paths exclude_paths="/usr/lib/*:/System/Library/Frameworks/*" include_paths="/*" recursion=false # UTILITIES if [ -e "${0%/*}/localdeps.utilities.source" ]; then . "${0%/*}/localdeps.utilities.source" else # the following section (from @BEGIN_UTILITIES@ to @END_UTILITIES@) # was copied from 'localdeps.utilities.source'. # changes you make to this section will be lost. #@BEGIN_UTILITIES@ verbose=${verbose:-0} error() { echo "$@" 1>&2 } substitute() { # substitutes literal strings # usage: echo foo | substitute foo bar g sed "s/$(echo $1 | sed 's:[]\[^$.*/&]:\\&:g')/$(echo $2 | sed 's:[]\[^$.*/&]:\\&:g')/$3" } check_binaries() { local cmd for cmd in "$@"; do if ! which "${cmd}" > /dev/null; then error "Could not find '${cmd}'. Is it installed?" exit 127 fi done } normalize_path() { # normalize a path specification, e.g. on Windows turn C:\Foo\Bar\ into /c/foo/bar/" # on most system this doesn't do anything, but override it to your needs... # e.g. on Windows use: ${CYGPATH} "$1" | tr "[A-Z]" "[a-z]" echo "$1" } list_dirs() { # local IN="$@" local iter while [ "$IN" ] ;do iter=${IN%%:*} echo "${iter}" [ "$IN" = "$iter" ] && IN='' || IN="${IN#*:}" done } check_in_path() { local needle=$1 local p local patterns shift patterns="$@" while [ "${patterns}" ]; do p=${patterns%%:*} [ "$patterns" = "$p" ] && patterns='' || patterns="${patterns#*:}" case "${needle}" in ${p}) echo "${needle}" break ;; esac done | grep . >/dev/null } check_includedep() { local path=$(normalize_path "$1") local p local result=0 # exclude non-existing files if [ ! -e "${path}" ]; then return 0 fi # skip paths that match one of the patterns in ${exclude_paths} if check_in_path "${path}" "${exclude_paths}"; then return 1 fi # only include paths that match one of the patterns in ${include_paths} if check_in_path "${path}" "${include_paths}"; then echo "${path}" return 0 fi # skip the rest return 1 } usage() { cat >/dev/stderr <] [-X ] [ ...] recursively includes all dependencies of the given binaries -I : adds one include path entry -X : adds one exclude path entry -v: raise verbosity -q: lower verbosity EOF case "$0" in *win*) cat >/dev/stderr </dev/stderr < ${outdir}" cp "${dep}" "${outdir}" chmod u+w "${outdir}/${depfile}" # make sure the dependency announces itself with the local path install_name_tool -id "${loaderpath}" "${outdir}/${depfile}" # recursively call ourselves, to resolve higher-order dependencies INSTALLDEPS_INDENT="${INSTALLDEPS_INDENT} " $0 -r "${outdir}/${depfile}" fi done } if [ "x${OTOOL}" = "x" ]; then check_binaries otool OTOOL="otool -L" fi for f in "$@"; do if [ -e "${f}" ]; then error install_deps "${f}" fi done # Code signing # On Monterey, binaries are automatically codesigned. Modifying them with this script renders the signature # invalid. When Pd loads an external with an invalid signature, it exits immediately. Thus, we need to make sure # that we codesign them again _after_ the localdeps process # This needs to be the absolutely last step. We don't do it while we're still inside a recursion. if ! $recursion; then echo -n "Code signing in progress... " outdir="$(dirname "$1")/${arch}" codesign --remove-signature "${ARGS[@]}" ${outdir}/*.dylib codesign -s - "${ARGS[@]}" ${outdir}/*.dylib echo "Done" fi flite-0.3.3/scripts/localdeps.win.sh000077500000000000000000000166451433521004700174230ustar00rootroot00000000000000#!/bin/sh ## puts dependencies besides the binary # LATER: put dependencies into a separate folder ## usage: $0 [...] ########################################### # WARNING # # this uses an ugly hack to allow side-by-side installation of 32bit and 64bit # dependencies: # embedded dependencies are renamed from "libfoo.dll" to "libfoo.w32" resp. # "libfoo.w64", and the files are modified (using 'sed') to reflect this # renaming. # this is somewhat brittle and likely to break! #default exclude/include paths exclude_paths="" include_paths="*mingw*:*/msys/*" # UTILITIES if [ -e "${0%/*}/localdeps.utilities.source" ]; then . "${0%/*}/localdeps.utilities.source" else # the following section (from @BEGIN_UTILITIES@ to @END_UTILITIES@) # was copied from 'localdeps.utilities.source'. # changes you make to this section will be lost. #@BEGIN_UTILITIES@ verbose=${verbose:-0} error() { echo "$@" 1>&2 } substitute() { # substitutes literal strings # usage: echo foo | substitute foo bar g sed "s/$(echo $1 | sed 's:[]\[^$.*/&]:\\&:g')/$(echo $2 | sed 's:[]\[^$.*/&]:\\&:g')/$3" } check_binaries() { local cmd for cmd in "$@"; do if ! which "${cmd}" > /dev/null; then error "Could not find '${cmd}'. Is it installed?" exit 127 fi done } normalize_path() { # normalize a path specification, e.g. on Windows turn C:\Foo\Bar\ into /c/foo/bar/" # on most system this doesn't do anything, but override it to your needs... # e.g. on Windows use: ${CYGPATH} "$1" | tr "[A-Z]" "[a-z]" echo "$1" } list_dirs() { # local IN="$@" local iter while [ "$IN" ] ;do iter=${IN%%:*} echo "${iter}" [ "$IN" = "$iter" ] && IN='' || IN="${IN#*:}" done } check_in_path() { local needle=$1 local p local patterns shift patterns="$@" while [ "${patterns}" ]; do p=${patterns%%:*} [ "$patterns" = "$p" ] && patterns='' || patterns="${patterns#*:}" case "${needle}" in ${p}) echo "${needle}" break ;; esac done | grep . >/dev/null } check_includedep() { local path=$(normalize_path "$1") local p local result=0 # exclude non-existing files if [ ! -e "${path}" ]; then return 0 fi # skip paths that match one of the patterns in ${exclude_paths} if check_in_path "${path}" "${exclude_paths}"; then return 1 fi # only include paths that match one of the patterns in ${include_paths} if check_in_path "${path}" "${include_paths}"; then echo "${path}" return 0 fi # skip the rest return 1 } usage() { cat >/dev/stderr <] [-X ] [ ...] recursively includes all dependencies of the given binaries -I : adds one include path entry -X : adds one exclude path entry -v: raise verbosity -q: lower verbosity EOF case "$0" in *win*) cat >/dev/stderr </dev/stderr </dev/null) if [ -z "${CYGPATH}" ]; then CYGPATH=echo fi normalize_path() { # convert to unix-format (C:\foo\bar\ --> /c/foo/bar/) # and lower-case everything (because on microsoft-fs, paths are case-insensitive) ${CYGPATH} "$1" | tr "[A-Z]" "[a-z]" } list_deps() { local path local path0 local inc "${NTLDD}" "$1" \ | grep ' => ' \ | sed -e 's|\\|/|g' -e 's|.* => ||' -e 's| (0.*||' \ | while read path; do path0=$(echo $path |sed -e 's|/|\\|g') inc=$(check_includedep "${path0}") if [ "x${inc}" != "x" ]; then echo "${path}" fi done } file2arch() { if file "$1" | grep -w "PE32+" >/dev/null; then echo "w64" return fi if file "$1" | grep -w "PE32" >/dev/null; then echo "w32" return fi } install_deps () { local outdir="$2" local idepfile local odepfile local archext local dep error "DEP: ${INSTALLDEPS_INDENT}'$1' '$2'" if [ "x${outdir}" = "x" ]; then outdir=${1%/*} fi if [ ! -d "${outdir}" ]; then outdir=. fi list_deps "$1" | while read dep; do idepfile=$(basename "${dep}") odepfile=${idepfile} archext=$(file2arch "${dep}") if [ "x${archext}" != "x" ]; then odepfile=$(echo ${idepfile} | sed -e "s|\.dll|.${archext}|") fi if [ "x${idepfile}" = "x${odepfile}" ]; then archext="" fi if [ -e "${outdir}/${odepfile}" ]; then error "DEP: ${INSTALLDEPS_INDENT} ${dep} SKIPPED" else error "DEP: ${INSTALLDEPS_INDENT} ${dep} -> ${outdir}/${odepfile}" cp "${dep}" "${outdir}/${odepfile}" chmod a-x "${outdir}/${odepfile}" fi if [ "x${archext}" != "x" ]; then sed -b \ -e "s|${idepfile}|${odepfile}|g" \ -i \ "${outdir}/${odepfile}" "${dep}" "$1" fi #recursively resolve dependencies INSTALLDEPS_INDENT="${INSTALLDEPS_INDENT} " install_deps "${outdir}/${odepfile}" done } if [ "x${NTLDD}" = "x" ]; then check_binaries ntldd NTLDD="ntldd" fi for f in "$@"; do if [ -e "${f}" ]; then error install_deps "${f}" fi done