├── unittests ├── data.one ├── hi_again.wav ├── data_utf8.txt ├── hello_world.wav ├── include_public_headers_test_main.c ├── token_test_main.c ├── wave_test_main.c └── hrg_test_main.c ├── .codecov.yml ├── meson_options.txt ├── doc ├── intro.txt ├── stuff.ed └── Makefile ├── .gitmodules ├── cross ├── ubuntu-armhf.txt └── ubuntu-mingw64.txt ├── tools ├── example.ssml ├── example.lex ├── LANGNAME_lex.h ├── a2byte.pl ├── a2int.pl ├── a2short.pl ├── Makefile.lex ├── Makefile.lang ├── LANGNAME_lang.h ├── mimic_test ├── LANGNAME_lex.c ├── find_cmimax ├── mimic_rename_voice ├── Makefile └── make_new_lang_lex ├── src ├── synth │ ├── us_phrasing_cart.h │ ├── us_phrasing_cart.c │ ├── cst_utt_utils.c │ └── cst_voice.c ├── cg │ ├── cst_spamf0.h │ └── cst_cg_map.h ├── regex │ └── regsub.c ├── utils │ ├── cst_error.c │ ├── cst_endian.c │ └── cst_wchar.c ├── audio │ ├── au_command.c │ └── au_none.c ├── stats │ └── cst_ss.c └── speech │ └── cst_lpcres.c ├── .gitignore ├── man └── man1 │ └── mimic.1 ├── include ├── cst_uregex.h ├── cst_plugins.h ├── cst_wchar.h ├── cst_hrg.h ├── cst_args.h ├── cst_socket.h ├── cst_endian.h ├── cst_lts_rewrites.h ├── cst_ss.h ├── cst_error.h ├── cst_units.h ├── cst_utt_utils.h ├── cst_diphone.h ├── cst_track.h ├── cst_ffeatures.h ├── cst_alloc.h ├── cst_cart.h ├── cst_relation.h ├── cst_voice.h ├── cst_sigpr.h ├── cst_endian_internal.h └── cst_utterance.h ├── testsuite ├── asciiS2U_main.c ├── asciiU2S_main.c ├── play_wave_main.c ├── play_server_main.c └── play_sync_main.c ├── ACKNOWLEDGEMENTS └── .travis.yml /unittests/data.one: -------------------------------------------------------------------------------- 1 | Hello world. 2 | "Yahoo!" who(s) 3 | A small test 4 | -------------------------------------------------------------------------------- /unittests/hi_again.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MycroftAI/mimic1-core/HEAD/unittests/hi_again.wav -------------------------------------------------------------------------------- /unittests/data_utf8.txt: -------------------------------------------------------------------------------- 1 | Hello world.😊 2 | "Yahoo!" who(s) 3 | ¡Good News! 4 | Åke€ 5 | Über 6 | 漢字 7 | 8 | -------------------------------------------------------------------------------- /unittests/hello_world.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MycroftAI/mimic1-core/HEAD/unittests/hello_world.wav -------------------------------------------------------------------------------- /.codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | ignore: # files and folders that will be removed during processing 3 | - "testsuite/*" 4 | - "unittests/*" 5 | 6 | -------------------------------------------------------------------------------- /meson_options.txt: -------------------------------------------------------------------------------- 1 | option('audio', type : 'combo', 2 | choices : ['auto', 'alsa', 'portaudio', 'none', 'sun', 'oss', 3 | 'pulseaudio', 'win32'], value : 'auto') 4 | 5 | -------------------------------------------------------------------------------- /doc/intro.txt: -------------------------------------------------------------------------------- 1 | Flite is a small, fast run-time synthesis engine, designed for 2 | embedded systems and servers. Flite was developed by Alan W Black and 3 | Kevin Lenzo at Carnegie Mellon University, in Pittsburgh. The 4 | city with TTS at its heart. 5 | 6 | 7 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "subprojects/HTSEngine"] 2 | path = subprojects/HTSEngine 3 | url = https://github.com/MycroftAI/htsengine_meson.git 4 | branch = master 5 | [submodule "subprojects/pcre2"] 6 | path = subprojects/pcre2 7 | url = https://github.com/MycroftAI/pcre2_meson.git 8 | branch = 10.23 9 | -------------------------------------------------------------------------------- /cross/ubuntu-armhf.txt: -------------------------------------------------------------------------------- 1 | [binaries] 2 | c = '/usr/bin/arm-linux-gnueabihf-gcc' 3 | cpp = '/usr/bin/arm-linux-gnueabihf-g++' 4 | ar = '/usr/arm-linux-gnueabihf/bin/ar' 5 | strip = '/usr/arm-linux-gnueabihf/bin/strip' 6 | pkgconfig = '/usr/bin/arm-linux-gnueabihf-pkg-config' 7 | 8 | [host_machine] 9 | system = 'linux' 10 | cpu_family = 'arm' 11 | cpu = 'armv7' 12 | endian = 'little' 13 | -------------------------------------------------------------------------------- /tools/example.ssml: -------------------------------------------------------------------------------- 1 | 2 | 3 | This is a pen. 4 | 5 | 8 | 9 | 10 | 11 | This is a pen too . 12 | 13 | 14 | This is a pen. 15 | 16 | You say tomato while I 17 | say tomato. 18 | 19 | -------------------------------------------------------------------------------- /cross/ubuntu-mingw64.txt: -------------------------------------------------------------------------------- 1 | [binaries] 2 | exe_wrapper = 'wine' # A command used to run generated executables. 3 | c = '/usr/bin/x86_64-w64-mingw32-gcc' 4 | cpp = '/usr/bin/x86_64-w64-mingw32-g++' 5 | ar = '/usr/bin/x86_64-w64-mingw32-ar' 6 | strip = '/usr/bin/x86_64-w64-mingw32-strip' 7 | pkgconfig = '/usr/bin/x86_64-w64-mingw32-pkg-config' 8 | 9 | [host_machine] 10 | system = 'windows' 11 | cpu_family = 'x86_64' 12 | cpu = 'x86_64' 13 | endian = 'little' 14 | 15 | -------------------------------------------------------------------------------- /tools/example.lex: -------------------------------------------------------------------------------- 1 | # 2 | # External Addenda lexicon 3 | # 4 | # #Comment 5 | # Blank lines are ignored 6 | # "headword" [pos] : phone phone phone phone ... 7 | # 8 | # phone *must* be in the phoneset for the lexicon, thus vowels must be 9 | # appended with 0 or 1 stress values (if you have them in your language) 10 | # head word should be quoted if it contains non-ascii or whitespace 11 | # 12 | sleekit j : s l iy1 k ih0 t 13 | trochled : t r ao1 k ax0 l d 14 | voldemort n : 15 | 16 | 17 | -------------------------------------------------------------------------------- /doc/stuff.ed: -------------------------------------------------------------------------------- 1 | 13 2 | d 3 | d 4 | a 5 |
by Alan W Black and Kevin A. Lenzo
6 |
Speech Group at Carnegie Mellon University
7 |
8 | Full distribution with sources and this document 9 | flite-2.0.0-release.tar.gz
10 | PDF version of this document alone 11 | mimic.pdf 12 |
13 | Updates and news on Flite will be posted on 14 | http://cmuflite.org 15 |

16 |

17 | NOTE: this document is incomplete 18 |

19 |
20 | . 21 | w 22 | q 23 | 24 | -------------------------------------------------------------------------------- /src/synth/us_phrasing_cart.h: -------------------------------------------------------------------------------- 1 | /*******************************************************/ 2 | /** Autogenerated cart tree for us_phrasing */ 3 | /** from . */ 4 | /*******************************************************/ 5 | 6 | DEF_STATIC_CONST_VAL_STRING(val_0000,"--"); 7 | DEF_STATIC_CONST_VAL_STRING(val_0001,"BB"); 8 | #define CTNODE_us_phrasing_NO_0000 2 9 | DEF_STATIC_CONST_VAL_STRING(val_0002,"0"); 10 | DEF_STATIC_CONST_VAL_STRING(val_0003,""); 11 | DEF_STATIC_CONST_VAL_STRING(val_0004,"1"); 12 | #define CTNODE_us_phrasing_NO_0004 6 13 | #define CTNODE_us_phrasing_NO_0006 8 14 | DEF_STATIC_CONST_VAL_STRING(val_0005,"NB"); 15 | #define CTNODE_us_phrasing_NO_0003 9 16 | #define CTNODE_us_phrasing_NO_0002 10 17 | #define CTNODE_us_phrasing_NO_0010 12 18 | #define CTNODE_us_phrasing_NO_0012 14 19 | -------------------------------------------------------------------------------- /unittests/include_public_headers_test_main.c: -------------------------------------------------------------------------------- 1 | #include "cst_alloc.h" 2 | #include "cst_args.h" 3 | #include "cst_audio.h" 4 | #include "cst_cart.h" 5 | #include "cst_cg.h" 6 | #include "cst_clunits.h" 7 | #include "cst_diphone.h" 8 | #include "cst_error.h" 9 | #include "cst_features.h" 10 | #include "cst_ffeatures.h" 11 | #include "cst_file.h" 12 | #include "cst_hrg.h" 13 | #include "cst_item.h" 14 | #include "cst_lexicon.h" 15 | #include "cst_lts.h" 16 | #include "cst_lts_rewrites.h" 17 | #include "cst_phoneset.h" 18 | #include "cst_plugins.h" 19 | #include "cst_regex.h" 20 | #include "cst_relation.h" 21 | #include "cst_sigpr.h" 22 | #include "cst_socket.h" 23 | #include "cst_ss.h" 24 | #include "cst_string.h" 25 | #include "cst_sts.h" 26 | #include "cst_synth.h" 27 | #include "cst_tokenstream.h" 28 | #include "cst_track.h" 29 | #include "cst_units.h" 30 | #include "cst_uregex.h" 31 | #include "cst_utterance.h" 32 | #include "cst_utt_utils.h" 33 | #include "cst_val_const.h" 34 | #include "cst_val_defs.h" 35 | #include "cst_val.h" 36 | #include "cst_viterbi.h" 37 | #include "cst_voice.h" 38 | #include "cst_wave.h" 39 | #include "cst_wchar.h" 40 | #include "flite_hts_engine.h" 41 | #include "mimic.h" 42 | 43 | int main() 44 | { 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | *.obj 6 | 7 | # Compiled Dynamic libraries 8 | *.so 9 | *.dylib 10 | *.dll 11 | 12 | # Compiled Static libraries 13 | *.lai 14 | *.la 15 | *.a 16 | *.lib 17 | 18 | # Executables 19 | *.exe 20 | *.out 21 | *.app 22 | 23 | # vim Swap File 24 | .*.swp 25 | 26 | # ctags file 27 | tags 28 | 29 | # gdb files 30 | .gdb_history 31 | 32 | # gcov files 33 | *.gcno 34 | *.gcda 35 | *.gcov 36 | 37 | # Configure Generated Files/Directories 38 | config.log 39 | config.status 40 | config/* 41 | configure 42 | aclocal.m4 43 | autom4te.cache 44 | Makefile.in 45 | m4/* 46 | include/mimic-core-config.h.in 47 | 48 | # Building Process Files/Directories 49 | *.deps 50 | *.dirstamp 51 | Makefile 52 | include/mimic-core-config.h 53 | include/stamp-h1 54 | 55 | # Test suite executables 56 | testsuite/play_client 57 | testsuite/play_server 58 | testsuite/play_sync 59 | testsuite/play_wave 60 | testsuite/record_wave 61 | testsuite/asciiS2U 62 | testsuite/asciiU2S 63 | testsuite/bin2ascii 64 | testsuite/combine_waves 65 | testsuite/compare_wave 66 | testsuite/lex_lookup 67 | testsuite/lpc_resynth 68 | testsuite/record_in_noise 69 | testsuite/rfc 70 | testsuite/by_word 71 | testsuite/multi_thread 72 | testsuite/lpc_test 73 | testsuite/lpc_test2 74 | testsuite/utt_test 75 | 76 | # unittests 77 | unittests/regex_test 78 | unittests/token_test 79 | unittests/hrg_test 80 | unittests/lex_test 81 | unittests/nums_test 82 | unittests/voice_select_test 83 | unittests/lts_test 84 | unittests/wave_test 85 | 86 | # temporary files for building cmulex 87 | _festsuite 88 | lang/cmulex/festival 89 | lang/cmulex/festlex_CMU.tar.gz 90 | 91 | subprojects/pcre2-10.23/ 92 | -------------------------------------------------------------------------------- /src/synth/us_phrasing_cart.c: -------------------------------------------------------------------------------- 1 | /*******************************************************/ 2 | /** Autogenerated cart trees for us_phrasing */ 3 | /*******************************************************/ 4 | 5 | #include "cst_synth.h" 6 | #include "cst_string.h" 7 | #include "cst_cart.h" 8 | #include "cst_regex.h" 9 | #include "us_phrasing_cart.h" 10 | 11 | static const cst_cart_node us_phrasing_cart_nodes[] = { 12 | { 0, CST_CART_OP_IS, CTNODE_us_phrasing_NO_0000, (cst_val *)&val_0000}, 13 | { 255, CST_CART_OP_NONE, 0, (cst_val *)&val_0001 }, 14 | { 1, CST_CART_OP_IS, CTNODE_us_phrasing_NO_0002, (cst_val *)&val_0002}, 15 | { 2, CST_CART_OP_IS, CTNODE_us_phrasing_NO_0003, (cst_val *)&val_0003}, 16 | { 3, CST_CART_OP_IS, CTNODE_us_phrasing_NO_0004, (cst_val *)&val_0004}, 17 | { 255, CST_CART_OP_NONE, 0, (cst_val *)&val_0001 }, 18 | { 4, CST_CART_OP_IS, CTNODE_us_phrasing_NO_0006, (cst_val *)&val_0004}, 19 | { 255, CST_CART_OP_NONE, 0, (cst_val *)&val_0001 }, 20 | { 255, CST_CART_OP_NONE, 0, (cst_val *)&val_0005 }, 21 | { 255, CST_CART_OP_NONE, 0, (cst_val *)&val_0001 }, 22 | { 5, CST_CART_OP_IS, CTNODE_us_phrasing_NO_0010, (cst_val *)&val_0002}, 23 | { 255, CST_CART_OP_NONE, 0, (cst_val *)&val_0001 }, 24 | { 4, CST_CART_OP_IS, CTNODE_us_phrasing_NO_0012, (cst_val *)&val_0004}, 25 | { 255, CST_CART_OP_NONE, 0, (cst_val *)&val_0001 }, 26 | { 255, CST_CART_OP_NONE, 0, (cst_val *)&val_0005 }, 27 | { 255, CST_CART_OP_NONE, 0, 0}}; 28 | 29 | 30 | 31 | static const char * const us_phrasing_feat_table[] = { 32 | "R:Token.parent.n.name", 33 | "R:Token.n.name", 34 | "R:Token.parent.punc", 35 | "R:Token.parent.break", 36 | "break", 37 | "n.name", 38 | NULL }; 39 | 40 | const cst_cart us_phrasing_cart = { 41 | us_phrasing_cart_nodes, 42 | us_phrasing_feat_table 43 | }; 44 | -------------------------------------------------------------------------------- /man/man1/mimic.1: -------------------------------------------------------------------------------- 1 | .TH mimic 1 "2016-08-07" "" "Mimic Text To Speech" 2 | .SH NAME 3 | mimic \- a text to speech tool 4 | .SH SYNOPSIS 5 | .B mimic 6 | [\fIoptions\fR] \fItext-file [\fIoutfile.wav] 7 | 8 | .B mimic 9 | \fB\-t \fB"Hello there"\fR [\fIwavefile] 10 | 11 | .SH DESCRIPTION 12 | Mimic is a command line tool for synthesizing speech from text. If \fIoutfile.wav\fR is omitted mimic will output the utterance using the computer sound card. 13 | .TP 14 | Mimic is based on flite (http://www.cmuflite.org) and strives to extend functionality and add more languages while keeping the application fast and light. 15 | .TP 16 | Mandatory arguments to long options are mandatory for short options too. 17 | 18 | .SH OPTIONS 19 | .TP 20 | \fB\-t "\fIText\fR" 21 | Create speech from \fIText\fR. 22 | .TP 23 | \fB\-f \fItextfile 24 | Set input file. 25 | .TP 26 | \fB\-o \fIwavefile 27 | Set output file. 28 | .TP 29 | \fB\-lv 30 | List included voices 31 | .TP 32 | \fB\-voice \fIvoice\fR 33 | Set mimic to speak with \fIvoice\fR, this can either be one of the included voices or a .flitevox-file. 34 | .TP 35 | \fB\-v 36 | Verbose mode, print extended output. 37 | .TP 38 | \fB\-l 39 | Loop output endlessly. 40 | .TP 41 | \fB\--help 42 | List usage. 43 | .TP 44 | \fB\-ssml 45 | Read input/file in ssml mode. 46 | .TP 47 | \fB\-pw 48 | Print words to stdout before they are spoken. 49 | .TP 50 | \fB\-ps 51 | Print phoneme segments to stdout before they are spoken. 52 | .TP 53 | \fB\-psdur 54 | Print segments and their end-time to stdout before they are spoken. 55 | .TP 56 | \fB\-pr \fIRelName\fR 57 | Get information for \fIRelName\fR from the utterance and print it to stdout. 58 | .TP 59 | \fB\-p "\fIPhonemes\fR" 60 | Create speech from the phoneme string \fIPhonemes\fR. 61 | .TP 62 | \fB\-seti \fIFeature=Int\fR 63 | Set voice \fIfeature\fR to integer value. 64 | .TP 65 | \fB\-setf \fIFeature=Float\fR 66 | Set voice \fIfeature\fR to float value. 67 | .TP 68 | \fB\-sets \fIFeature=String\fR 69 | Set voice \fIfeature\fR to string value. 70 | .TP 71 | \fB\-s\fR, \fB\-set \fIFeature=Int\fR 72 | Set voice \fIfeature\fR and try to guess the type from the input. 73 | .TP 74 | -------------------------------------------------------------------------------- /include/cst_uregex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sergio Oller 3 | 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above 11 | * copyright notice, this list of conditions and the following disclaimer 12 | * in the documentation and/or other materials provided with the 13 | * distribution. 14 | * * Neither the name of the nor the names of its 15 | * contributors may be used to endorse or promote products derived from 16 | * this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * 30 | */ 31 | #ifndef CST_UREGEX_H 32 | #define CST_UREGEX_H 33 | 34 | #include "mimic_core_config.h" 35 | #include "cst_lib_visibility.h" 36 | #include 37 | #include 38 | 39 | #define PCRE2_CODE_UNIT_WIDTH 8 40 | #include 41 | 42 | typedef pcre2_code cst_uregex; 43 | MIMIC_CORE_PUBLIC cst_string *cst_toupper_utf8(const cst_string *in); 44 | MIMIC_CORE_PUBLIC cst_string *cst_tolower_utf8(const cst_string *in); 45 | MIMIC_CORE_PUBLIC cst_uregex *new_cst_uregex(cst_string *pattern, uint32_t options); 46 | MIMIC_CORE_PUBLIC void delete_cst_uregex(cst_uregex *uregex); 47 | MIMIC_CORE_PUBLIC int cst_uregex_match(cst_uregex *uregex, const cst_string *str); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /include/cst_plugins.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cst_plugins.h 3 | * 4 | * Copyright 2017 Sergio Oller 5 | * All rights reserved. 6 | */ 7 | /* 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are 10 | * met: 11 | * 12 | * * Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above 15 | * copyright notice, this list of conditions and the following disclaimer 16 | * in the documentation and/or other materials provided with the 17 | * distribution. 18 | * * Neither the name of the nor the names of its 19 | * contributors may be used to endorse or promote products derived from 20 | * this software without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 26 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 28 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * 34 | */ 35 | /* A plugin system for mimic */ 36 | 37 | #ifndef include_cst_plugins_h 38 | #define include_cst_plugins_h 39 | #include "mimic_core_config.h" 40 | #ifdef MIMIC_ENABLE_PLUGINS 41 | typedef struct mimic_plugin_s 42 | { 43 | char *name; 44 | int version; 45 | void (*mimic_init)(void); 46 | void (*mimic_exit)(void); 47 | } mimic_plugin_t; 48 | 49 | typedef struct mimic_plugin_handler_s 50 | { 51 | void *handle; 52 | mimic_plugin_t* plugin; 53 | } mimic_plugin_handler_t; 54 | 55 | mimic_plugin_handler_t* mimic_plugin_load(const char *filename); 56 | int mimic_plugin_unload(mimic_plugin_handler_t *plugin); 57 | extern mimic_plugin_handler_t** mimic_plugins; 58 | 59 | #endif 60 | 61 | 62 | int mimic_plugins_init(); 63 | void mimic_plugins_exit(); 64 | 65 | #endif /*header */ 66 | -------------------------------------------------------------------------------- /src/cg/cst_spamf0.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 2011 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Authors: Gopala Anumanchipalli (gopalakr@cs.cmu.edu) */ 34 | /* Date: November 2011 */ 35 | /*************************************************************************/ 36 | 37 | #ifndef _CST_SPAMF0_H__ 38 | #define _CST_SPAMF0_H__ 39 | 40 | cst_utterance *cst_spamf0(cst_utterance *utt); 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/regex/regsub.c: -------------------------------------------------------------------------------- 1 | /* 2 | * regsub 3 | * 4 | * Copyright (c) 1986 by University of Toronto. 5 | * Written by Henry Spencer. Not derived from licensed software. 6 | * 7 | * Permission is granted to anyone to use this software for any 8 | * purpose on any computer system, and to redistribute it freely, 9 | * subject to the following restrictions: 10 | * 11 | * 1. The author is not responsible for the consequences of use of 12 | * this software, no matter how awful, even if they arise 13 | * from defects in it. 14 | * 15 | * 2. The origin of this software must not be misrepresented, either 16 | * by explicit claim or by omission. 17 | * 18 | * 3. Altered versions must be plainly marked as such, and must not 19 | * be misrepresented as being the original software. 20 | */ 21 | /* This is an altered version. It has been modified by David 22 | Huggins-Daines on 2001-10-23 to use a different 23 | API and be re-entrant and safe and all that good stuff. */ 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include "cst_regex.h" 29 | 30 | #define FAIL(m) { fprintf(stderr, "regexp failure: %s\n", m); exit(-1); } 31 | 32 | size_t cst_regsub(const cst_regstate *state, const char *in, char *out, 33 | size_t max) 34 | { 35 | const char *src; 36 | char *dst; 37 | int c, no, len; 38 | size_t count; 39 | 40 | if (state == NULL || in == NULL) 41 | { 42 | FAIL("NULL parm to regsub\n"); 43 | } 44 | 45 | src = in; 46 | dst = out; 47 | count = 0; 48 | while ((c = *src++) != '\0') 49 | { 50 | if (out && dst + 1 > out + max - 1) 51 | break; 52 | if (c == '&') 53 | no = 0; 54 | else if (c == '\\' && '0' <= *src && *src <= '9') 55 | no = *src++ - '0'; 56 | else 57 | no = -1; 58 | 59 | if (no < 0) 60 | { /* Ordinary character. */ 61 | if (c == '\\' && (*src == '\\' || *src == '&')) 62 | c = *src++; 63 | if (out) 64 | *dst++ = c; 65 | count++; 66 | } 67 | else if (state->startp[no] != NULL && state->endp[no] != NULL) 68 | { 69 | len = state->endp[no] - state->startp[no]; 70 | if (out) 71 | { 72 | if (dst + len > out + max - 1) 73 | len = (out + max - 1) - dst; 74 | strncpy(dst, state->startp[no], len); 75 | dst += len; 76 | /* strncpy hit NUL. */ 77 | if (len != 0 && *(dst - 1) == '\0') 78 | { 79 | FAIL("damaged match string"); 80 | } 81 | } 82 | count += len; 83 | } 84 | } 85 | if (out && ((size_t) (dst - out + 1)) < max) 86 | *dst++ = '\0'; 87 | 88 | return count; 89 | } 90 | -------------------------------------------------------------------------------- /tools/LANGNAME_lex.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 2013 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* LANGNAME Lexicon public functions */ 34 | /*************************************************************************/ 35 | 36 | #ifndef _cmu_LANGNAME_lex_h_ 37 | #define _cmu_LANGNAME_lex_h_ 38 | 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif /* __cplusplus */ 42 | 43 | #include "cst_lexicon.h" 44 | cst_lexicon *cmu_LANGNAME_lex_init(void); 45 | 46 | #ifdef __cplusplus 47 | } /* extern "C" */ 48 | #endif /* __cplusplus */ 49 | 50 | #endif 51 | 52 | -------------------------------------------------------------------------------- /tools/a2byte.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | ########################################################################### 3 | ## ## 4 | ## Carnegie Mellon University ## 5 | ## Copyright (c) 2005 ## 6 | ## All Rights Reserved. ## 7 | ## ## 8 | ## Permission is hereby granted, free of charge, to use and distribute ## 9 | ## this software and its documentation without restriction, including ## 10 | ## without limitation the rights to use, copy, modify, merge, publish, ## 11 | ## distribute, sublicense, and/or sell copies of this work, and to ## 12 | ## permit persons to whom this work is furnished to do so, subject to ## 13 | ## the following conditions: ## 14 | ## 1. The code must retain the above copyright notice, this list of ## 15 | ## conditions and the following disclaimer. ## 16 | ## 2. Any modifications must be clearly marked as such. ## 17 | ## 3. Original authors' names are not deleted. ## 18 | ## 4. The authors' names are not used to endorse or promote products ## 19 | ## derived from this software without specific prior written ## 20 | ## permission. ## 21 | ## ## 22 | ## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ## 23 | ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## 24 | ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## 25 | ## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ## 26 | ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## 27 | ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## 28 | ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## 29 | ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## 30 | ## THIS SOFTWARE. ## 31 | ## ## 32 | ########################################################################### 33 | ## ## 34 | ## Convert ascii to binary ## 35 | ## ## 36 | ########################################################################### 37 | 38 | use strict; 39 | $|=1; 40 | binmode(STDOUT); 41 | 42 | my $bintype; 43 | 44 | $bintype = 'C'; 45 | 46 | my $dub; 47 | my $buff; 48 | while (<>) { 49 | $buff = pack($bintype,$_); 50 | print "$buff"; 51 | } 52 | 53 | 54 | -------------------------------------------------------------------------------- /tools/a2int.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | ########################################################################### 3 | ## ## 4 | ## Carnegie Mellon University ## 5 | ## Copyright (c) 2005 ## 6 | ## All Rights Reserved. ## 7 | ## ## 8 | ## Permission is hereby granted, free of charge, to use and distribute ## 9 | ## this software and its documentation without restriction, including ## 10 | ## without limitation the rights to use, copy, modify, merge, publish, ## 11 | ## distribute, sublicense, and/or sell copies of this work, and to ## 12 | ## permit persons to whom this work is furnished to do so, subject to ## 13 | ## the following conditions: ## 14 | ## 1. The code must retain the above copyright notice, this list of ## 15 | ## conditions and the following disclaimer. ## 16 | ## 2. Any modifications must be clearly marked as such. ## 17 | ## 3. Original authors' names are not deleted. ## 18 | ## 4. The authors' names are not used to endorse or promote products ## 19 | ## derived from this software without specific prior written ## 20 | ## permission. ## 21 | ## ## 22 | ## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ## 23 | ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## 24 | ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## 25 | ## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ## 26 | ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## 27 | ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## 28 | ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## 29 | ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## 30 | ## THIS SOFTWARE. ## 31 | ## ## 32 | ########################################################################### 33 | ## ## 34 | ## Convert ascii to binary ## 35 | ## ## 36 | ########################################################################### 37 | 38 | use strict; 39 | $|=1; 40 | binmode(STDOUT); 41 | 42 | my $bintype; 43 | 44 | $bintype = 'I'; 45 | 46 | my $dub; 47 | my $buff; 48 | while (<>) { 49 | $buff = pack($bintype,$_); 50 | print "$buff"; 51 | } 52 | 53 | 54 | -------------------------------------------------------------------------------- /tools/a2short.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | ########################################################################### 3 | ## ## 4 | ## Carnegie Mellon University ## 5 | ## Copyright (c) 2005 ## 6 | ## All Rights Reserved. ## 7 | ## ## 8 | ## Permission is hereby granted, free of charge, to use and distribute ## 9 | ## this software and its documentation without restriction, including ## 10 | ## without limitation the rights to use, copy, modify, merge, publish, ## 11 | ## distribute, sublicense, and/or sell copies of this work, and to ## 12 | ## permit persons to whom this work is furnished to do so, subject to ## 13 | ## the following conditions: ## 14 | ## 1. The code must retain the above copyright notice, this list of ## 15 | ## conditions and the following disclaimer. ## 16 | ## 2. Any modifications must be clearly marked as such. ## 17 | ## 3. Original authors' names are not deleted. ## 18 | ## 4. The authors' names are not used to endorse or promote products ## 19 | ## derived from this software without specific prior written ## 20 | ## permission. ## 21 | ## ## 22 | ## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ## 23 | ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## 24 | ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## 25 | ## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ## 26 | ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## 27 | ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## 28 | ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## 29 | ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## 30 | ## THIS SOFTWARE. ## 31 | ## ## 32 | ########################################################################### 33 | ## ## 34 | ## Convert ascii to binary ## 35 | ## ## 36 | ########################################################################### 37 | 38 | use strict; 39 | $|=1; 40 | binmode(STDOUT); 41 | 42 | my $bintype; 43 | 44 | $bintype = 'S'; 45 | 46 | my $dub; 47 | my $buff; 48 | while (<>) { 49 | $buff = pack($bintype,$_); 50 | print "$buff"; 51 | } 52 | 53 | 54 | -------------------------------------------------------------------------------- /tools/Makefile.lex: -------------------------------------------------------------------------------- 1 | ########################################################################### 2 | ## ## 3 | ## Language Technologies Institute ## 4 | ## Carnegie Mellon University ## 5 | ## Copyright (c) 2013 ## 6 | ## All Rights Reserved. ## 7 | ## ## 8 | ## Permission is hereby granted, free of charge, to use and distribute ## 9 | ## this software and its documentation without restriction, including ## 10 | ## without limitation the rights to use, copy, modify, merge, publish, ## 11 | ## distribute, sublicense, and/or sell copies of this work, and to ## 12 | ## permit persons to whom this work is furnished to do so, subject to ## 13 | ## the following conditions: ## 14 | ## 1. The code must retain the above copyright notice, this list of ## 15 | ## conditions and the following disclaimer. ## 16 | ## 2. Any modifications must be clearly marked as such. ## 17 | ## 3. Original authors' names are not deleted. ## 18 | ## 4. The authors' names are not used to endorse or promote products ## 19 | ## derived from this software without specific prior written ## 20 | ## permission. ## 21 | ## ## 22 | ## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ## 23 | ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## 24 | ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## 25 | ## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ## 26 | ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## 27 | ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## 28 | ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## 29 | ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## 30 | ## THIS SOFTWARE. ## 31 | ## ## 32 | ########################################################################### 33 | ## ## 34 | ## LANGNAME lexicon and letter to sound rules ## 35 | ## ## 36 | ########################################################################### 37 | TOP=../.. 38 | DIRNAME=lang/cmu_LANGNAME_lex 39 | BUILD_DIRS = 40 | ALL_DIRS= 41 | H = cmu_LANGNAME_lex.h 42 | SRCS = cmu_LANGNAME_lex.c 43 | SCRIPTS = 44 | OBJS = $(SRCS:.c=.o) 45 | SCM= 46 | FILES = Makefile $(SCM) $(SRCS) $(H) $(SCRIPTS) 47 | LIBNAME = mimic_cmu_LANGNAME_lex 48 | LOCAL_INCLUDES = 49 | 50 | ALL = 51 | 52 | include $(TOP)/config/common_make_rules 53 | 54 | -------------------------------------------------------------------------------- /tools/Makefile.lang: -------------------------------------------------------------------------------- 1 | ########################################################################### 2 | ## ## 3 | ## Language Technologies Institute ## 4 | ## Carnegie Mellon University ## 5 | ## Copyright (c) 2013 ## 6 | ## All Rights Reserved. ## 7 | ## ## 8 | ## Permission is hereby granted, free of charge, to use and distribute ## 9 | ## this software and its documentation without restriction, including ## 10 | ## without limitation the rights to use, copy, modify, merge, publish, ## 11 | ## distribute, sublicense, and/or sell copies of this work, and to ## 12 | ## permit persons to whom this work is furnished to do so, subject to ## 13 | ## the following conditions: ## 14 | ## 1. The code must retain the above copyright notice, this list of ## 15 | ## conditions and the following disclaimer. ## 16 | ## 2. Any modifications must be clearly marked as such. ## 17 | ## 3. Original authors' names are not deleted. ## 18 | ## 4. The authors' names are not used to endorse or promote products ## 19 | ## derived from this software without specific prior written ## 20 | ## permission. ## 21 | ## ## 22 | ## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ## 23 | ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## 24 | ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## 25 | ## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ## 26 | ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## 27 | ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## 28 | ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## 29 | ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## 30 | ## THIS SOFTWARE. ## 31 | ## ## 32 | ########################################################################### 33 | ## ## 34 | ## LANGNAME general functions/models ## 35 | ## ## 36 | ########################################################################### 37 | TOP=../.. 38 | DIRNAME=lang/cmu_LANGNAME_lang 39 | BUILD_DIRS = 40 | ALL_DIRS= 41 | H = cmu_LANGNAME_lang.h 42 | SRCS = cmu_LANGNAME_lang.c cmu_LANGNAME_phoneset.c 43 | SCRIPTS = 44 | OBJS = $(SRCS:.c=.o) 45 | SCM= 46 | FILES = Makefile $(SCM) $(SRCS) $(H) $(SCRIPTS) 47 | LIBNAME = mimic_cmu_LANGNAME_lang 48 | LOCAL_INCLUDES = 49 | 50 | ALL = 51 | 52 | include $(TOP)/config/common_make_rules 53 | 54 | -------------------------------------------------------------------------------- /tools/LANGNAME_lang.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 2013 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* LANGNAME lang public functions */ 34 | /*************************************************************************/ 35 | 36 | #ifndef _cmu_LANGNAME_lang_h_ 37 | #define _cmu_LANGNAME_lang_h_ 38 | 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif /* __cplusplus */ 42 | 43 | #include "cst_utterance.h" 44 | #include "cst_cart.h" 45 | #include "cst_val.h" 46 | #include "cst_phoneset.h" 47 | #include "cst_lexicon.h" 48 | #include "cst_synth.h" 49 | 50 | void cmu_LANGNAME_lang_init(cst_voice *v); 51 | extern const cst_phoneset cmu_LANGNAME_phoneset; 52 | /* extern const cst_cart cmu_LANGNAME_phrasing_cart; */ 53 | 54 | #ifdef __cplusplus 55 | } /* extern "C" */ 56 | #endif /* __cplusplus */ 57 | 58 | #endif 59 | 60 | -------------------------------------------------------------------------------- /testsuite/asciiS2U_main.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 2001 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: August 2000 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* Converts ascii shorts to ascii mulaw */ 38 | /* */ 39 | /*************************************************************************/ 40 | #include 41 | #include "cst_wave.h" 42 | 43 | int main() 44 | { 45 | int s; 46 | 47 | while (scanf("%d\n", &s) != EOF) 48 | printf("%d\n", (int) cst_short_to_ulaw(s)); 49 | 50 | return 0; 51 | } 52 | -------------------------------------------------------------------------------- /include/cst_wchar.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 2008 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: June 2008 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* WCHAR functions */ 38 | /* */ 39 | /*************************************************************************/ 40 | #ifndef __CST_WCHAR_H__ 41 | #define __CST_WCHAR_H__ 42 | 43 | #include 44 | 45 | wchar_t *cst_cstr2wstr(const char *s); 46 | char *cst_wstr2cstr(const wchar_t *s); 47 | 48 | #define cst_wstrlen(X) wcslen(X) 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /include/cst_hrg.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 1999 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: December 1999 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* Heterogeneous Relation Graphs */ 38 | /* */ 39 | /*************************************************************************/ 40 | #ifndef _CST_HRG_H__ 41 | #define _CST_HRG_H__ 42 | 43 | #include "cst_file.h" 44 | #include "cst_val.h" 45 | #include "cst_features.h" 46 | #include "cst_item.h" 47 | #include "cst_relation.h" 48 | #include "cst_utterance.h" 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /testsuite/asciiU2S_main.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 2001 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: August 2000 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* Converts ascii mulaw to ascii shorts */ 38 | /* */ 39 | /*************************************************************************/ 40 | #include 41 | #include "cst_wave.h" 42 | 43 | int main() 44 | { 45 | int s; 46 | 47 | while (scanf("%d\n", &s) != EOF) 48 | printf("%d\n", (int) cst_ulaw_to_short((int) s)); 49 | 50 | return 0; 51 | } 52 | -------------------------------------------------------------------------------- /include/cst_args.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 2001 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: November 2001 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* parse args */ 38 | /* */ 39 | /*************************************************************************/ 40 | #ifndef CST_ARGS_H 41 | #define CST_ARGS_H 42 | 43 | #include "cst_lib_visibility.h" 44 | #include "cst_features.h" 45 | 46 | MIMIC_CORE_PUBLIC cst_val *cst_args(char **argv, int argc, 47 | const char *description, cst_features *args); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /include/cst_socket.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 2000 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: October 2000 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* General Socket code */ 38 | /* */ 39 | /*************************************************************************/ 40 | #ifndef _CST_SOCKET_H__ 41 | #define _CST_SOCKET_H__ 42 | 43 | int cst_socket_open(const char *host, int port); 44 | int cst_socket_close(int socket); 45 | 46 | int cst_socket_server(const char *name, int port, 47 | int (process_client) (int name, int fd)); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /tools/mimic_test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #####################################################-*-mode:shell-script-*- 3 | ## ## 4 | ## Language Technologies Institute ## 5 | ## Carnegie Mellon University ## 6 | ## Copyright (c) 2008 ## 7 | ## All Rights Reserved. ## 8 | ## ## 9 | ## Permission is hereby granted, free of charge, to use and distribute ## 10 | ## this software and its documentation without restriction, including ## 11 | ## without limitation the rights to use, copy, modify, merge, publish, ## 12 | ## distribute, sublicense, and/or sell copies of this work, and to ## 13 | ## permit persons to whom this work is furnished to do so, subject to ## 14 | ## the following conditions: ## 15 | ## 1. The code must retain the above copyright notice, this list of ## 16 | ## conditions and the following disclaimer. ## 17 | ## 2. Any modifications must be clearly marked as such. ## 18 | ## 3. Original authors' names are not deleted. ## 19 | ## 4. The authors' names are not used to endorse or promote products ## 20 | ## derived from this software without specific prior written ## 21 | ## permission. ## 22 | ## ## 23 | ## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ## 24 | ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## 25 | ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## 26 | ## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ## 27 | ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## 28 | ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## 29 | ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## 30 | ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## 31 | ## THIS SOFTWARE. ## 32 | ## ## 33 | ########################################################################### 34 | ## ## 35 | ## Generate a bunch of sentences with the given mimic binary ## 36 | ## ## 37 | ########################################################################### 38 | 39 | 40 | if [ $# = 0 ] 41 | then 42 | echo mimic_test MIMICBINARY TXT.DATA ODIR 43 | exit 44 | fi 45 | 46 | if [ $# = 3 ] 47 | then 48 | ODIR=$3 49 | if [ ! -d $ODIR ] 50 | then 51 | mkdir -p $ODIR 52 | fi 53 | else 54 | ODIR=./ 55 | fi 56 | 57 | cat $2 | 58 | sed 's/^[^(]*(//;s/[ ]*)[ ]*$//' | 59 | awk '{print $1; 60 | for (i=2; i 41 | #include 42 | #include 43 | #include "cst_file.h" 44 | #include "cst_error.h" 45 | jmp_buf *cst_errjmp = 0; 46 | 47 | int cst_errmsg(const char *fmt, ...) 48 | { 49 | va_list args; 50 | int rv; 51 | 52 | va_start(args, fmt); 53 | rv = vfprintf(stderr, fmt, args); 54 | va_end(args); 55 | 56 | return rv; 57 | } 58 | -------------------------------------------------------------------------------- /include/cst_endian.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 1999 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: August 2000 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* endianness */ 38 | /* */ 39 | /*************************************************************************/ 40 | 41 | #ifndef CST_ENDIAN_H 42 | #define CST_ENDIAN_H 43 | 44 | #include 45 | 46 | #ifndef UINTPTR_MAX 47 | #error "Cannot determine pointer size" 48 | #endif 49 | 50 | #if (UINTPTR_MAX == UINT32_MAX) 51 | #define MIMIC_CPU_BITS 32 52 | #elif (UINTPTR_MAX == UINT64_MAX) 53 | #define MIMIC_CPU_BITS 64 54 | #else 55 | #error "Unknown architecture size" 56 | #endif 57 | 58 | 59 | #endif /* Header guard */ 60 | 61 | -------------------------------------------------------------------------------- /include/cst_lts_rewrites.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 2002 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: August 2002 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* Letter to sound rewrite rules */ 38 | /* */ 39 | /*************************************************************************/ 40 | #ifndef _CST_LTS_REWRITES_H__ 41 | #define _CST_LTS_REWRITES_H__ 42 | 43 | #include "cst_val.h" 44 | 45 | typedef struct cst_lts_rewrites_struct { 46 | char *name; 47 | const cst_val *sets; 48 | const cst_val *rules; 49 | } cst_lts_rewrites; 50 | 51 | cst_val *lts_rewrites(const cst_val *itape, const cst_lts_rewrites *r); 52 | cst_val *lts_rewrites_word(const char *word, const cst_lts_rewrites *r); 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /include/cst_ss.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 2001 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: November 2001 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* sufficient statitsics */ 38 | /* */ 39 | /*************************************************************************/ 40 | #ifndef _CST_SS_H__ 41 | #define _CST_SS_H__ 42 | 43 | typedef struct cst_ss_struct { 44 | double num_samples; 45 | double sum; 46 | double sumx; 47 | } cst_ss; 48 | 49 | cst_ss *new_ss(); 50 | void delete_ss(cst_ss *ss); 51 | void ss_reset(cst_ss *ss); 52 | double ss_mean(cst_ss *ss); 53 | double ss_variance(cst_ss *ss); 54 | double ss_stddev(cst_ss *ss); 55 | void ss_cummulate(cst_ss *ss, double a); 56 | void ss_cummulate_n(cst_ss *ss, double a, double count); 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /tools/LANGNAME_lex.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 2013 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* */ 34 | /* LANGNAME Lexical function */ 35 | /* */ 36 | /*************************************************************************/ 37 | #include "mimic.h" 38 | #include "cst_val.h" 39 | #include "cst_voice.h" 40 | #include "cst_lexicon.h" 41 | #include "cst_ffeatures.h" 42 | #include "cmu_LANGNAME_lex.h" 43 | 44 | cst_val *cmu_LANGNAME_lex_lts_function(const struct lexicon_struct *l, 45 | const char *word, const char *pos) 46 | { 47 | return NULL; 48 | } 49 | 50 | cst_lexicon *cmu_LANGNAME_lex_init(void) 51 | { 52 | /* Should it be global const or dynamic */ 53 | /* Can make lts_rules just a cart tree like others */ 54 | cst_lexicon *l; 55 | 56 | l = cst_alloc(cst_lexicon,1); 57 | l->name = "cmu_LANGNAME_lex"; 58 | 59 | l->lts_function = cmu_LANGNAME_lex_lts_function; 60 | 61 | return l; 62 | 63 | } 64 | -------------------------------------------------------------------------------- /include/cst_error.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 1999 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: December 1999 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* Error handler */ 38 | /* */ 39 | /*************************************************************************/ 40 | #ifndef CST_ERROR_H 41 | #define CST_ERROR_H 42 | 43 | #include "cst_lib_visibility.h" 44 | #include 45 | 46 | #ifdef DIE_ON_ERROR 47 | #define cst_error() abort() 48 | #else /* not DIE_ON_ERROR */ 49 | #include 50 | extern jmp_buf *cst_errjmp; 51 | #define cst_error() (cst_errjmp ? longjmp(*cst_errjmp,1) : exit(-1)) 52 | #endif 53 | 54 | MIMIC_CORE_PUBLIC int cst_errmsg(const char *fmt, ...); 55 | #define cst_dbgmsg cst_errmsg 56 | 57 | /* Need macros to help set catches */ 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /unittests/token_test_main.c: -------------------------------------------------------------------------------- 1 | #include "cutest.h" 2 | #include 3 | #include 4 | #include 5 | #include "cst_tokenstream.h" 6 | #include "cst_lexicon.h" 7 | 8 | #ifndef TEST_FILE 9 | #define TEST_FILE "data.one" 10 | #endif 11 | 12 | #ifndef TEST_FILE_UTF8 13 | #define TEST_FILE_UTF8 "data_utf8.txt" 14 | #endif 15 | 16 | 17 | void test_token(void) 18 | { 19 | cst_tokenstream *fd; 20 | const char *token; 21 | 22 | fd = ts_open(TEST_FILE, " \r\n\t", NULL, "\"!", NULL, 0); 23 | TEST_CHECK(fd != NULL); 24 | 25 | token = ts_get(fd); 26 | TEST_CHECK(strcmp(token, "Hello") == 0); 27 | token = ts_get(fd); 28 | TEST_CHECK(strcmp(token, "world") == 0); 29 | token = ts_get(fd); 30 | TEST_CHECK(strcmp(token, "Yahoo") == 0); 31 | token = ts_get(fd); 32 | TEST_CHECK(strcmp(token, "who") == 0); 33 | token = ts_get(fd); 34 | TEST_CHECK(strcmp(token, "(") == 0); 35 | token = ts_get(fd); 36 | TEST_CHECK(strcmp(token, "s") == 0); 37 | token = ts_get(fd); 38 | TEST_CHECK(strcmp(token, ")") == 0); 39 | token = ts_get(fd); 40 | TEST_CHECK(strcmp(token, "A") == 0); 41 | token = ts_get(fd); 42 | TEST_CHECK(strcmp(token, "small") == 0); 43 | token = ts_get(fd); 44 | TEST_CHECK(strcmp(token, "test") == 0); 45 | token = ts_get(fd); 46 | TEST_CHECK(strcmp(token, "") == 0); 47 | TEST_CHECK(ts_eof(fd)); 48 | ts_close(fd); 49 | } 50 | 51 | void test_token_utf8(void) 52 | { 53 | cst_tokenstream *fd; 54 | const char *token; 55 | const char *singl = "€(){}[]"; /* EURO SIGN + defaults */ 56 | const char *prepunc = "¿¡\"!"; /* INVERTED QUESTION MARK, INV. EXCL. MARK, ", ! */ 57 | const char *postpunc = "\"'`.,:;!?(){}[]"; 58 | int emoji_as_singlecharsymbols = 1; 59 | fd = ts_open(TEST_FILE_UTF8, " \r\n\t", singl, prepunc, postpunc, emoji_as_singlecharsymbols); 60 | TEST_CHECK(fd != NULL); 61 | 62 | token = ts_get(fd); 63 | TEST_CHECK(strcmp(token, "Hello") == 0); 64 | token = ts_get(fd); 65 | TEST_CHECK(strcmp(token, "world") == 0); 66 | TEST_CHECK(strcmp(fd->postpunctuation, ".") == 0); 67 | token = ts_get(fd); 68 | TEST_CHECK(strcmp(token, "😊") == 0); 69 | token = ts_get(fd); 70 | TEST_CHECK(strcmp(token, "Yahoo") == 0); 71 | TEST_CHECK(strcmp(fd->postpunctuation, "!\"") == 0); 72 | token = ts_get(fd); 73 | TEST_CHECK(strcmp(token, "who") == 0); 74 | token = ts_get(fd); 75 | TEST_CHECK(strcmp(token, "(") == 0); 76 | token = ts_get(fd); 77 | TEST_CHECK(strcmp(token, "s") == 0); 78 | token = ts_get(fd); 79 | TEST_CHECK(strcmp(token, ")") == 0); 80 | token = ts_get(fd); 81 | TEST_CHECK(strcmp(token, "Good") == 0); 82 | TEST_CHECK(strcmp(fd->prepunctuation, "¡") == 0); 83 | token = ts_get(fd); 84 | TEST_CHECK(strcmp(token, "News") == 0); 85 | TEST_CHECK(strcmp(fd->postpunctuation, "!") == 0); 86 | token = ts_get(fd); 87 | TEST_CHECK(strcmp(token, "Åke") == 0); 88 | token = ts_get(fd); 89 | TEST_CHECK(strcmp(token, "€") == 0); 90 | token = ts_get(fd); 91 | TEST_CHECK(strcmp(token, "Über") == 0); 92 | token = ts_get(fd); 93 | TEST_CHECK(strcmp(token, "漢字") == 0); 94 | token = ts_get(fd); 95 | TEST_CHECK(strcmp(token, "") == 0); 96 | TEST_CHECK(ts_eof(fd)); 97 | ts_close(fd); 98 | } 99 | 100 | TEST_LIST = 101 | { 102 | { 103 | "tokens", test_token}, 104 | { 105 | "tokens_utf8", test_token_utf8}, 106 | { 107 | 0} 108 | }; 109 | -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 1 | ########################################################################### 2 | ## ## 3 | ## Language Technologies Institute ## 4 | ## Carnegie Mellon University ## 5 | ## Copyright (c) 1999 ## 6 | ## All Rights Reserved. ## 7 | ## ## 8 | ## Permission is hereby granted, free of charge, to use and distribute ## 9 | ## this software and its documentation without restriction, including ## 10 | ## without limitation the rights to use, copy, modify, merge, publish, ## 11 | ## distribute, sublicense, and/or sell copies of this work, and to ## 12 | ## permit persons to whom this work is furnished to do so, subject to ## 13 | ## the following conditions: ## 14 | ## 1. The code must retain the above copyright notice, this list of ## 15 | ## conditions and the following disclaimer. ## 16 | ## 2. Any modifications must be clearly marked as such. ## 17 | ## 3. Original authors' names are not deleted. ## 18 | ## 4. The authors' names are not used to endorse or promote products ## 19 | ## derived from this software without specific prior written ## 20 | ## permission. ## 21 | ## ## 22 | ## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ## 23 | ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## 24 | ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## 25 | ## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ## 26 | ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## 27 | ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## 28 | ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## 29 | ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## 30 | ## THIS SOFTWARE. ## 31 | ## ## 32 | ########################################################################### 33 | ## ## 34 | ## Documenation ## 35 | ## ## 36 | ########################################################################### 37 | TOP=.. 38 | DIRNAME=doc 39 | BUILD_DIRS = 40 | ALL_DIRS= 41 | FILES = Makefile mimic.texi intro.txt alice stuff.ed 42 | 43 | ALL = 44 | 45 | include $(TOP)/config/common_make_rules 46 | 47 | doc: mimic.html mimic.pdf 48 | cp -p mimic.pdf html 49 | 50 | mimic.html: mimic.texi 51 | @ if [ ! -d html ] ; \ 52 | then mkdir -p html ; fi 53 | (cd html; texi2html -number -split_chapter ../mimic.texi) 54 | @ if [ -d html/mimic ] ; \ 55 | then mv html/mimic/*.html html ; \ 56 | rmdir html/mimic; fi 57 | @ for i in html/*.html ; \ 58 | do \ 59 | sed 's///' $$i >ttt.html; \ 60 | mv ttt.html $$i ; \ 61 | done 62 | @ cat stuff.ed | ed html/mimic_toc.html 63 | @ (cd html; rm -f index.html; ln mimic_toc.html index.html) 64 | 65 | mimic.pdf: mimic.texi 66 | @ texi2pdf mimic.texi 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /src/synth/cst_utt_utils.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 2000 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: September 2000 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* Various basic utt utilities */ 38 | /* */ 39 | /*************************************************************************/ 40 | 41 | #include "cst_synth.h" 42 | #include "cst_utt_utils.h" 43 | 44 | cst_wave *utt_wave(cst_utterance *u) 45 | { 46 | if (u) 47 | return val_wave(feat_val(u->features, "wave")); 48 | else 49 | return 0; 50 | } 51 | 52 | int utt_set_wave(cst_utterance *u, cst_wave *w) 53 | { 54 | feat_set(u->features, "wave", wave_val(w)); 55 | return 0; 56 | } 57 | 58 | const char *utt_input_text(cst_utterance *u) 59 | { 60 | return val_string(feat_val(u->features, "input_text")); 61 | } 62 | 63 | int utt_set_input_text(cst_utterance *u, const char *text) 64 | { 65 | feat_set_string(u->features, "input_text", text); 66 | return 0; 67 | } 68 | -------------------------------------------------------------------------------- /src/synth/cst_voice.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 1999 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: December 2000 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* Voice definition */ 38 | /* */ 39 | /*************************************************************************/ 40 | #include "cst_alloc.h" 41 | #include "cst_voice.h" 42 | #include "mimic.h" 43 | 44 | CST_VAL_REGISTER_TYPE(voice, cst_voice); 45 | cst_voice *new_voice() 46 | { 47 | cst_voice *v = cst_alloc(struct cst_voice_struct, 1); 48 | 49 | v->features = new_features(); 50 | v->ffunctions = new_features(); 51 | 52 | return v; 53 | } 54 | 55 | void delete_voice(cst_voice *v) 56 | { 57 | if (v) 58 | { 59 | if (feat_present(v->features, "voxdata")) 60 | { 61 | if (feat_present(v->features, "clunit_db")) 62 | mimic_munmap_clunit_voxdata(v); 63 | } 64 | 65 | delete_features(v->features); 66 | delete_features(v->ffunctions); 67 | cst_free(v); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/utils/cst_endian.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 2000 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: August 2000 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* Some code for byte order support */ 38 | /* */ 39 | /*************************************************************************/ 40 | #include 41 | #include 42 | #include "cst_alloc.h" 43 | #include "cst_endian_internal.h" 44 | 45 | const int32_t cst_endian_loc = 1; 46 | 47 | void swap_bytes_short(int16_t *b, size_t n) 48 | { 49 | size_t i; 50 | 51 | for (i = 0; i < n; i++) 52 | b[i] = SWAPINT16(b[i]); 53 | } 54 | 55 | void swapdouble(double *dbl) 56 | { 57 | /* cast to int, as access as flt may cause FPE on some machines */ 58 | int32_t t; 59 | int32_t *dd = (int32_t *) dbl; 60 | t = SWAPINT32(dd[0]); 61 | dd[0] = SWAPINT32(dd[1]); 62 | dd[1] = t; 63 | } 64 | 65 | void swapfloat(float *flt) 66 | { 67 | /* cast to int, as access as flt may cause FPE on some machines */ 68 | int32_t *ff = (int32_t *) flt; 69 | ff[0] = SWAPINT32(ff[0]); 70 | } 71 | -------------------------------------------------------------------------------- /src/utils/cst_wchar.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 2008 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: June 2008 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* wchar_t functions */ 38 | /* */ 39 | /*************************************************************************/ 40 | #include "cst_wchar.h" 41 | #include "cst_alloc.h" 42 | #include "cst_string.h" 43 | 44 | wchar_t *cst_cstr2wstr(const char *s) 45 | { 46 | /* Actually this is naive and is really only for ASCII wchar_ts */ 47 | int i, l; 48 | wchar_t *w; 49 | 50 | l = cst_strlen(s); 51 | w = cst_alloc(wchar_t, l + 1); 52 | 53 | for (i = 0; i < l; i++) 54 | { 55 | w[i] = (wchar_t) s[i]; 56 | } 57 | w[i] = (wchar_t) '\0'; 58 | 59 | return w; 60 | } 61 | 62 | char *cst_wstr2cstr(const wchar_t *w) 63 | { 64 | int i, l; 65 | char *s; 66 | 67 | l = cst_wstrlen(w); 68 | s = cst_alloc(char, l + 1); 69 | 70 | for (i = 0; i < l; i++) 71 | { 72 | s[i] = (char) w[i]; 73 | } 74 | s[i] = (wchar_t) '\0'; 75 | 76 | return s; 77 | } 78 | -------------------------------------------------------------------------------- /tools/find_cmimax: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #####################################################-*-mode:shell-script-*- 3 | ## ## 4 | ## Language Technologies Institute ## 5 | ## Alan W Black and Kevin A. Lenzo ## 6 | ## Copyright (c) 2000 ## 7 | ## All Rights Reserved. ## 8 | ## ## 9 | ## Permission is hereby granted, free of charge, to use and distribute ## 10 | ## this software and its documentation without restriction, including ## 11 | ## without limitation the rights to use, copy, modify, merge, publish, ## 12 | ## distribute, sublicense, and/or sell copies of this work, and to ## 13 | ## permit persons to whom this work is furnished to do so, subject to ## 14 | ## the following conditions: ## 15 | ## 1. The code must retain the above copyright notice, this list of ## 16 | ## conditions and the following disclaimer. ## 17 | ## 2. Any modifications must be clearly marked as such. ## 18 | ## 3. Original authors' names are not deleted. ## 19 | ## 4. The authors' names are not used to endorse or promote products ## 20 | ## derived from this software without specific prior written ## 21 | ## permission. ## 22 | ## ## 23 | ## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ## 24 | ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## 25 | ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## 26 | ## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ## 27 | ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## 28 | ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## 29 | ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## 30 | ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## 31 | ## THIS SOFTWARE. ## 32 | ## ## 33 | ########################################################################### 34 | ## ## 35 | ## Setup the current directory for building a MIMIC voice from a ## 36 | ## a festvox voice ## 37 | ## ## 38 | ########################################################################### 39 | 40 | if [ ! "$ESTDIR" ] 41 | then 42 | echo "environment variable ESTDIR is unset" 43 | echo "set it to your local speech tools directory e.g." 44 | echo ' bash$ export ESTDIR=/home/awb/projects/speech_tools/' 45 | echo or 46 | echo ' csh% setenv ESTDIR /home/awb/projects/speech_tools/' 47 | exit 1 48 | fi 49 | 50 | if [ ! "$MIMICDIR" ] 51 | then 52 | echo "environment variable MIMICDIR is unset" 53 | echo "set it to your local festvox directory e.g." 54 | echo ' bash$ export MIMICDIR=/home/awb/projects/mimic/' 55 | echo or 56 | echo ' csh% setenv MIMICDIR /home/awb/projects/mimic/' 57 | exit 1 58 | fi 59 | 60 | for i in $* 61 | do 62 | ch_track -otype ascii $i 63 | done | 64 | awk 'BEGIN {min=0; max=0;} 65 | { for (i=2; i<=NF; i++) 66 | { 67 | if ($i < min) min = $i; 68 | if ($i > max) max = $i; 69 | } 70 | } 71 | END {printf("min %f max %f\n",min,max);}' 72 | -------------------------------------------------------------------------------- /testsuite/play_wave_main.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 2000 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: August 2000 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* Read and play a waveform */ 38 | /* */ 39 | /*************************************************************************/ 40 | #include 41 | #include "cst_wave.h" 42 | #include "cst_audio.h" 43 | 44 | int main(int argc, char **argv) 45 | { 46 | /* need that cool argument parser */ 47 | cst_wave *w; 48 | int i; 49 | 50 | if (argc == 1) 51 | { 52 | fprintf(stderr, "usage: mimic_play_wave WAVEFILE\n"); 53 | return 1; 54 | } 55 | 56 | for (i = 1; i < argc; i++) 57 | { 58 | w = new_wave(); 59 | if (cst_wave_load_riff(w, argv[i]) != CST_OK_FORMAT) 60 | { 61 | fprintf(stderr, 62 | "mimic_play_wave: can't read file or wrong format \"%s\"\n", 63 | argv[i]); 64 | continue; 65 | } 66 | mimic_play_wave(w); 67 | delete_wave(w); 68 | } 69 | 70 | return 0; 71 | } 72 | -------------------------------------------------------------------------------- /ACKNOWLEDGEMENTS: -------------------------------------------------------------------------------- 1 | Mimic is currently being developed and maintained by Mycroft AI, Inc. 2 | Mycroft AI is the company behind the Mycroft artificial intelligence 3 | and voice assistant platform, more info here: https://mycroft.ai 4 | 5 | The initial development of Mimic was primarily done by awb through 6 | the Flite project while he was traveling, perhaps the name is 7 | doubly appropriate as a substantial amount of the coding was 8 | done over 30,000ft). During most of that time awb was funded 9 | by the Language Technologies Institute at Carnegie Mellon University. 10 | 11 | Kevin A. Lenzo was involved in the design, conversion techniques and 12 | representations for the voice distributed with Flite (as well as being 13 | the actual kal voice itself). 14 | 15 | Other contributions are: 16 | 17 | Henry Spencer 18 | For the regex code 19 | University of Edinburgh 20 | for releasing Festival for free, making a companion runtime synthesizer 21 | a practical project, much of the design of flite relies on the 22 | architecture decisions made in the Festival Speech Synthesis Systems and 23 | the Edinburgh Speech Tools. 24 | The duration cart tree and intonation (accent and F0) models were 25 | derived from the models in the Festival distribution. which in turn 26 | were trained from the Boston University FM Radio Data Corpus. 27 | Carnegie Mellon University 28 | The included lexicon is derived from CMULEX and the letter to sound 29 | rules are constructed using the Lenzo and Black techniques for 30 | building LTS decision graphs. 31 | Nagoya Institute of Technology 32 | The mlsa code derives from HTS (following a long chain) 33 | Tomoki Toda 34 | The mlsa and mlpg support came view Tomoki's support for voice convertion 35 | in FestVox which in turn (some of which) comes from NITECH's HTS. 36 | Marcela Charfuelan (DFKI) 37 | For the mixed-excitation techniques. These originally came from NITECH 38 | but we understood the technqiues from Marcela's Open Mary Java code and 39 | implemented them in our optimized version of MLSA. 40 | David Huggins-Daines (dhd@cepstral.com) 41 | much of the clunits code, porting to multiple platforms, substantial 42 | code tidy up and configure/autoconf guidance. 43 | Cepstral, LLC (http://cepstral.com) 44 | For supporting DHD to spend time (in 2001) on flite and passing 45 | back the important early fixes and enhancements including SAPI 46 | support (funded by Portuguese FCT to produce an open source 47 | synthesis solution). 48 | Willie Walker and the rest of the Sun Speech Group 49 | lots of low level bugs (and fixes). 50 | Portuguese Foundation for Science and Technology (FCT) Praxis XXI program 51 | The SAPI interface provided by Cepstral, LLC was partially funded by 52 | the above program. 53 | Craig Reese: IDA/Supercomputing Research Center 54 | Joe Campbell: Department of Defense 55 | who wrote the ulaw conversion routines in src/speech/cst_wave_utils.c 56 | Mario Lang: 57 | causing the support of shared libraries to happen 58 | Eric House (fixin@peak.org) 59 | who provided examples of how to do 68K Call Backs for system functions 60 | Greg Parker gparker@sealiesoftware.com 61 | peal, the binding glue and shared library foo for getting the arm 62 | version doing something reasonable under PalmOS 63 | Lukas Loehrer Feb 2006 64 | alsa support (default if available) 65 | Udhyakumar N 66 | For making the mixed excitation code work, and show its value 67 | Brian Langner 68 | redid the Visual Studio support 69 | Alok Parlikar 70 | Android support, and cg voice dumping (and loading), indic support 71 | Gopala Anumanchipalli 72 | spamf0 support, unitran integration 73 | Richard Sproat and Kyoung-young Kim (UIUC) 74 | Unitran: unicode to sampa grapheme mapping tables 75 | Sun Microsystems 76 | g72x code 77 | Peter Drysdale: Hand optimized mlsa routine 78 | -------------------------------------------------------------------------------- /unittests/wave_test_main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "cst_wave.h" 6 | #include "mimic.h" 7 | 8 | #include "cutest.h" 9 | 10 | 11 | #ifndef A_WAV1 12 | #define A_WAV1 "hello_world.wav" 13 | #endif 14 | 15 | #ifndef A_WAV2 16 | #define A_WAV2 "hi_again.wav" 17 | #endif 18 | 19 | void test_copy(void) 20 | { 21 | cst_wave *w1 = new_wave(); 22 | cst_wave *w2; 23 | mimic_core_init(); 24 | TEST_CHECK(cst_wave_load_riff(w1, A_WAV1) == 0); 25 | w2 = copy_wave(w1); 26 | TEST_CHECK(w1 != w2); 27 | TEST_CHECK(w1->num_samples == w2->num_samples); 28 | TEST_CHECK(w1->sample_rate == w2->sample_rate); 29 | TEST_CHECK(w1->num_channels == w2->num_channels); 30 | TEST_CHECK(w1->samples != w2->samples); 31 | TEST_CHECK(w1->samples[0] == w2->samples[0]); 32 | TEST_CHECK(w1->samples[10] == w2->samples[10]); 33 | TEST_CHECK(w1->samples[20] == w2->samples[20]); 34 | delete_wave(w1); 35 | delete_wave(w2); 36 | mimic_core_exit(); 37 | } 38 | 39 | void test_concat(void) 40 | { 41 | int original_len; 42 | cst_wave *w1 = new_wave(); 43 | cst_wave *w2 = new_wave(); 44 | mimic_core_init(); 45 | TEST_CHECK(cst_wave_load_riff(w1, A_WAV1) == 0); 46 | TEST_CHECK(cst_wave_load_riff(w2, A_WAV2) == 0); 47 | original_len = w1->num_samples; 48 | concat_wave(w1, w2); 49 | TEST_CHECK(w1->num_samples == w2->num_samples + original_len); 50 | delete_wave(w1); 51 | delete_wave(w2); 52 | 53 | w1 = new_wave(); 54 | w2 = new_wave(); 55 | TEST_CHECK(cst_wave_load_riff(w1, A_WAV1) == 0); 56 | TEST_CHECK(cst_wave_load_riff(w2, A_WAV2) == 0); 57 | 58 | w2->sample_rate *= 2; // create sample rate mismatch 59 | fprintf(stderr, "\nExpect error message below:\n"); 60 | fflush(stderr); 61 | concat_wave(w1, w2); 62 | fprintf(stderr, "Expect error message above:\n"); 63 | fflush(stderr); 64 | TEST_CHECK(w1->num_samples != w2->num_samples + original_len); 65 | delete_wave(w1); 66 | delete_wave(w2); 67 | 68 | w1 = new_wave(); 69 | w2 = new_wave(); 70 | 71 | TEST_CHECK(cst_wave_load_riff(w1, A_WAV1) == 0); 72 | TEST_CHECK(cst_wave_load_riff(w2, A_WAV2) == 0); 73 | 74 | w2->num_channels *= 2; // create channel number mismatch 75 | fprintf(stderr, "Expect error message below:\n"); 76 | fflush(stderr); 77 | concat_wave(w1, w2); 78 | fprintf(stderr, "Expect error message above:\n"); 79 | fflush(stderr); 80 | TEST_CHECK(w1->num_samples != w2->num_samples + original_len); 81 | delete_wave(w1); 82 | delete_wave(w2); 83 | } 84 | 85 | void test_create(void) 86 | { 87 | cst_wave *w = NULL; 88 | w = new_wave(); 89 | TEST_CHECK(w != NULL); 90 | TEST_CHECK(w->num_samples == 0); 91 | TEST_CHECK(w->type == NULL); 92 | delete_wave(w); 93 | } 94 | 95 | void test_delete(void) 96 | { 97 | delete_wave(NULL); 98 | } 99 | 100 | void test_resize(void) 101 | { 102 | cst_wave *w = new_wave(); 103 | cst_wave_resize(w, 200, 2); 104 | TEST_CHECK(w->num_samples == 200); 105 | TEST_CHECK(w->num_channels = 2); 106 | TEST_CHECK(cst_wave_resize(NULL, 200, 2) < 0); 107 | delete_wave(w); 108 | } 109 | 110 | void test_rescale(void) 111 | { 112 | int i; 113 | cst_wave *w = new_wave(); 114 | cst_wave_resize(w, 10, 2); 115 | for (i = 0; i < 10; i++) 116 | w->samples[i] = 10 + i; 117 | cst_wave_rescale(w, 65536 * 2); //scale x2 118 | for (i = 0; i < 10; i++) 119 | TEST_CHECK(w->samples[i] == (10 + i) * 2); 120 | delete_wave(w); 121 | } 122 | 123 | TEST_LIST = 124 | { 125 | {"create wave", test_create}, 126 | {"delete wave", test_delete}, 127 | {"resize wave", test_resize}, 128 | {"rescale wave", test_rescale}, 129 | {"copy wave", test_copy}, 130 | {"concatenate waves", test_concat}, 131 | {0} 132 | }; 133 | -------------------------------------------------------------------------------- /include/cst_units.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 2001 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: January 2001 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* Unit databases */ 38 | /* */ 39 | /*************************************************************************/ 40 | #ifndef _CST_UNITS_H__ 41 | #define _CST_UNITS_H__ 42 | 43 | #include "cst_file.h" 44 | #include "cst_hrg.h" 45 | #include "cst_sts.h" 46 | 47 | cst_utterance *join_units(cst_utterance *utt); 48 | 49 | cst_utterance *join_units_windowed(cst_utterance *utt); 50 | cst_utterance *join_units_simple(cst_utterance *utt); 51 | cst_utterance *join_units_modified_lpc(cst_utterance *utt); 52 | 53 | cst_utterance *asis_to_pm(cst_utterance *utt); 54 | cst_utterance *f0_targets_to_pm(cst_utterance *utt); 55 | cst_utterance *concat_units(cst_utterance *utt); 56 | 57 | void add_residual(int targ_size, unsigned char *targ_residual, 58 | int unit_size, const unsigned char *unit_residual); 59 | void add_residual_pulse(int targ_size, unsigned char *targ_residual, 60 | int unit_size, const unsigned char *unit_residual); 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /src/audio/au_command.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 2001 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: January 2001 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* Use some external program to play stuff */ 38 | /* */ 39 | /*************************************************************************/ 40 | #include "cst_audio.h" 41 | 42 | int audio_init_command() 43 | { 44 | return 0; 45 | } 46 | 47 | int audio_exit_command() 48 | { 49 | return 0; 50 | } 51 | 52 | cst_audiodev *audio_open_command(int sps, int channels, int fmt) 53 | { 54 | cst_audiodev *ad; 55 | 56 | ad = cst_alloc(cst_audiodev, 1); 57 | ad->sps = sps; 58 | ad->channels = channels; 59 | ad->fmt = fmt; 60 | return NULL; 61 | } 62 | 63 | int audio_close_command(cst_audiodev *ad) 64 | { 65 | if (ad) 66 | cst_free(ad); 67 | return 0; 68 | } 69 | 70 | int audio_write_command(cst_audiodev *ad, void *samples, int num_bytes) 71 | { 72 | (void) ad; 73 | (void) samples; 74 | return num_bytes; 75 | } 76 | 77 | int audio_drain_command(cst_audiodev *ad) 78 | { 79 | (void) ad; 80 | return 0; 81 | } 82 | 83 | int audio_flush_command(cst_audiodev *ad) 84 | { 85 | (void) ad; 86 | return 0; 87 | } 88 | -------------------------------------------------------------------------------- /include/cst_utt_utils.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 1999 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: September 2000 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* Various utterance access/setting functions */ 38 | /* */ 39 | /*************************************************************************/ 40 | #ifndef _UTT_UTILS_H__ 41 | #define _UTT_UTILS_H__ 42 | 43 | #include "cst_hrg.h" 44 | #include "cst_wave.h" 45 | 46 | int utt_set_wave(cst_utterance *u, cst_wave *w); 47 | cst_wave *utt_wave(cst_utterance *u); 48 | 49 | const char *utt_input_text(cst_utterance *u); 50 | int utt_set_input_text(cst_utterance *u, const char *text); 51 | 52 | #define utt_feat_string(U,F) (feat_string((U)->features,F)) 53 | #define utt_feat_int(U,F) (feat_int((U)->features,F)) 54 | #define utt_feat_float(U,F) (feat_float((U)->features,F)) 55 | #define utt_feat_val(U,F) (feat_val((U)->features,F)) 56 | 57 | #define utt_set_feat_string(U,F,V) (feat_set_string((U)->features,F,V)) 58 | #define utt_set_feat_int(U,F,V) (feat_set_int((U)->features,F,V)) 59 | #define utt_set_feat_float(U,F,V) (feat_set_float((U)->features,F,V)) 60 | #define utt_set_feat(U,F,V) (feat_set((U)->features,F,V)) 61 | 62 | #define utt_rel_head(U,R) (relation_head(utt_relation((U),R))) 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | sudo: false 3 | 4 | matrix: 5 | include: 6 | - env: TASK="osx" 7 | os: osx 8 | compiler: clang 9 | before_install: rvm get stable 10 | install: 11 | - brew update 12 | - brew install python3 ninja pkg-config pcre2 portaudio; echo "done" 13 | - pip3 install meson 14 | - env: TASK="linux" 15 | os: linux 16 | dist: "trusty" 17 | install: 18 | - export PATH="`pwd`/build:${PATH}" 19 | - wget https://github.com/ninja-build/ninja/releases/download/v1.7.2/ninja-linux.zip && unzip -q ninja-linux.zip -d build 20 | - pip3 install --user meson 21 | addons: {apt: {packages: [libasound2-dev, python3-pip, pkg-config]}} 22 | - env: TASK="coverage" 23 | os: linux 24 | dist: "trusty" 25 | install: 26 | - export PATH="`pwd`/build:${PATH}" 27 | - wget https://github.com/ninja-build/ninja/releases/download/v1.7.2/ninja-linux.zip && unzip -q ninja-linux.zip -d build 28 | - pip3 install --user meson 29 | script: 30 | - meson build --prefix="$PWD/install" -D b_coverage=true 31 | - ninja -C build test 32 | after_success: 33 | - bash <(curl -s https://codecov.io/bash) 34 | addons: {apt: {packages: [libasound2-dev, python3-pip, pkg-config]}} 35 | - env: TASK="windows" 36 | os: linux 37 | dist: "trusty" 38 | install: 39 | - export PATH="`pwd`/build:${PATH}" 40 | - wget https://github.com/ninja-build/ninja/releases/download/v1.7.2/ninja-linux.zip && unzip -q ninja-linux.zip -d build 41 | - pip3 install --user meson 42 | script: 43 | - meson build --prefix="$PWD/install" --cross-file="cross/ubuntu-mingw64.txt" 44 | - ninja -C build install 45 | addons: {apt: {packages: [python3-pip, pkg-config, wine, binutils-mingw-w64-x86-64, mingw-w64-x86-64-dev, gcc-mingw-w64-x86-64]}} 46 | - env: TASK="armhf" 47 | os: linux 48 | dist: "trusty" 49 | install: 50 | - export PATH="`pwd`/build:${PATH}" 51 | - wget https://github.com/ninja-build/ninja/releases/download/v1.7.2/ninja-linux.zip && unzip -q ninja-linux.zip -d build 52 | - pip3 install --user meson 53 | script: 54 | - meson build --prefix="$PWD/install" --cross-file="cross/ubuntu-armhf.txt" 55 | - ninja -C build install 56 | addons: {apt: {packages: [python3-pip, pkg-config-arm-linux-gnueabihf, libc6-dev-armhf-cross, gcc-arm-linux-gnueabihf, binutils-arm-linux-gnueabihf]}} 57 | 58 | # We don't want to pull submodules recursively 59 | git: 60 | submodules: false 61 | 62 | before_install: 63 | - git submodule update --init 64 | 65 | script: 66 | - meson build --prefix="$PWD/install" 67 | - ninja -C build test install 68 | 69 | 70 | 71 | env: 72 | global: 73 | # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created 74 | # via the "travis encrypt" command using the project repo's public key 75 | - secure: "RhaRC6Zqf+OTAKK/b3fYOb02z2tIMc7SmpAZfLy2hK0rtx8DRG9noHXuzPn6DaZvGqmVhvmtW6q7EYDrXBqvTIjalq+D94ROA5HDRIk/GH0HzIDuSieYVda8bTE9nBHm1wMBX/hjoDVLAauVnNo1r7YHBax1ODz8BUmEoOtjveZni/Is5MlALxJaXBTn/mVvaBUS+v16JvGGwViNnJ7Jq33a0ixOU7LNawGFwlUgEWVquzWOJEH+Ms5qSjgs6JswHfxNhpF0Pw1SUtmBu3KcNa6sAeHhtvpqwiqdM4FCXwkKSqqE97zCurvFeLfbIFt9G+FRzJbyg38hzNU6c8gMHvJ4/QTWNrBpuQ96tv/fXIyjomorC5uLe6qICivWiImMBTbmu6dgSs3JrPGfZcI4hSgdCAIXjIt/zloDL3UGo4yyr+7kjROVxIeQleLTTwnsJw2702sdaL++Eq2++vy69ydkb61TE2RsdxDcFxm/oi0+cBGb43+La40ZUx09Sy9Er/vEDZua+nJLqbMQhfzvcvJBsyZozaHNIheO7B+BHKWERgumEC3Q6iox+p/ummZSwZ98EGC/F1YfCnUbkK+/38i48FAMF/E5lycVOg8prKK3IdhtCUg9QPdlw2e5OeS2L2Uee4Aez66KbCAeYXCI+2p7N8EahZPyJQ41s1DHDe4=" 76 | 77 | 78 | 79 | addons: 80 | coverity_scan: 81 | project: 82 | name: "zeehio/mimic-core" 83 | description: "Core text to speech for mycroft" 84 | notification_email: sergioller@gmail.com 85 | build_command_prepend: meson build_cov_scan --prefix="$PWD/install" 86 | build_command: ninja -C build_cov_scan test install 87 | branch_pattern: coverity_scan 88 | 89 | -------------------------------------------------------------------------------- /include/cst_diphone.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 2001 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: January 2001 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* Diphone databases */ 38 | /* */ 39 | /*************************************************************************/ 40 | #ifndef CST_DIPHONE_H 41 | #define CST_DIPHONE_H 42 | 43 | #include "cst_lib_visibility.h" 44 | #include "cst_file.h" 45 | #include "cst_val.h" 46 | #include "cst_features.h" 47 | #include "cst_wave.h" 48 | #include "cst_track.h" 49 | #include "cst_sts.h" 50 | #include "cst_hrg.h" 51 | 52 | struct cst_diphone_entry_struct { 53 | const char *name; 54 | unsigned short start_pm; 55 | unsigned char pb_pm; 56 | unsigned char end_pm; 57 | }; 58 | typedef struct cst_diphone_entry_struct cst_diphone_entry; 59 | 60 | struct cst_diphone_db_struct { 61 | const char *name; 62 | int num_entries; 63 | const cst_diphone_entry *diphones; 64 | const cst_sts_list *sts; 65 | }; 66 | typedef struct cst_diphone_db_struct cst_diphone_db; 67 | 68 | CST_VAL_USER_TYPE_DCLS_VISIB(diphone_db, cst_diphone_db, MIMIC_CORE_PUBLIC); 69 | MIMIC_CORE_PUBLIC cst_utterance *diphone_synth(cst_utterance *utt); 70 | cst_utterance *get_diphone_units(cst_utterance *utt); 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /src/audio/au_none.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 2001 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: January 2001 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* Ain't got no direct audio */ 38 | /* */ 39 | /*************************************************************************/ 40 | 41 | #include "cst_string.h" 42 | #include "cst_wave.h" 43 | #include "cst_audio.h" 44 | 45 | int audio_init_none() 46 | { 47 | return 0; 48 | } 49 | 50 | int audio_exit_none() 51 | { 52 | return 0; 53 | } 54 | 55 | 56 | cst_audiodev *audio_open_none(int sps, int channels, int fmt) 57 | { 58 | cst_audiodev *ad; 59 | 60 | ad = cst_alloc(cst_audiodev, 1); 61 | ad->sps = ad->real_sps = sps; 62 | ad->channels = ad->real_channels = channels; 63 | ad->fmt = ad->real_fmt = fmt; 64 | return ad; 65 | } 66 | 67 | int audio_close_none(cst_audiodev *ad) 68 | { 69 | if (ad) 70 | cst_free(ad); 71 | return 0; 72 | } 73 | 74 | int audio_write_none(cst_audiodev *ad, void *samples, int num_bytes) 75 | { 76 | (void) ad; 77 | (void) samples; 78 | return num_bytes; 79 | } 80 | 81 | int audio_drain_none(cst_audiodev *ad) 82 | { 83 | (void) ad; 84 | return 0; 85 | } 86 | 87 | int audio_flush_none(cst_audiodev *ad) 88 | { 89 | (void) ad; 90 | return 0; 91 | } 92 | -------------------------------------------------------------------------------- /tools/mimic_rename_voice: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ########################################################################### 3 | ## ## 4 | ## Language Technologies Institute ## 5 | ## Carnegie Mellon University ## 6 | ## Copyright (c) 2010 ## 7 | ## All Rights Reserved. ## 8 | ## ## 9 | ## Permission is hereby granted, free of charge, to use and distribute ## 10 | ## this software and its documentation without restriction, including ## 11 | ## without limitation the rights to use, copy, modify, merge, publish, ## 12 | ## distribute, sublicense, and/or sell copies of this work, and to ## 13 | ## permit persons to whom this work is furnished to do so, subject to ## 14 | ## the following conditions: ## 15 | ## 1. The code must retain the above copyright notice, this list of ## 16 | ## conditions and the following disclaimer. ## 17 | ## 2. Any modifications must be clearly marked as such. ## 18 | ## 3. Original authors' names are not deleted. ## 19 | ## 4. The authors' names are not used to endorse or promote products ## 20 | ## derived from this software without specific prior written ## 21 | ## permission. ## 22 | ## ## 23 | ## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ## 24 | ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## 25 | ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## 26 | ## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ## 27 | ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## 28 | ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## 29 | ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## 30 | ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## 31 | ## THIS SOFTWARE. ## 32 | ## ## 33 | ########################################################################### 34 | # 35 | # Renames a clunits/voxdata flite voice build by build_flite 36 | # 37 | # flite_rename_voice FROMDIR NEWNAME TODIR 38 | # 39 | # You have to recompile it afterwards 40 | # 41 | FROMDIR=$1 42 | NEWNAME=$2 43 | TODIR=$3 44 | 45 | OLDNAME=`cat $FROMDIR/voxdefs.h | awk '{ if ($2 == "VOXNAME") printf("%s",$3)}'` 46 | 47 | mkdir -p $TODIR 48 | 49 | if [ ! -f $FROMDIR/$OLDNAME.c ] 50 | then 51 | echo Current directory does not contain $FROMDIR/$OLDNAME.c 52 | echo no renaming possible 53 | exit -1 54 | fi 55 | 56 | for i in $FROMDIR/*.c $FROMDIR/*.h $FROMDIR/Makefile 57 | do 58 | fname=`basename $i` 59 | cat $i | 60 | sed 's/'$OLDNAME'/'$NEWNAME'/g' | 61 | cat >$TODIR/`echo $fname | sed 's/'$OLDNAME'/'$NEWNAME'/g'` 62 | done 63 | 64 | for i in $FROMDIR/*.raw 65 | do 66 | fname=`basename $i` 67 | cp -p $i $TODIR/`echo $fname | sed 's/'$OLDNAME'/'$NEWNAME'/g'` 68 | 69 | done 70 | 71 | for i in $FROMDIR/*.voxdata 72 | do 73 | fname=`basename $i` 74 | echo $OLDNAME $NEWNAME | 75 | awk '{if (length($1) < length($2)) 76 | { 77 | fo = sprintf("%%%ds",length($2)); 78 | o = sprintf(fo,$1); 79 | n = $2; 80 | } 81 | else 82 | { 83 | fn = sprintf("%%%ds",length($1)); 84 | n = sprintf(fn,$2); 85 | o = $1; 86 | } 87 | printf("#>%s<<%s<\n",n,o); 88 | printf("sed '"'"'s%%%s%%%s%%'"'"'\n",o,n)}' >$TODIR/sed.command 89 | sh $TODIR/sed.command <$i >$TODIR/`echo $fname | sed 's/'$OLDNAME'/'$NEWNAME'/g'` 90 | rm -f $TODIR/sed.command 91 | done 92 | 93 | -------------------------------------------------------------------------------- /include/cst_track.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 1999 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: August 2000 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* Waveforms */ 38 | /* */ 39 | /*************************************************************************/ 40 | #ifndef CST_TRACK_H 41 | #define CST_TRACK_H 42 | 43 | #include "cst_lib_visibility.h" 44 | #include "cst_file.h" 45 | #include "cst_error.h" 46 | #include "cst_alloc.h" 47 | #include "cst_file.h" 48 | #include "cst_val.h" 49 | 50 | typedef struct cst_track_struct { 51 | const char *type; 52 | int num_frames; 53 | int num_channels; 54 | float *times; 55 | float **frames; 56 | } cst_track; 57 | 58 | MIMIC_CORE_PUBLIC cst_track *new_track(); 59 | MIMIC_CORE_PUBLIC void delete_track(cst_track *val); 60 | 61 | MIMIC_CORE_PUBLIC float track_frame_shift(cst_track *t, int frame); 62 | MIMIC_CORE_PUBLIC void cst_track_resize(cst_track *t, int num_frames, int num_channels); 63 | MIMIC_CORE_PUBLIC cst_track *cst_track_copy(const cst_track *t); 64 | 65 | MIMIC_CORE_PUBLIC int cst_track_save_est(cst_track *t, const char *filename); 66 | MIMIC_CORE_PUBLIC int cst_track_save_est_binary(cst_track *t, const char *filename); 67 | MIMIC_CORE_PUBLIC int cst_track_load_est(cst_track *t, const char *filename); 68 | 69 | CST_VAL_USER_TYPE_DCLS(track, cst_track); 70 | #endif 71 | -------------------------------------------------------------------------------- /testsuite/play_server_main.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 2000 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: October 2000 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* Wait from waveforms to connect to a socket and play them streaming */ 38 | /* */ 39 | /*************************************************************************/ 40 | #include 41 | #include 42 | #include "cst_wave.h" 43 | #include "cst_audio.h" 44 | 45 | int play_server_main_usage() 46 | { 47 | printf("simple audio server\n"); 48 | printf("usage: play_server [PORTNUMBER]\n"); 49 | printf("Sit and listen on socket number PORTNUMBER and play waveforms\n"); 50 | printf("Send to it, default PORTNUMBER is %d\n", CST_AUDIO_DEFAULT_PORT); 51 | return 0; 52 | } 53 | 54 | int main(int argc, char **argv) 55 | { 56 | int port; 57 | 58 | port = CST_AUDIO_DEFAULT_PORT; 59 | 60 | if (argc > 1) 61 | { 62 | if ((cst_streq("-h", argv[1])) || 63 | (cst_streq("-help", argv[1])) || (cst_streq("--help", argv[1]))) 64 | { 65 | play_server_main_usage(); 66 | return -1; 67 | } 68 | port = atoi(argv[1]); 69 | if (port <= 0) 70 | { 71 | fprintf(stderr, "invalid port number: %d\n", port); 72 | return -1; 73 | } 74 | } 75 | 76 | auserver(port); 77 | 78 | return 0; 79 | 80 | } 81 | -------------------------------------------------------------------------------- /include/cst_ffeatures.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 2007 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: November 2007 */ 35 | /*************************************************************************/ 36 | /* Language independant feature functions */ 37 | /*************************************************************************/ 38 | 39 | #ifndef CST_FFEATURES_H 40 | #define CST_FFEATURES_H 41 | 42 | #include "cst_lib_visibility.h" 43 | #include "cst_val.h" 44 | #include "cst_item.h" 45 | 46 | const cst_val *ph_vc(const cst_item *p); 47 | const cst_val *ph_vlng(const cst_item *p); 48 | const cst_val *ph_vheight(const cst_item *p); 49 | const cst_val *ph_vrnd(const cst_item *p); 50 | const cst_val *ph_vfront(const cst_item *p); 51 | const cst_val *ph_ctype(const cst_item *p); 52 | const cst_val *ph_cplace(const cst_item *p); 53 | const cst_val *ph_cvox(const cst_item *p); 54 | const cst_val *accented(const cst_item *p); 55 | 56 | const cst_val *cg_duration(const cst_item *p); 57 | const cst_val *cg_state_pos(const cst_item *p); 58 | const cst_val *cg_state_place(const cst_item *p); 59 | const cst_val *cg_state_index(const cst_item *p); 60 | const cst_val *cg_state_rindex(const cst_item *p); 61 | const cst_val *cg_phone_place(const cst_item *p); 62 | const cst_val *cg_phone_index(const cst_item *p); 63 | const cst_val *cg_phone_rindex(const cst_item *p); 64 | 65 | MIMIC_CORE_PUBLIC const cst_val *generic_gpos(const cst_item *word, const cst_val * const * const lang_gpos[]); 66 | 67 | MIMIC_CORE_PUBLIC void basic_ff_register(cst_features *ffunctions); 68 | 69 | #endif /* _CST_FFEATURES_H */ 70 | -------------------------------------------------------------------------------- /src/cg/cst_cg_map.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 2010 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alok Parlikar (aup@cs.cmu.edu) */ 34 | /* Date: April 2010 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* A clustergen generic voice, that can load from a file */ 38 | /* */ 39 | /*************************************************************************/ 40 | #ifndef __CST_CG_MAP_H 41 | #define __CST_CG_MAP_H 42 | 43 | #include "cst_file.h" 44 | #include "cst_cg.h" 45 | #include "cst_cart.h" 46 | #include "cst_val.h" 47 | #include "cst_synth.h" 48 | 49 | int cst_cg_read_header(cst_file fd); 50 | 51 | cst_cg_db *cst_cg_load_db(cst_voice *vox, cst_file fd); 52 | void cst_cg_free_db(cst_file fd, cst_cg_db *); 53 | 54 | char *cst_read_string(cst_file fd); 55 | void *cst_read_padded(cst_file fd, int *nb); 56 | char **cst_read_db_types(cst_file fd); 57 | 58 | cst_cart_node *cst_read_tree_nodes(cst_file fd); 59 | char **cst_read_tree_feats(cst_file fd); 60 | cst_cart *cst_read_tree(cst_file fd); 61 | cst_cart **cst_read_tree_array(cst_file fd); 62 | 63 | void *cst_read_array(cst_file fd); 64 | void **cst_read_2d_array(cst_file fd); 65 | 66 | dur_stat **cst_read_dur_stats(cst_file fd); 67 | 68 | char ***cst_read_phone_states(cst_file fd); 69 | 70 | void cst_read_voice_feature(cst_file fd, char **fname, char **fval); 71 | int cst_read_int32(cst_file fd); 72 | float cst_read_float(cst_file fd); 73 | 74 | extern const char *const cg_voice_header_string; 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /unittests/hrg_test_main.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 1999 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: December 1999 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* Test of hrg creation and manipulation */ 38 | /* */ 39 | /*************************************************************************/ 40 | #include 41 | #include "cst_hrg.h" 42 | 43 | #include "cutest.h" 44 | 45 | float correct_list[] = { 0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8 }; 46 | 47 | void test_hrg(void) 48 | { 49 | cst_utterance *u; 50 | cst_relation *r; 51 | cst_item *item = 0; 52 | int i; 53 | 54 | u = new_utterance(); 55 | r = utt_relation_create(u, "Segment"); 56 | 57 | for (i = 0; i < 10; i++) 58 | { 59 | char buff[20]; 60 | sprintf(buff, "seg_%03d", i); 61 | if (i == 0) 62 | item = relation_append(r, NULL); 63 | else 64 | item = item_append(item, NULL); 65 | item_set_string(item, "name", buff); 66 | item_set_float(item, "duration", i * 0.20); 67 | } 68 | 69 | for (i = 0, item = relation_head(utt_relation(u, "Segment")); 70 | item; item = item_next(item), i++) 71 | { 72 | TEST_CHECK(item_feat_float(item, "duration") == correct_list[i]); 73 | } 74 | 75 | delete_utterance(u); 76 | } 77 | 78 | TEST_LIST = { 79 | {"hrg creation and manipulation", test_hrg}, 80 | {0} 81 | }; 82 | -------------------------------------------------------------------------------- /include/cst_alloc.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 1999 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: July 1999 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* Basic wraparounds for malloc and free */ 38 | /* */ 39 | /*************************************************************************/ 40 | #ifndef CST_ALLOC_H 41 | #define CST_ALLOC_H 42 | 43 | #include "cst_lib_visibility.h" 44 | 45 | #ifndef TRUE 46 | #define TRUE (1==1) 47 | #endif 48 | #ifndef FALSE 49 | #define FALSE (1==0) 50 | #endif 51 | 52 | /* Global allocation (the only kind on Unix) */ 53 | MIMIC_CORE_PUBLIC void *cst_safe_alloc(int size); 54 | MIMIC_CORE_PUBLIC void *cst_safe_calloc(int size); 55 | MIMIC_CORE_PUBLIC void *cst_safe_realloc(void *p, int size); 56 | 57 | typedef void *cst_alloc_context; 58 | #define new_alloc_context(size) (NULL) 59 | #define delete_alloc_context(ctx) 60 | #define cst_local_alloc(ctx,size) cst_safe_alloc(size) 61 | #define cst_local_free(cst,p) cst_free(p) 62 | 63 | /* The public interface to the alloc functions */ 64 | 65 | /* Note the underlying call is calloc, so everything is zero'd */ 66 | #define cst_alloc(TYPE,SIZE) ((TYPE *)cst_safe_alloc(sizeof(TYPE)*(SIZE))) 67 | #define cst_calloc(TYPE,SIZE) ((TYPE *)cst_safe_calloc(sizeof(TYPE)*(SIZE))) 68 | #define cst_realloc(P,TYPE,SIZE) ((TYPE *)cst_safe_realloc((void *)(P),sizeof(TYPE)*(SIZE))) 69 | 70 | MIMIC_CORE_PUBLIC void cst_free(void *p); 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /testsuite/play_sync_main.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 2000 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: September 2000 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* Play waveform displaying text as we go (testing callback events) */ 38 | /* */ 39 | /*************************************************************************/ 40 | #include 41 | #include "cst_hrg.h" 42 | #include "cst_wave.h" 43 | #include "cst_audio.h" 44 | 45 | static int my_call_back(cst_item *i) 46 | { 47 | const char *name; 48 | 49 | name = item_feat_string(i, "name"); 50 | if (cst_streq(name, "__silence__")) 51 | printf("\n"); 52 | else 53 | { 54 | /* printf("%s %f\n",name,item_feat_float(i,"end")); */ 55 | printf("%s ", name); 56 | fflush(stdout); 57 | } 58 | 59 | return CST_OK_FORMAT; 60 | } 61 | 62 | int main(int argc, char **argv) 63 | { 64 | cst_wave *w; 65 | cst_relation *r; 66 | cst_utterance *u; 67 | 68 | if (argc != 3) 69 | { 70 | fprintf(stderr, "usage: mimic_play_wave_sync WAVEFILE LABELFILE\n"); 71 | return 1; 72 | } 73 | 74 | w = new_wave(); 75 | if (cst_wave_load_riff(w, argv[1]) != CST_OK_FORMAT) 76 | return -1; 77 | u = new_utterance(); 78 | r = utt_relation_create(u, "FOO"); 79 | if (relation_load(r, argv[2]) != CST_OK_FORMAT) 80 | return -1; 81 | 82 | mimic_play_wave_sync(w, r, my_call_back); 83 | 84 | return 0; 85 | } 86 | -------------------------------------------------------------------------------- /include/cst_cart.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 2000 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: January 2000 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* CART tree support */ 38 | /* */ 39 | /*************************************************************************/ 40 | #ifndef CST_CART_H 41 | #define CST_CART_H 42 | 43 | #include "cst_lib_visibility.h" 44 | #include 45 | #include "cst_file.h" 46 | #include "cst_val.h" 47 | #include "cst_features.h" 48 | #include "cst_item.h" 49 | #include "cst_relation.h" 50 | 51 | #define CST_CART_OP_NONE 255 52 | #define CST_CART_OP_LEAF 255 53 | #define CST_CART_OP_IS 0 54 | #define CST_CART_OP_IN 1 55 | #define CST_CART_OP_LESS 2 56 | #define CST_CART_OP_GREATER 3 57 | #define CST_CART_OP_MATCHES 4 58 | #define CST_CART_OP_EQUALS 5 59 | 60 | typedef struct cst_cart_node_struct { 61 | unsigned char feat; 62 | unsigned char op; 63 | /* yes is always the next node */ 64 | uint16_t no_node; /* or answer index */ 65 | const cst_val *val; 66 | } cst_cart_node; 67 | 68 | typedef struct cst_cart_struct { 69 | const cst_cart_node *rule_table; 70 | const char *const *feat_table; 71 | } cst_cart; 72 | 73 | void delete_cart(cst_cart *c); 74 | 75 | CST_VAL_USER_TYPE_DCLS_VISIB(cart, cst_cart, MIMIC_CORE_PUBLIC); 76 | MIMIC_CORE_PUBLIC const cst_val *cart_interpret(cst_item *item, const cst_cart *tree); 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /include/cst_relation.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 1999 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: December 1999 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* Relation */ 38 | /* */ 39 | /*************************************************************************/ 40 | #ifndef CST_RELATION_H 41 | #define CST_RELATION_H 42 | 43 | #include "cst_lib_visibility.h" 44 | #include "cst_file.h" 45 | #include "cst_val.h" 46 | #include "cst_features.h" 47 | #include "cst_item.h" 48 | #include "cst_utterance.h" 49 | 50 | struct cst_relation_struct { 51 | char *name; 52 | cst_features *features; 53 | cst_utterance *utterance; 54 | cst_item *head; 55 | cst_item *tail; 56 | }; 57 | 58 | /* Constructor functions */ 59 | MIMIC_CORE_PUBLIC cst_relation *new_relation(const char *name, cst_utterance *u); 60 | 61 | MIMIC_CORE_PUBLIC void delete_relation(cst_relation *r); 62 | 63 | MIMIC_CORE_PUBLIC cst_item *relation_head(cst_relation *r); 64 | MIMIC_CORE_PUBLIC cst_item *relation_tail(cst_relation *r); 65 | MIMIC_CORE_PUBLIC const char *relation_name(cst_relation *r); 66 | 67 | MIMIC_CORE_PUBLIC cst_item *relation_append(cst_relation *r, cst_item *i); 68 | MIMIC_CORE_PUBLIC cst_item *relation_prepend(cst_relation *r, cst_item *i); 69 | 70 | MIMIC_CORE_PUBLIC int relation_load(cst_relation *r, const char *filename); 71 | MIMIC_CORE_PUBLIC int relation_save(cst_relation *r, const char *filename); 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /include/cst_voice.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 1999 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: December 2000 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* Voice functions */ 38 | /* */ 39 | /*************************************************************************/ 40 | #ifndef CST_VOICE_H 41 | #define CST_VOICE_H 42 | 43 | #include "cst_lib_visibility.h" 44 | #include "cst_file.h" 45 | #include "cst_val.h" 46 | #include "cst_features.h" 47 | #include "cst_utterance.h" 48 | #include "cst_relation.h" 49 | #include "cst_lexicon.h" 50 | 51 | struct cst_voice_struct { 52 | const char *name; 53 | 54 | cst_features *features; 55 | cst_features *ffunctions; 56 | 57 | /* This hook is called (from utt_init()) after the input text (if 58 | any) has been set and voice features have been copied in, but 59 | before synthesis. */ 60 | cst_utterance *(*utt_init) (cst_utterance *u, struct cst_voice_struct *v); 61 | }; 62 | typedef struct cst_voice_struct cst_voice; 63 | 64 | /* Hold pointers to language and lexicon init function */ 65 | struct cst_lang_struct { 66 | const char *lang; 67 | void (*lang_init) (cst_voice *vox); 68 | cst_lexicon *(*lex_init) (); 69 | }; 70 | typedef struct cst_lang_struct cst_lang; 71 | 72 | /* Constructor functions */ 73 | MIMIC_CORE_PUBLIC cst_voice *new_voice(); 74 | MIMIC_CORE_PUBLIC void delete_voice(cst_voice *u); 75 | 76 | CST_VAL_USER_TYPE_DCLS_VISIB(voice, cst_voice, MIMIC_CORE_PUBLIC); 77 | #endif 78 | -------------------------------------------------------------------------------- /src/stats/cst_ss.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 2001 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: November 2001 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* sufficient statitsics */ 38 | /* */ 39 | /*************************************************************************/ 40 | 41 | #include "cst_alloc.h" 42 | #include "cst_ss.h" 43 | #include 44 | 45 | cst_ss *new_ss() 46 | { 47 | cst_ss *ss = cst_alloc(cst_ss, 1); 48 | return ss; 49 | } 50 | 51 | void delete_ss(cst_ss *ss) 52 | { 53 | cst_free(ss); 54 | } 55 | 56 | void ss_reset(cst_ss *ss) 57 | { 58 | ss->num_samples = 0; 59 | ss->sum = 0; 60 | ss->sumx = 0; 61 | } 62 | 63 | double ss_mean(cst_ss *ss) 64 | { 65 | if (ss->num_samples > 0) 66 | return ss->sum / ss->num_samples; 67 | else 68 | return 0; 69 | } 70 | 71 | double ss_variance(cst_ss *ss) 72 | { 73 | if (ss->num_samples > 1) 74 | return ((ss->num_samples * ss->sumx) - (ss->sum * ss->sum)) / 75 | (ss->num_samples * (ss->num_samples - 1)); 76 | else 77 | return 0; 78 | } 79 | 80 | double ss_stddev(cst_ss *ss) 81 | { 82 | return sqrt(ss_variance(ss)); 83 | } 84 | 85 | void ss_cummulate(cst_ss *ss, double a) 86 | { 87 | ss->sum += a; 88 | ss->sumx += a * a; 89 | ss->num_samples++; 90 | } 91 | 92 | void ss_cummulate_n(cst_ss *ss, double a, double count) 93 | { 94 | ss->sum += a * count; 95 | ss->sumx += (a * a) * count; 96 | ss->num_samples += count; 97 | } 98 | -------------------------------------------------------------------------------- /include/cst_sigpr.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 2001 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: January 2001 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* Signal processing */ 38 | /* */ 39 | /*************************************************************************/ 40 | #ifndef CST_SIGPR_H 41 | #define CST_SIGPR_H 42 | 43 | #include "cst_lib_visibility.h" 44 | #include "cst_file.h" 45 | #include "cst_val.h" 46 | #include "cst_sts.h" 47 | 48 | MIMIC_CORE_PUBLIC cst_wave *lpc_resynth(cst_lpcres *lpcres); 49 | cst_wave *lpc_resynth_fixedpoint(cst_lpcres *lpcres); 50 | cst_wave *lpc_resynth_spike(cst_lpcres *lpcres); 51 | 52 | MIMIC_CORE_PUBLIC void lpc2ref(const float *lpc, float *rfc, int order); 53 | MIMIC_CORE_PUBLIC void ref2lpc(const float *rfc, float *lpc, int order); 54 | 55 | 56 | void add_residual_windowed(int targ_size, 57 | unsigned char *targ_residual, 58 | int unit_size, const unsigned char *unit_residual); 59 | void add_residual_g721(int targ_size, unsigned char *targ_residual, 60 | int packed_unit_size, 61 | const unsigned char *unit_residual); 62 | void add_residual_g721vuv(int targ_size, unsigned char *targ_residual, 63 | int uunit_size, const unsigned char *unit_residual); 64 | void add_residual_vuv(int targ_size, unsigned char *targ_residual, 65 | int packed_unit_size, 66 | const unsigned char *unit_residual); 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /tools/Makefile: -------------------------------------------------------------------------------- 1 | ########################################################################### 2 | ## ## 3 | ## Language Technologies Institute ## 4 | ## Carnegie Mellon University ## 5 | ## Copyright (c) 2000-2008 ## 6 | ## All Rights Reserved. ## 7 | ## ## 8 | ## Permission is hereby granted, free of charge, to use and distribute ## 9 | ## this software and its documentation without restriction, including ## 10 | ## without limitation the rights to use, copy, modify, merge, publish, ## 11 | ## distribute, sublicense, and/or sell copies of this work, and to ## 12 | ## permit persons to whom this work is furnished to do so, subject to ## 13 | ## the following conditions: ## 14 | ## 1. The code must retain the above copyright notice, this list of ## 15 | ## conditions and the following disclaimer. ## 16 | ## 2. Any modifications must be clearly marked as such. ## 17 | ## 3. Original authors' names are not deleted. ## 18 | ## 4. The authors' names are not used to endorse or promote products ## 19 | ## derived from this software without specific prior written ## 20 | ## permission. ## 21 | ## ## 22 | ## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ## 23 | ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## 24 | ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## 25 | ## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ## 26 | ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## 27 | ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## 28 | ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## 29 | ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## 30 | ## THIS SOFTWARE. ## 31 | ## ## 32 | ########################################################################### 33 | ## ## 34 | ## Tools for converting Festvox structures to Flite code ## 35 | ## ## 36 | ########################################################################### 37 | TOP=.. 38 | DIRNAME=tools 39 | BUILD_DIRS = 40 | ALL_DIRS= 41 | SRCS = find_sts_main.c mimic_sort_main.c 42 | OBJS = $(SRCS:.c=.o) 43 | TMPLTS = VOICE_ldom.c VOICE_clunits.c VOICE_diphone.c \ 44 | VOICE_cg.c Makefile.mimic \ 45 | Makefile.lex LANGNAME_lex.c LANGNAME_lex.h \ 46 | Makefile.lang LANGNAME_lang.c LANGNAME_lang.h 47 | SCRIPTS = build_mimic setup_mimic huff_table mimic_test \ 48 | make_voice_list wfst2c build_lex clunit_prune \ 49 | a2byte.pl a2short.pl a2int.pl mimic_rename_voice \ 50 | make_lang_list make_new_lang_lex 51 | SCM=make_lex.scm make_lts.scm make_cart.scm play_sync.scm \ 52 | make_phoneset.scm make_vallist.scm make_clunits.scm \ 53 | make_didb.scm make_didb2.scm make_f0lr.scm make_lts_wfst.scm \ 54 | make_lts_rewrite.scm \ 55 | make_cg.scm make_ug.scm 56 | 57 | FILES = Makefile $(SCM) $(SRCS) $(SCRIPTS) $(TMPLTS) \ 58 | find_cmimax example.lex example.ssml 59 | LOCAL_INCLUDES = 60 | 61 | ifeq ($(HOST_PLATFORM),$(TARGET_PLATFORM)) 62 | ALL = $(BINDIR)/find_sts $(BINDIR)/mimic_sort makescripts 63 | endif 64 | 65 | include $(TOP)/config/common_make_rules 66 | 67 | LOCAL_CLEAN = $(BINDIR)/find_sts $(BINDIR)/mimic_sort $(TOP)/bin 68 | 69 | $(BINDIR)/find_sts: find_sts_main.o $(MIMICLIBS) 70 | $(CC) $(CFLAGS) -o $@ find_sts_main.o $(MIMICLIBFLAGS) $(LDFLAGS) 71 | $(BINDIR)/mimic_sort: mimic_sort_main.o $(MIMICLIBS) 72 | $(CC) $(CFLAGS) -o $@ mimic_sort_main.o $(MIMICLIBFLAGS) $(LDFLAGS) 73 | makescripts: 74 | @ cp -p $(SCRIPTS) $(TOP)/bin 75 | 76 | -------------------------------------------------------------------------------- /include/cst_endian_internal.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 1999 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: August 2000 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* endianness */ 38 | /* */ 39 | /*************************************************************************/ 40 | 41 | #ifndef CST_ENDIAN_INTERNAL_H 42 | #define CST_ENDIAN_INTERNAL_H 43 | 44 | #include 45 | #include 46 | #include "cst_lib_visibility.h" 47 | #include "cst_endian.h" 48 | 49 | /* This gets set to 1 and we test where the on bit is to determine byteorder */ 50 | MIMIC_CORE_PRIVATE extern const int32_t cst_endian_loc; 51 | /* Sun, HP, SGI Mips, M68000, PowerPC */ 52 | #define CST_BIG_ENDIAN (((char *)&cst_endian_loc)[0] == 0) 53 | /* Intel, Alpha, DEC Mips, Vax, ARM, Other MIPS (Casio, Ben Nanonote etc) */ 54 | #define CST_LITTLE_ENDIAN (((char *)&cst_endian_loc)[0] != 0) 55 | /* Perq (from Three Rivers) has a third byte order -- but we have no support */ 56 | 57 | /* EST byte order strings */ 58 | #define BYTE_ORDER_BIG "10" 59 | #define BYTE_ORDER_LITTLE "01" 60 | 61 | #define SWAPINT32(x) ((((uint32_t)x) & 0xff) << 24 | \ 62 | (((uint32_t)x) & 0xff00) << 8 | \ 63 | (((uint32_t)x) & 0xff0000) >> 8 | \ 64 | (((uint32_t)x) & 0xff000000) >> 24) 65 | #define SWAPINT16(x) ((((uint16_t)x) & 0xff) << 8 | \ 66 | (((uint16_t)x) & 0xff00) >> 8) 67 | 68 | MIMIC_CORE_PRIVATE void swap_bytes_short(int16_t *b, size_t n); 69 | 70 | MIMIC_CORE_PROTECTED void swapdouble(double *d); 71 | MIMIC_CORE_PROTECTED void swapfloat(float *f); 72 | 73 | 74 | #endif /* Header guard */ 75 | 76 | -------------------------------------------------------------------------------- /tools/make_new_lang_lex: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #####################################################-*-mode:shell-script-*- 3 | ## ## 4 | ## Language Technologies Institute ## 5 | ## Carnegie Mellon University ## 6 | ## Copyright (c) 2013 ## 7 | ## All Rights Reserved. ## 8 | ## ## 9 | ## Permission is hereby granted, free of charge, to use and distribute ## 10 | ## this software and its documentation without restriction, including ## 11 | ## without limitation the rights to use, copy, modify, merge, publish, ## 12 | ## distribute, sublicense, and/or sell copies of this work, and to ## 13 | ## permit persons to whom this work is furnished to do so, subject to ## 14 | ## the following conditions: ## 15 | ## 1. The code must retain the above copyright notice, this list of ## 16 | ## conditions and the following disclaimer. ## 17 | ## 2. Any modifications must be clearly marked as such. ## 18 | ## 3. Original authors' names are not deleted. ## 19 | ## 4. The authors' names are not used to endorse or promote products ## 20 | ## derived from this software without specific prior written ## 21 | ## permission. ## 22 | ## ## 23 | ## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ## 24 | ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## 25 | ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## 26 | ## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ## 27 | ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## 28 | ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## 29 | ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## 30 | ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## 31 | ## THIS SOFTWARE. ## 32 | ## ## 33 | ########################################################################### 34 | ## ## 35 | ## Make empty lang and lex directories for a new language ## 36 | ## ## 37 | ########################################################################### 38 | 39 | export LANG=C; 40 | 41 | if [ $# = 0 ] 42 | then 43 | echo ./tools/make_new_lang_lex LANGNAME 44 | echo Will make: 45 | echo lang/cmu_${LANGNAME}_lex/cmu_${LANGNAME}_lex.h 46 | echo lang/cmu_${LANGNAME}_lex/cmu_${LANGNAME}_lex.c 47 | echo lang/cmu_${LANGNAME}_lang/cmu_${LANGNAME}_lang.h 48 | echo lang/cmu_${LANGNAME}_lang/cmu_${LANGNAME}_lang.c 49 | echo You may want to use tools/build_lex to make a more complete 50 | echo set of files for lang/cmu_${LANGNAME}_lex/ 51 | echo 52 | echo "Note this doesn't add anything to CVS, nor does it add the" 53 | echo "lang to the langlist (add them to config/default.lv) by hand" 54 | fi 55 | 56 | LANGNAME=$1 57 | 58 | mkdir lang/cmu_${LANGNAME}_lex 59 | cat tools/Makefile.lex | 60 | sed 's/LANGNAME/'${LANGNAME}'/g' >lang/cmu_${LANGNAME}_lex/Makefile 61 | cat tools/LANGNAME_lex.h | 62 | sed 's/LANGNAME/'${LANGNAME}'/g' >lang/cmu_${LANGNAME}_lex/cmu_${LANGNAME}_lex.h 63 | cat tools/LANGNAME_lex.c | 64 | sed 's/LANGNAME/'${LANGNAME}'/g' >lang/cmu_${LANGNAME}_lex/cmu_${LANGNAME}_lex.c 65 | echo made lang/cmu_${LANGNAME}_lex/ and skeleton files 66 | 67 | mkdir lang/cmu_${LANGNAME}_lang 68 | cat tools/Makefile.lang | 69 | sed 's/LANGNAME/'${LANGNAME}'/g' >lang/cmu_${LANGNAME}_lang/Makefile 70 | cat tools/LANGNAME_lang.h | 71 | sed 's/LANGNAME/'${LANGNAME}'/g' >lang/cmu_${LANGNAME}_lang/cmu_${LANGNAME}_lang.h 72 | cat tools/LANGNAME_lang.c | 73 | sed 's/LANGNAME/'${LANGNAME}'/g' >lang/cmu_${LANGNAME}_lang/cmu_${LANGNAME}_lang.c 74 | echo made lang/cmu_${LANGNAME}_lang/ and skeleton files 75 | 76 | 77 | -------------------------------------------------------------------------------- /include/cst_utterance.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 1999 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: December 1999 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* Utterances */ 38 | /* */ 39 | /*************************************************************************/ 40 | #ifndef CST_UTTERANCE_H 41 | #define CST_UTTERANCE_H 42 | 43 | #include "cst_lib_visibility.h" 44 | #include "cst_file.h" 45 | #include "cst_val.h" 46 | #include "cst_features.h" 47 | #include "cst_item.h" 48 | #include "cst_relation.h" 49 | #include "cst_alloc.h" 50 | 51 | struct cst_utterance_struct { 52 | cst_features *features; 53 | cst_features *ffunctions; 54 | cst_features *relations; 55 | cst_alloc_context ctx; 56 | }; 57 | 58 | /* Constructor functions */ 59 | MIMIC_CORE_PUBLIC cst_utterance *new_utterance(); 60 | MIMIC_CORE_PUBLIC void delete_utterance(cst_utterance *u); 61 | 62 | MIMIC_CORE_PUBLIC cst_relation *utt_relation(const cst_utterance *u, const char *name); 63 | MIMIC_CORE_PUBLIC cst_relation *utt_relation_create(cst_utterance *u, const char *name); 64 | MIMIC_CORE_PUBLIC int utt_relation_delete(cst_utterance *u, const char *name); 65 | MIMIC_CORE_PUBLIC int utt_relation_present(cst_utterance *u, const char *name); 66 | 67 | typedef cst_utterance *(*cst_uttfunc) (cst_utterance *i); 68 | CST_VAL_USER_FUNCPTR_DCLS_VISIB(uttfunc, cst_uttfunc, MIMIC_CORE_PUBLIC); 69 | /* Allocate memory "locally" to an utterance, on platforms that 70 | support/require this (currently only WinCE) */ 71 | #define cst_utt_alloc(UTT,TYPE,SIZE) ((TYPE *)cst_local_alloc((UTT)->ctx,sizeof(TYPE)*(SIZE))) 72 | #define cst_utt_free(UTT,PTR) cst_local_free((UTT)->ctx,(PTR)) 73 | #endif 74 | -------------------------------------------------------------------------------- /src/speech/cst_lpcres.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* */ 3 | /* Language Technologies Institute */ 4 | /* Carnegie Mellon University */ 5 | /* Copyright (c) 2001 */ 6 | /* All Rights Reserved. */ 7 | /* */ 8 | /* Permission is hereby granted, free of charge, to use and distribute */ 9 | /* this software and its documentation without restriction, including */ 10 | /* without limitation the rights to use, copy, modify, merge, publish, */ 11 | /* distribute, sublicense, and/or sell copies of this work, and to */ 12 | /* permit persons to whom this work is furnished to do so, subject to */ 13 | /* the following conditions: */ 14 | /* 1. The code must retain the above copyright notice, this list of */ 15 | /* conditions and the following disclaimer. */ 16 | /* 2. Any modifications must be clearly marked as such. */ 17 | /* 3. Original authors' names are not deleted. */ 18 | /* 4. The authors' names are not used to endorse or promote products */ 19 | /* derived from this software without specific prior written */ 20 | /* permission. */ 21 | /* */ 22 | /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ 23 | /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ 24 | /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ 25 | /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ 26 | /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ 27 | /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ 28 | /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ 29 | /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ 30 | /* THIS SOFTWARE. */ 31 | /* */ 32 | /*************************************************************************/ 33 | /* Author: Alan W Black (awb@cs.cmu.edu) */ 34 | /* Date: August 2000 */ 35 | /*************************************************************************/ 36 | /* */ 37 | /* Waveforms */ 38 | /* */ 39 | /*************************************************************************/ 40 | #include "cst_string.h" 41 | #include "cst_val.h" 42 | #include "cst_sts.h" 43 | 44 | CST_VAL_REGISTER_TYPE(lpcres, cst_lpcres); 45 | cst_lpcres *new_lpcres() 46 | { 47 | cst_lpcres *l = cst_alloc(struct cst_lpcres_struct, 1); 48 | return l; 49 | } 50 | 51 | void delete_lpcres(cst_lpcres *l) 52 | { 53 | if (l) 54 | { 55 | cst_free(l->times); 56 | cst_free((unsigned short **) l->frames); 57 | cst_free(l->residual); 58 | cst_free(l->sizes); 59 | if (l->delayed_decoding) 60 | cst_free(l->packed_residuals); 61 | cst_free(l); 62 | } 63 | return; 64 | } 65 | 66 | float lpcres_frame_shift(cst_lpcres *t, int frame) 67 | { 68 | if (frame == 0) 69 | return (float) t->times[frame]; 70 | else 71 | return (float) t->times[frame] - t->times[frame - 1]; 72 | } 73 | 74 | void lpcres_resize_frames(cst_lpcres *l, int num_frames) 75 | { 76 | l->times = cst_alloc(int, num_frames); 77 | l->frames = cst_alloc(const unsigned short *, num_frames); 78 | l->sizes = cst_alloc(int, num_frames); 79 | l->num_frames = num_frames; 80 | } 81 | 82 | void lpcres_resize_samples(cst_lpcres *l, int num_samples) 83 | { 84 | l->residual = cst_alloc(unsigned char, num_samples); 85 | /* mulaw for 0 is 255 */ 86 | memset(l->residual, 255, num_samples); 87 | l->num_samples = num_samples; 88 | 89 | } 90 | --------------------------------------------------------------------------------