[-]
[+]
|
Changed |
_service:tar_git:mimic.spec
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -1,7 +1,7 @@
<services>
<service name="tar_git">
<param name="url">https://github.com/sailfishos-chum/mimic</param>
- <param name="revision">1.2.0.3</param>
+ <param name="revision">1.3.0.1</param>
<param name="debian">N</param>
<param name="dumb">N</param>
</service>
|
[-]
[+]
|
Deleted |
_service:tar_git:mimic-1.2.0.3.tar.gz/mimic/NEWS.md
^
|
@@ -1,13 +0,0 @@
-# mimic 0.0.0.9000
-
-* Add PortAudio support. PortAudio is a cross-platform audio I/O library. We
- can support audio output on Mac OS X and Windows.
-
-* Add some unit tests and convert part of the testsuite to unit tests
-
-* Rebuild English cmulex lexicon and letter to sound rules
-
-## Bug fixes
-
-* Workaround for issue #18, where if PulseAudio is running ALSA output was
- stopped mid-word.
|
[-]
[+]
|
Deleted |
_service:tar_git:mimic-1.2.0.3.tar.gz/mimic/do_gcov.sh
^
|
@@ -1,9 +0,0 @@
-#!/bin/sh
-
-for direct in $(find . -type d); do
- (cd "$direct";
- for file in $(ls | grep "\\.gcno$"); do
- echo "$PWD";
- gcov -b "$file";
- done)
-done
|
[-]
[+]
|
Deleted |
_service:tar_git:mimic-1.2.0.3.tar.gz/mimic/flite_notes/Flite_Dependencies.mm
^
|
@@ -1,351 +0,0 @@
-<map version="0.9.0">
-<!-- To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net -->
-<node CREATED="1454700618114" ID="ID_193781555" MODIFIED="1454702022004" STYLE="fork" TEXT="Flite Dependencies">
-<node CREATED="1454701962569" ID="ID_64691784" MODIFIED="1454705045921" POSITION="right" STYLE="bubble" TEXT="main">
-<icon BUILTIN="folder"/>
-<node CREATED="1454700948781" HGAP="25" ID="ID_1934972025" MODIFIED="1454705055774" STYLE="bubble" TEXT="mimic_main.c" VSHIFT="3">
-<node CREATED="1454701869434" ID="ID_1329754322" MODIFIED="1454705045922" STYLE="bubble" TEXT="include">
-<icon BUILTIN="folder"/>
-<node CREATED="1454700966845" ID="ID_1056917830" MODIFIED="1454707258962" TEXT="mimic.h">
-<node CREATED="1454701483358" ID="ID_865582417" MODIFIED="1454705045923" TEXT="cst_string.h"/>
-<node CREATED="1454701536052" ID="ID_136442307" MODIFIED="1454705045923" TEXT="cst_regex.h">
-<node CREATED="1454702317037" ID="ID_1036929866" MODIFIED="1454705045923" TEXT="cst_file.h"/>
-<node CREATED="1454702361099" ID="ID_419456838" MODIFIED="1454705045923" TEXT="cst_string.h"/>
-</node>
-<node CREATED="1454701547179" ID="ID_1696455494" MODIFIED="1454705045923" TEXT="cst_val.h">
-<node CREATED="1454702641484" ID="ID_925807975" MODIFIED="1454705045923" TEXT="cst_file.h"/>
-<node CREATED="1454702661615" ID="ID_38399503" MODIFIED="1454705045923" TEXT="cst_string.h"/>
-<node CREATED="1454702672979" ID="ID_1592211033" MODIFIED="1454705045923" TEXT="cst_error.h"/>
-<node CREATED="1454702684780" ID="ID_609860600" MODIFIED="1454705045924" TEXT="cst_alloc.h"/>
-<node CREATED="1454702700907" ID="ID_1730112295" MODIFIED="1454705045924" TEXT="cst_val_defs.h"/>
-</node>
-<node CREATED="1454701565093" ID="ID_223829576" MODIFIED="1454705045924" TEXT="cst_features.h">
-<node CREATED="1454702902853" ID="ID_29553462" MODIFIED="1454705045924" TEXT="cst_alloc.h"/>
-<node CREATED="1454702913382" ID="ID_1276238363" MODIFIED="1454705045924" TEXT="cst_val.h"/>
-<node CREATED="1454702924004" ID="ID_1335403549" MODIFIED="1454705045924" TEXT="cst_string.h"/>
-</node>
-<node CREATED="1454701575012" ID="ID_1899257205" MODIFIED="1454705045924" TEXT="cst_item.h">
-<node CREATED="1454703006053" ID="ID_1096749177" MODIFIED="1454705045925" TEXT="cst_file.h"/>
-<node CREATED="1454703013691" ID="ID_1627421001" MODIFIED="1454705045925" TEXT="cst_features.h"/>
-</node>
-<node CREATED="1454701582965" ID="ID_369577516" MODIFIED="1454705045925" TEXT="cst_relation.h">
-<node CREATED="1454703071229" ID="ID_217320971" MODIFIED="1454705045925" TEXT="cst_file.h"/>
-<node CREATED="1454703111012" ID="ID_1606618043" MODIFIED="1454705045925" TEXT="cst_val.h"/>
-<node CREATED="1454703117558" ID="ID_1943382871" MODIFIED="1454705045925" TEXT="cst_features.h"/>
-<node CREATED="1454703127126" ID="ID_1143297006" MODIFIED="1454705045925" TEXT="cst_item.h"/>
-<node CREATED="1454703134123" ID="ID_1955712017" MODIFIED="1454705045925" TEXT="cst_utterance.h"/>
-</node>
-<node CREATED="1454701597589" ID="ID_799384072" MODIFIED="1454705045926" TEXT="cst_utterance.h">
-<node CREATED="1454703210262" ID="ID_1460733222" MODIFIED="1454705045926" TEXT="cst_file.h"/>
-<node CREATED="1454703219206" ID="ID_991655141" MODIFIED="1454705045926" TEXT="cst_val.h"/>
-<node CREATED="1454703223989" ID="ID_1097925957" MODIFIED="1454705045926" TEXT="cst_features.h"/>
-<node CREATED="1454703230917" ID="ID_844081763" MODIFIED="1454705045926" TEXT="cst_item.h"/>
-<node CREATED="1454703239509" ID="ID_1010494878" MODIFIED="1454705045926" TEXT="cst_relation.h"/>
-<node CREATED="1454703264333" ID="ID_889192042" MODIFIED="1454705045926" TEXT="cst_alloc.h"/>
-</node>
-<node CREATED="1454701613062" ID="ID_1963345345" MODIFIED="1454705045927" TEXT="cst_wave.h">
-<node CREATED="1454703327244" ID="ID_1383798873" MODIFIED="1454705045927" TEXT="cst_file.h"/>
-<node CREATED="1454703333439" ID="ID_412273176" MODIFIED="1454705045927" TEXT="cst_error.h"/>
-<node CREATED="1454703339181" ID="ID_1880750614" MODIFIED="1454705045927" TEXT="cst_alloc.h"/>
-<node CREATED="1454703346253" ID="ID_322202603" MODIFIED="1454705045927" TEXT="cst_endian.h"/>
-<node CREATED="1454703378909" ID="ID_1766617266" MODIFIED="1454705045927" TEXT="cst_val.h"/>
-</node>
-<node CREATED="1454701630965" ID="ID_307530306" MODIFIED="1454705045927" TEXT="cst_track.h">
-<node CREATED="1454703493972" ID="ID_1285350475" MODIFIED="1454705045927" TEXT="cst_file.h"/>
-<node CREATED="1454703502108" ID="ID_1357221392" MODIFIED="1454705045928" TEXT="cst_error.h"/>
-<node CREATED="1454703510413" ID="ID_1288732262" MODIFIED="1454705045928" TEXT="cst_alloc.h"/>
-<node CREATED="1454703516771" ID="ID_1185726727" MODIFIED="1454705045928" TEXT="cst_endian.h"/>
-<node CREATED="1454703524917" ID="ID_1715716072" MODIFIED="1454705045928" TEXT="cst_file.h"/>
-<node CREATED="1454703533843" ID="ID_1364975267" MODIFIED="1454705045928" TEXT="cst_val.h"/>
-</node>
-<node CREATED="1454702095788" ID="ID_1446396473" MODIFIED="1454705045928" TEXT="cst_cart.h">
-<node CREATED="1454703616317" ID="ID_418085648" MODIFIED="1454705045928" TEXT="cst_file.h"/>
-<node CREATED="1454703630396" ID="ID_1150155286" MODIFIED="1454705045929" TEXT="cst_val.h"/>
-<node CREATED="1454703634707" ID="ID_155878302" MODIFIED="1454705045929" TEXT="cst_features.h"/>
-<node CREATED="1454703640492" ID="ID_1887437259" MODIFIED="1454705045929" TEXT="cst_item.h"/>
-<node CREATED="1454703646053" ID="ID_1850649210" MODIFIED="1454705045929" TEXT="cst_relation.h"/>
-</node>
-<node CREATED="1454702102700" ID="ID_1572459738" MODIFIED="1454705045929" TEXT="cst_phoneset.h">
-<node CREATED="1454703729509" ID="ID_1012119751" MODIFIED="1454705045929" TEXT="cst_file.h"/>
-<node CREATED="1454703737498" ID="ID_299836496" MODIFIED="1454705045929" TEXT="cst_val.h"/>
-<node CREATED="1454703745515" ID="ID_289885428" MODIFIED="1454705045929" TEXT="cst_features.h"/>
-<node CREATED="1454703758310" ID="ID_1579160259" MODIFIED="1454705045930" TEXT="cst_item.h"/>
-</node>
-<node CREATED="1454702117157" ID="ID_438080058" MODIFIED="1454705045930" TEXT="cst_voice.h">
-<node CREATED="1454703838251" ID="ID_1704407356" MODIFIED="1454705045930" TEXT="cst_file.h"/>
-<node CREATED="1454703848043" ID="ID_363977063" MODIFIED="1454705045930" TEXT="cst_val.h"/>
-<node CREATED="1454703851948" ID="ID_846861102" MODIFIED="1454705045930" TEXT="cst_features.h"/>
-<node CREATED="1454703858982" ID="ID_120684283" MODIFIED="1454705045930" TEXT="cst_utterance.h"/>
-<node CREATED="1454703872653" ID="ID_1741246835" MODIFIED="1454705045930" TEXT="cst_relation.h"/>
-<node CREATED="1454703885435" ID="ID_652396610" MODIFIED="1454705045931" TEXT="cst_lexicon.h">
-<node CREATED="1454703943580" ID="ID_1594616120" MODIFIED="1454705045931" TEXT="cst_item.h"/>
-<node CREATED="1454703952068" ID="ID_1903374461" MODIFIED="1454705045931" TEXT="cst_lts.h">
-<node CREATED="1454703997611" ID="ID_1410761398" MODIFIED="1454705045931" TEXT="cst_val.h"/>
-</node>
-</node>
-</node>
-<node CREATED="1454702136572" ID="ID_355177648" MODIFIED="1454705045931" TEXT="cst_audio.h">
-<node CREATED="1454704061715" ID="ID_1764364019" MODIFIED="1454705045931" TEXT="cst_wave.h"/>
-<node CREATED="1454704068373" ID="ID_1170155332" MODIFIED="1454705045931" TEXT="cst_hrg.h">
-<node CREATED="1454704148995" ID="ID_1465968253" MODIFIED="1454705045931" TEXT="cst_file.h"/>
-<node CREATED="1454704155045" ID="ID_487564090" MODIFIED="1454705045932" TEXT="cst_val.h"/>
-<node CREATED="1454704159331" ID="ID_1945477233" MODIFIED="1454705045932" TEXT="cst_features.h"/>
-<node CREATED="1454704164732" ID="ID_513786838" MODIFIED="1454705045932" TEXT="cst_item.h"/>
-<node CREATED="1454704170221" ID="ID_293397214" MODIFIED="1454705045932" TEXT="cst_relation.h"/>
-<node CREATED="1454704181843" ID="ID_854205686" MODIFIED="1454705045932" TEXT="cst_utterance.h"/>
-</node>
-</node>
-<node CREATED="1454702143763" ID="ID_1724025351" MODIFIED="1454705045932" TEXT="cst_utt_utils.h">
-<node CREATED="1454704240445" ID="ID_351307489" MODIFIED="1454705045932" TEXT="cst_hrg.h"/>
-<node CREATED="1454704252629" ID="ID_881179018" MODIFIED="1454705045933" TEXT="cst_wave.h"/>
-</node>
-<node CREATED="1454702160211" ID="ID_1678484858" MODIFIED="1454705045933" TEXT="cst_lexicon.h">
-<node CREATED="1454704278381" ID="ID_481307560" MODIFIED="1454705045933" TEXT="cst_item.h"/>
-<node CREATED="1454704293021" ID="ID_1430928074" MODIFIED="1454705045933" TEXT="cst_lts.h">
-<node CREATED="1454704319068" ID="ID_522041904" MODIFIED="1454705045933" TEXT="cst_val.h"/>
-</node>
-</node>
-<node CREATED="1454702185613" ID="ID_129127565" MODIFIED="1454705045933" TEXT="cst_synth.h">
-<node CREATED="1454704373468" ID="ID_1052463327" MODIFIED="1454705045933" TEXT="cst_hrg.h"/>
-<node CREATED="1454704379829" ID="ID_710590005" MODIFIED="1454705045934" TEXT="cst_tokenstream.h"/>
-<node CREATED="1454704389198" ID="ID_1190638139" MODIFIED="1454705045934" TEXT="cst_voice.h"/>
-<node CREATED="1454704396995" ID="ID_1809102243" MODIFIED="1454705045934" TEXT="cst_wave.h"/>
-</node>
-<node CREATED="1454702193470" ID="ID_870380302" MODIFIED="1454705045934" TEXT="cst_units.h">
-<node CREATED="1454704525819" ID="ID_1037498045" MODIFIED="1454705045934" TEXT="cst_file.h"/>
-<node CREATED="1454704539222" ID="ID_321329312" MODIFIED="1454705045934" TEXT="cst_hrg.h"/>
-<node CREATED="1454704549989" ID="ID_1876029900" MODIFIED="1454705045934" TEXT="cst_sts.h">
-<node CREATED="1454704606614" ID="ID_1819774282" MODIFIED="1454705045934" TEXT="cst_wave.h"/>
-<node CREATED="1454704616093" ID="ID_1920892346" MODIFIED="1454705045935" TEXT="cst_audio.h"/>
-</node>
-</node>
-<node CREATED="1454702200571" ID="ID_1895484756" MODIFIED="1454705045935" TEXT="cst_tokenstream.h">
-<node CREATED="1454704451571" ID="ID_667278299" MODIFIED="1454705045935" TEXT="cst_alloc.h"/>
-<node CREATED="1454704460795" ID="ID_190923604" MODIFIED="1454705045935" TEXT="cst_string.h"/>
-<node CREATED="1454704468934" ID="ID_161604241" MODIFIED="1454705045935" TEXT="cst_file.h"/>
-<node CREATED="1454704473236" ID="ID_1915598941" MODIFIED="1454705045935" TEXT="cst_features.h"/>
-</node>
-</node>
-<node CREATED="1454701326669" ID="ID_1653932057" MODIFIED="1454705045935" TEXT="mimic_version.h"/>
-</node>
-</node>
-</node>
-<node CREATED="1454704994462" ID="ID_639571460" MODIFIED="1454706322252" POSITION="left" STYLE="bubble" TEXT="src">
-<icon BUILTIN="folder"/>
-<node CREATED="1454705084596" ID="ID_1946399624" MODIFIED="1454708360518" TEXT="audio">
-<icon BUILTIN="folder"/>
-<node CREATED="1454705162740" ID="ID_720324850" MODIFIED="1454705451632" TEXT="au_alsa.c">
-<node CREATED="1454705225141" ID="ID_833621996" MODIFIED="1454705502353" TEXT="include">
-<icon BUILTIN="folder"/>
-<node CREATED="1454705237908" ID="ID_1997728177" MODIFIED="1454705265895" TEXT="cst_string.h"/>
-<node CREATED="1454705267133" ID="ID_130478854" MODIFIED="1454705274673" TEXT="cst_wave.h"/>
-<node CREATED="1454705274941" ID="ID_1167604796" MODIFIED="1454705281918" TEXT="cst_audio.h"/>
-</node>
-</node>
-<node CREATED="1454705332117" ID="ID_952521083" MODIFIED="1454705385662" TEXT="au_command.c">
-<node CREATED="1454705355365" ID="ID_334151745" MODIFIED="1454705363882" TEXT="include">
-<icon BUILTIN="folder"/>
-<node CREATED="1454705394292" ID="ID_643399883" MODIFIED="1454705402037" TEXT="cst_audio.h"/>
-</node>
-</node>
-<node CREATED="1454705479318" ID="ID_714732635" MODIFIED="1454705600166" TEXT="au_none.c">
-<node CREATED="1454705225141" ID="ID_143079224" MODIFIED="1454705502353" TEXT="include">
-<icon BUILTIN="folder"/>
-<node CREATED="1454705237908" ID="ID_183963288" MODIFIED="1454705265895" TEXT="cst_string.h"/>
-<node CREATED="1454705267133" ID="ID_1862820189" MODIFIED="1454705274673" TEXT="cst_wave.h"/>
-<node CREATED="1454705274941" ID="ID_1937488573" MODIFIED="1454705281918" TEXT="cst_audio.h"/>
-</node>
-</node>
-<node CREATED="1454706030245" ID="ID_229253809" MODIFIED="1454706116756" TEXT="au_palmos.c">
-<node CREATED="1454705225141" ID="ID_1567057032" MODIFIED="1454705502353" TEXT="include">
-<icon BUILTIN="folder"/>
-<node CREATED="1454706129691" ID="ID_1350720339" MODIFIED="1454706138296" TEXT="cst_file.h"/>
-<node CREATED="1454705237908" ID="ID_1089962875" MODIFIED="1454705265895" TEXT="cst_string.h"/>
-<node CREATED="1454705267133" ID="ID_713377009" MODIFIED="1454705274673" TEXT="cst_wave.h"/>
-<node CREATED="1454705274941" ID="ID_740517219" MODIFIED="1454705281918" TEXT="cst_audio.h"/>
-</node>
-</node>
-<node CREATED="1454705637740" ID="ID_1028361878" MODIFIED="1454705648084" TEXT="auserver.c">
-<node CREATED="1454705225141" ID="ID_1274709740" MODIFIED="1454705502353" TEXT="include">
-<icon BUILTIN="folder"/>
-<node CREATED="1454705743462" ID="ID_1220946906" MODIFIED="1454705753001" TEXT="cst_socket.h"/>
-<node CREATED="1454705237908" ID="ID_1355017692" MODIFIED="1454705265895" TEXT="cst_string.h"/>
-<node CREATED="1454705267133" ID="ID_768403245" MODIFIED="1454705274673" TEXT="cst_wave.h"/>
-<node CREATED="1454705724172" ID="ID_620011331" MODIFIED="1454705735102" TEXT="cst_file.h"/>
-<node CREATED="1454705274941" ID="ID_1933680628" MODIFIED="1454705281918" TEXT="cst_audio.h"/>
-</node>
-</node>
-<node CREATED="1454706327037" ID="ID_1647665628" MODIFIED="1454706357261" TEXT="au_sun.c">
-<node CREATED="1454705225141" ID="ID_1511218583" MODIFIED="1454705502353" TEXT="include">
-<icon BUILTIN="folder"/>
-<node CREATED="1454705237908" ID="ID_398926454" MODIFIED="1454705265895" TEXT="cst_string.h"/>
-<node CREATED="1454705267133" ID="ID_1760573540" MODIFIED="1454705274673" TEXT="cst_wave.h"/>
-<node CREATED="1454705274941" ID="ID_701525845" MODIFIED="1454705281918" TEXT="cst_audio.h"/>
-</node>
-</node>
-<node CREATED="1454706472109" ID="ID_1658090112" MODIFIED="1454706488119" TEXT="auclient.c">
-<node CREATED="1454705225141" ID="ID_1078031481" MODIFIED="1454705502353" TEXT="include">
-<icon BUILTIN="folder"/>
-<node CREATED="1454705743462" ID="ID_190939059" MODIFIED="1454705753001" TEXT="cst_socket.h"/>
-<node CREATED="1454705237908" ID="ID_459114804" MODIFIED="1454705265895" TEXT="cst_string.h"/>
-<node CREATED="1454705267133" ID="ID_1379602508" MODIFIED="1454705274673" TEXT="cst_wave.h"/>
-<node CREATED="1454705724172" ID="ID_1264568707" MODIFIED="1454705735102" TEXT="cst_file.h"/>
-<node CREATED="1454705274941" ID="ID_189947545" MODIFIED="1454705281918" TEXT="cst_audio.h"/>
-</node>
-</node>
-<node CREATED="1454706595908" ID="ID_542217405" MODIFIED="1454706604741" TEXT="audio.c">
-<node CREATED="1454705225141" ID="ID_1663690308" MODIFIED="1454705502353" TEXT="include">
-<icon BUILTIN="folder"/>
-<node CREATED="1454705237908" ID="ID_1469346993" MODIFIED="1454705265895" TEXT="cst_string.h"/>
|
[-]
[+]
|
Deleted |
_service:tar_git:mimic-1.2.0.3.tar.gz/mimic/flite_notes/README.md
^
|
@@ -1,13 +0,0 @@
-#Flite Notes Directory
-
-This directory is for notes taken while getting acquainted with the flite source code.
-This dir and its contents are intended to be removed once mimic can stand on its own feet, as it were.
-
-###Flite Dependency Mindmap
-
-Flite_Dependencies.mm
-
->A visual aid to get a better understanding of flite's overall structure.
-Use the program 'freemind' to view.
-Not yet complete.
-
|
[-]
[+]
|
Deleted |
_service:tar_git:mimic-1.2.0.3.tar.gz/mimic/include/cst_icu.h
^
|
@@ -1,48 +0,0 @@
-/*
- * Copyright 2016 Sergio Oller <sergioller@gmail.com>
-
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of the nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-#ifndef CST_ICU_H__
-#define CST_ICU_H__
-
-#include "config.h"
-#include <stdint.h>
-#include <unicode/ustring.h>
-#include <unicode/ucasemap.h>
-#include <unicode/uregex.h>
-#include <unicode/utypes.h>
-#include <cst_string.h>
-
-cst_string *cst_tolower_l(const cst_string *in, const char *locale);
-cst_string *cst_toupper_l(const cst_string *in, const char *locale);
-URegularExpression *new_cst_uregex(cst_string *pattern, uint32_t flags);
-void delete_cst_uregex(URegularExpression * uregex);
-int cst_uregex_match(URegularExpression * uregex, const cst_string *str);
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:mimic-1.2.0.3.tar.gz/mimic/lang/cmulex/libmimic-cmulex.vcproj
^
|
@@ -1,214 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="libmimic-cmulex"
- ProjectGUID="{78B2092A-F5B1-456F-BAB1-A172AF5D84E4}"
- RootNamespace="libmimic-cmulex"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="..\..\lib"
- IntermediateDirectory="..\..\windows\build\Debug\cmulex"
- ConfigurationType="4"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\..\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB;"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- CompileAs="1"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="..\..\lib"
- IntermediateDirectory="..\..\windows\build\Release\cmulex"
- ConfigurationType="4"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..\..\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- CompileAs="1"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\cmu_lex.h"
- >
- </File>
- <File
- RelativePath=".\cmu_lts_model.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\cmu_lex.c"
- >
- </File>
- <File
- RelativePath=".\cmu_lex_data.c"
- >
- </File>
- <File
- RelativePath=".\cmu_lex_data_raw.c"
- >
- </File>
- <File
- RelativePath=".\cmu_lex_entries.c"
- >
- </File>
- <File
- RelativePath=".\cmu_lex_entries_huff_table.c"
- >
- </File>
- <File
- RelativePath=".\cmu_lex_num_bytes.c"
- >
- </File>
- <File
- RelativePath=".\cmu_lex_phones_huff_table.c"
- >
- </File>
- <File
- RelativePath=".\cmu_lts_model.c"
|
[-]
[+]
|
Deleted |
_service:tar_git:mimic-1.2.0.3.tar.gz/mimic/src/utils/cst_icu.c
^
|
@@ -1,124 +0,0 @@
-/*
- * icu functions
- *
- * Copyright 2016 Sergio Oller <sergioller@gmail.com>
-
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of the nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include "cst_icu.h"
-#include "cst_alloc.h"
-#include "cst_string.h"
-#include "cst_error.h"
-
-static cst_string *cst_to_l(const cst_string *in, const char *locale,
- int32_t (*func)(const UCaseMap *, char *, int32_t,
- const char *, int32_t,
- UErrorCode *))
-{
- if (locale == NULL)
- {
- locale = "C";
- }
- if (in == NULL)
- {
- return NULL;
- }
- cst_string *output = NULL;
- int32_t output_size;
- UCaseMap *csm;
- UErrorCode status = U_ZERO_ERROR;
- csm = ucasemap_open(locale, 0, &status);
- output_size = func(csm, NULL, 0, in, -1, &status);
- if (status == U_BUFFER_OVERFLOW_ERROR)
- {
- status = U_ZERO_ERROR;
- }
- output = cst_alloc(char, output_size + 1);
- func(csm, output, output_size + 1, in, -1, &status);
- ucasemap_close(csm);
- if (U_FAILURE(status))
- {
- cst_free(output);
- cst_errmsg
- ("Error lowering (with locale %s) the string %s.\nError message: %s",
- locale, in, u_errorName(status));
- return NULL;
- }
- return output;
-}
-
-
-cst_string *cst_tolower_l(const cst_string *in, const char *locale)
-{
- return cst_to_l(in, locale, ucasemap_utf8ToLower);
-}
-
-cst_string *cst_toupper_l(const cst_string *in, const char *locale)
-{
- return cst_to_l(in, locale, ucasemap_utf8ToUpper);
-}
-
-/* Compile regex */
-URegularExpression *new_cst_uregex(cst_string *pattern, uint32_t flags)
-{
- URegularExpression *output;
- UErrorCode status = U_ZERO_ERROR;
- output = uregex_openC((const char *) pattern, flags, NULL, &status);
- if (U_FAILURE(status))
- {
- cst_errmsg("Error creating uregex: %s", u_errorName(status));
- return NULL;
- }
- return output;
-}
-
-/* free regex */
-void delete_cst_uregex(URegularExpression * uregex)
-{
- uregex_close(uregex);
- return;
-}
-
-/* match regex string */
-int cst_uregex_match(URegularExpression * uregex, const cst_string *str)
-{
- UErrorCode status = U_ZERO_ERROR;
- UText *ut = NULL;
- UBool ismatch;
- ut = utext_openUTF8(ut, str, -1, &status);
- uregex_setUText(uregex, ut, &status);
- ismatch = uregex_matches(uregex, 0, &status);
- uregex_reset(uregex, 0, &status);
- if (U_FAILURE(status))
- {
- cst_errmsg("Error cst_uregex_match: %s", u_errorName(status));
- return -1;
- }
- return ((int) ismatch);
-}
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/.travis.yml
^
|
@@ -1,40 +1,70 @@
language: c
+sudo: false
+
+branches:
+ only:
+ - master
+ - development
matrix:
include:
- env: TASK="osx"
os: osx
compiler: clang
- - os: linux
- env: TASK="coverage" # code coverage
+# workaround travis error:
+# /Users/travis/build.sh: line 159: shell_session_update: command not found
+# https://github.com/bizz84/SwiftyStoreKit/commit/68a67eef94670964e62ea473860b82780c386c77
+ before_install:
+ - gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 || curl -sSL https://rvm.io/mpapis.asc | gpg --import -
+ - rvm get stable
+ - env: TASK="ios"
+ os: osx
+ compiler: clang
+# workaround travis error:
+# /Users/travis/build.sh: line 159: shell_session_update: command not found
+# https://github.com/bizz84/SwiftyStoreKit/commit/68a67eef94670964e62ea473860b82780c386c77
+ before_install:
+ - gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 || curl -sSL https://rvm.io/mpapis.asc | gpg --import -
+ - rvm get stable
+ - env: TASK="coverage" # code coverage
+ os: linux
+ dist: trusty
compiler: gcc
- sudo: false
+ addons: {apt: {packages: [libasound2-dev]}}
+ after_success: bash <(curl -s https://codecov.io/bash)
- env: TASK="shared" # shared libraries
os: linux
+ dist: trusty
compiler: gcc
- sudo: false
+ addons: {apt: {packages: [libasound2-dev]}}
- env: TASK="gcc6" # gcc-6
os: linux
+ dist: trusty
compiler: gcc-6
- sudo: false
+ addons: {apt: {packages: [libasound2-dev, gcc-6], sources: [ubuntu-toolchain-r-test]}}
- env: TASK="arm-linux-gnueabihf-gcc" # arm build
os: linux
- compiler: gcc
- sudo: false
+ dist: trusty
+ compiler: arm-linux-gnueabihf-gcc
+ addons: {apt: {packages: [pkg-config-arm-linux-gnueabihf, libc6-dev-armhf-cross, gcc-arm-linux-gnueabihf, binutils-arm-linux-gnueabihf]}}
- env: TASK="winbuild" # windows build
os: linux
- compiler: gcc
- sudo: false
- - env: TASK="winbuild_shared" # windows build shared libraries
- os: linux
- compiler: gcc
- sudo: false
+ dist: trusty
+ compiler: i686-w64-mingw32-gcc
+ addons: {apt: {packages: [wine, xvfb, binutils-mingw-w64-i686, mingw-w64-i686-dev, gcc-mingw-w64-i686]}}
+ # - env: TASK="winbuild_shared" # windows build shared libraries
+ #os: linux
+ #dist: trusty
+ #compiler: i686-w64-mingw32-gcc
+ #addons: {apt: {packages: [wine, xvfb, binutils-mingw-w64-i686, mingw-w64-i686-dev, gcc-mingw-w64-i686]}}
+
+jobs:
+ allow_failures:
+ - env: TASK="ios"
-script:
+script:
- ./run_testsuite.sh "$TASK"
-after_success:
- - if [ "x$TASK" = "xcoverage" ]; then bash <(curl -s https://codecov.io/bash); fi
env:
global:
@@ -43,28 +73,6 @@
- secure: "VQXmVb9lTL4Yo58doWyCkdPTaDoe7sHPnOMCcJMPuxOpK1d/JWkm9Pp2UV8L/32JkCOO32azPJ1R1nr7uz6GFs0CwNAW+FO24mRex/h3CaH33eu7fQkq4MwfBqa19qqPoUX7KB8iofT6KyRxNrC8Z+zYPR9gogP2VrLSldi0Wva3+On/9tnj+e0/Cy2lTfjyXGvdFoDCM+WtbVz38IZrrAl7TG9azCorM0AaHr1U57DNVKQNlWdTJLiN2tzc5971nA7/Ws+ZoNK2ZWV6fIghgLju/h25JIqKpXB/Wi5QyUWY0pZ5oAEfqIgJchZ3e5qLS4bARsJwXTL8BFfwStA05qBTKI5M0lj93u1/d4tuVJzSP5LTJJelFYPsLVtyOKglFHr/Pb4PhieHJXjr/jig8P48nP+jgXcQjpP4uLZ3D1Z01///QCWCiHXloSurQkA0fhQSyeCHGNiTPEjAYfcFAjlH5/C1tsRLIerxm8hdGDhF0x7lg9j069B0Yet5GINiBeBZdTph1r6YWYQUqAwb8gAYt20KE/i/f5TSIFOd9jDOrPHLgSZX0N+C7x6PqVTxBGMksNJtf+PNOrBC5+VbYxdw0ldX1AveBD4oW9bcJ9wo3rAsFGZ8q6Vnl0r3U48eKWtMUf4//aq4Ab1h/LP8t+c+XyEXfMNh4WpJ4lySn4s="
addons:
- apt:
- packages:
- - autotools-dev
- - autoconf
- - automake
- - libtool
- - pkg-config
- - libasound2-dev
- - libicu-dev
- - binutils-arm-linux-gnueabihf
- - gcc-arm-linux-gnueabihf
- - g++-arm-linux-gnueabihf
- - libc6-dev-armhf-cross
- - pkg-config-arm-linux-gnueabihf
- - mingw32
- - mingw32-runtime
- - wine
- - xvfb
- - gcc-6
- - g++-6
- sources:
- - sourceline: 'ppa:ubuntu-toolchain-r/test'
coverity_scan:
project:
name: "MycroftAI/mimic"
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/ACKNOWLEDGEMENTS
^
|
@@ -74,3 +74,4 @@
Unitran: unicode to sampa grapheme mapping tables
Sun Microsystems
g72x code
+Peter Drysdale: Hand optimized mlsa routine
|
[-]
[+]
|
Added |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/CODE_OF_CONDUCT.md
^
|
@@ -0,0 +1,46 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at kathy.reid@mycroft.ai. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
+
+[homepage]: http://contributor-covenant.org
+[version]: http://contributor-covenant.org/version/1/4/
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/COPYING
^
|
@@ -1,20 +1,813 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: Mimic
+Source: https://github.com/mycroftai/mimic
+Comment: Mimic is free software
+ Mimic is available under permissive BSD-like licenses
+ .
+ This file lists all the copyrights and licenses of mimic files.
+
+Files:
+ lang/vid_gb_ap/vid_gb_ap.c
+ lang/vid_gb_ap/vid_gb_ap_cg_01_mcep_trees.c
+ lang/vid_gb_ap/vid_gb_ap_cg_01_mcep_trees.h
+ lang/vid_gb_ap/vid_gb_ap_cg_01_params.c
+ lang/vid_gb_ap/vid_gb_ap_cg_08_durmodel.c
+ lang/vid_gb_ap/vid_gb_ap_cg_08_durmodel.h
+ lang/vid_gb_ap/vid_gb_ap_cg_10_durmodel.c
+ lang/vid_gb_ap/vid_gb_ap_cg_10_durmodel.h
+ lang/vid_gb_ap/vid_gb_ap_cg_12_mcep_trees.c
+ lang/vid_gb_ap/vid_gb_ap_cg_12_mcep_trees.h
+ lang/vid_gb_ap/vid_gb_ap_cg_12_params.c
+ lang/vid_gb_ap/vid_gb_ap_cg_17_durmodel.c
+ lang/vid_gb_ap/vid_gb_ap_cg_17_durmodel.h
+ lang/vid_gb_ap/vid_gb_ap_cg_17_mcep_trees.c
+ lang/vid_gb_ap/vid_gb_ap_cg_17_mcep_trees.h
+ lang/vid_gb_ap/vid_gb_ap_cg_17_params.c
+ lang/vid_gb_ap/vid_gb_ap_cg.c
+ lang/vid_gb_ap/vid_gb_ap_cg_f0_trees.c
+ lang/vid_gb_ap/vid_gb_ap_cg_f0_trees.h
+ lang/vid_gb_ap/vid_gb_ap_cg_phonestate.c
+ lang/vid_gb_ap/voxdefs.h
+ voices/mycroft_voice_4.0.flitevox
+Copyright: No copyright information
+License: No License Information
+
+Files:
+ unittests/cutest.h
+Copyright: 2013-2017 Martin Mitáš
+License: MIT/X11 (BSD like)
+
+Files:
+ doc/alice
+Copyright: public domain
+License: public-domain
+Comment:
+ Is the first two chapters of Alice in Wonderland as distributed by the
+ Gutenburg project and is now in the public domain
+
+Files:
+ lang/cmulex/make_cmulex_helper.py
+Copyright:
+ 2016 Sergio Oller
+ 2010-2014 Peter Norvig
+License: BSD-3-clause
+
+Files:
+ include/cst_uregex.h
+ src/utils/cst_uregex.c
+ lang/es_lang/es_init.c
+ lang/es_lang/es_text_analysis.c
+ lang/es_lang/es_tokenizer.c
+ lang/es_lang/es_lang.h
+Copyright:
+ 2016 Sergio Oller
+License: BSD-3-clause
+
+Files:
+ autogen.sh
+ codecov.yml
+ configure.ac
+ COPYING
+ do_gcov.sh
+ Makefile.am
+ man/man1/mimic.1
+ mimic.pc.in
+ run_testsuite.sh
+ dependencies.sh
+ .travis.yml
+Copyright:
+ 2016-2017 Sergio Oller
+ 2016-2017 Åke Forslund
+License: flite
+
+
+Files:
+ gen_ctags.sh
+Copyright: 2016 Nicholas Peterson
+
+Files:
+ README.md
+Copyright:
+ 2016 Nicholas Peterson
+ 2016-2017 Sergio Oller
+ 2016-2017 Åke Forslund
+License: flite
+
+
+Files:
+ include/cst_alloc.h
+ include/cst_cart.h
+ include/cst_cg.h
+ include/cst_endian.h
+ include/cst_item.h
+ include/cst_string.h
+ include/cst_tokenstream.h
+ include/cst_wave.h
+ include/mimic.h
+ lang/cmulex/make_cmulex
+ main/mimic_lang_list.c
+ main/mimic_voice_list.c
+ src/audio/au_alsa.c
+ src/audio/auclient.c
+ src/audio/audio.c
+ src/audio/au_none.c
+ src/audio/au_oss.c
+ src/audio/au_portaudio.c
+ src/audio/au_pulseaudio.c
+ src/audio/auserver.c
+ src/audio/au_streaming.c
+ src/audio/au_sun.c
+ src/audio/native_audio.h
+ src/utils/cst_tokenstream.c
+ unittests/data.one
+ unittests/data_utf8.txt
+ unittests/es_text.txt
+ unittests/es_tokenstream_test_main.c
+ unittests/hrg_test_main.c
+ unittests/lex_test_main.c
+ unittests/lts_test_main.c
+ unittests/nums_test_main.c
+ unittests/regex_test_main.c
+ unittests/string_test_main.c
+ unittests/token_test_main.c
+ unittests/voice_select_test_main.c
+ unittests/wave_test_main.c
+Copyright:
+ 1999-2014 Language Technologies Institute, Carnegie Mellon University
+ 2016-2017 Sergio Oller
+ 2016-2017 Åke Forslund
+License: flite
+
+Files:
+ include/flite_hts_engine.h
+ src/hts/flite_hts_engine.c
+Copyright:
+ 2005-2016 Nagoya Institute of Technology, Department of Computer Science
+ 2005-2008 Tokyo Institute of Technology, Interdisciplinary Graduate School
+ of Science and Engineering
+ 2017 Sergio Oller
+License: BSD-3-clause
+
+Files:
+ src/hts/hts_engine_API/include/HTS_engine.h
+ src/hts/hts_engine_API/lib/HTS_audio.c
+ src/hts/hts_engine_API/lib/HTS_engine.c
+ src/hts/hts_engine_API/lib/HTS_gstream.c
+ src/hts/hts_engine_API/lib/HTS_hidden.h
+ src/hts/hts_engine_API/lib/HTS_label.c
+ src/hts/hts_engine_API/lib/HTS_misc.c
+ src/hts/hts_engine_API/lib/HTS_model.c
+ src/hts/hts_engine_API/lib/HTS_pstream.c
+ src/hts/hts_engine_API/lib/HTS_sstream.c
+ src/hts/hts_engine_API/lib/HTS_vocoder.c
+Copyright:
+ 2005-2016 Nagoya Institute of Technology, Department of Computer Science
+ 2005-2008 Tokyo Institute of Technology, Interdisciplinary Graduate School
+ of Science and Engineering
+License: BSD-3-clause
+
+
+Files:
+ include/cst_audio.h
+Copyright:
+ 1999-2014 Language Technologies Institute, Carnegie Mellon University
+ 2016 Markus Toman
+ 2016-2017 Sergio Oller
+ 2016-2017 Åke Forslund
+License: flite
+
+
+Files:
+ src/audio/au_wince.c
+ src/utils/cst_mmap_none.c
+ src/utils/cst_mmap_posix.c
+ src/utils/cst_mmap_win32.c
+ src/utils/cst_file_stdio.c
+Copyright:
+ 2001 Cepstral, LLC
+ 2016 Åke Forslund
+License: flite
+
+Files:
+ ACKNOWLEDGEMENTS
+ doc/intro.txt
+ include/cst_args.h
+ include/cst_clunits.h
+ include/cst_diphone.h
+ include/cst_error.h
+ include/cst_features.h
+ include/cst_ffeatures.h
|
[-]
[+]
|
Added |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/ISSUE_TEMPLATE.md
^
|
@@ -0,0 +1,58 @@
+# How to submit an Issue to a Mycroft repository
+
+When submitting an Issue to a Mycroft repository, please follow these guidelines to help us help you.
+
+## Be clear about the software, hardware and version you are running
+
+For example:
+
+* I'm running a Mark 1
+* With version 0.9.10 of the Mycroft software
+* With the standard Wake Word
+
+## Try to provide steps that we can use to replicate the Issue
+
+For example:
+
+1. Burn the 0.9.10 image to Micro SD card using Etcher
+2. Seat the Micro SD card in the RPi 3
+3. Boot Picroft
+4. Wait 3 minutes
+5. The red light will come on indicating that the RPi 3 is overheating
+6. Running `htop` via the command line indicates a number of Zombie'd processes
+
+## Be as specific as possible about the expected condition, and the deviation from expected condition.
+
+This is called _object-deviation format_. Specify the object, then the deviation of the object from an expected condition.
+
+Example 1:
+
+* When I say "Hey Mycroft, set your eyes to cadet blue", the eyes turn purple instead of blue.
+
+Example 2:
+
+* When I say "Hey Mycroft, what time is it in Paris", the time spoken is out by one hour - it's not observing daylight savings time.
+
+Example 3:
+
+* When I run `msm default` on my Mark 1, I receive lots of Git 'locked file' errors on the command line.
+
+## Provide log files or other output to help us see the error
+
+We will normally require log files or other troubleshooting information to assist you with your Issue.
+
+This [documentation](https://mycroft.ai/documentation/troubleshooting/) explains how to find log files.
+
+As of version 0.9.10, the [Support Skill](https://github.com/MycroftAI/skill-support) also helps to automate gathering support information.
+
+Simply say:
+
+* "Create a support ticket" _or_
+* "You're not working!" _or_
+* "Send me debug info"
+
+and the Skill will put together a support package which you can email to us.
+
+## Upload any files to the Issue that will be useful in helping us to investigate
+
+Please ensure you upload any relevant files - such as screenshots - which will aid us investigating.
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/Makefile.am
^
|
@@ -1,6 +1,6 @@
ACLOCAL_AMFLAGS = -I m4
-AM_CPPFLAGS = -Wall -Werror -I$(top_srcdir)/include $(ICU_CFLAGS)
+AM_CPPFLAGS = -Wall -Werror -I$(top_srcdir)/include $(PCRE2_CFLAGS)
SUBDIRS = .
@@ -18,7 +18,7 @@
libttsmimic_la_SOURCES =
libttsmimic_la_CFLAGS =
libttsmimic_la_LDFLAGS = -no-undefined
-libttsmimic_la_LIBADD = $(ICU_LIBS)
+libttsmimic_la_LIBADD = $(PCRE2_LIBS)
libttsmimic_lang_all_langs_la_SOURCES = main/mimic_lang_list.c
libttsmimic_lang_all_langs_la_LDFLAGS = -no-undefined
@@ -32,6 +32,9 @@
pkgconfiginstalldir = $(libdir)/pkgconfig
pkgconfiginstall_DATA = mimic.pc
+voicesinstalldir = $(pkgdatadir)/voices
+voicesinstall_DATA =
+
################## START: LANG_USENGLISH #################################
if LANG_USENGLISH
lib_LTLIBRARIES += libttsmimic_lang_usenglish.la
@@ -125,6 +128,25 @@
################# END: LANG_INDIC ########################################
+############## START: LANG_ES_ANALYSIS #################################
+if LANG_ES_ANALYSIS
+ lib_LTLIBRARIES += libttsmimic_lang_es.la
+ libttsmimic_lang_all_langs_la_LIBADD += libttsmimic_lang_es.la
+endif
+
+libttsmimic_lang_es_la_LDFLAGS = -no-undefined
+libttsmimic_lang_es_la_LIBADD = libttsmimic.la
+libttsmimic_lang_es_la_SOURCES = \
+ lang/es_lang/es_init.c \
+ lang/es_lang/es_lang.h \
+ lang/es_lang/es_text_analysis.c \
+ lang/es_lang/es_tokenizer.c
+
+langheader_HEADERS += \
+ lang/es_lang/es_lang.h
+
+############## END: LANG_ES_ANALYSIS ##################################
+
############## START: LEX_CMULEX #########################################
if LEX_CMULEX
lib_LTLIBRARIES += libttsmimic_lang_cmulex.la
@@ -373,6 +395,30 @@
libttsmimic_lang_cmulex.la \
libttsmimic_lang_usenglish.la
+###############
+
+if VOICE_CMU_US_SLT_HTS
+ lib_LTLIBRARIES += libttsmimic_lang_cmu_us_slt_hts.la
+ libttsmimic_lang_all_voices_la_LIBADD += libttsmimic_lang_cmu_us_slt_hts.la
+ voicesinstall_DATA += voices/cmu_us_slt_hts.htsvoice
+else
+ EXTRA_DIST += voices/cmu_us_slt_hts.htsvoice
+endif
+
+libttsmimic_lang_cmu_us_slt_hts_la_LDFLAGS = -no-undefined
+libttsmimic_lang_cmu_us_slt_hts_la_SOURCES = \
+ lang/cmu_us_slt_hts/cmu_us_slt_hts.c \
+ lang/cmu_us_slt_hts/voxdefs.h
+
+libttsmimic_lang_cmu_us_slt_hts_la_CFLAGS = \
+ -I$(top_srcdir)/lang/usenglish \
+ -I$(top_srcdir)/lang/cmulex
+
+libttsmimic_lang_cmu_us_slt_hts_la_LIBADD = \
+ libttsmimic.la \
+ libttsmimic_lang_cmulex.la \
+ libttsmimic_lang_usenglish.la
+
###########
@@ -434,10 +480,10 @@
src/audio/au_wince.c \
src/audio/native_audio.h
-libttsmimic_la_CFLAGS += $(AUDIODEFS)
+libttsmimic_la_CFLAGS += $(AUDIODEFS) -DPKGDATADIR='"$(pkgdatadir)"'
libttsmimic_la_SOURCES += $(src_audio_SOURCES)
-libttsmimic_la_LIBADD += $(AUDIOLIBS)
+libttsmimic_la_LIBADD += $(AUDIOLIBS) $(HTS_LIBS)
###### src/cg ##################
libttsmimic_la_SOURCES += \
@@ -463,6 +509,28 @@
src/hrg/cst_ffeature.c \
src/hrg/cst_rel_io.c
+####### src/hts ###############
+libttsmimic_la_SOURCES += \
+ src/hts/flite_hts_engine.c
+
+if HTSEngineBundled
+ AM_CPPFLAGS += -I$(top_srcdir)/src/hts/hts_engine_API/include
+ headers_HEADERS +=src/hts/hts_engine_API/include/HTS_engine.h
+ libttsmimic_la_SOURCES += \
+ src/hts/hts_engine_API/lib/HTS_audio.c \
+ src/hts/hts_engine_API/lib/HTS_engine.c \
+ src/hts/hts_engine_API/lib/HTS_hidden.h \
+ src/hts/hts_engine_API/lib/HTS_misc.c \
+ src/hts/hts_engine_API/lib/HTS_pstream.c \
+ src/hts/hts_engine_API/lib/HTS_sstream.c \
+ src/hts/hts_engine_API/lib/HTS_model.c \
+ src/hts/hts_engine_API/lib/HTS_vocoder.c \
+ src/hts/hts_engine_API/lib/HTS_gstream.c \
+ src/hts/hts_engine_API/lib/HTS_label.c
+else
+ libttsmimic_la_LIBADD += $(HTS_LIBS)
+endif
+
###### src/lexicon #########
libttsmimic_la_SOURCES += \
@@ -526,8 +594,8 @@
src/utils/cst_socket.c \
src/utils/cst_string.c \
src/utils/cst_tokenstream.c \
+ src/utils/cst_uregex.c \
src/utils/cst_url.c \
- src/utils/cst_icu.c \
src/utils/cst_val.c \
src/utils/cst_val_const.c \
src/utils/cst_val_user.c \
@@ -600,6 +668,17 @@
endif
endif
+if LANG_ES_ANALYSIS
+ myunittests += unittests/es_tokenstream_test
+ unittests_es_tokenstream_test_SOURCES = unittests/es_tokenstream_test_main.c
+ unittests_es_tokenstream_test_CFLAGS = \
+ -DTEST_FILE=\"$(top_srcdir)/unittests/es_text.txt\" \
+ -I$(top_srcdir)/lang/es_lang
+ unittests_es_tokenstream_test_LDADD = libttsmimic.la \
+ libttsmimic_lang_es.la
+endif
+
+
check_PROGRAMS = $(myunittests)
unittests_lex_test_SOURCES = unittests/lex_test_main.c
@@ -623,7 +702,7 @@
unittests_regex_test_LDADD = libttsmimic.la
unittests_string_test_SOURCES = unittests/string_test_main.c
-unittests_string_test_LDADD = libttsmimic.la $(ICU_LIBS)
+unittests_string_test_LDADD = libttsmimic.la $(PCRE2_LIBS)
unittests_token_test_SOURCES = unittests/token_test_main.c
@@ -687,7 +766,8 @@
testsuite/play_server \
testsuite/play_sync \
testsuite/play_wave \
- testsuite/rfc
+ testsuite/rfc \
+ testsuite/time_voice_load
if LEX_CMULEX
check_PROGRAMS += testsuite/utt_test
@@ -758,6 +838,9 @@
testsuite_utt_test_SOURCES = testsuite/utt_test_main.c
testsuite_utt_test_LDADD = libttsmimic.la libttsmimic_lang_all_langs.la libttsmimic_lang_cmulex.la
+testsuite_time_voice_load_SOURCES = testsuite/time_voice_load.c
+testsuite_time_voice_load_LDADD = libttsmimic_lang_all_langs.la libttsmimic_lang_all_voices.la libttsmimic.la -lm
+
TESTS += $(myunittests)
# "testsuite/multi_thread_run.sh"
@@ -776,7 +859,6 @@
include/cst_ffeatures.h \
include/cst_file.h \
include/cst_hrg.h \
- include/cst_icu.h \
include/cst_item.h \
include/cst_lexicon.h \
include/cst_lts.h \
@@ -793,6 +875,7 @@
include/cst_tokenstream.h \
include/cst_track.h \
include/cst_units.h \
+ include/cst_uregex.h \
include/cst_utterance.h \
include/cst_utt_utils.h \
include/cst_val_const.h \
@@ -802,5 +885,14 @@
|
[-]
[+]
|
Added |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/PULL_REQUEST_TEMPLATE.md
^
|
@@ -0,0 +1,6 @@
+* Description of what the PR does, such as fixes # {issue number}
+
+* Description of how to validate or test this PR
+
+* Whether you have signed a CLA (Contributor Licensing Agreement)
+
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/README.md
^
|
@@ -1,4 +1,4 @@
-#Mimic - The Mycroft TTS Engine
+# Mimic - The Mycroft TTS Engine
[![Stories in Ready](https://badge.waffle.io/MycroftAI/mimic.png?label=ready&title=Ready)](https://waffle.io/MycroftAI/mimic)
[![Build Status](https://travis-ci.org/MycroftAI/mimic.svg?branch=development)](https://travis-ci.org/MycroftAI/mimic)
@@ -7,10 +7,10 @@
Mimic is a fast, lightweight Text-to-speech engine developed by [Mycroft A.I.](https://mycroft.ai/) and [VocaliD](https://vocalid.co/), based on Carnegie Mellon University’s [Flite (Festival-Lite)](http://www.festvox.org/flite) software. Mimic takes in text and reads it out loud to create a high quality voice.
-######Official project site: [mimic.mycroft.ai](https://mimic.mycroft.ai/)
+###### Official project site: [mimic.mycroft.ai](https://mimic.mycroft.ai/)
-##Supported platforms
+## Supported platforms
- Linux (ARM & Intel architectures)
- Mac OS X
@@ -22,114 +22,109 @@
**Future**
- iOS
-##Requirements
+## Requirements
-###Linux
+This is the list of requirements. Below there is the commands needed on the most
+popular distributions and supported OS.
-- A good C compiler (_Recommended:_ gcc or clang)
-- GNU make
-- automake and libtool
+- A good C compiler:
+ * Linux or Mac OSX: _Recommended:_ gcc or clang
+ * Windows: _Recommended:_ GCC under [Cygwin](https://cygwin.com/) or [mingw32](http://www.mingw.org/)
+- GNU make, automake and libtool
- pkg-config
-- ALSA/PortAudio/PulseAudio (_Recommended:_ ALSA)
-- ICU library and headers
+- Optionally, PCRE2 library and headers (they are compiled otherwise)
+- An audio engine:
+ * Linux: ALSA/PortAudio/PulseAudio (_Recommended:_ ALSA)
+ * Mac OSX: PortAudio
+ * Windows: PortAudio
-####Instructions
+### Linux
-- Install *gcc*, *make*, *automake*, *libtool*, *pkg-config*, *libicu-dev* and *ALSA*
+##### On Debian/Ubuntu
+```
+$ sudo apt-get install gcc make pkg-config automake libtool libasound2-dev
+```
-#####On Debian/Ubuntu
+##### On Fedora
```
-$ sudo apt-get install gcc make pkg-config automake libtool libicu-dev libasound2-dev
+$ sudo dnf install gcc make pkgconfig automake libtool alsa-lib-devel
```
-###Mac OSX
+##### On Arch
+```
+$ sudo pacman -S --needed install gcc make pkg-config automake libtool alsa-lib
+```
-- A good C compiler. (_Recommended:_ gcc or clang)
-- GNU make
-- pkg-config
-- PortAudio
-- ICU library
-####Instructions
+### Mac OSX
- Install *Brew*
```
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
```
-- Install *pkg-config*, *libtool*, *icu* and *PortAudio*
+- Install *pkg-config*, *automake*, *libtool*, *pcre2* and *PortAudio*
```
- $ brew install pkg-config libtool portaudio icu4c
+ $ brew install pkg-config automake libtool portaudio pcre2
```
-###Windows
+### Windows
#### Cross compiling:
The fastest and most straightforward way to build mimic for windows is by
-cross-compilation from linux.
-
-From a debian based linux system, install the dependencies, including mingw32
-packages. Install `wine` too for testing
-
-1. Install dependencies:
+cross-compilation from linux. This requires some additional packages to be
+installed.
+On Ubuntu 16.04 (xenial):
```
-sudo apt-get install gcc make pkg-config automake libtool libicu-dev mingw32 mingw32-runtime wine
-```
+sudo apt-get install gcc make pkg-config automake libtool libpcre2-dev wine binutils-mingw-w64-i686 mingw-w64-i686-dev gcc-mingw-w64-i686
-2. Run the windows build script:
```
-./run_testsuite.sh winbuild
-```
-
-3. Test it
-The directory `install` will contain `bin/mimic.exe` file
+On Ubuntu 14.04 (trusty):
```
-wine ./mimic.exe -t "hello world"
+sudo apt-get install gcc make pkg-config automake libtool mingw32 mingw32-runtime wine
```
-4. Distribute it
-
-You can distribute the compiled mimic by adding to a zip file everything in the
-`install/bin` directory.
-
#### Native Windows building
-* A good C compiler (_Recommended:_ GCC under [Cygwin](https://cygwin.com/) or [mingw32](http://www.mingw.org/))
-* GNU Make
-* PortAudio
-* ICU
-
-######Note
-- Audio device and audio libraries are optional, as mimic can write its output to a waveform file
+- Audio device and audio libraries are optional, as mimic can write its output to a waveform file.
- Some of the source files are quite large, that some C compilers might choke on these. So, *gcc* is recommended.
- Visual C++ 6.0 is known to fail on the large diphone database files
-- The build process is much slower on Windows.
+- The build process is **MUCH** slower on Windows.
+
-##Build
+## Build
+
+### On a native build (not cross-compilation)
- Clone the repository
```
- $ git clone https://github.com/MycroftAI/mimic.git
+ $ git clone https://github.com/MycroftAI/mimic1.git
```
- Navigate to mimic directory
```
- $ cd mimic
+ $ cd mimic1
+ ```
+
+- Build and install missing dependencies (pcre2)
+ ```
+ $ ./dependencies.sh --prefix="/usr/local"
```
-- Generate build scripts
+- Generate mimic build scripts
```
$ ./autogen.sh
```
-- Configure
+- Configure.
+
```
- $ ./configure
+ $ ./configure --prefix="/usr/local"
```
- Build
@@ -142,166 +137,198 @@
$ make check
```
-######Note
+### Cross compilation:
+
+- Run the windows build script:
+
+```
+./run_testsuite.sh winbuild
+```
+
+- Test it: The directory `install` will contain `bin/mimic.exe` file
+
+```
|
[-]
[+]
|
Added |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/SUPPORT.md
^
|
@@ -0,0 +1,28 @@
+# How to get support with Mycroft software, hardware and products
+
+There are multiple ways to seek support with Mycroft software, hardware and products.
+
+## Forum
+
+We maintain a [Forum](https://community.mycroft.ai) which is regularly monitored.
+Feel free to post questions, bugs, and requests for assistance in the relevant Forum Topic.
+
+## Chat
+
+Mycroft staff are regularly available in our [Chat](https://community.mycroft.ai) platform.
+There are specific rooms available for different projects and products.
+
+## Contact
+
+You can contact us via [our online form](https://mycroft.ai/contact), or give a call.
+
+## GitHub
+
+We welcome you raising Issues and Pull Requests on our public GitHub repositories.
+See the [CONTRIBUTING.md](CONTRIBUTING.md) file for more information.
+
+## Helping us to help you
+
+Our [documentation](https://mycroft.ai/documentation/troubleshooting/) contains troubleshooting information, and information on log files and other files that we may need to help us help you.
+
+
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/codecov.yml
^
|
@@ -1,6 +1,7 @@
coverage:
ignore: # files and folders that will be removed during processing
- - "testsuite/*"
- - "unittests/*"
-
+ - "testsuite/"
+ - "thirdparty/"
+ - "unittests/"
+ - "src/hts/hts_engine_API/"
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/configure.ac
^
|
@@ -1,7 +1,7 @@
dnl Use autogen.sh to regenerate the configure script
AC_PREREQ([2.62])
AC_INIT([mimic],
- [1.2.0.2],
+ [1.3.0.1],
[https://github.com/MycroftAI/mimic/issues])
AC_CONFIG_AUX_DIR([config])
@@ -67,24 +67,40 @@
AC_CHECK_HEADERS([sys/socket.h])
+dnl: Look for htsengine_API headers and library
+AC_ARG_WITH([hts],
+ [AS_HELP_STRING([--without-hts],
+ [disable hts speech synthesis capabilities (for hts voices)])],
+ [],
+ [with_hts=yes])
+AM_CONDITIONAL([HTSEngine], [test "x$with_hts" != xno])
+
+HTS_LIBS=
+with_hts_bundled="no"
+AS_IF([test "x$with_hts" != "xno"],
+ [AC_DEFINE([HAVE_HTSENGINE], [1], [Define if you have hts_engine])
+ AC_CHECK_LIB([HTSEngine],
+ [HTS_Engine_initialize],
+ [AC_SUBST([HTS_LIBS], ["-lHTSEngine"])
+ ],
+ [with_hts_bundled="yes"
+ AC_MSG_NOTICE([HTSEngine was not detected, using bundled HTSEngine])
+ ],
+ [])
+ ])
+AM_CONDITIONAL([HTSEngineBundled], [test "x$with_hts_bundled" != "xno"])
+
+
+
dnl: pkg-config mimic.pc file:
PKGCONFIG_MIMIC_CFLAGS="-I${includedir}/ttsmimic -I${includedir}/ttsmimic/lang"
PKGCONFIG_MIMIC_LIBS="-L${libdir}"
PKGCONFIG_MIMIC_DEPS=
-dnl Check ICU
-PKG_CHECK_MODULES([ICU], [icu-i18n],
- [found_icu=yes; break;], [m4_ignore])
-AC_CHECK_HEADER(unicode/ustring.h,
- [found_ustring=yes; break;])
-AS_IF([test "x$found_ustring" != "xyes" && test "x$found_icu" != "xyes"],
- [AC_MSG_ERROR([Unable to detect ICU installation])])
-AS_IF([test "x$found_icu" != "xyes"],
- [AC_MSG_WARN([ICU was only partially detected and may be missing])])
-
-AC_DEFINE([U_CHARSET_IS_UTF8], [1], [mimic accepts UTF-8 only])
-
-PKGCONFIG_MIMIC_DEPS="${PKGCONFIG_MIMIC_DEPS} icu-i18n"
+dnl Check libpcre2-8
+PKG_CHECK_MODULES([PCRE2], [libpcre2-8])
+PKGCONFIG_MIMIC_DEPS="${PKGCONFIG_MIMIC_DEPS} libpcre2-8"
+
dnl
@@ -236,6 +252,11 @@
[],
[enable_lang_indic=${enable_lang_all}])
+AC_ARG_ENABLE([lang-es],
+ [AS_HELP_STRING([--enable-lang-es],
+ [(NOT WORKING YET) enable Spanish language support])],
+ [],
+ [enable_lang_es=no])
dnl -------------------- Language analysis ---------------------------
dnl For US English en-us:
@@ -252,6 +273,12 @@
[],
[enable_indic_analysis=${enable_lang_indic}])
+AC_ARG_ENABLE([es_analysis],
+ [AS_HELP_STRING([--disable-es-analysis],
+ [disable Spanish text analysis support])],
+ [],
+ [enable_es_analysis=${enable_lang_es}])
+
dnl ------------------- Lexicons ------------------------------
dnl US Lexicon:
@@ -340,7 +367,7 @@
dnl cmu_us_slt
AC_ARG_ENABLE([cmu_us_slt],
[AS_HELP_STRING([--disable-cmu_us_slt],
- [disable cmu_us_slt clustergem voice])],
+ [disable cmu_us_slt clustergen voice])],
[],
[enable_cmu_us_slt=${enable_voices_english}])
@@ -350,6 +377,24 @@
enable_cmulex="yes"])
+dnl cmu_us_slt_hts
+AC_ARG_ENABLE([cmu_us_slt_hts],
+ [AS_HELP_STRING([--disable-cmu_us_slt_hts],
+ [disable cmu_us_slt_hts hts voice])],
+ [],
+ [enable_cmu_us_slt_hts=${enable_voices_english}])
+
+AS_IF([test "x$enable_cmu_us_slt_hts" != "xno" -a "x$with_hts" = "xno"],
+ [enable_cmu_us_slt_hts="no"
+ AC_MSG_WARN([cmu_us_slt_hts disabled because hts support is not available])],
+ [])
+
+dnl: Dependencies for cmu_us_slt_hts
+AS_IF([test "x$enable_cmu_us_slt_hts" != xno],
+ [enable_usenglish="yes"
+ enable_cmulex="yes"])
+
+
dnl vid_gb_ap
AC_ARG_ENABLE([vid_gb_ap],
[AS_HELP_STRING([--disable-vid_gb_ap],
@@ -408,6 +453,14 @@
],
[ AC_DEFINE([ENABLE_CMU_US_SLT], [0], [Enable cmu_us_slt voice]) ])
+AM_CONDITIONAL([VOICE_CMU_US_SLT_HTS], [test "x$enable_cmu_us_slt_hts" != xno])
+AS_IF([test "x$enable_cmu_us_slt_hts" != xno ],
+ [ AC_DEFINE([ENABLE_CMU_US_SLT_HTS], [1], [Enable cmu_us_slt_hts voice])
+ PKGCONFIG_MIMIC_LIBS="${PKGCONFIG_MIMIC_LIBS} -lttsmimic_lang_cmu_us_slt_hts"
+ ],
+ [ AC_DEFINE([ENABLE_CMU_US_SLT_HTS], [0], [Enable cmu_us_slt_hts voice]) ])
+
+
AM_CONDITIONAL([VOICE_VID_GB_AP], [test "x$enable_vid_gb_ap" != xno])
AS_IF([test "x$enable_vid_gb_ap" != xno ],
[ AC_DEFINE([ENABLE_VID_GB_AP], [1], [Enable vid_gb_ap voice])
@@ -445,6 +498,12 @@
PKGCONFIG_MIMIC_LIBS="${PKGCONFIG_MIMIC_LIBS} -lttsmimic_lang_usenglish" ],
[ AC_DEFINE([ENABLE_USENGLISH], [0], [Enable US English text analysis]) ])
+AM_CONDITIONAL([LANG_ES_ANALYSIS], [test "x$enable_es_analysis" != xno])
+AS_IF([test "x$enable_es_analysis" != xno ],
+ [ AC_DEFINE([ENABLE_ES_ANALYSIS], [1], [Enable Spanish text analysis])
+ PKGCONFIG_MIMIC_LIBS="${PKGCONFIG_MIMIC_LIBS} -lttsmimic_lang_es" ],
+ [ AC_DEFINE([ENABLE_ES_ANALYSIS], [0], [Enable Spanish text analysis]) ])
+
PKGCONFIG_MIMIC_LIBS="${PKGCONFIG_MIMIC_LIBS} -lttsmimic_lang_all_langs -lttsmimic_lang_all_voices -lttsmimic"
|
[-]
[+]
|
Added |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/dependencies.sh
^
|
@@ -0,0 +1,84 @@
+#!/bin/sh
+
+#### This function emulates readlink -f, not available on osx ####
+readlink2()
+{
+MYWD=`pwd`
+TARGET_FILE=$1
+
+cd `dirname $TARGET_FILE`
+TARGET_FILE=`basename $TARGET_FILE`
+
+# Iterate down a (possible) chain of symlinks
+while [ -L "$TARGET_FILE" ]
+do
+ TARGET_FILE=`readlink $TARGET_FILE`
+ cd `dirname $TARGET_FILE`
+ TARGET_FILE=`basename $TARGET_FILE`
+done
+
+# Compute the canonicalized name by finding the physical path
+# for the directory we're in and appending the target file.
+PHYS_DIR=`pwd -P`
+RESULT=$PHYS_DIR/$TARGET_FILE
+# restore working directory
+cd "$MYWD"
+echo $RESULT
+}
+
+# Absolute path to this script, e.g. /home/user/bin/foo.sh
+SCRIPT=$(readlink2 "$0")
+# Absolute path this script is in, thus /home/user/bin
+SCRIPTPATH=$(dirname "$SCRIPT")
+
+CURDIR="$PWD"
+
+if [ "x${WORKDIR}" = "x" ]; then
+ WORKDIR="$PWD/build"
+fi
+mkdir -p "$WORKDIR" || exit 1
+
+if [ "x${PKG_CONFIG}" = "x" ]; then
+ PKG_CONFIG=`which pkg-config`
+fi
+
+which "$PKG_CONFIG" ||(echo "Please install pkg-config"; exit 1)
+
+"$PKG_CONFIG" --exists libpcre2-8 && HAVE_PCRE2="yes" || HAVE_PCRE2="no"
+echo "Have PCRE2? [${HAVE_PCRE2}]"
+
+if [ "x${HAVE_PCRE2}" = "xno" ]; then
+ # Prepare pcre2-10.23 source:
+ (mkdir -p "${WORKDIR}/thirdparty/" && \
+ cd "${WORKDIR}/thirdparty" && \
+ wget "ftp://ftp.pcre.org/pub/pcre/pcre2-10.23.zip"
+ echo "56c07f59ccd052ccdbdedadf24574a63 pcre2-10.23.zip" | md5sum -c || exit 1
+ unzip "pcre2-10.23.zip" && \
+ cd "pcre2-10.23" && \
+ patch -p1 < "${SCRIPTPATH}/thirdparty/pcre2.patch" && \
+ autoreconf -fi ) || exit 1
+ # Build pcre2-10.23:
+ mkdir -p "${WORKDIR}/thirdparty/build_pcre2" || exit 1
+ cd "${WORKDIR}/thirdparty/build_pcre2" || exit 1
+ ${WORKDIR}/thirdparty/pcre2-10.23/configure --disable-option-checking $@ || exit 1
+ make || exit 1
+ make install && echo "PCRE2 installation succeeded" || (
+ cat << EOF
+PCRE was successfully compiled. However, it could not be installed.
+The most likely cause is a lack of permissions. This script will try to run
+the installation with sudo asking your password.
+EOF
+ sudo make install && echo "PCRE2 installation succeeded" || (
+ cat << EOF
+The installation failed. Please run this or check other possible errors:
+ cd "${WORKDIR}/thirdparty/build_pcre2"
+ sudo make install
+In case you do not have admin permissions you can install everything to a custom
+directory by running dependencies.sh with --prefix="/a/writable/directory"
+EOF
+ exit 1)
+ exit 1 )
+fi
+
+cd "${CURDIR}"
+
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/include/cst_ffeatures.h
^
|
@@ -50,6 +50,7 @@
const cst_val *ph_ctype(const cst_item *p);
const cst_val *ph_cplace(const cst_item *p);
const cst_val *ph_cvox(const cst_item *p);
+const cst_val *accented(const cst_item *p);
const cst_val *cg_duration(const cst_item *p);
const cst_val *cg_state_pos(const cst_item *p);
@@ -60,6 +61,8 @@
const cst_val *cg_phone_index(const cst_item *p);
const cst_val *cg_phone_rindex(const cst_item *p);
+const cst_val *generic_gpos(const cst_item *word, const cst_val * const * const lang_gpos[]);
+
void basic_ff_register(cst_features *ffunctions);
#endif /* _CST_FFEATURES_H */
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/include/cst_file.h
^
|
@@ -81,6 +81,7 @@
int cst_sprintf(char *s, const char *fmt, ...);
int cst_fclose(cst_file fh);
int cst_fgetc(cst_file fh);
+int cst_file_exists(const char *path);
/* These aren't LFS-compliant. I don't think we'll need >2G files. */
long cst_ftell(cst_file fh);
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/include/cst_tokenstream.h
^
|
@@ -77,6 +77,11 @@
const cst_string *p_prepunctuationsymbols;
const cst_string *p_postpunctuationsymbols;
+ /* Treat all found emoji characters as single character tokens TS_CHARCLASS_SINGLECHAR.
+ * This is equivalent to adding all emoji characters in p_singlecharsymbols, but more memory
+ * efficient. */
+ int all_emoji_as_singlechars;
+
/* 1-byte long UTF-8 characters are in [0, 128) */
cst_string charclass[128];
/* 2-byte long UTF-8 characters have a first UTF-8 character like
@@ -139,17 +144,20 @@
const cst_string *whitespacesymbols,
const cst_string *singlecharsymbols,
const cst_string *prepunctsymbols,
- const cst_string *postpunctsymbols);
+ const cst_string *postpunctsymbols,
+ int emoji_as_singlechars);
cst_tokenstream *ts_open_string(const cst_string *string,
const cst_string *whitespacesymbols,
const cst_string *singlecharsymbols,
const cst_string *prepunctsymbols,
- const cst_string *postpunctsymbols);
+ const cst_string *postpunctsymbols,
+ int emoji_as_singlechars);
cst_tokenstream *ts_open_generic(const char *filename,
const cst_string *whitespacesymbols,
const cst_string *singlecharsymbols,
const cst_string *prepunctsymbols,
const cst_string *postpunctsymbols,
+ int emoji_as_singlechars,
void *streamtype_data,
int (*open) (cst_tokenstream *ts,
const char *filename),
@@ -174,7 +182,6 @@
const cst_string *prepunctuation,
const cst_string *postpunctuation);
-
int ts_set_stream_pos(cst_tokenstream *ts, int pos);
int ts_get_stream_pos(cst_tokenstream *ts);
int ts_get_stream_size(cst_tokenstream *ts);
|
[-]
[+]
|
Added |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/include/cst_uregex.h
^
|
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2016 Sergio Oller <sergioller@gmail.com>
+
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of the nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef CST_UREGEX_H__
+#define CST_UREGEX_H__
+
+#include "config.h"
+#include <stdint.h>
+#include <cst_string.h>
+
+#define PCRE2_CODE_UNIT_WIDTH 8
+#include <pcre2.h>
+
+typedef pcre2_code cst_uregex;
+cst_string *cst_toupper_utf8(const cst_string *in);
+cst_string *cst_tolower_utf8(const cst_string *in);
+cst_uregex *new_cst_uregex(cst_string *pattern, uint32_t options);
+void delete_cst_uregex(cst_uregex *uregex);
+int cst_uregex_match(cst_uregex *uregex, const cst_string *str);
+
+#endif
|
[-]
[+]
|
Added |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/include/flite_hts_engine.h
^
|
@@ -0,0 +1,147 @@
+/* ----------------------------------------------------------------- */
+/* The English TTS System "Flite+hts_engine" */
+/* developed by HTS Working Group */
+/* http://hts-engine.sourceforge.net/ */
+/* ----------------------------------------------------------------- */
+/* */
+/* Copyright (c) 2005-2016 Nagoya Institute of Technology */
+/* Department of Computer Science */
+/* */
+/* 2005-2008 Tokyo Institute of Technology */
+/* Interdisciplinary Graduate School of */
+/* Science and Engineering */
+/* */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or */
+/* without modification, are permitted provided that the following */
+/* conditions are met: */
+/* */
+/* - Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* - Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* - Neither the name of the HTS working group nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */
+/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */
+/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
+/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
+/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS */
+/* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
+/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
+/* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
+/* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, */
+/* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY */
+/* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/* POSSIBILITY OF SUCH DAMAGE. */
+/* ----------------------------------------------------------------- */
+/* mimic adaptations by Sergio Oller, 2017 */
+
+#ifndef FLITE_HTS_ENGINE_H
+#define FLITE_HTS_ENGINE_H
+
+#include "config.h"
+
+#if HAVE_HTSENGINE == 0
+
+typedef struct _Flite_HTS_Engine {
+ void *not_supported;
+} Flite_HTS_Engine;
+
+#include "cst_val.h"
+#include "cst_utterance.h"
+
+CST_VAL_USER_TYPE_DCLS(flitehtsengine, Flite_HTS_Engine);
+void delete_flitehtsengine(Flite_HTS_Engine * f);
+
+#else /* HAVE_HTSENGINE */
+
+#ifdef __cplusplus
+#define FLITE_HTS_ENGINE_H_START extern "C" {
+#define FLITE_HTS_ENGINE_H_END }
+#else
+#define FLITE_HTS_ENGINE_H_START
+#define FLITE_HTS_ENGINE_H_END
+#endif /* __CPLUSPLUS */
+
+FLITE_HTS_ENGINE_H_START;
+
+#include "HTS_engine.h"
+
+typedef struct _Flite_HTS_Engine {
+ HTS_Engine engine;
+ int is_engine_loaded;
+} Flite_HTS_Engine;
+
+#include "cst_val.h"
+#include "cst_utterance.h"
+
+CST_VAL_USER_TYPE_DCLS(flitehtsengine, Flite_HTS_Engine);
+void delete_flitehtsengine(Flite_HTS_Engine * f);
+
+/* Flite_HTS_Engine_initialize: initialize system */
+void Flite_HTS_Engine_initialize(Flite_HTS_Engine * f);
+
+/* Flite_HTS_Engine_load: load HTS voice */
+HTS_Boolean Flite_HTS_Engine_load(Flite_HTS_Engine * f, const char *fn);
+
+/* Flite_HTS_Engine_set_sampling_frequency: set sampling frequency */
+void Flite_HTS_Engine_set_sampling_frequency(Flite_HTS_Engine * f, size_t i);
+
+/* Flite_HTS_Engine_set_fperiod: set frame period */
+void Flite_HTS_Engine_set_fperiod(Flite_HTS_Engine * f, size_t i);
+
+/* Flite_HTS_Engine_set_audio_buff_size: set audio buffer size */
+void Flite_HTS_Engine_set_audio_buff_size(Flite_HTS_Engine * engine,
+ size_t i);
+
+/* Flite_HTS_Engine_set_volume: set volume in dB */
+void Flite_HTS_Engine_set_volume(Flite_HTS_Engine * engine, double d);
+
+/* Flite_HTS_Engine_set_alpha: set alpha */
+void Flite_HTS_Engine_set_alpha(Flite_HTS_Engine * f, double d);
+
+/* Flite_HTS_Engine_set_beta: set beta */
+void Flite_HTS_Engine_set_beta(Flite_HTS_Engine * f, double d);
+
+/* Flite_HTS_Engine_add_half_tone: add half-tone */
+void Flite_HTS_Engine_add_half_tone(Flite_HTS_Engine * f, double d);
+
+/* Flite_HTS_Engine_set_msd_threshold: set MSD threshold */
+void Flite_HTS_Engine_set_msd_threshold(Flite_HTS_Engine * f,
+ size_t stream_index, double d);
+
+/* Flite_HTS_Engine_set_gv_weight: set GV weight */
+void Flite_HTS_Engine_set_gv_weight(Flite_HTS_Engine * f, size_t stream_index,
+ double d);
+
+/* Flite_HTS_Engine_set_speed: set speech speed */
+void Flite_HTS_Engine_set_speed(Flite_HTS_Engine * engine, double f);
+
+/* Flite_HTS_Engine_synthesize: synthesize speech */
+HTS_Boolean Flite_HTS_Engine_synthesize(Flite_HTS_Engine * f, const char *txt,
+ const char *wav);
+
+/* Flite_HTS_Engine_clear: free system */
+void Flite_HTS_Engine_clear(Flite_HTS_Engine * f);
+
+/* Flite_HTS_Engine_get_sampling_frequency: get sampling frequency from engine */
+size_t Flite_HTS_Engine_get_sampling_frequency(Flite_HTS_Engine * f);
+
+/* Generate wave for utt */
+cst_utterance *hts_synth(cst_utterance *utt);
+
+/* Find .htsvoice file path for voice v */
+char *mimic_hts_get_voice_file(const cst_voice *const v);
+
+FLITE_HTS_ENGINE_H_END;
+
+#endif /* HAVE_HTSENGINE */
+
+#endif /* FLITE_HTS_ENGINE_H */
|
[-]
[+]
|
Added |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/lang/cmu_us_slt_hts/cmu_us_slt_hts.c
^
|
@@ -0,0 +1,114 @@
+/*************************************************************************/
+/* */
+/* Language Technologies Institute */
+/* Carnegie Mellon University */
+/* Copyright (c) 1999-2007 */
+/* All Rights Reserved. */
+/* */
+/* Permission is hereby granted, free of charge, to use and distribute */
+/* this software and its documentation without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of this work, and to */
+/* permit persons to whom this work is furnished to do so, subject to */
+/* the following conditions: */
+/* 1. The code must retain the above copyright notice, this list of */
+/* conditions and the following disclaimer. */
+/* 2. Any modifications must be clearly marked as such. */
+/* 3. Original authors' names are not deleted. */
+/* 4. The authors' names are not used to endorse or promote products */
+/* derived from this software without specific prior written */
+/* permission. */
+/* */
+/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
+/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
+/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
+/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
+/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
+/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
+/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
+/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
+/* THIS SOFTWARE. */
+/* */
+/*************************************************************************/
+/* Author: Alan W Black (awb@cs.cmu.edu) */
+/* Date: November 2007 */
+/*************************************************************************/
+/* */
+/* A hts voice defintion */
+/* */
+/*************************************************************************/
+/* mimic adaptations by Sergio Oller, 2017 */
+
+#include <string.h>
+#include "mimic.h"
+
+#include "usenglish.h"
+#include "cmu_lex.h"
+#include "flite_hts_engine.h"
+
+cst_voice *cmu_us_slt_hts = NULL;
+
+cst_voice *register_cmu_us_slt_hts(const char *voxdir)
+{
+ (void) voxdir;
+ cst_voice *vox;
+ cst_lexicon *lex;
+ Flite_HTS_Engine *flite_hts = NULL;
+
+
+ if (cmu_us_slt_hts)
+ return cmu_us_slt_hts; /* Already registered */
+
+ vox = new_voice();
+ vox->name = "slt_hts";
+
+ /* Sets up language specific parameters in the cmu_us_slt_hts. */
+ usenglish_init(vox);
+
+ /* Things that weren't filled in already. */
+ mimic_feat_set_string(vox->features, "name", "cmu_us_slt_hts");
+
+ /* Lexicon */
+ lex = cmu_lex_init();
+ mimic_feat_set(vox->features, "lexicon", lexicon_val(lex));
+ mimic_feat_set(vox->features, "postlex_func", uttfunc_val(lex->postlex));
+
+ /* No standard segment durations are needed as its done at the */
+ /* HMM state level */
+ mimic_feat_set_string(vox->features, "no_segment_duration_model", "1");
+ mimic_feat_set_string(vox->features, "no_f0_target_model", "1");
+
+ /* HTS engine */
+ flite_hts = cst_alloc(Flite_HTS_Engine, 1);
+ Flite_HTS_Engine_initialize(flite_hts);
+ /* load HTS voice */
+ char *fn_voice = mimic_hts_get_voice_file(vox);
+ if (fn_voice != NULL)
+ {
+ mimic_feat_set_string(vox->features, "htsvoice_file", fn_voice);
+ cst_free(fn_voice);
+ }
+ else
+ {
+ mimic_feat_set_string(vox->features, "htsvoice_file",
+ "cmu_us_slt_hts.htsvoice");
+ }
+ mimic_feat_set(vox->features, "flite_hts", flitehtsengine_val(flite_hts));
+
+ /* Waveform synthesis */
+ mimic_feat_set(vox->features, "wave_synth_func", uttfunc_val(&hts_synth));
+ mimic_feat_set_int(vox->features, "sample_rate",
+ Flite_HTS_Engine_get_sampling_frequency(flite_hts));
+
+ cmu_us_slt_hts = vox;
+
+ return cmu_us_slt_hts;
+}
+
+void unregister_cmu_us_slt_hts(cst_voice *vox)
+{
+ if (vox != cmu_us_slt_hts)
+ return;
+ delete_voice(vox);
+ cmu_us_slt_hts = NULL;
+}
|
[-]
[+]
|
Added |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/lang/es_lang/es_init.c
^
|
@@ -0,0 +1,37 @@
+#include "cst_ffeatures.h"
+#include "es_lang.h"
+
+void es_init(cst_voice *v)
+{
+ /* Basic generic functions that need to be registered always */
+ basic_ff_register(v->ffunctions);
+
+ /* 1. Tokenizer */
+ es_init_tokenizer(v);
+
+ /* 2. Utterance break function */
+ feat_set(v->features,"utt_break",breakfunc_val(&default_utt_break));
+
+ /* 3. Text analyser */
+ feat_set(v->features,"tokentowords_func",itemfunc_val(&es_tokentowords));
+
+ /* 4. very simple POS tagger */
+ /* TO DO */
+
+ /* 5. Phrasing */
+ /* TO DO */
+
+ /* 6a. Phoneset */
+ /* TO DO */
+
+
+ /* 8. Intonation */
+ /* TO DO */
+
+ /* 10. Duration */
+ /* TO DO? */
+
+ /* 11. f0 model */
+ /* TO DO? */
+
+}
|
[-]
[+]
|
Added |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/lang/es_lang/es_lang.h
^
|
@@ -0,0 +1,5 @@
+#include "mimic.h"
+
+void es_init(cst_voice *v);
+void es_init_tokenizer(cst_voice *v);
+cst_val *es_tokentowords(cst_item *token);
|
[-]
[+]
|
Added |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/lang/es_lang/es_text_analysis.c
^
|
@@ -0,0 +1,85 @@
+#include "es_lang.h"
+#include "cst_uregex.h"
+#include "mimic.h"
+
+cst_utterance *es_textanalysis(cst_utterance *u);
+cst_val *es_tokentowords(cst_item *token);
+static cst_val *es_tokentowords_one(cst_item *token, const char *name);
+
+
+cst_utterance *es_textanalysis(cst_utterance *u)
+{
+ if (!feat_present(u->features, "tokentowords_func"))
+ utt_set_feat(u, "tokentowords_func", itemfunc_val(es_tokentowords));
+
+ return default_textanalysis(u);
+}
+
+cst_val *es_tokentowords(cst_item *token)
+{
+ return es_tokentowords_one(token, item_feat_string(token, "name"));
+}
+
+static cst_val *es_tokentowords_one(cst_item *token, const char *name)
+{
+ cst_val *list_of_words;
+ char *name_mod;
+ /* Each token has defined four features:
+ - The token name: ffeature_string(token,"name");
+ - The token prepunctuation: ffeature_string(token,"prepunctuation");
+ - The token postpunctuation: ffeature_string(token,"punc");
+ - The token whitespace: ffeature_string(token,"whitespace");
+
+ We can also traverse the list of tokens for contextual information:
+ - The previous token: cst_item *prev_token = item_prev(token);
+ - The next token: cst_item *next_token = item_next(token);
+
+ So we can combine both traversing and accessing features:
+ - The name of the next token: ffeature_string(item_next(token), "name");
+
+ As text analysis requires constantly of checking context, we can use
+ feature paths:
+ Feature paths can be up to 200 characters long.
+ Their syntax is implemented in src/hrg/cst_ffeature.c. You may the
+ internal_ff function. In summary, feature paths are strings composed of
+ operators separated by dots. The most common operators applicable to
+ tokens are:
+ - "n": Advances to the next token
+ - "nn": Advances to the next next token
+ - "p": Advances to the previous token
+ - "pp": Advances to the previous previous token
+
+ Other cst_item usually require other operators that we won't explore now:
+ - "parent": Advances to the parent item
+ - "daughter": Advances to the first daughter item
+ - "daughtern": Advances to the last daughter item
+ - "RNameOfRelation": Moves to another relation.
+
+ After the last operator, we typically want access to a token feature:
+ - Token. Previous. Name: ffeature_string(token,"p.name");
+ - Token. PreviousPrevious. Name: ffeature_string(token,"pp.name");
+ - Token. Previous. Name: ffeature_string(token,"p.name");
+ - Look the next-next-next token punctuation: ffeature_string(token, "nn.n.punc");
+
+ */
+ if (strcmp(name, "€") == 0)
+ {
+ list_of_words = cons_val(string_val("euro"), NULL);
+ } else if (name[cst_strlen(name)] == '%')
+ {
+ name_mod = cst_strdup(name);
+ name_mod[cst_strlen(name_mod)-1] = '\0';
+ list_of_words = es_tokentowords_one(token, name_mod);
+ list_of_words = val_append(list_of_words,
+ cons_val(string_val("por"),
+ cons_val(string_val("ciento"), NULL)));
+ cst_free(name_mod);
+ } else if (strcmp(name, "17") == 0) /* TO DO: Handle all numbers */
+ {
+ list_of_words = cons_val(string_val("diecisiete"), NULL);
+ } else
+ {
+ list_of_words = cons_val(string_val(cst_tolower_l(name, "es_ES")), NULL);
+ }
+ return list_of_words;
+}
|
[-]
[+]
|
Added |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/lang/es_lang/es_tokenizer.c
^
|
@@ -0,0 +1,14 @@
+#include "es_lang.h"
+
+static const char* es_whitespace = " \t\n\r";
+static const char* es_singlecharsymbols = "€😃";
+static const char* es_prepunctuation = "¿¡«\"'``({[";
+static const char* es_punctuation = "»\"'``.,:;!?(){}[]";
+
+void es_init_tokenizer(cst_voice *v)
+{
+ feat_set_string(v->features, "text_whitespace", es_whitespace);
+ feat_set_string(v->features, "text_postpunctuation", es_punctuation);
+ feat_set_string(v->features, "text_prepunctuation", es_prepunctuation);
+ feat_set_string(v->features, "text_singlecharsymbols", es_singlecharsymbols);
+}
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/lang/usenglish/us_ffeatures.c
^
|
@@ -39,6 +39,50 @@
/* semantics follow them */
/*************************************************************************/
+/* ----------------------------------------------------------------- */
+/* The English TTS System "Flite+hts_engine" */
+/* developed by HTS Working Group */
+/* http://hts-engine.sourceforge.net/ */
+/* ----------------------------------------------------------------- */
+/* */
+/* Copyright (c) 2005-2016 Nagoya Institute of Technology */
+/* Department of Computer Science */
+/* */
+/* 2005-2008 Tokyo Institute of Technology */
+/* Interdisciplinary Graduate School of */
+/* Science and Engineering */
+/* */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or */
+/* without modification, are permitted provided that the following */
+/* conditions are met: */
+/* */
+/* - Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* - Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* - Neither the name of the HTS working group nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */
+/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */
+/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
+/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
+/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS */
+/* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
+/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
+/* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
+/* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, */
+/* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY */
+/* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/* POSSIBILITY OF SUCH DAMAGE. */
+/* ----------------------------------------------------------------- */
+
#include "cst_hrg.h"
#include "cst_phoneset.h"
#include "cst_regex.h"
@@ -56,24 +100,10 @@
DEF_STATIC_CONST_VAL_STRING(val_string_flight,"flight");
DEF_STATIC_CONST_VAL_STRING(val_string_to,"to");
-DEF_STATIC_CONST_VAL_STRING(val_string_content,"content");
-
static const cst_val *gpos(const cst_item *word)
{
/* Guess at part of speech (function/content) */
- const char *w;
- int s,t;
-
- w = item_feat_string(word,"name");
-
- for (s=0; us_gpos[s]; s++)
- {
- for (t=1; us_gpos[s][t]; t++)
- if (cst_streq(w,val_string(us_gpos[s][t])))
- return us_gpos[s][0];
- }
-
- return (cst_val *)&val_string_content;
+ return generic_gpos(word, us_gpos);
}
static const cst_val *num_digits(const cst_item *token)
@@ -159,53 +189,9 @@
return r;
}
-const cst_val *content_words_in(const cst_item *p)
-{
- const cst_item *s;
- int i=0;
- p=item_as(p,"Word");
- s=item_as(path_to_item(p,"R:SylStructure.R:Phrase.parent.daughter1"),"Word");
- for (;s && !item_equal(p,s);s=item_next(s))
- {
- if (!strcmp(ffeature_string(s,"gpos"),"content"))
- {i++;}
- }
- // if(!strcmp(ffeature_string(p,"gpos"), "content")){i++;}
- return val_string_n(i);
-}
-
-const cst_val *content_words_out(const cst_item *p)
-{
- const cst_item *s;
- int i=0;
- p=item_as(p,"Word");
- s=item_as(path_to_item(p,"R:SylStructure.R:Phrase.parent.daughtern"),"Word");
-#if 1 /* fix by uratec */
- for (;s && !item_equal(p,s);s=item_prev(s))
- {
- if (!strcmp(ffeature_string(s,"gpos"),"content"))
- {i++;}
- }
-#else
- for (;s && !item_equal(p,s);p=item_next(p))
- {
- if (!strcmp(ffeature_string(p,"gpos"),"content"))
- {i++;}
- }
- if(!strcmp(ffeature_string(s,"gpos"), "content")){i++;}
-#endif
- return val_string_n(i);
-}
-
-const cst_val *cg_content_words_in_phrase(const cst_item *p)
-{
- return float_val(ffeature_float(p,"R:SylStructure.parent.parent.R:Word.content_words_in") + ffeature_float(p,"R:SylStructure.parent.parent.R:Word.content_words_out")) ;//- (strcmp(ffeature_string(p,"R:SylStructure.parent.parent.R:Word.gpos"),"content")==0?1:0));
-}
-
void us_ff_register(cst_features *ffunctions)
{
-
/* The language independent ones */
basic_ff_register(ffunctions);
@@ -213,8 +199,5 @@
ff_register(ffunctions, "num_digits",num_digits);
ff_register(ffunctions, "month_range",month_range);
ff_register(ffunctions, "token_pos_guess",token_pos_guess);
- ff_register(ffunctions, "content_words_in",content_words_in);
- ff_register(ffunctions, "content_words_out",content_words_out);
- ff_register(ffunctions, "lisp_cg_content_words_in_phrase",cg_content_words_in_phrase);
}
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/lang/usenglish/us_text.c
^
|
@@ -211,7 +211,7 @@
static int contains_unicode_single_quote(const char *name)
{
- static const char *unicode_single_quote = "’";
+ static const char *unicode_single_quote = "\xe2\x80\x99";
int i;
for (i=0; name[i]; i++)
@@ -227,7 +227,7 @@
static char *map_unicode_single_quote(const char *name)
{
- static const char *unicode_single_quote = "’";
+ static const char *unicode_single_quote = "\xe2\x80\x99";
int i,j;
char *aaa = cst_strdup(name); /* it'll always get shorter */
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/main/mimic_lang_list.c
^
|
@@ -1,3 +1,45 @@
+/*************************************************************************/
+/* */
+/* Language Technologies Institute */
+/* Carnegie Mellon University */
+/* Copyright (c) 2001 */
+/* All Rights Reserved. */
+/* */
+/* Permission is hereby granted, free of charge, to use and distribute */
+/* this software and its documentation without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of this work, and to */
+/* permit persons to whom this work is furnished to do so, subject to */
+/* the following conditions: */
+/* 1. The code must retain the above copyright notice, this list of */
+/* conditions and the following disclaimer. */
+/* 2. Any modifications must be clearly marked as such. */
+/* 3. Original authors' names are not deleted. */
+/* 4. The authors' names are not used to endorse or promote products */
+/* derived from this software without specific prior written */
+/* permission. */
+/* */
+/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
+/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
+/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
+/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
+/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
+/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
+/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
+/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
+/* THIS SOFTWARE. */
+/* */
+/*************************************************************************/
+/* Author: Alan W Black (awb@cs.cmu.edu) */
+/* Date: January 2001 */
+/*************************************************************************/
+/* */
+/* Set lang list */
+/* */
+/*************************************************************************/
+/* Copyright 2016-2017 Sergio Oller, under the same terms as above */
+/*************************************************************************/
+
#include "mimic.h"
#if ENABLE_USENGLISH
@@ -18,6 +60,11 @@
cst_lexicon *cmu_grapheme_lex_init(void);
#endif
+#if ENABLE_ES_ANALYSIS
+#include "lang/es_lang/es_lang.h"
+#endif
+
+
void mimic_set_lang_list(void)
{
#if (ENABLE_USENGLISH & ENABLE_CMULEX)
@@ -28,5 +75,9 @@
mimic_add_lang("cmu_indic_lang",cmu_indic_lang_init,cmu_indic_lex_init);
mimic_add_lang("cmu_grapheme_lang",cmu_grapheme_lang_init,cmu_grapheme_lex_init);
#endif
+ #if ENABLE_ES_ANALYSIS
+ mimic_add_lang("es", es_init, NULL);
+ #endif
+
}
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/main/mimic_main.c
^
|
@@ -78,15 +78,16 @@
static void mimic_version()
{
printf(" Carnegie Mellon University, Copyright (c) 1999-2011, all rights reserved\n");
- printf(" mimic developers, Copyright (c) 2016, all rights reserved\n");
- printf(" version: %s-%s (%s)\n",
- PACKAGE_NAME, PACKAGE_VERSION, PACKAGE_URL);
+ printf(" mimic developers, Copyright (c) 2016-2020, all rights reserved\n");
+ printf(" version: %s-%s\n",
+ PACKAGE_NAME, PACKAGE_VERSION);
}
static void mimic_usage()
{
printf("mimic: a small simple speech synthesizer\n");
mimic_version();
+ printf("Report bugs to %s.\n", PACKAGE_BUGREPORT);
printf("usage: mimic TEXT/FILE [WAVEFILE]\n"
" Converts text in TEXTFILE to a waveform in WAVEFILE\n"
" If text contains a space the it is treated as a literal\n"
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/main/mimic_voice_list.c
^
|
@@ -1,3 +1,44 @@
+/*************************************************************************/
+/* */
+/* Language Technologies Institute */
+/* Carnegie Mellon University */
+/* Copyright (c) 2001 */
+/* All Rights Reserved. */
+/* */
+/* Permission is hereby granted, free of charge, to use and distribute */
+/* this software and its documentation without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of this work, and to */
+/* permit persons to whom this work is furnished to do so, subject to */
+/* the following conditions: */
+/* 1. The code must retain the above copyright notice, this list of */
+/* conditions and the following disclaimer. */
+/* 2. Any modifications must be clearly marked as such. */
+/* 3. Original authors' names are not deleted. */
+/* 4. The authors' names are not used to endorse or promote products */
+/* derived from this software without specific prior written */
+/* permission. */
+/* */
+/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
+/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
+/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
+/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
+/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
+/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
+/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
+/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
+/* THIS SOFTWARE. */
+/* */
+/*************************************************************************/
+/* Author: Alan W Black (awb@cs.cmu.edu) */
+/* Date: January 2001 */
+/*************************************************************************/
+/* */
+/* Set voice list */
+/* */
+/*************************************************************************/
+/* Copyright 2016-2017 Sergio Oller, under the same terms as above */
+/*************************************************************************/
#include "mimic.h"
@@ -26,6 +67,10 @@
cst_voice *register_cmu_us_slt(const char *voxdir);
#endif
+#if ENABLE_CMU_US_SLT_HTS
+cst_voice *register_cmu_us_slt_hts(const char *voxdir);
+#endif
+
#if ENABLE_VID_GB_AP
cst_voice *register_vid_gb_ap(const char *voxdir);
#endif
@@ -39,6 +84,9 @@
#if ENABLE_CMU_US_SLT
mimic_voice_list = cons_val(voice_val(register_cmu_us_slt(voxdir)),mimic_voice_list);
#endif
+ #if ENABLE_CMU_US_SLT_HTS
+ mimic_voice_list = cons_val(voice_val(register_cmu_us_slt_hts(voxdir)),mimic_voice_list);
+ #endif
#if ENABLE_CMU_US_KAL
mimic_voice_list = cons_val(voice_val(register_cmu_us_kal(voxdir)),mimic_voice_list);
#endif
|
[-]
[+]
|
Added |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/man/man1/mimic.1
^
|
@@ -0,0 +1,73 @@
+.TH mimic 1 "2016-08-07" "" "Mimic Text To Speech"
+.SH NAME
+mimic \- a text to speech tool
+.SH SYNOPSIS
+.B mimic
+[\fIoptions\fR] \fItext-file [\fIoutfile.wav]
+
+.B mimic
+\fB\-t \fB"Hello there"\fR [\fIwavefile]
+
+.SH DESCRIPTION
+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.
+.TP
+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.
+.TP
+Mandatory arguments to long options are mandatory for short options too.
+
+.SH OPTIONS
+.TP
+\fB\-t "\fIText\fR"
+Create speech from \fIText\fR.
+.TP
+\fB\-f \fItextfile
+Set input file.
+.TP
+\fB\-o \fIwavefile
+Set output file.
+.TP
+\fB\-lv
+List included voices
+.TP
+\fB\-voice \fIvoice\fR
+Set mimic to speak with \fIvoice\fR, this can either be one of the included voices or a .flitevox-file.
+.TP
+\fB\-v
+Verbose mode, print extended output.
+.TP
+\fB\-l
+Loop output endlessly.
+.TP
+\fB\--help
+List usage.
+.TP
+\fB\-ssml
+Read input/file in ssml mode.
+.TP
+\fB\-pw
+Print words to stdout before they are spoken.
+.TP
+\fB\-ps
+Print phoneme segments to stdout before they are spoken.
+.TP
+\fB\-psdur
+Print segments and their end-time to stdout before they are spoken.
+.TP
+\fB\-pr \fIRelName\fR
+Get information for \fIRelName\fR from the utterance and print it to stdout.
+.TP
+\fB\-p "\fIPhonemes\fR"
+Create speech from the phoneme string \fIPhonemes\fR.
+.TP
+\fB\-seti \fIFeature=Int\fR
+Set voice \fIfeature\fR to integer value.
+.TP
+\fB\-setf \fIFeature=Float\fR
+Set voice \fIfeature\fR to float value.
+.TP
+\fB\-sets \fIFeature=String\fR
+Set voice \fIfeature\fR to string value.
+.TP
+\fB\-s\fR, \fB\-set \fIFeature=Int\fR
+Set voice \fIfeature\fR and try to guess the type from the input.
+.TP
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/run_testsuite.sh
^
|
@@ -1,205 +1,401 @@
#!/bin/sh
-WHAT_TO_RUN="$1"
-WORKDIR=`pwd`
-export MANIFEST_TOOL=:
+#### Help message ####
+if [ "$#" -eq 0 ]; then
+ echo "./run_testsuite.sh requires a task/build target to be done"
+ echo " - ./run_testsuite.sh osx (OSX install dependencies, build and test)"
+ echo " - ./run_testsuite.sh ios (OSX install dependencies, build universal lib)"
+ echo " - ./run_testsuite.sh coverage (Build with code coverage)"
+ echo " - ./run_testsuite.sh shared (Build with shared libraries)"
+ echo " - ./run_testsuite.sh gcc6 (Build using gcc6)"
+ echo " - ./run_testsuite.sh arm-linux-gnueabihf-gcc (crosscompiling)"
+ echo " - ./run_testsuite.sh winbuild (crosscompiling)"
+ echo " - ./run_testsuite.sh winbuild_shared (crosscompiling, with shared libraries)"
+fi
-crosscompile_icu()
+#### This function emulates readlink -f, not available on osx ####
+readlink2()
{
- # Download & Extract icu
- if [ ! -e "icu4c-57_1-src.tgz" ]; then
- wget "http://download.icu-project.org/files/icu4c/57.1/icu4c-57_1-src.tgz"
- fi
- echo "976734806026a4ef8bdd17937c8898b9 icu4c-57_1-src.tgz" | md5sum -c || exit 1
- tar xzf "icu4c-57_1-src.tgz" # creates directory "icu"
+MYWD=`pwd`
+TARGET_FILE=$1
+
+cd `dirname $TARGET_FILE`
+TARGET_FILE=`basename $TARGET_FILE`
+
+# Iterate down a (possible) chain of symlinks
+while [ -L "$TARGET_FILE" ]
+do
+ TARGET_FILE=`readlink $TARGET_FILE`
+ cd `dirname $TARGET_FILE`
+ TARGET_FILE=`basename $TARGET_FILE`
+done
+
+# Compute the canonicalized name by finding the physical path
+# for the directory we're in and appending the target file.
+PHYS_DIR=`pwd -P`
+RESULT=$PHYS_DIR/$TARGET_FILE
+# restore working directory
+cd "$MYWD"
+echo $RESULT
+}
+
+# Cross-compilation in Windows looks for a "Manifest tool". autotools
+# mistakenly finds `/bin/mt` and assumes it is the manifest tool, even though
+# it is an unrelated program. This export makes sure that autotools does not
+# find the wrong manifest tool.
+export MANIFEST_TOOL=:
+
+
+# The task we want to run
+WHAT_TO_RUN="$1"
- # We have to build icu twice: Once for the build system and once for the
- # host system. First the build system:
- mkdir icu_build_build
- cd icu_build_build
- ../icu/source/configure "$@" || exit 1
- make || exit 1
-
- # Now the host system:
- cd "${WORKDIR}"
- mkdir icu_build_host
- cd icu_build_host
-
- ../icu/source/configure --host=${HOST_TRIPLET} --build=${BUILD_TRIPLET} \
- --with-cross-build="${WORKDIR}/icu_build_build" \
- --prefix="${WORKDIR}/install" \
- CC=${HOST_TRIPLET}-gcc \
- CXX=${HOST_TRIPLET}-g++ \
- LD=${HOST_TRIPLET}-ld \
- RANLIB=${HOST_TRIPLET}-ranlib \
- AR=${HOST_TRIPLET}-ar \
- "$@" || exit 1
- make || exit 1
- make install || exit 1
- cd "${WORKDIR}"
-}
-
-fix_icu_dll_filenames()
-{
- # The linker will fail to find icu*.dll files if they don't start with lib
- # An easy workaround is to have a copy of each dll (or a soft link) with
- # a different name: icuuc57.dll -> libicuuc57.dll
- cd "$WORKDIR/install/lib"
- for file in `ls icu*.dll`; do ln -s "$file" "lib"$file; done
- cd "$WORKDIR"
+# Set up an environment variable to increase compilation speed (and RAM usage)
+if [ "x${NCORES}" = "x" ]; then
+ NCORES=1
+fi
+
+# The directory where the mimic source code is.
+export MIMIC_TOP_SRCDIR=`dirname \`readlink2 "$0"\``
+
+
+# The following functions are used later on. They assume the following variables
+# will be set:
+# Assumes MIMIC_TOP_SRCDIR points to mimic sources directory (where configure is)
+# Assumes MIMIC_INSTALL_DIR points to where mimic will be installed
+# Assumes WORKDIR points to a directory where build items can be placed
+
+crosscompile_dependencies()
+{
+ # Ubuntu precise & trusty bug (inherited from debian):
+ # ${HOST_TRIPLET}-pkg-config ignores PKG_CONFIG_PATH
+ # We need PKG_CONFIG_PATH="${MIMIC_INSTALL_DIR}/lib/pkgconfig/"
+ # so we use pkg-config without the triplet.
+ # and we set PKG_CONFIG_PATH manually to the right search paths
+ # pkg-config in Debian stretch and in Ubuntu xenial have this bug fixed so
+ # in the future the ${HOST_TRIPLET}-pkg-config can be used with a simple
+ # PKG_CONFIG_PATH="${MIMIC_INSTALL_DIR}/lib/pkgconfig/"
+ (cd "${WORKDIR}" && \
+ PKG_CONFIG_LIBDIR="" \
+ PKG_CONFIG_PATH="${MIMIC_INSTALL_DIR}/lib/pkgconfig/:/usr/lib/${HOST_TRIPLET}/pkgconfig:/usr/${HOST_TRIPLET}/lib/pkgconfig" \
+ PKG_CONFIG=`which pkg-config` \
+ ${MIMIC_TOP_SRCDIR}/dependencies.sh \
+ --prefix="${MIMIC_INSTALL_DIR}" \
+ --build="${BUILD_TRIPLET}" \
+ --host="${HOST_TRIPLET}" \
+ "$@" ) || exit 1
}
crosscompile_portaudio()
{
# Download & Extract portaudio
- if [ ! -e "pa_stable_v19_20140130.tgz" ]; then
- wget "http://www.portaudio.com/archives/pa_stable_v19_20140130.tgz"
+ if [ ! -e "${WORKDIR}/pa_stable_v190600_20161030.tgz" ]; then
+ wget -O "${WORKDIR}/pa_stable_v190600_20161030.tgz" "http://www.portaudio.com/archives/pa_stable_v190600_20161030.tgz"
fi
- echo "7f220406902af9dca009668e198cbd23 pa_stable_v19_20140130.tgz" | md5sum -c || exit 1
- tar xzf "pa_stable_v19_20140130.tgz" # creates directory "portaudio"
+ echo "4df8224e047529ca9ad42f0521bf81a8 ${WORKDIR}/pa_stable_v190600_20161030.tgz" | md5sum -c || exit 1
+ tar xzf "${WORKDIR}/pa_stable_v190600_20161030.tgz" -C "${WORKDIR}" # creates directory "portaudio"
+
+ # Patch makefile due to bug:
+ # http://sites.music.columbia.edu/pipermail/portaudio/2014-April/016026.html
+ sed -i -e 's:src/hostapi/wmme \\:src/hostapi/wmme src/hostapi/skeleton \\:' "${WORKDIR}/portaudio/Makefile.in" || exit 1
+
# Cross compile portaudio:
- mkdir portaudio_build
- cd portaudio_build
+ mkdir -p "${WORKDIR}/portaudio_build"
+ (cd "${WORKDIR}/portaudio_build" && \
../portaudio/configure --build="${BUILD_TRIPLET}" \
--host="${HOST_TRIPLET}" \
- --prefix="$WORKDIR/install" \
- CC=${HOST_TRIPLET}-gcc \
- CXX=${HOST_TRIPLET}-g++ \
- LD=${HOST_TRIPLET}-ld \
- RANLIB=${HOST_TRIPLET}-ranlib \
- AR=${HOST_TRIPLET}-ar \
- "$@" || exit 1
- make || exit 1
- make install || exit 1
- cd "${WORKDIR}"
+ --prefix="${MIMIC_INSTALL_DIR}" \
+ "$@" && \
+ make -j ${NCORES} && make install) || exit 1
}
crosscompile_mimic()
{
# Cross compile mimic:
- cd "$WORKDIR" || exit 1
- mkdir mimic_build || exit 1
- cd mimic_build || exit 1
+ mkdir -p "${WORKDIR}/mimic_build" || exit 1
+ ( cd "${WORKDIR}/mimic_build" && \
# Ubuntu precise & trusty bug (inherited from debian):
# ${HOST_TRIPLET}-pkg-config ignores PKG_CONFIG_PATH
- # We need PKG_CONFIG_PATH="$WORKDIR/install/lib/pkgconfig/"
+ # We need PKG_CONFIG_PATH="${MIMIC_INSTALL_DIR}/lib/pkgconfig/"
# so we use pkg-config without the triplet.
# and we set PKG_CONFIG_PATH manually to the right search paths
- # pkg-config in Debian stretch and in Ubuntu xenial has this bug fixed so
+ # pkg-config in Debian stretch and in Ubuntu xenial have this bug fixed so
# in the future the ${HOST_TRIPLET}-pkg-config can be used with a simple
- # PKG_CONFIG_PATH="$WORKDIR/install/lib/pkgconfig/"
- ../configure --build="${BUILD_TRIPLET}" \
+ # PKG_CONFIG_PATH="${MIMIC_INSTALL_DIR}/lib/pkgconfig/"
+ ${MIMIC_TOP_SRCDIR}/configure \
+ --build="${BUILD_TRIPLET}" \
--host="${HOST_TRIPLET}" \
- --prefix="$WORKDIR/install" \
- CC=${HOST_TRIPLET}-gcc \
- LD=${HOST_TRIPLET}-ld \
- RANLIB=${HOST_TRIPLET}-ranlib \
- AR=${HOST_TRIPLET}-ar \
- PKG_CONFIG_PATH="$WORKDIR/install/lib/pkgconfig/:/usr/lib/${HOST_TRIPLET}/pkgconfig:/usr/${HOST_TRIPLET}/lib/pkgconfig" \
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/src/cg/cst_cg.c
^
|
@@ -439,16 +439,16 @@
/* Smooth F0 and mark unvoice frames as 0.0 */
cst_item *mcep;
int i;
- float mean, stddev;
+ float base_mean, base_stddev;
/* cg_smooth_F0_naive(param_track); */
cg_F0_interpolate_spline(utt, param_track);
- mean =
+ base_mean =
get_param_float(utt->features, "int_f0_target_mean", cg_db->f0_mean);
- mean *= get_param_float(utt->features, "f0_shift", 1.0);
- stddev =
+ base_mean *= get_param_float(utt->features, "f0_shift", 1.0);
+ base_stddev =
get_param_float(utt->features, "int_f0_target_stddev",
cg_db->f0_stddev);
@@ -457,6 +457,25 @@
{
if (voiced_frame(mcep))
{
+ float mean = base_mean;
+ float stddev = base_stddev;
+ float local_f0_mean =
+ ffeature_float(mcep,
+ "R:mcep_link.parent.R:segstate.parent.R:SylStructure.parent.parent.R:Token.parent.local_f0_mean"
+ );
+ if (local_f0_mean != 0.0)
+ {
+ mean = local_f0_mean;
+ }
+ float local_f0_range =
+ ffeature_float(mcep,
+ "R:mcep_link.parent.R:segstate.parent.R:SylStructure.parent.parent.R:Token.parent.local_f0_range"
+ );
+ if (local_f0_range > 0.0)
+ {
+ /* feature_float returns 0 by default, shifted to allow 0 to be passed. */
+ stddev = local_f0_range - 1.0;
+ }
/* scale the F0 -- which normally wont change it at all */
param_track->frames[i][0] =
(((param_track->frames[i][0] -
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/src/cg/cst_cg_load_voice.c
^
|
@@ -41,6 +41,7 @@
#include "mimic.h"
#include "cst_cg.h"
#include "cst_cg_map.h"
+#include "cst_alloc.h"
cst_voice *cst_cg_load_voice(const char *filename,
const cst_lang * lang_table)
@@ -55,18 +56,22 @@
char *fval;
cst_file vd;
+ char *vd_buff;
+ vd_buff = cst_alloc(char, 64 * 1024);
vd = cst_fopen(filename, CST_OPEN_READ|CST_OPEN_BINARY);
if (vd == NULL)
{
+ cst_free(vd_buff);
cst_errmsg("Error load voice: can't open file %s\n", filename);
return NULL;
}
-
+ setvbuf(vd, vd_buff, _IOFBF, (size_t)64 * 1024);
if (cst_cg_read_header(vd) != 0)
{
cst_errmsg("Error load voice: %s does not have expected header\n",
filename);
cst_fclose(vd);
+ cst_free(vd_buff);
return NULL;
}
@@ -96,6 +101,7 @@
if (cg_db == NULL)
{
cst_fclose(vd);
+ cst_free(vd_buff);
return NULL;
}
@@ -117,6 +123,7 @@
/* Delete allocated memory in cg_db */
cst_cg_free_db(vd, cg_db);
cst_fclose(vd);
+ cst_free(vd_buff);
cst_errmsg
("Error load voice: lang/lex %s not supported in this binary\n",
language);
@@ -142,6 +149,7 @@
mimic_feat_set_int(vox->features, "sample_rate", cg_db->sample_rate);
cst_fclose(vd);
+ cst_free(vd_buff);
return vox;
}
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/src/cg/cst_cg_map.c
^
|
@@ -76,22 +76,25 @@
{
cst_cg_db *db = cst_alloc(cst_cg_db, 1);
int i;
-
+ uint32_t elements[2];
+ uint32_t integer_vals[2];
+ float float_vals[2];
db->freeable = 1; /* somebody can free this if they want */
-
db->name = cst_read_string(fd);
db->types = (const char **) cst_read_db_types(fd);
- db->num_types = cst_read_int32(fd);
- db->sample_rate = cst_read_int32(fd);
- db->f0_mean = cst_read_float(fd);
- db->f0_stddev = cst_read_float(fd);
-
+ cst_fread(fd, integer_vals, sizeof(integer_vals), 1);
+ cst_fread(fd, float_vals, sizeof(integer_vals), 1);
+ db->num_types = integer_vals[0];
+ db->sample_rate = integer_vals[1];
+ db->f0_mean = float_vals[0];
+ db->f0_stddev = float_vals[1];
db->f0_trees = (const cst_cart **) cst_read_tree_array(fd);
db->num_param_models =
get_param_int(vox->features, "num_param_models", 3);
- db->param_trees = cst_alloc(const cst_cart * const *, db->num_param_models);
+ db->param_trees = cst_alloc(const cst_cart * const *,
+ db->num_param_models);
for (i = 0; i < db->num_param_models; i++)
db->param_trees[i] = (const cst_cart **) cst_read_tree_array(fd);
@@ -108,8 +111,9 @@
cst_alloc(uint16_t **, db->num_param_models);
for (i = 0; i < db->num_param_models; i++)
{
- db->num_channels[i] = cst_read_int32(fd);
- db->num_frames[i] = cst_read_int32(fd);
+ cst_fread(fd, elements, sizeof(uint32_t) * 2, 1);
+ db->num_channels[i] = elements[0];
+ db->num_frames[i] = elements[1];
db->model_vectors[i] =
(uint16_t **) cst_read_2d_array(fd);
}
@@ -180,16 +184,9 @@
void *cst_read_padded(cst_file fd, int *numbytes)
{
void *ret;
- int n;
-
*numbytes = cst_read_int32(fd);
ret = (void *) cst_alloc(char, *numbytes);
- n = cst_fread(fd, ret, sizeof(char), *numbytes);
- if (n != (*numbytes))
- {
- cst_free(ret);
- return NULL;
- }
+ cst_fread(fd, ret, sizeof(char), *numbytes);
return ret;
}
@@ -218,16 +215,17 @@
int i, num_nodes;
short vtype;
char *str;
-
+ uint16_t buff[3];
num_nodes = cst_read_int32(fd);
nodes = cst_alloc(cst_cart_node, num_nodes + 1);
for (i = 0; i < num_nodes; i++)
{
- cst_fread(fd, &nodes[i].feat, sizeof(char), 1);
- cst_fread(fd, &nodes[i].op, sizeof(char), 1);
- cst_fread(fd, &nodes[i].no_node, sizeof(int16_t), 1);
- cst_fread(fd, &vtype, sizeof(int16_t), 1);
+ cst_fread(fd, buff, sizeof(uint16_t) * 3, 1);
+ nodes[i].feat = buff[0] & 0xff;
+ nodes[i].op = buff[0] >> 8;
+ nodes[i].no_node = buff[1];
+ vtype = buff[2];
if (vtype == CST_VAL_TYPE_STRING)
{
str = cst_read_padded(fd, &temp);
@@ -256,7 +254,9 @@
feats = cst_alloc(char *, numfeats + 1);
for (i = 0; i < numfeats; i++)
- feats[i] = cst_read_string(fd);
+ {
+ feats[i] = (char *)cst_read_string(fd);
+ }
feats[i] = 0;
return feats;
@@ -314,7 +314,9 @@
arrayrows = cst_alloc(void *, numrows);
for (i = 0; i < numrows; i++)
+ {
arrayrows[i] = cst_read_array(fd);
+ }
}
return arrayrows;
@@ -325,7 +327,7 @@
int numstats;
int i, temp;
dur_stat **ds;
-
+ float elements[2];
numstats = cst_read_int32(fd);
ds = cst_alloc(dur_stat *, (1 + numstats));
@@ -333,8 +335,9 @@
for (i = 0; i < numstats; i++)
{
ds[i] = cst_alloc(dur_stat, 1);
- ds[i]->mean = cst_read_float(fd);
- ds[i]->stddev = cst_read_float(fd);
+ cst_fread(fd, elements, sizeof(uint32_t), 2);
+ ds[i]->mean = elements[0];
+ ds[i]->stddev = elements[1];
ds[i]->phone = cst_read_padded(fd, &temp);
}
ds[i] = NULL;
@@ -373,22 +376,14 @@
int32_t cst_read_int32(cst_file fd)
{
- int32_t val;
- size_t n;
-
- n = cst_fread(fd, &val, sizeof(int32_t), 1);
- if (n != 1)
- return 0;
+ int32_t val = 0;
+ cst_fread(fd, &val, sizeof(int32_t), 1);
return val;
}
float cst_read_float(cst_file fd)
{
- float val;
- int n;
-
- n = cst_fread(fd, &val, sizeof(float), 1);
- if (n != 1)
- return 0;
+ float val = 0;
+ cst_fread(fd, &val, sizeof(float), 1);
return val;
}
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/src/cg/cst_mlsa.c
^
|
@@ -58,18 +58,17 @@
#include "cst_alloc.h"
#include "cst_string.h"
#include <math.h>
+#include <limits.h>
#include "cst_track.h"
#include "cst_wave.h"
#include "cst_audio.h"
-#ifdef ANDROID
-#define SPEED_HACK
-#endif
-
#include "cst_vc.h"
#include "cst_cg.h"
#include "cst_mlsa.h"
+/* Bellbird optimized mlsa routines */
+#include "../filter/bb_mlsacore.c"
static cst_wave *synthesis_body(const cst_track *params,
const cst_track *str,
@@ -170,7 +169,9 @@
return NULL;
}
else
+ {
return wave;
+ }
}
static void init_vocoder(double fs, int framel, int m, VocoderSetup *vs,
@@ -180,53 +181,37 @@
vs->fprd = framel;
vs->iprd = 1;
vs->seed = 1;
-#ifdef SPEED_HACK
- /* This makes it about 25% faster and sounds basically the same */
- vs->pd = 4;
-#else
- vs->pd = 5;
-#endif
vs->next = 1;
vs->gauss = MTRUE;
/* Pade' approximants */
vs->pade[0] = 1.0;
- vs->pade[1] = 1.0;
- vs->pade[2] = 0.0;
- vs->pade[3] = 1.0;
- vs->pade[4] = 0.0;
- vs->pade[5] = 0.0;
- vs->pade[6] = 1.0;
- vs->pade[7] = 0.0;
- vs->pade[8] = 0.0;
- vs->pade[9] = 0.0;
- vs->pade[10] = 1.0;
- vs->pade[11] = 0.4999273;
- vs->pade[12] = 0.1067005;
- vs->pade[13] = 0.01170221;
- vs->pade[14] = 0.0005656279;
- vs->pade[15] = 1.0;
- vs->pade[16] = 0.4999391;
- vs->pade[17] = 0.1107098;
- vs->pade[18] = 0.01369984;
- vs->pade[19] = 0.0009564853;
- vs->pade[20] = 0.00003041721;
+ vs->pade[1]=0.4999391;
+ vs->pade[2]=0.1107098;
+ vs->pade[3]=0.01369984;
+ vs->pade[4]=0.0009564853;
+ vs->pade[5]=0.00003041721;
vs->rate = fs;
vs->c =
- cst_alloc(double, 3 * (m + 1) + 3 * (vs->pd + 1) + vs->pd * (m + 2));
+ cst_alloc(double, 3 * (m + 1) + 3 * (BELL_PORDER + 1)
+ + BELL_PORDER * (m + 4));
+
+ vs->cc = vs->c + m + 1;
+ vs->cinc = vs->cc + m + 1;
+ vs->d1 = vs->cinc + m + 1;
vs->p1 = -1;
vs->sw = 0;
- vs->x = 0x55555555;
/* for postfiltering */
vs->mc = NULL;
vs->o = 0;
- vs->d = NULL;
vs->irleng = 64;
+ vs->d2offset = 1;
+
// for MIXED EXCITATION
vs->ME_order = cg_db->ME_order;
vs->ME_num = cg_db->ME_num;
@@ -390,9 +375,17 @@
else
x *= exp(vs->c[0]) * gain;
- x = mlsadf(x, vs->c, m, cg_db->mlsa_alpha, vs->pd, vs->d1, vs);
-
- wav->samples[*pos] = (short) x;
+ x = mlsadf(x, vs->c, m, cg_db->mlsa_alpha, vs->d1,
+ &(vs->d2offset), vs->pade);
+ if (x > SHRT_MAX) {
+ wav->samples[*pos] = SHRT_MAX;
+ }
+ else if (x < SHRT_MIN) {
+ wav->samples[*pos] = SHRT_MIN;
+ }
+ else {
+ wav->samples[*pos] = (short) x;
+ }
*pos += 1;
if (!--i)
@@ -410,90 +403,6 @@
return;
}
-static double mlsadf(double x, double *b, int m, double a, int pd, double *d,
- VocoderSetup *vs)
-{
-
- vs->ppade = &(vs->pade[pd * (pd + 1) / 2]);
-
- x = mlsadf1(x, b, m, a, pd, d, vs);
- x = mlsadf2(x, b, m, a, pd, &d[2 * (pd + 1)], vs);
-
- return (x);
-}
-
-static double mlsadf1(double x, double *b, int m, double a, int pd, double *d,
- VocoderSetup *vs)
-{
- (void) m;
- double v, out = 0.0, *pt, aa;
- register int i;
-
- aa = 1 - a * a;
- pt = &d[pd + 1];
-
- for (i = pd; i >= 1; i--)
- {
- d[i] = aa * pt[i - 1] + a * d[i];
- pt[i] = d[i] * b[1];
- v = pt[i] * vs->ppade[i];
- x += (1 & i) ? v : -v;
- out += v;
- }
-
- pt[0] = x;
- out += x;
-
- return (out);
-}
-
-static double mlsadf2(double x, double *b, int m, double a, int pd, double *d,
- VocoderSetup *vs)
-{
- double v, out = 0.0, *pt;
- // double aa;
- register int i;
-
- //aa = 1 - a*a;
- pt = &d[pd * (m + 2)];
-
- for (i = pd; i >= 1; i--)
- {
- pt[i] = mlsafir(pt[i - 1], b, m, a, &d[(i - 1) * (m + 2)]);
-
- v = pt[i] * vs->ppade[i];
-
- x += (1 & i) ? v : -v;
- out += v;
- }
-
- pt[0] = x;
- out += x;
-
- return (out);
-}
-
-static double mlsafir(double x, double *b, int m, double a, double *d)
-{
- double y = 0.0;
- double aa;
- register int i;
-
- aa = 1 - a * a;
-
- d[0] = x;
- d[1] = aa * d[0] + a * d[1];
- for (i = 2; i <= m; i++)
- {
- d[i] = d[i] + a * (d[i + 1] - d[i - 1]);
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/src/cg/cst_mlsa.h
^
|
@@ -66,32 +66,27 @@
int fprd;
int iprd;
int seed;
- int pd;
unsigned long next;
Boolean gauss;
double p1;
double pc;
- double pj;
double pade[21];
- double *ppade;
double *c, *cc, *cinc, *d1;
double rate;
int sw;
double r1, r2, s;
- int x;
-
/* for postfiltering */
- int size;
- double *d;
- double *g;
double *mc;
double *cep;
double *ir;
int o;
int irleng;
+ /* d2 offset to avoid shuffle */
+ int d2offset;
+
/* for MIXED EXCITATION */
int ME_order;
int ME_num;
@@ -111,22 +106,10 @@
const float *str,
int m, cst_cg_db *cg_db,
VocoderSetup *vs, cst_wave *wav, long *pos);
-static double mlsadf(double x, double *b, int m, double a, int pd, double *d,
- VocoderSetup *vs);
-static double mlsadf1(double x, double *b, int m, double a, int pd, double *d,
- VocoderSetup *vs);
-static double mlsadf2(double x, double *b, int m, double a, int pd, double *d,
- VocoderSetup *vs);
-static double mlsafir(double x, double *b, int m, double a, double *d);
static double nrandom(VocoderSetup *vs);
static double rnd(unsigned long *next);
static unsigned long srnd(unsigned long seed);
-static void mc2b(double *mc, double *b, int m, double a);
static double b2en(double *b, int m, double a, VocoderSetup *vs);
-static void b2mc(double *b, double *mc, int m, double a);
-static void freqt(double *c1, int m1, double *c2, int m2, double a,
- VocoderSetup *vs);
-static void c2ir(double *c, int nc, double *h, int leng);
static void free_vocoder(VocoderSetup *vs);
|
[-]
[+]
|
Added |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/src/filter/bb_mlsacore.c
^
|
@@ -0,0 +1,307 @@
+/*************************************************************************/
+/* This code has been modified for Bellbird. */
+/* See COPYING for more copyright details. */
+/* The unmodified source code copyright notice */
+/* is included below. */
+/*************************************************************************/
+/* --------------------------------------------------------------- */
+/* The HMM-Based Speech Synthesis System (HTS): version 1.1b */
+/* HTS Working Group */
+/* */
+/* Department of Computer Science */
+/* Nagoya Institute of Technology */
+/* and */
+/* Interdisciplinary Graduate School of Science and Engineering */
+/* Tokyo Institute of Technology */
+/* Copyright (c) 2001-2003 */
+/* All Rights Reserved. */
+/* */
+/* Permission is hereby granted, free of charge, to use and */
+/* distribute this software and its documentation without */
+/* restriction, including without limitation the rights to use, */
+/* copy, modify, merge, publish, distribute, sublicense, and/or */
+/* sell copies of this work, and to permit persons to whom this */
+/* work is furnished to do so, subject to the following conditions: */
+/* */
+/* 1. The code must retain the above copyright notice, this list */
+/* of conditions and the following disclaimer. */
+/* */
+/* 2. Any modifications must be clearly marked as such. */
+/* */
+/* NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF TECHNOLOGY, */
+/* HTS WORKING GROUP, AND THE CONTRIBUTORS TO THIS WORK DISCLAIM */
+/* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */
+/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
+/* SHALL NAGOYA INSTITUTE OF TECHNOLOGY, TOKYO INSITITUTE OF */
+/* TECHNOLOGY, HTS WORKING GROUP, NOR THE CONTRIBUTORS BE LIABLE */
+/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY */
+/* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, */
+/* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS */
+/* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR */
+/* PERFORMANCE OF THIS SOFTWARE. */
+/* */
+/* This is originally part of Heiga Zen's mlsa code. */
+/* It was modified by Toda and Black eventually ending up in Flite. */
+/*-------------------------------------------------------------------*/
+
+/* This source file is included in more than one compilation unit. */
+/* Ordinarily we might use normal functions but we use static functions */
+/* as experience has showed us this code is highly performance critical */
+/* and the compiler likes to inline and improve performance of these */
+/* functions if we declare them static. */
+
+#define BELL_PORDER 5
+
+#define RANDMAX 32767
+static double mlsadf1(double x, const double *c, const double a,
+ double *d1, const double *ppade)
+{
+ double v, out = 0.0, *pt, aa;
+ int i;
+
+ aa = 1 - a*a;
+ pt = &d1[BELL_PORDER+1];
+
+ for (i=BELL_PORDER; i>=1; i--) {
+ d1[i] = aa*pt[i-1] + a*d1[i];
+ pt[i] = d1[i] * c[1];
+ v = pt[i] * ppade[i];
+ x += (1 & i) ? v : -v;
+ out += v;
+ }
+
+ pt[0] = x;
+ out += x;
+
+ return(out);
+}
+
+static double mlsadf2(double x, const double *c, const int m, const double a,
+ double *d2, const double *ppade, int *pd2offset)
+{
+// This function is partially optimized as it is extremely performance
+// critical to bellbird. Before making changes
+// ensure that changes have been profiled.
+// This function avoids some unnecessary memory copies
+// which improves performance at the cost of slightly more
+// memory (a few hundred bytes).
+// This function has been partially optimized with "by hand" loop
+// unrolling and caching to reduce impact of recursion in the underlying equations.
+// This outperforms gcc and clang's builtin optimizers.
+// This function only works for BELL_PORDER=5.
+
+ double v, out = 0.0;
+ double * const pt = &d2[BELL_PORDER * (m+4)];
+ const double aa = 1 - a*a;
+ double ptcache[BELL_PORDER]; // temp holding pt[] values to reduce recursiveness
+ const int d2offset = *pd2offset;
+ int j,k;
+// default values for start and end of loops through history terms
+// set end of first loop
+ const int offsetend1 = (d2offset == BELL_PORDER) ? BELL_PORDER*(m+1): BELL_PORDER*(m+2);
+// set end of second loop
+ const int offsetend2 = d2offset-2*BELL_PORDER;
+// start of second loop
+ int offsetstart2 = BELL_PORDER;
+// index of second element
+ int secelement = d2offset + BELL_PORDER;
+// a special case for loop lengths
+ if (d2offset == BELL_PORDER*(m+2)) {
+ offsetstart2 = 2*BELL_PORDER;
+ secelement = BELL_PORDER;
+ }
+
+// Filtering but without shuffling history terms.
+// d2offset is index of start of history terms which are stored in a
+// wrap around buffer.
+// Elements d2[0] and d2[BELL_PORDER*(m+3)] are 'ghost' edge elements
+// to avoid conditionals in stencil (d2[k+BELL_PORDER]-d2[k-BELL_PORDER])
+ ptcache[0] = 0.0;
+ ptcache[1] = 0.0;
+ ptcache[2] = 0.0;
+ ptcache[3] = 0.0;
+ ptcache[4] = 0.0;
+ j = 2; // initialize indexing for MLSA filter coefficients
+
+// Second element is a special case calculate it here
+ d2[secelement] = aa*pt[0] + a*d2[secelement];
+ d2[secelement+1] = aa*pt[1] + a*d2[secelement+1];
+ d2[secelement+2] = aa*pt[2] + a*d2[secelement+2];
+ d2[secelement+3] = aa*pt[3] + a*d2[secelement+3];
+ d2[secelement+4] = aa*pt[4] + a*d2[secelement+4];
+
+// First part of loop through wrap around buffer
+ for (k=d2offset+2*BELL_PORDER; k<=offsetend1; k+=BELL_PORDER,j++) {
+ d2[k] += a*(d2[k+BELL_PORDER] -d2[k-BELL_PORDER]);
+ d2[k+1] += a*(d2[k+BELL_PORDER+1]-d2[k-BELL_PORDER+1]);
+ d2[k+2] += a*(d2[k+BELL_PORDER+2]-d2[k-BELL_PORDER+2]);
+ d2[k+3] += a*(d2[k+BELL_PORDER+3]-d2[k-BELL_PORDER+3]);
+ d2[k+4] += a*(d2[k+BELL_PORDER+4]-d2[k-BELL_PORDER+4]);
+ ptcache[0] += d2[k] * c[j];
+ ptcache[1] += d2[k+1]*c[j];
+ ptcache[2] += d2[k+2]*c[j];
+ ptcache[3] += d2[k+3]*c[j];
+ ptcache[4] += d2[k+4]*c[j];
+ }
+
+// Update 'ghost' edge element of stencil d2[0]
+ d2[0] = d2[BELL_PORDER*(m+2)];
+ d2[1] = d2[BELL_PORDER*(m+2)+1];
+ d2[2] = d2[BELL_PORDER*(m+2)+2];
+ d2[3] = d2[BELL_PORDER*(m+2)+3];
+ d2[4] = d2[BELL_PORDER*(m+2)+4];
+
+// Second part of loop through wrap around buffer
+ for (k=offsetstart2; k<=offsetend2; k+=BELL_PORDER,j++) {
+ d2[k] += a*(d2[k+BELL_PORDER] -d2[k-BELL_PORDER]);
+ d2[k+1] += a*(d2[k+BELL_PORDER+1]-d2[k-BELL_PORDER+1]);
+ d2[k+2] += a*(d2[k+BELL_PORDER+2]-d2[k-BELL_PORDER+2]);
+ d2[k+3] += a*(d2[k+BELL_PORDER+3]-d2[k-BELL_PORDER+3]);
+ d2[k+4] += a*(d2[k+BELL_PORDER+4]-d2[k-BELL_PORDER+4]);
+ ptcache[0] += d2[k] * c[j];
+ ptcache[1] += d2[k+1]*c[j];
+ ptcache[2] += d2[k+2]*c[j];
+ ptcache[3] += d2[k+3]*c[j];
+ ptcache[4] += d2[k+4]*c[j];
+ }
+
+// Copy element which is not shuffled in usual implement. of this function
+ d2[d2offset] = d2[secelement];
+ d2[d2offset+1] = d2[secelement+1];
+ d2[d2offset+2] = d2[secelement+2];
+ d2[d2offset+3] = d2[secelement+3];
+ d2[d2offset+4] = d2[secelement+4];
+
+// Copy 'ghost' edge elements for stencil in next call of this function
+ d2[0] = d2[BELL_PORDER*(m+2)];
+ d2[1] = d2[BELL_PORDER*(m+2)+1];
+ d2[2] = d2[BELL_PORDER*(m+2)+2];
+ d2[3] = d2[BELL_PORDER*(m+2)+3];
+ d2[4] = d2[BELL_PORDER*(m+2)+4];
+ d2[BELL_PORDER*(m+3)] = d2[BELL_PORDER];
+ d2[BELL_PORDER*(m+3)+1] = d2[BELL_PORDER+1];
+ d2[BELL_PORDER*(m+3)+2] = d2[BELL_PORDER+2];
+ d2[BELL_PORDER*(m+3)+3] = d2[BELL_PORDER+3];
+ d2[BELL_PORDER*(m+3)+4] = d2[BELL_PORDER+4];
+
+// Update pt values from cache
+ pt[5] = ptcache[4];
+ pt[4] = ptcache[3];
+ pt[3] = ptcache[2];
+ pt[2] = ptcache[1];
+ pt[1] = ptcache[0];
+
+ for (k=BELL_PORDER; k>=1; k--) {
+ v = pt[k] * ppade[k];
+ x += (1 & k) ? v : -v;
+ out += v;
+ }
+
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/src/hrg/cst_rel_io.c
^
|
@@ -49,7 +49,7 @@
cst_item *item;
const char *token = 0;
- if ((fd = ts_open(filename, NULL, ";", "", "")) == 0)
+ if ((fd = ts_open(filename, NULL, ";", "", "", 0)) == 0)
{
cst_errmsg("relation_load: can't open file \"%s\" for reading\n",
filename);
|
[-]
[+]
|
Added |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/src/hts/flite_hts_engine.c
^
|
@@ -0,0 +1,550 @@
+/* ----------------------------------------------------------------- */
+/* The English TTS System "Flite+hts_engine" */
+/* developed by HTS Working Group */
+/* http://hts-engine.sourceforge.net/ */
+/* ----------------------------------------------------------------- */
+/* */
+/* Copyright (c) 2005-2016 Nagoya Institute of Technology */
+/* Department of Computer Science */
+/* */
+/* 2005-2008 Tokyo Institute of Technology */
+/* Interdisciplinary Graduate School of */
+/* Science and Engineering */
+/* */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or */
+/* without modification, are permitted provided that the following */
+/* conditions are met: */
+/* */
+/* - Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* - Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* - Neither the name of the HTS working group nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */
+/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */
+/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
+/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
+/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS */
+/* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
+/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
+/* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
+/* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, */
+/* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY */
+/* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/* POSSIBILITY OF SUCH DAMAGE. */
+/* ----------------------------------------------------------------- */
+/* mimic adaptations by Sergio Oller, 2017 */
+
+#include "config.h"
+#include "cst_synth.h"
+#include "cst_utt_utils.h"
+#include <math.h>
+#include "cst_file.h"
+#include "cst_val.h"
+#include "cst_string.h"
+#include "cst_alloc.h"
+#include "cst_item.h"
+#include "cst_relation.h"
+#include "cst_utterance.h"
+#include "cst_tokenstream.h"
+#include "cst_string.h"
+#include "cst_regex.h"
+#include "cst_features.h"
+#include "cst_utterance.h"
+#include "mimic.h"
+#include "cst_synth.h"
+#include "cst_utt_utils.h"
+
+#include "flite_hts_engine.h"
+
+#if HAVE_HTSENGINE == 0
+
+#include "cst_error.h"
+
+CST_VAL_REGISTER_TYPE(flitehtsengine, Flite_HTS_Engine);
+
+void delete_flitehtsengine(Flite_HTS_Engine * f)
+{
+ cst_errmsg("HTS Engine not supported in this compiled version of mimic");
+ return;
+}
+
+#else /* HAVE_HTSENGINE */
+
+
+#define MAXBUFLEN 1024
+
+CST_VAL_REGISTER_TYPE(flitehtsengine, Flite_HTS_Engine);
+
+/* create_label: create label per phoneme */
+static void create_label(cst_item *item, char *label)
+{
+ const char *p1 = ffeature_string(item, "p.p.name");
+ const char *p2 = ffeature_string(item, "p.name");
+ const char *p3 = ffeature_string(item, "name");
+ const char *p4 = ffeature_string(item, "n.name");
+ const char *p5 = ffeature_string(item, "n.n.name");
+
+ if (strcmp(p3, "pau") == 0)
+ {
+ /* for pause */
+ int a3 =
+ ffeature_int(item,
+ "p.R:SylStructure.parent.R:Syllable.syl_numphones");
+ int c3 =
+ ffeature_int(item,
+ "n.R:SylStructure.parent.R:Syllable.syl_numphones");
+ int d2 =
+ ffeature_int(item,
+ "p.R:SylStructure.parent.parent.R:Word.word_numsyls");
+ int f2 =
+ ffeature_int(item,
+ "n.R:SylStructure.parent.parent.R:Word.word_numsyls");
+ int g1 =
+ ffeature_int(item,
+ "p.R:SylStructure.parent.parent.R:Phrase.parent.lisp_num_syls_in_phrase");
+ int g2 =
+ ffeature_int(item,
+ "p.R:SylStructure.parent.parent.R:Phrase.parent.lisp_num_words_in_phrase");
+ int i1 =
+ ffeature_int(item,
+ "n.R:SylStructure.parent.parent.R:Phrase.parent.lisp_num_syls_in_phrase");
+ int i2 =
+ ffeature_int(item,
+ "n.R:SylStructure.parent.parent.R:Phrase.parent.lisp_num_words_in_phrase");
+ int j1, j2, j3;
+ if (item_next(item) != NULL)
+ {
+ j1 = ffeature_int(item,
+ "n.R:SylStructure.parent.parent.R:Phrase.parent.lisp_total_syls");
+ j2 = ffeature_int(item,
+ "n.R:SylStructure.parent.parent.R:Phrase.parent.lisp_total_words");
+ j3 = ffeature_int(item,
+ "n.R:SylStructure.parent.parent.R:Phrase.parent.lisp_total_phrases");
+ }
+ else
+ {
+ j1 = ffeature_int(item,
+ "p.R:SylStructure.parent.parent.R:Phrase.parent.lisp_total_syls");
+ j2 = ffeature_int(item,
+ "p.R:SylStructure.parent.parent.R:Phrase.parent.lisp_total_words");
+ j3 = ffeature_int(item,
+ "p.R:SylStructure.parent.parent.R:Phrase.parent.lisp_total_phrases");
+ }
+ sprintf(label, "%s^%s-%s+%s=%s@xx_xx/A:%s_%s_%s/B:xx-xx-xx@xx-xx&xx-xx#xx-xx$xx-xx!xx-xx;xx-xx|xx/C:%s+%s+%s/D:%s_%s/E:xx+xx@xx+xx&xx+xx#xx+xx/F:%s_%s/G:%s_%s/H:xx=xx^xx=xx|xx/I:%s=%s/J:%d+%d-%d", /* */
+ strcmp(p1, "0") == 0 ? "xx" : p1, /* p1 */
+ strcmp(p2, "0") == 0 ? "xx" : p2, /* p2 */
+ p3, /* p3 */
+ strcmp(p4, "0") == 0 ? "xx" : p4, /* p4 */
+ strcmp(p5, "0") == 0 ? "xx" : p5, /* p5 */
+ a3 == 0 ? "xx" : ffeature_string(item, "p.R:SylStructure.parent.R:Syllable.stress"), /* a1 */
+ a3 == 0 ? "xx" : ffeature_string(item, "p.R:SylStructure.parent.R:Syllable.accented"), /* a2 */
+ a3 == 0 ? "xx" : val_string(val_string_n(a3)), /* a3 */
+ c3 == 0 ? "xx" : ffeature_string(item, "n.R:SylStructure.parent.R:Syllable.stress"), /* c1 */
+ c3 == 0 ? "xx" : ffeature_string(item, "n.R:SylStructure.parent.R:Syllable.accented"), /* c2 */
+ c3 == 0 ? "xx" : val_string(val_string_n(c3)), /* c3 */
+ d2 == 0 ? "xx" : ffeature_string(item, "p.R:SylStructure.parent.parent.R:Word.gpos"), /* d1 */
+ d2 == 0 ? "xx" : val_string(val_string_n(d2)), /* d2 */
+ f2 == 0 ? "xx" : ffeature_string(item, "n.R:SylStructure.parent.parent.R:Word.gpos"), /* f1 */
+ f2 == 0 ? "xx" : val_string(val_string_n(f2)), /* f2 */
+ g1 == 0 ? "xx" : val_string(val_string_n(g1)), /* g1 */
+ g2 == 0 ? "xx" : val_string(val_string_n(g2)), /* g2 */
+ i1 == 0 ? "xx" : val_string(val_string_n(i1)), /* i1 */
+ i2 == 0 ? "xx" : val_string(val_string_n(i2)), /* i2 */
+ j1, /* j1 */
+ j2, /* j2 */
+ j3); /* j3 */
+ }
+ else
+ {
+ /* for no pause */
+ int p6 = ffeature_int(item, "R:SylStructure.pos_in_syl") + 1;
+ int a3 =
+ ffeature_int(item,
+ "R:SylStructure.parent.R:Syllable.p.syl_numphones");
+ int b3 =
+ ffeature_int(item,
+ "R:SylStructure.parent.R:Syllable.syl_numphones");
+ int b4 =
+ ffeature_int(item,
+ "R:SylStructure.parent.R:Syllable.pos_in_word") + 1;
+ int b12 =
+ ffeature_int(item,
+ "R:SylStructure.parent.R:Syllable.lisp_distance_to_p_stress");
+ int b13 =
+ ffeature_int(item,
+ "R:SylStructure.parent.R:Syllable.lisp_distance_to_n_stress");
+ int b14 =
+ ffeature_int(item,
+ "R:SylStructure.parent.R:Syllable.lisp_distance_to_p_accent");
+ int b15 =
+ ffeature_int(item,
+ "R:SylStructure.parent.R:Syllable.lisp_distance_to_n_accent");
+ int c3 =
+ ffeature_int(item,
+ "R:SylStructure.parent.R:Syllable.n.syl_numphones");
+ int d2 =
+ ffeature_int(item,
+ "R:SylStructure.parent.parent.R:Word.p.word_numsyls");
+ int e2 =
+ ffeature_int(item,
+ "R:SylStructure.parent.parent.R:Word.word_numsyls");
|
[-]
[+]
|
Added |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/src/hts/hts_engine_API/include/HTS_engine.h
^
|
@@ -0,0 +1,473 @@
+/* ----------------------------------------------------------------- */
+/* The HMM-Based Speech Synthesis Engine "hts_engine API" */
+/* developed by HTS Working Group */
+/* http://hts-engine.sourceforge.net/ */
+/* ----------------------------------------------------------------- */
+/* */
+/* Copyright (c) 2001-2015 Nagoya Institute of Technology */
+/* Department of Computer Science */
+/* */
+/* 2001-2008 Tokyo Institute of Technology */
+/* Interdisciplinary Graduate School of */
+/* Science and Engineering */
+/* */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or */
+/* without modification, are permitted provided that the following */
+/* conditions are met: */
+/* */
+/* - Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* - Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* - Neither the name of the HTS working group nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */
+/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */
+/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
+/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
+/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS */
+/* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
+/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
+/* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
+/* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, */
+/* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY */
+/* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/* POSSIBILITY OF SUCH DAMAGE. */
+/* ----------------------------------------------------------------- */
+
+#ifndef HTS_ENGINE_H
+#define HTS_ENGINE_H
+
+#ifdef __cplusplus
+#define HTS_ENGINE_H_START extern "C" {
+#define HTS_ENGINE_H_END }
+#else
+#define HTS_ENGINE_H_START
+#define HTS_ENGINE_H_END
+#endif /* __CPLUSPLUS */
+
+HTS_ENGINE_H_START;
+
+#include <stdio.h>
+
+/* common ---------------------------------------------------------- */
+
+typedef char HTS_Boolean;
+
+#ifndef TRUE
+#define TRUE 1
+#endif /* !TRUE */
+
+#ifndef FALSE
+#define FALSE 0
+#endif /* !FALSE */
+
+#ifndef HTS_NODATA
+#define HTS_NODATA (-1.0e+10)
+#endif /* HTS_NODATA */
+
+/* copyright ------------------------------------------------------- */
+
+#define HTS_COPYRIGHT "The HMM-Based Speech Synthesis Engine \"hts_engine API\"\nVersion 1.10 (http://hts-engine.sourceforge.net/)\nCopyright (C) 2001-2015 Nagoya Institute of Technology\n 2001-2008 Tokyo Institute of Technology\nAll rights reserved.\n"
+
+/* audio ----------------------------------------------------------- */
+
+/* HTS_Audio: audio output wrapper */
+typedef struct _HTS_Audio {
+ size_t sampling_frequency; /* sampling frequency */
+ size_t max_buff_size; /* buffer size for audio output interface */
+ short *buff; /* current buffer */
+ size_t buff_size; /* current buffer size */
+ void *audio_interface; /* audio interface specified in compile step */
+} HTS_Audio;
+
+/* model ----------------------------------------------------------- */
+
+/* HTS_Window: window coefficients to calculate dynamic features. */
+typedef struct _HTS_Window {
+ size_t size; /* # of windows (static + deltas) */
+ int *l_width; /* left width of windows */
+ int *r_width; /* right width of windows */
+ double **coefficient; /* window coefficient */
+ size_t max_width; /* maximum width of windows */
+} HTS_Window;
+
+/* HTS_Pattern: list of patterns in a question and a tree. */
+typedef struct _HTS_Pattern {
+ char *string; /* pattern string */
+ struct _HTS_Pattern *next; /* pointer to the next pattern */
+} HTS_Pattern;
+
+/* HTS_Question: list of questions in a tree. */
+typedef struct _HTS_Question {
+ char *string; /* name of this question */
+ HTS_Pattern *head; /* pointer to the head of pattern list */
+ struct _HTS_Question *next; /* pointer to the next question */
+} HTS_Question;
+
+/* HTS_Node: list of tree nodes in a tree. */
+typedef struct _HTS_Node {
+ int index; /* index of this node */
+ size_t pdf; /* index of PDF for this node (leaf node only) */
+ struct _HTS_Node *yes; /* pointer to its child node (yes) */
+ struct _HTS_Node *no; /* pointer to its child node (no) */
+ struct _HTS_Node *next; /* pointer to the next node */
+ HTS_Question *quest; /* question applied at this node */
+} HTS_Node;
+
+/* HTS_Tree: list of decision trees in a model. */
+typedef struct _HTS_Tree {
+ HTS_Pattern *head; /* pointer to the head of pattern list for this tree */
+ struct _HTS_Tree *next; /* pointer to next tree */
+ HTS_Node *root; /* root node of this tree */
+ size_t state; /* state index of this tree */
+} HTS_Tree;
+
+/* HTS_Model: set of PDFs, decision trees and questions. */
+typedef struct _HTS_Model {
+ size_t vector_length; /* vector length (static features only) */
+ size_t num_windows; /* # of windows for delta */
+ HTS_Boolean is_msd; /* flag for MSD */
+ size_t ntree; /* # of trees */
+ size_t *npdf; /* # of PDFs at each tree */
+ float ***pdf; /* PDFs */
+ HTS_Tree *tree; /* pointer to the list of trees */
+ HTS_Question *question; /* pointer to the list of questions */
+} HTS_Model;
+
+/* HTS_ModelSet: set of duration models, HMMs and GV models. */
+typedef struct _HTS_ModelSet {
+ char *hts_voice_version; /* version of HTS voice format */
+ size_t sampling_frequency; /* sampling frequency */
+ size_t frame_period; /* frame period */
+ size_t num_voices; /* # of HTS voices */
+ size_t num_states; /* # of HMM states */
+ size_t num_streams; /* # of streams */
+ char *stream_type; /* stream type */
+ char *fullcontext_format; /* fullcontext label format */
+ char *fullcontext_version; /* version of fullcontext label */
+ HTS_Question *gv_off_context; /* GV switch */
+ char **option; /* options for each stream */
+ HTS_Model *duration; /* duration PDFs and trees */
+ HTS_Window *window; /* window coefficients for delta */
+ HTS_Model **stream; /* parameter PDFs and trees */
+ HTS_Model **gv; /* GV PDFs and trees */
+} HTS_ModelSet;
+
+/* label ----------------------------------------------------------- */
+
+/* HTS_LabelString: individual label string with time information */
+typedef struct _HTS_LabelString {
+ struct _HTS_LabelString *next; /* pointer to next label string */
+ char *name; /* label string */
+ double start; /* start frame specified in the given label */
+ double end; /* end frame specified in the given label */
+} HTS_LabelString;
+
+/* HTS_Label: list of label strings */
+typedef struct _HTS_Label {
+ HTS_LabelString *head; /* pointer to the head of label string */
+ size_t size; /* # of label strings */
+} HTS_Label;
+
+/* sstream --------------------------------------------------------- */
+
+/* HTS_SStream: individual state stream */
+typedef struct _HTS_SStream {
+ size_t vector_length; /* vector length (static features only) */
+ double **mean; /* mean vector sequence */
+ double **vari; /* variance vector sequence */
+ double *msd; /* MSD parameter sequence */
+ size_t win_size; /* # of windows (static + deltas) */
+ int *win_l_width; /* left width of windows */
+ int *win_r_width; /* right width of windows */
+ double **win_coefficient; /* window cofficients */
+ size_t win_max_width; /* maximum width of windows */
+ double *gv_mean; /* mean vector of GV */
+ double *gv_vari; /* variance vector of GV */
+ HTS_Boolean *gv_switch; /* GV flag sequence */
+} HTS_SStream;
+
+/* HTS_SStreamSet: set of state stream */
+typedef struct _HTS_SStreamSet {
|
[-]
[+]
|
Added |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/src/hts/hts_engine_API/lib/HTS_audio.c
^
|
@@ -0,0 +1,508 @@
+/* ----------------------------------------------------------------- */
+/* The HMM-Based Speech Synthesis Engine "hts_engine API" */
+/* developed by HTS Working Group */
+/* http://hts-engine.sourceforge.net/ */
+/* ----------------------------------------------------------------- */
+/* */
+/* Copyright (c) 2001-2015 Nagoya Institute of Technology */
+/* Department of Computer Science */
+/* */
+/* 2001-2008 Tokyo Institute of Technology */
+/* Interdisciplinary Graduate School of */
+/* Science and Engineering */
+/* */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or */
+/* without modification, are permitted provided that the following */
+/* conditions are met: */
+/* */
+/* - Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* - Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* - Neither the name of the HTS working group nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */
+/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */
+/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
+/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
+/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS */
+/* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
+/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
+/* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
+/* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, */
+/* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY */
+/* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/* POSSIBILITY OF SUCH DAMAGE. */
+/* ----------------------------------------------------------------- */
+
+#ifndef HTS_AUDIO_C
+#define HTS_AUDIO_C
+
+#ifdef __cplusplus
+#define HTS_AUDIO_C_START extern "C" {
+#define HTS_AUDIO_C_END }
+#else
+#define HTS_AUDIO_C_START
+#define HTS_AUDIO_C_END
+#endif /* __CPLUSPLUS */
+
+HTS_AUDIO_C_START;
+
+#if !defined(AUDIO_PLAY_WIN32) && !defined(AUDIO_PLAY_PORTAUDIO) && !defined(AUDIO_PLAY_NONE)
+#if defined(__WINCE__) || defined(_WINCE) || defined(_WINCE) || defined(__WINCE) || defined(__WIN32__) || defined(__WIN32) || defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
+#define AUDIO_PLAY_WIN32
+#else
+#define AUDIO_PLAY_NONE
+#endif /* __WINCE__ || _WINCE || _WINCE || __WINCE || __WIN32__ || __WIN32 || _WIN32 || WIN32 || __CYGWIN__ || __MINGW32__ */
+#endif /* !AUDIO_PLAY_WIN32 && !AUDIO_PLAY_PORTAUDIO && !AUDIO_PLAY_NONE */
+
+/* hts_engine libralies */
+#include "HTS_hidden.h"
+
+#ifdef AUDIO_PLAY_WIN32
+
+#include <windows.h>
+#include <mmsystem.h>
+#define AUDIO_WAIT_BUFF_MS 10 /* wait time (0.01 sec) */
+#define AUDIO_CHANNEL 1 /* monaural */
+#ifdef _M_X64
+#define AUDIO_POINTER_TYPE DWORD_PTR
+#else
+#define AUDIO_POINTER_TYPE DWORD
+#endif
+
+/* HTS_Audio: audio interface for Windows */
+typedef struct _HTS_AudioInterface {
+ HWAVEOUT hwaveout; /* audio device handle */
+ WAVEFORMATEX waveformatex; /* wave formatex */
+ unsigned char which_buff; /* double buffering flag */
+ HTS_Boolean now_buff_1; /* double buffering flag */
+ HTS_Boolean now_buff_2; /* double buffering flag */
+ WAVEHDR buff_1; /* buffer */
+ WAVEHDR buff_2; /* buffer */
+} HTS_AudioInterface;
+
+/* HTS_AudioInterface_callback_function: callback function from audio device */
+static void CALLBACK HTS_AudioInterface_callback_function(HWAVEOUT hwaveout, UINT msg, AUDIO_POINTER_TYPE user_data, AUDIO_POINTER_TYPE param1, AUDIO_POINTER_TYPE param2)
+{
+ WAVEHDR *wavehdr = (WAVEHDR *) param1;
+ HTS_AudioInterface *audio_interface = (HTS_AudioInterface *) user_data;
+
+ if (msg == MM_WOM_DONE && wavehdr && (wavehdr->dwFlags & WHDR_DONE)) {
+ if (audio_interface->now_buff_1 == TRUE && wavehdr == &(audio_interface->buff_1)) {
+ audio_interface->now_buff_1 = FALSE;
+ } else if (audio_interface->now_buff_2 == TRUE && wavehdr == &(audio_interface->buff_2)) {
+ audio_interface->now_buff_2 = FALSE;
+ }
+ }
+}
+
+/* HTS_AudioInterface_write: send buffer to audio device */
+static HTS_Boolean HTS_AudioInterface_write(HTS_AudioInterface * audio_interface, const short *buff, size_t buff_size)
+{
+ MMRESULT result;
+
+ if (audio_interface->which_buff == 1) {
+ while (audio_interface->now_buff_1 == TRUE)
+ Sleep(AUDIO_WAIT_BUFF_MS);
+ audio_interface->now_buff_1 = TRUE;
+ audio_interface->which_buff = 2;
+ memcpy(audio_interface->buff_1.lpData, buff, buff_size * sizeof(short));
+ audio_interface->buff_1.dwBufferLength = (DWORD) buff_size *sizeof(short);
+ result = waveOutWrite(audio_interface->hwaveout, &(audio_interface->buff_1), sizeof(WAVEHDR));
+ } else {
+ while (audio_interface->now_buff_2 == TRUE)
+ Sleep(AUDIO_WAIT_BUFF_MS);
+ audio_interface->now_buff_2 = TRUE;
+ audio_interface->which_buff = 1;
+ memcpy(audio_interface->buff_2.lpData, buff, buff_size * sizeof(short));
+ audio_interface->buff_2.dwBufferLength = (DWORD) buff_size *sizeof(short);
+ result = waveOutWrite(audio_interface->hwaveout, &(audio_interface->buff_2), sizeof(WAVEHDR));
+ }
+
+ if (result != MMSYSERR_NOERROR)
+ HTS_error(0, "hts_engine: Cannot send datablocks to your output audio device to play waveform.\n");
+
+ return (result == MMSYSERR_NOERROR) ? TRUE : FALSE;
+}
+
+/* HTS_AudioInterface_close: close audio device */
+static void HTS_AudioInterface_close(HTS_AudioInterface * audio_interface)
+{
+ MMRESULT result;
+
+ /* stop audio */
+ result = waveOutReset(audio_interface->hwaveout);
+ if (result != MMSYSERR_NOERROR)
+ HTS_error(0, "hts_engine: Cannot stop and reset your output audio device.\n");
+ /* unprepare */
+ result = waveOutUnprepareHeader(audio_interface->hwaveout, &(audio_interface->buff_1), sizeof(WAVEHDR));
+ if (result != MMSYSERR_NOERROR)
+ HTS_error(0, "hts_engine: Cannot cleanup the audio datablocks to play waveform.\n");
+ result = waveOutUnprepareHeader(audio_interface->hwaveout, &(audio_interface->buff_2), sizeof(WAVEHDR));
+ if (result != MMSYSERR_NOERROR)
+ HTS_error(0, "hts_engine: Cannot cleanup the audio datablocks to play waveform.\n");
+ /* close */
+ result = waveOutClose(audio_interface->hwaveout);
+ if (result != MMSYSERR_NOERROR)
+ HTS_error(0, "hts_engine: Failed to close your output audio device.\n");
+ if (audio_interface->buff_1.lpData != NULL)
+ HTS_free(audio_interface->buff_1.lpData);
+ if (audio_interface->buff_2.lpData != NULL)
+ HTS_free(audio_interface->buff_2.lpData);
+
+ HTS_free(audio_interface);
+}
+
+static HTS_AudioInterface *HTS_AudioInterface_open(size_t sampling_frequency, size_t max_buff_size)
+{
+ HTS_AudioInterface *audio_interface;
+ MMRESULT result;
+
+ /* make audio interface */
+ audio_interface = (HTS_AudioInterface *) HTS_calloc(1, sizeof(HTS_AudioInterface));
+
+ audio_interface->hwaveout = 0;
+ audio_interface->which_buff = 1;
+ audio_interface->now_buff_1 = FALSE;
+ audio_interface->now_buff_2 = FALSE;
+
+ /* format */
+ audio_interface->waveformatex.wFormatTag = WAVE_FORMAT_PCM;
+ audio_interface->waveformatex.nChannels = AUDIO_CHANNEL;
+ audio_interface->waveformatex.nSamplesPerSec = (DWORD) sampling_frequency;
+ audio_interface->waveformatex.wBitsPerSample = sizeof(short) * 8;
+ audio_interface->waveformatex.nBlockAlign = AUDIO_CHANNEL * audio_interface->waveformatex.wBitsPerSample / 8;
+ audio_interface->waveformatex.nAvgBytesPerSec = (DWORD) sampling_frequency *audio_interface->waveformatex.nBlockAlign;
+ /* open */
+ result = waveOutOpen(&audio_interface->hwaveout, WAVE_MAPPER, &audio_interface->waveformatex, (AUDIO_POINTER_TYPE) HTS_AudioInterface_callback_function, (AUDIO_POINTER_TYPE) audio_interface, CALLBACK_FUNCTION);
+ if (result != MMSYSERR_NOERROR) {
+ HTS_error(0, "hts_engine: Failed to open your output audio_interface device to play waveform.\n");
+ HTS_free(audio_interface);
+ return NULL;
+ }
+
+ /* prepare */
+ audio_interface->buff_1.lpData = (LPSTR) HTS_calloc(max_buff_size, sizeof(short));
+ audio_interface->buff_1.dwBufferLength = (DWORD) max_buff_size *sizeof(short);
+ audio_interface->buff_1.dwFlags = WHDR_BEGINLOOP | WHDR_ENDLOOP;
+ audio_interface->buff_1.dwLoops = 1;
+ audio_interface->buff_1.lpNext = 0;
+ audio_interface->buff_1.reserved = 0;
+ result = waveOutPrepareHeader(audio_interface->hwaveout, &(audio_interface->buff_1), sizeof(WAVEHDR));
|
[-]
[+]
|
Added |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/src/hts/hts_engine_API/lib/HTS_engine.c
^
|
@@ -0,0 +1,792 @@
+/* ----------------------------------------------------------------- */
+/* The HMM-Based Speech Synthesis Engine "hts_engine API" */
+/* developed by HTS Working Group */
+/* http://hts-engine.sourceforge.net/ */
+/* ----------------------------------------------------------------- */
+/* */
+/* Copyright (c) 2001-2015 Nagoya Institute of Technology */
+/* Department of Computer Science */
+/* */
+/* 2001-2008 Tokyo Institute of Technology */
+/* Interdisciplinary Graduate School of */
+/* Science and Engineering */
+/* */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or */
+/* without modification, are permitted provided that the following */
+/* conditions are met: */
+/* */
+/* - Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* - Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* - Neither the name of the HTS working group nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */
+/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */
+/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
+/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
+/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS */
+/* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
+/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
+/* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
+/* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, */
+/* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY */
+/* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/* POSSIBILITY OF SUCH DAMAGE. */
+/* ----------------------------------------------------------------- */
+
+#ifndef HTS_ENGINE_C
+#define HTS_ENGINE_C
+
+#ifdef __cplusplus
+#define HTS_ENGINE_C_START extern "C" {
+#define HTS_ENGINE_C_END }
+#else
+#define HTS_ENGINE_C_START
+#define HTS_ENGINE_C_END
+#endif /* __CPLUSPLUS */
+
+HTS_ENGINE_C_START;
+
+#include <stdlib.h> /* for atof() */
+#include <string.h> /* for strcpy() */
+#include <math.h> /* for pow() */
+
+/* hts_engine libraries */
+#include "HTS_hidden.h"
+
+/* HTS_Engine_initialize: initialize engine */
+void HTS_Engine_initialize(HTS_Engine * engine)
+{
+ /* global */
+ engine->condition.sampling_frequency = 0;
+ engine->condition.fperiod = 0;
+ engine->condition.audio_buff_size = 0;
+ engine->condition.stop = FALSE;
+ engine->condition.volume = 1.0;
+ engine->condition.msd_threshold = NULL;
+ engine->condition.gv_weight = NULL;
+
+ /* duration */
+ engine->condition.speed = 1.0;
+ engine->condition.phoneme_alignment_flag = FALSE;
+
+ /* spectrum */
+ engine->condition.stage = 0;
+ engine->condition.use_log_gain = FALSE;
+ engine->condition.alpha = 0.0;
+ engine->condition.beta = 0.0;
+
+ /* log F0 */
+ engine->condition.additional_half_tone = 0.0;
+
+ /* interpolation weights */
+ engine->condition.duration_iw = NULL;
+ engine->condition.parameter_iw = NULL;
+ engine->condition.gv_iw = NULL;
+
+ /* initialize audio */
+ HTS_Audio_initialize(&engine->audio);
+ /* initialize model set */
+ HTS_ModelSet_initialize(&engine->ms);
+ /* initialize label list */
+ HTS_Label_initialize(&engine->label);
+ /* initialize state sequence set */
+ HTS_SStreamSet_initialize(&engine->sss);
+ /* initialize pstream set */
+ HTS_PStreamSet_initialize(&engine->pss);
+ /* initialize gstream set */
+ HTS_GStreamSet_initialize(&engine->gss);
+}
+
+/* HTS_Engine_load: load HTS voices */
+HTS_Boolean HTS_Engine_load(HTS_Engine * engine, char **voices, size_t num_voices)
+{
+ size_t i, j;
+ size_t nstream;
+ double average_weight;
+ const char *option, *find;
+
+ /* reset engine */
+ HTS_Engine_clear(engine);
+
+ /* load voices */
+ if (HTS_ModelSet_load(&engine->ms, voices, num_voices) != TRUE) {
+ HTS_Engine_clear(engine);
+ return FALSE;
+ }
+ nstream = HTS_ModelSet_get_nstream(&engine->ms);
+ average_weight = 1.0 / num_voices;
+
+ /* global */
+ engine->condition.sampling_frequency = HTS_ModelSet_get_sampling_frequency(&engine->ms);
+ engine->condition.fperiod = HTS_ModelSet_get_fperiod(&engine->ms);
+ engine->condition.msd_threshold = (double *) HTS_calloc(nstream, sizeof(double));
+ for (i = 0; i < nstream; i++)
+ engine->condition.msd_threshold[i] = 0.5;
+ engine->condition.gv_weight = (double *) HTS_calloc(nstream, sizeof(double));
+ for (i = 0; i < nstream; i++)
+ engine->condition.gv_weight[i] = 1.0;
+
+ /* spectrum */
+ option = HTS_ModelSet_get_option(&engine->ms, 0);
+ find = strstr(option, "GAMMA=");
+ if (find != NULL)
+ engine->condition.stage = (size_t) atoi(&find[strlen("GAMMA=")]);
+ find = strstr(option, "LN_GAIN=");
+ if (find != NULL)
+ engine->condition.use_log_gain = atoi(&find[strlen("LN_GAIN=")]) == 1 ? TRUE : FALSE;
+ find = strstr(option, "ALPHA=");
+ if (find != NULL)
+ engine->condition.alpha = atof(&find[strlen("ALPHA=")]);
+
+ /* interpolation weights */
+ engine->condition.duration_iw = (double *) HTS_calloc(num_voices, sizeof(double));
+ for (i = 0; i < num_voices; i++)
+ engine->condition.duration_iw[i] = average_weight;
+ engine->condition.parameter_iw = (double **) HTS_calloc(num_voices, sizeof(double *));
+ for (i = 0; i < num_voices; i++) {
+ engine->condition.parameter_iw[i] = (double *) HTS_calloc(nstream, sizeof(double));
+ for (j = 0; j < nstream; j++)
+ engine->condition.parameter_iw[i][j] = average_weight;
+ }
+ engine->condition.gv_iw = (double **) HTS_calloc(num_voices, sizeof(double *));
+ for (i = 0; i < num_voices; i++) {
+ engine->condition.gv_iw[i] = (double *) HTS_calloc(nstream, sizeof(double));
+ for (j = 0; j < nstream; j++)
+ engine->condition.gv_iw[i][j] = average_weight;
+ }
+
+ return TRUE;
+}
+
+/* HTS_Engine_set_sampling_frequency: set sampling frequency */
+void HTS_Engine_set_sampling_frequency(HTS_Engine * engine, size_t i)
+{
+ if (i < 1)
+ i = 1;
+ engine->condition.sampling_frequency = i;
+ HTS_Audio_set_parameter(&engine->audio, engine->condition.sampling_frequency, engine->condition.audio_buff_size);
+}
+
+/* HTS_Engine_get_sampling_frequency: get sampling frequency */
+size_t HTS_Engine_get_sampling_frequency(HTS_Engine * engine)
+{
+ return engine->condition.sampling_frequency;
+}
+
+/* HTS_Engine_set_fperiod: set frame period */
+void HTS_Engine_set_fperiod(HTS_Engine * engine, size_t i)
+{
+ if (i < 1)
+ i = 1;
+ engine->condition.fperiod = i;
+}
+
+/* HTS_Engine_get_fperiod: get frame period */
+size_t HTS_Engine_get_fperiod(HTS_Engine * engine)
+{
+ return engine->condition.fperiod;
+}
+
+/* HTS_Engine_set_audio_buff_size: set audio buffer size */
|
[-]
[+]
|
Added |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/src/hts/hts_engine_API/lib/HTS_gstream.c
^
|
@@ -0,0 +1,203 @@
+/* ----------------------------------------------------------------- */
+/* The HMM-Based Speech Synthesis Engine "hts_engine API" */
+/* developed by HTS Working Group */
+/* http://hts-engine.sourceforge.net/ */
+/* ----------------------------------------------------------------- */
+/* */
+/* Copyright (c) 2001-2015 Nagoya Institute of Technology */
+/* Department of Computer Science */
+/* */
+/* 2001-2008 Tokyo Institute of Technology */
+/* Interdisciplinary Graduate School of */
+/* Science and Engineering */
+/* */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or */
+/* without modification, are permitted provided that the following */
+/* conditions are met: */
+/* */
+/* - Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* - Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* - Neither the name of the HTS working group nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */
+/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */
+/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
+/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
+/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS */
+/* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
+/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
+/* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
+/* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, */
+/* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY */
+/* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/* POSSIBILITY OF SUCH DAMAGE. */
+/* ----------------------------------------------------------------- */
+
+#ifndef HTS_GSTREAM_C
+#define HTS_GSTREAM_C
+
+#ifdef __cplusplus
+#define HTS_GSTREAM_C_START extern "C" {
+#define HTS_GSTREAM_C_END }
+#else
+#define HTS_GSTREAM_C_START
+#define HTS_GSTREAM_C_END
+#endif /* __CPLUSPLUS */
+
+HTS_GSTREAM_C_START;
+
+/* hts_engine libraries */
+#include "HTS_hidden.h"
+
+/* HTS_GStreamSet_initialize: initialize generated parameter stream set */
+void HTS_GStreamSet_initialize(HTS_GStreamSet * gss)
+{
+ gss->nstream = 0;
+ gss->total_frame = 0;
+ gss->total_nsample = 0;
+ gss->gstream = NULL;
+ gss->gspeech = NULL;
+}
+
+/* HTS_GStreamSet_create: generate speech */
+HTS_Boolean HTS_GStreamSet_create(HTS_GStreamSet * gss, HTS_PStreamSet * pss, size_t stage, HTS_Boolean use_log_gain, size_t sampling_rate, size_t fperiod, double alpha, double beta, HTS_Boolean * stop, double volume, HTS_Audio * audio)
+{
+ size_t i, j, k;
+ size_t msd_frame;
+ HTS_Vocoder v;
+ size_t nlpf = 0;
+ double *lpf = NULL;
+
+ /* check */
+ if (gss->gstream || gss->gspeech) {
+ HTS_error(1, "HTS_GStreamSet_create: HTS_GStreamSet is not initialized.\n");
+ return FALSE;
+ }
+
+ /* initialize */
+ gss->nstream = HTS_PStreamSet_get_nstream(pss);
+ gss->total_frame = HTS_PStreamSet_get_total_frame(pss);
+ gss->total_nsample = fperiod * gss->total_frame;
+ gss->gstream = (HTS_GStream *) HTS_calloc(gss->nstream, sizeof(HTS_GStream));
+ for (i = 0; i < gss->nstream; i++) {
+ gss->gstream[i].vector_length = HTS_PStreamSet_get_vector_length(pss, i);
+ gss->gstream[i].par = (double **) HTS_calloc(gss->total_frame, sizeof(double *));
+ for (j = 0; j < gss->total_frame; j++)
+ gss->gstream[i].par[j] = (double *) HTS_calloc(gss->gstream[i].vector_length, sizeof(double));
+ }
+ gss->gspeech = (double *) HTS_calloc(gss->total_nsample, sizeof(double));
+
+ /* copy generated parameter */
+ for (i = 0; i < gss->nstream; i++) {
+ if (HTS_PStreamSet_is_msd(pss, i)) { /* for MSD */
+ for (j = 0, msd_frame = 0; j < gss->total_frame; j++)
+ if (HTS_PStreamSet_get_msd_flag(pss, i, j) == TRUE) {
+ for (k = 0; k < gss->gstream[i].vector_length; k++)
+ gss->gstream[i].par[j][k] = HTS_PStreamSet_get_parameter(pss, i, msd_frame, k);
+ msd_frame++;
+ } else
+ for (k = 0; k < gss->gstream[i].vector_length; k++)
+ gss->gstream[i].par[j][k] = HTS_NODATA;
+ } else { /* for non MSD */
+ for (j = 0; j < gss->total_frame; j++)
+ for (k = 0; k < gss->gstream[i].vector_length; k++)
+ gss->gstream[i].par[j][k] = HTS_PStreamSet_get_parameter(pss, i, j, k);
+ }
+ }
+
+ /* check */
+ if (gss->nstream != 2 && gss->nstream != 3) {
+ HTS_error(1, "HTS_GStreamSet_create: The number of streams should be 2 or 3.\n");
+ HTS_GStreamSet_clear(gss);
+ return FALSE;
+ }
+ if (HTS_PStreamSet_get_vector_length(pss, 1) != 1) {
+ HTS_error(1, "HTS_GStreamSet_create: The size of lf0 static vector should be 1.\n");
+ HTS_GStreamSet_clear(gss);
+ return FALSE;
+ }
+ if (gss->nstream >= 3 && gss->gstream[2].vector_length % 2 == 0) {
+ HTS_error(1, "HTS_GStreamSet_create: The number of low-pass filter coefficient should be odd numbers.");
+ HTS_GStreamSet_clear(gss);
+ return FALSE;
+ }
+
+ /* synthesize speech waveform */
+ HTS_Vocoder_initialize(&v, gss->gstream[0].vector_length - 1, stage, use_log_gain, sampling_rate, fperiod);
+ if (gss->nstream >= 3)
+ nlpf = gss->gstream[2].vector_length;
+ for (i = 0; i < gss->total_frame && (*stop) == FALSE; i++) {
+ j = i * fperiod;
+ if (gss->nstream >= 3)
+ lpf = &gss->gstream[2].par[i][0];
+ HTS_Vocoder_synthesize(&v, gss->gstream[0].vector_length - 1, gss->gstream[1].par[i][0], &gss->gstream[0].par[i][0], nlpf, lpf, alpha, beta, volume, &gss->gspeech[j], audio);
+ }
+ HTS_Vocoder_clear(&v);
+ if (audio)
+ HTS_Audio_flush(audio);
+
+ return TRUE;
+}
+
+/* HTS_GStreamSet_get_total_nsamples: get total number of sample */
+size_t HTS_GStreamSet_get_total_nsamples(HTS_GStreamSet * gss)
+{
+ return gss->total_nsample;
+}
+
+/* HTS_GStreamSet_get_total_frame: get total number of frame */
+size_t HTS_GStreamSet_get_total_frame(HTS_GStreamSet * gss)
+{
+ return gss->total_frame;
+}
+
+/* HTS_GStreamSet_get_vector_length: get features length */
+size_t HTS_GStreamSet_get_vector_length(HTS_GStreamSet * gss, size_t stream_index)
+{
+ return gss->gstream[stream_index].vector_length;
+}
+
+/* HTS_GStreamSet_get_speech: get synthesized speech parameter */
+double HTS_GStreamSet_get_speech(HTS_GStreamSet * gss, size_t sample_index)
+{
+ return gss->gspeech[sample_index];
+}
+
+/* HTS_GStreamSet_get_parameter: get generated parameter */
+double HTS_GStreamSet_get_parameter(HTS_GStreamSet * gss, size_t stream_index, size_t frame_index, size_t vector_index)
+{
+ return gss->gstream[stream_index].par[frame_index][vector_index];
+}
+
+/* HTS_GStreamSet_clear: free generated parameter stream set */
+void HTS_GStreamSet_clear(HTS_GStreamSet * gss)
+{
+ size_t i, j;
+
+ if (gss->gstream) {
+ for (i = 0; i < gss->nstream; i++) {
+ if (gss->gstream[i].par != NULL) {
+ for (j = 0; j < gss->total_frame; j++)
+ HTS_free(gss->gstream[i].par[j]);
+ HTS_free(gss->gstream[i].par);
+ }
+ }
+ HTS_free(gss->gstream);
+ }
+ if (gss->gspeech)
+ HTS_free(gss->gspeech);
+ HTS_GStreamSet_initialize(gss);
+}
|
[-]
[+]
|
Added |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/src/hts/hts_engine_API/lib/HTS_hidden.h
^
|
@@ -0,0 +1,511 @@
+/* ----------------------------------------------------------------- */
+/* The HMM-Based Speech Synthesis Engine "hts_engine API" */
+/* developed by HTS Working Group */
+/* http://hts-engine.sourceforge.net/ */
+/* ----------------------------------------------------------------- */
+/* */
+/* Copyright (c) 2001-2015 Nagoya Institute of Technology */
+/* Department of Computer Science */
+/* */
+/* 2001-2008 Tokyo Institute of Technology */
+/* Interdisciplinary Graduate School of */
+/* Science and Engineering */
+/* */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or */
+/* without modification, are permitted provided that the following */
+/* conditions are met: */
+/* */
+/* - Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* - Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* - Neither the name of the HTS working group nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */
+/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */
+/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
+/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
+/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS */
+/* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
+/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
+/* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
+/* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, */
+/* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY */
+/* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/* POSSIBILITY OF SUCH DAMAGE. */
+/* ----------------------------------------------------------------- */
+
+#ifndef HTS_HIDDEN_H
+#define HTS_HIDDEN_H
+
+#ifdef __cplusplus
+#define HTS_HIDDEN_H_START extern "C" {
+#define HTS_HIDDEN_H_END }
+#else
+#define HTS_HIDDEN_H_START
+#define HTS_HIDDEN_H_END
+#endif /* __CPLUSPLUS */
+
+HTS_HIDDEN_H_START;
+
+/* hts_engine libraries */
+#include "HTS_engine.h"
+
+/* common ---------------------------------------------------------- */
+
+#define HTS_MAXBUFLEN 1024
+
+#if !defined(WORDS_BIGENDIAN) && !defined(WORDS_LITTLEENDIAN)
+#define WORDS_LITTLEENDIAN
+#endif /* !WORDS_BIGENDIAN && !WORDS_LITTLEENDIAN */
+#if defined(WORDS_BIGENDIAN) && defined(WORDS_LITTLEENDIAN)
+#undef WORDS_BIGENDIAN
+#endif /* WORDS_BIGENDIAN && WORDS_LITTLEENDIAN */
+
+#define MAX_F0 20000.0
+#define MIN_F0 20.0
+#define MAX_LF0 9.9034875525361280454891979401956 /* log(20000.0) */
+#define MIN_LF0 2.9957322735539909934352235761425 /* log(20.0) */
+#define HALF_TONE 0.05776226504666210911810267678818 /* log(2.0) / 12.0 */
+#define DB 0.11512925464970228420089957273422 /* log(10.0) / 20.0 */
+
+/* misc ------------------------------------------------------------ */
+
+typedef struct _HTS_File {
+ unsigned char type;
+ void *pointer;
+} HTS_File;
+
+/* HTS_fopen: wrapper for fopen */
+HTS_File *HTS_fopen_from_fn(const char *name, const char *opt);
+
+/* HTS_fopen_from_fp: wrapper for fopen */
+HTS_File *HTS_fopen_from_fp(HTS_File * fp, size_t size);
+
+/* HTS_fopen_from_data: wrapper for fopen */
+HTS_File *HTS_fopen_from_data(void *data, size_t size);
+
+/* HTS_fclose: wrapper for fclose */
+void HTS_fclose(HTS_File * fp);
+
+/* HTS_fgetc: wrapper for fgetc */
+int HTS_fgetc(HTS_File * fp);
+
+/* HTS_feof: wrapper for feof */
+int HTS_feof(HTS_File * fp);
+
+/* HTS_fseek: wrapper for fseek */
+int HTS_fseek(HTS_File * fp, long offset, int origin);
+
+/* HTS_ftell: wrapper for ftell */
+size_t HTS_ftell(HTS_File * fp);
+
+/* HTS_fread_big_endian: fread with byteswap */
+size_t HTS_fread_big_endian(void *buf, size_t size, size_t n, HTS_File * fp);
+
+/* HTS_fread_little_endian: fread with byteswap */
+size_t HTS_fread_little_endian(void *buf, size_t size, size_t n, HTS_File * fp);
+
+/* HTS_fwrite_little_endian: fwrite with byteswap */
+size_t HTS_fwrite_little_endian(const void *buf, size_t size, size_t n, FILE * fp);
+
+/* HTS_get_pattern_token: get pattern token (single/double quote can be used) */
+HTS_Boolean HTS_get_pattern_token(HTS_File * fp, char *buff);
+
+/* HTS_get_token: get token from file pointer (separators are space,tab,line break) */
+HTS_Boolean HTS_get_token_from_fp(HTS_File * fp, char *buff);
+
+/* HTS_get_token: get token from file pointer with specified separator */
+HTS_Boolean HTS_get_token_from_fp_with_separator(HTS_File * fp, char *buff, char separator);
+
+/* HTS_get_token_from_string: get token from string (separator are space,tab,line break) */
+HTS_Boolean HTS_get_token_from_string(const char *string, size_t * index, char *buff);
+
+/* HTS_get_token_from_string_with_separator: get token from string with specified separator */
+HTS_Boolean HTS_get_token_from_string_with_separator(const char *str, size_t * index, char *buff, char separator);
+
+/* HTS_calloc: wrapper for calloc */
+void *HTS_calloc(const size_t num, const size_t size);
+
+/* HTS_strdup: wrapper for strdup */
+char *HTS_strdup(const char *string);
+
+/* HTS_calloc_matrix: allocate double matrix */
+double **HTS_alloc_matrix(size_t x, size_t y);
+
+/* HTS_free_matrix: free double matrix */
+void HTS_free_matrix(double **p, size_t x);
+
+/* HTS_Free: wrapper for free */
+void HTS_free(void *p);
+
+/* HTS_error: output error message */
+void HTS_error(int error, const char *message, ...);
+
+/* audio ----------------------------------------------------------- */
+
+/* HTS_Audio_initialize: initialize audio */
+void HTS_Audio_initialize(HTS_Audio * audio);
+
+/* HTS_Audio_set_parameter: set parameters for audio */
+void HTS_Audio_set_parameter(HTS_Audio * audio, size_t sampling_frequency, size_t max_buff_size);
+
+/* HTS_Audio_write: send data to audio */
+void HTS_Audio_write(HTS_Audio * audio, short data);
+
+/* HTS_Audio_flush: flush remain data */
+void HTS_Audio_flush(HTS_Audio * audio);
+
+/* HTS_Audio_clear: free audio */
+void HTS_Audio_clear(HTS_Audio * audio);
+
+/* model ----------------------------------------------------------- */
+
+/* HTS_ModelSet_initialize: initialize model set */
+void HTS_ModelSet_initialize(HTS_ModelSet * ms);
+
+/* HTS_ModelSet_load: load HTS voices */
+HTS_Boolean HTS_ModelSet_load(HTS_ModelSet * ms, char **voices, size_t num_voices);
+
+/* HTS_ModelSet_get_sampling_frequency: get sampling frequency of HTS voices */
+size_t HTS_ModelSet_get_sampling_frequency(HTS_ModelSet * ms);
+
+/* HTS_ModelSet_get_fperiod: get frame period of HTS voices */
+size_t HTS_ModelSet_get_fperiod(HTS_ModelSet * ms);
+
+/* HTS_ModelSet_get_fperiod: get stream option */
+const char *HTS_ModelSet_get_option(HTS_ModelSet * ms, size_t stream_index);
+
+/* HTS_ModelSet_get_gv_flag: get GV flag */
+HTS_Boolean HTS_ModelSet_get_gv_flag(HTS_ModelSet * ms, const char *string);
+
+/* HTS_ModelSet_get_nstate: get number of state */
+size_t HTS_ModelSet_get_nstate(HTS_ModelSet * ms);
+
+/* HTS_Engine_get_fullcontext_label_format: get full-context label format */
+const char *HTS_ModelSet_get_fullcontext_label_format(HTS_ModelSet * ms);
+
+/* HTS_Engine_get_fullcontext_label_version: get full-context label version */
+const char *HTS_ModelSet_get_fullcontext_label_version(HTS_ModelSet * ms);
+
+/* HTS_ModelSet_get_nstream: get number of stream */
+size_t HTS_ModelSet_get_nstream(HTS_ModelSet * ms);
|
[-]
[+]
|
Added |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/src/hts/hts_engine_API/lib/HTS_label.c
^
|
@@ -0,0 +1,263 @@
+/* ----------------------------------------------------------------- */
+/* The HMM-Based Speech Synthesis Engine "hts_engine API" */
+/* developed by HTS Working Group */
+/* http://hts-engine.sourceforge.net/ */
+/* ----------------------------------------------------------------- */
+/* */
+/* Copyright (c) 2001-2015 Nagoya Institute of Technology */
+/* Department of Computer Science */
+/* */
+/* 2001-2008 Tokyo Institute of Technology */
+/* Interdisciplinary Graduate School of */
+/* Science and Engineering */
+/* */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or */
+/* without modification, are permitted provided that the following */
+/* conditions are met: */
+/* */
+/* - Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* - Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* - Neither the name of the HTS working group nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */
+/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */
+/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
+/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
+/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS */
+/* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
+/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
+/* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
+/* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, */
+/* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY */
+/* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/* POSSIBILITY OF SUCH DAMAGE. */
+/* ----------------------------------------------------------------- */
+
+#ifndef HTS_LABEL_C
+#define HTS_LABEL_C
+
+#ifdef __cplusplus
+#define HTS_LABEL_C_START extern "C" {
+#define HTS_LABEL_C_END }
+#else
+#define HTS_LABEL_C_START
+#define HTS_LABEL_C_END
+#endif /* __CPLUSPLUS */
+
+HTS_LABEL_C_START;
+
+#include <stdlib.h> /* for atof() */
+#include <ctype.h> /* for isgraph(),isdigit() */
+
+/* hts_engine libraries */
+#include "HTS_hidden.h"
+
+static HTS_Boolean isdigit_string(char *str)
+{
+ int i;
+
+ if (sscanf(str, "%d", &i) == 1)
+ return TRUE;
+ else
+ return FALSE;
+}
+
+/* HTS_Label_initialize: initialize label */
+void HTS_Label_initialize(HTS_Label * label)
+{
+ label->head = NULL;
+ label->size = 0;
+}
+
+/* HTS_Label_check_time: check label */
+static void HTS_Label_check_time(HTS_Label * label)
+{
+ HTS_LabelString *lstring = label->head;
+ HTS_LabelString *next = NULL;
+
+ if (lstring)
+ lstring->start = 0.0;
+ while (lstring) {
+ next = lstring->next;
+ if (!next)
+ break;
+ if (lstring->end < 0.0 && next->start >= 0.0)
+ lstring->end = next->start;
+ else if (lstring->end >= 0.0 && next->start < 0.0)
+ next->start = lstring->end;
+ if (lstring->start < 0.0)
+ lstring->start = -1.0;
+ if (lstring->end < 0.0)
+ lstring->end = -1.0;
+ lstring = next;
+ }
+}
+
+/* HTS_Label_load: load label */
+static void HTS_Label_load(HTS_Label * label, size_t sampling_rate, size_t fperiod, HTS_File * fp)
+{
+ char buff[HTS_MAXBUFLEN];
+ HTS_LabelString *lstring = NULL;
+ double start, end;
+ const double rate = (double) sampling_rate / ((double) fperiod * 1e+7);
+
+ if (label->head || label->size != 0) {
+ HTS_error(1, "HTS_Label_load_from_fp: label is not initialized.\n");
+ return;
+ }
+
+ /* parse label file */
+ while (HTS_get_token_from_fp(fp, buff)) {
+ if (!isgraph((int) buff[0]))
+ break;
+ label->size++;
+
+ if (lstring) {
+ lstring->next = (HTS_LabelString *) HTS_calloc(1, sizeof(HTS_LabelString));
+ lstring = lstring->next;
+ } else { /* first time */
+ lstring = (HTS_LabelString *) HTS_calloc(1, sizeof(HTS_LabelString));
+ label->head = lstring;
+ }
+ if (isdigit_string(buff)) { /* has frame infomation */
+ start = atof(buff);
+ HTS_get_token_from_fp(fp, buff);
+ end = atof(buff);
+ HTS_get_token_from_fp(fp, buff);
+ lstring->start = rate * start;
+ lstring->end = rate * end;
+ } else {
+ lstring->start = -1.0;
+ lstring->end = -1.0;
+ }
+ lstring->next = NULL;
+ lstring->name = HTS_strdup(buff);
+ }
+ HTS_Label_check_time(label);
+}
+
+/* HTS_Label_load_from_fn: load label from file name */
+void HTS_Label_load_from_fn(HTS_Label * label, size_t sampling_rate, size_t fperiod, const char *fn)
+{
+ HTS_File *fp = HTS_fopen_from_fn(fn, "r");
+ HTS_Label_load(label, sampling_rate, fperiod, fp);
+ HTS_fclose(fp);
+}
+
+/* HTS_Label_load_from_strings: load label from strings */
+void HTS_Label_load_from_strings(HTS_Label * label, size_t sampling_rate, size_t fperiod, char **lines, size_t num_lines)
+{
+ char buff[HTS_MAXBUFLEN];
+ HTS_LabelString *lstring = NULL;
+ size_t i;
+ size_t data_index;
+ double start, end;
+ const double rate = (double) sampling_rate / ((double) fperiod * 1e+7);
+
+ if (label->head || label->size != 0) {
+ HTS_error(1, "HTS_Label_load_from_fp: label list is not initialized.\n");
+ return;
+ }
+ /* copy label */
+ for (i = 0; i < num_lines; i++) {
+ if (!isgraph((int) lines[i][0]))
+ break;
+ label->size++;
+
+ if (lstring) {
+ lstring->next = (HTS_LabelString *) HTS_calloc(1, sizeof(HTS_LabelString));
+ lstring = lstring->next;
+ } else { /* first time */
+ lstring = (HTS_LabelString *) HTS_calloc(1, sizeof(HTS_LabelString));
+ label->head = lstring;
+ }
+ data_index = 0;
+ if (isdigit_string(lines[i])) { /* has frame infomation */
+ HTS_get_token_from_string(lines[i], &data_index, buff);
+ start = atof(buff);
+ HTS_get_token_from_string(lines[i], &data_index, buff);
+ end = atof(buff);
+ HTS_get_token_from_string(lines[i], &data_index, buff);
+ lstring->name = HTS_strdup(buff);
+ lstring->start = rate * start;
+ lstring->end = rate * end;
+ } else {
+ lstring->start = -1.0;
+ lstring->end = -1.0;
+ lstring->name = HTS_strdup(lines[i]);
+ }
+ lstring->next = NULL;
+ }
|
[-]
[+]
|
Added |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/src/hts/hts_engine_API/lib/HTS_misc.c
^
|
@@ -0,0 +1,613 @@
+/* ----------------------------------------------------------------- */
+/* The HMM-Based Speech Synthesis Engine "hts_engine API" */
+/* developed by HTS Working Group */
+/* http://hts-engine.sourceforge.net/ */
+/* ----------------------------------------------------------------- */
+/* */
+/* Copyright (c) 2001-2015 Nagoya Institute of Technology */
+/* Department of Computer Science */
+/* */
+/* 2001-2008 Tokyo Institute of Technology */
+/* Interdisciplinary Graduate School of */
+/* Science and Engineering */
+/* */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or */
+/* without modification, are permitted provided that the following */
+/* conditions are met: */
+/* */
+/* - Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* - Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* - Neither the name of the HTS working group nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */
+/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */
+/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
+/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
+/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS */
+/* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
+/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
+/* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
+/* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, */
+/* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY */
+/* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/* POSSIBILITY OF SUCH DAMAGE. */
+/* ----------------------------------------------------------------- */
+
+#ifndef HTS_MISC_C
+#define HTS_MISC_C
+
+#ifdef __cplusplus
+#define HTS_MISC_C_START extern "C" {
+#define HTS_MISC_C_END }
+#else
+#define HTS_MISC_C_START
+#define HTS_MISC_C_END
+#endif /* __CPLUSPLUS */
+
+HTS_MISC_C_START;
+
+#include <stdlib.h> /* for exit(),calloc(),free() */
+#include <stdarg.h> /* for va_list */
+#include <string.h> /* for strcpy(),strlen() */
+
+/* hts_engine libraries */
+#include "HTS_hidden.h"
+
+#ifdef FESTIVAL
+#include "EST_walloc.h"
+#endif /* FESTIVAL */
+
+#define HTS_FILE 0
+#define HTS_DATA 1
+
+typedef struct _HTS_Data {
+ unsigned char *data;
+ size_t size;
+ size_t index;
+} HTS_Data;
+
+/* HTS_fopen_from_fn: wrapper for fopen */
+HTS_File *HTS_fopen_from_fn(const char *name, const char *opt)
+{
+ HTS_File *fp = (HTS_File *) HTS_calloc(1, sizeof(HTS_File));
+
+ fp->type = HTS_FILE;
+ fp->pointer = (void *) fopen(name, opt);
+
+ if (fp->pointer == NULL) {
+ HTS_error(0, "HTS_fopen: Cannot open %s.\n", name);
+ HTS_free(fp);
+ return NULL;
+ }
+
+ return fp;
+}
+
+/* HTS_fopen_from_fp: wrapper for fopen */
+HTS_File *HTS_fopen_from_fp(HTS_File * fp, size_t size)
+{
+ if (fp == NULL || size == 0)
+ return NULL;
+ else if (fp->type == HTS_FILE) {
+ HTS_Data *d;
+ HTS_File *f;
+ d = (HTS_Data *) HTS_calloc(1, sizeof(HTS_Data));
+ d->data = (unsigned char *) HTS_calloc(size, sizeof(unsigned char));
+ d->size = size;
+ d->index = 0;
+ if (fread(d->data, sizeof(unsigned char), size, (FILE *) fp->pointer) != size) {
+ free(d->data);
+ free(d);
+ return NULL;
+ }
+ f = (HTS_File *) HTS_calloc(1, sizeof(HTS_File));
+ f->type = HTS_DATA;
+ f->pointer = (void *) d;
+ return f;
+ } else if (fp->type == HTS_DATA) {
+ HTS_File *f;
+ HTS_Data *tmp1, *tmp2;
+ tmp1 = (HTS_Data *) fp->pointer;
+ if (tmp1->index + size > tmp1->size)
+ return NULL;
+ tmp2 = (HTS_Data *) HTS_calloc(1, sizeof(HTS_Data));
+ tmp2->data = (unsigned char *) HTS_calloc(size, sizeof(unsigned char));
+ tmp2->size = size;
+ tmp2->index = 0;
+ memcpy(tmp2->data, &tmp1->data[tmp1->index], size);
+ tmp1->index += size;
+ f = (HTS_File *) HTS_calloc(1, sizeof(HTS_File));
+ f->type = HTS_DATA;
+ f->pointer = (void *) tmp2;
+ return f;
+ }
+
+ HTS_error(0, "HTS_fopen_from_fp: Unknown file type.\n");
+ return NULL;
+}
+
+/* HTS_fopen_from_data: wrapper for fopen */
+HTS_File *HTS_fopen_from_data(void *data, size_t size)
+{
+ HTS_Data *d;
+ HTS_File *f;
+
+ if (data == NULL || size == 0)
+ return NULL;
+
+ d = (HTS_Data *) HTS_calloc(1, sizeof(HTS_Data));
+ d->data = (unsigned char *) HTS_calloc(size, sizeof(unsigned char));
+ d->size = size;
+ d->index = 0;
+
+ memcpy(d->data, data, size);
+
+ f = (HTS_File *) HTS_calloc(1, sizeof(HTS_File));
+ f->type = HTS_DATA;
+ f->pointer = (void *) d;
+
+ return f;
+}
+
+/* HTS_fclose: wrapper for fclose */
+void HTS_fclose(HTS_File * fp)
+{
+ if (fp == NULL) {
+ return;
+ } else if (fp->type == HTS_FILE) {
+ if (fp->pointer != NULL)
+ fclose((FILE *) fp->pointer);
+ HTS_free(fp);
+ return;
+ } else if (fp->type == HTS_DATA) {
+ if (fp->pointer != NULL) {
+ HTS_Data *d = (HTS_Data *) fp->pointer;
+ if (d->data != NULL)
+ HTS_free(d->data);
+ HTS_free(d);
+ }
+ HTS_free(fp);
+ return;
+ }
+ HTS_error(0, "HTS_fclose: Unknown file type.\n");
+}
+
+/* HTS_fgetc: wrapper for fgetc */
+int HTS_fgetc(HTS_File * fp)
+{
+ if (fp == NULL) {
+ return EOF;
+ } else if (fp->type == HTS_FILE) {
+ return fgetc((FILE *) fp->pointer);
+ } else if (fp->type == HTS_DATA) {
+ HTS_Data *d = (HTS_Data *) fp->pointer;
+ if (d->size <= d->index)
+ return EOF;
+ return (int) d->data[d->index++];
+ }
+ HTS_error(0, "HTS_fgetc: Unknown file type.\n");
+ return EOF;
+}
|
[-]
[+]
|
Added |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/src/hts/hts_engine_API/lib/HTS_model.c
^
|
@@ -0,0 +1,1693 @@
+/* ----------------------------------------------------------------- */
+/* The HMM-Based Speech Synthesis Engine "hts_engine API" */
+/* developed by HTS Working Group */
+/* http://hts-engine.sourceforge.net/ */
+/* ----------------------------------------------------------------- */
+/* */
+/* Copyright (c) 2001-2015 Nagoya Institute of Technology */
+/* Department of Computer Science */
+/* */
+/* 2001-2008 Tokyo Institute of Technology */
+/* Interdisciplinary Graduate School of */
+/* Science and Engineering */
+/* */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or */
+/* without modification, are permitted provided that the following */
+/* conditions are met: */
+/* */
+/* - Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* - Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* - Neither the name of the HTS working group nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */
+/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */
+/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
+/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
+/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS */
+/* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
+/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
+/* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
+/* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, */
+/* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY */
+/* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/* POSSIBILITY OF SUCH DAMAGE. */
+/* ----------------------------------------------------------------- */
+
+#ifndef HTS_MODEL_C
+#define HTS_MODEL_C
+
+#ifdef __cplusplus
+#define HTS_MODEL_C_START extern "C" {
+#define HTS_MODEL_C_END }
+#else
+#define HTS_MODEL_C_START
+#define HTS_MODEL_C_END
+#endif /* __CPLUSPLUS */
+
+HTS_MODEL_C_START;
+
+#include <stdlib.h> /* for atoi(),abs() */
+#include <string.h> /* for strlen(),strstr(),strrchr(),strcmp() */
+#include <ctype.h> /* for isdigit() */
+
+/* hts_engine libraries */
+#include "HTS_hidden.h"
+
+#ifdef WIN32
+typedef unsigned __int32 uint32_t;
+#else
+#include <stdint.h>
+#endif /* WIN32 */
+
+/* HTS_dp_match: recursive matching */
+static HTS_Boolean HTS_dp_match(const char *string, const char *pattern, size_t pos, size_t max)
+{
+ if (pos > max)
+ return FALSE;
+ if (string[0] == '\0' && pattern[0] == '\0')
+ return TRUE;
+ if (pattern[0] == '*') {
+ if (HTS_dp_match(string + 1, pattern, pos + 1, max) == 1)
+ return TRUE;
+ else
+ return HTS_dp_match(string, pattern + 1, pos, max);
+ }
+ if (string[0] == pattern[0] || pattern[0] == '?') {
+ if (HTS_dp_match(string + 1, pattern + 1, pos + 1, max + 1) == 1)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/* HTS_pattern_match: pattern matching function */
+static HTS_Boolean HTS_pattern_match(const char *string, const char *pattern)
+{
+ size_t i, j;
+ size_t buff_length, max = 0, nstar = 0, nquestion = 0;
+ char buff[HTS_MAXBUFLEN];
+ size_t pattern_length = strlen(pattern);
+
+ for (i = 0; i < pattern_length; i++) {
+ switch (pattern[i]) {
+ case '*':
+ nstar++;
+ break;
+ case '?':
+ nquestion++;
+ max++;
+ break;
+ default:
+ max++;
+ }
+ }
+ if (nstar == 2 && nquestion == 0 && pattern[0] == '*' && pattern[i - 1] == '*') {
+ /* only string matching is required */
+ buff_length = i - 2;
+ for (i = 0, j = 1; i < buff_length; i++, j++)
+ buff[i] = pattern[j];
+ buff[buff_length] = '\0';
+ if (strstr(string, buff) != NULL)
+ return TRUE;
+ else
+ return FALSE;
+ } else
+ return HTS_dp_match(string, pattern, 0, strlen(string) - max);
+}
+
+/* HTS_is_num: check given buffer is number or not */
+static HTS_Boolean HTS_is_num(const char *buff)
+{
+ size_t i;
+ size_t length = strlen(buff);
+
+ for (i = 0; i < length; i++)
+ if (!(isdigit((int) buff[i]) || (buff[i] == '-')))
+ return FALSE;
+
+ return TRUE;
+}
+
+/* HTS_name2num: convert name of node to number */
+static size_t HTS_name2num(const char *buff)
+{
+ size_t i;
+
+ for (i = strlen(buff) - 1; '0' <= buff[i] && buff[i] <= '9'; i--);
+ i++;
+
+ return (size_t) atoi(&buff[i]);
+}
+
+/* HTS_get_state_num: return the number of state */
+static size_t HTS_get_state_num(const char *string)
+{
+ const char *left, *right;
+
+ left = strchr(string, '[');
+ if (left == NULL)
+ return 0;
+ left++;
+
+ right = strchr(left, ']');
+ if (right == NULL)
+ return 0;
+
+ return (size_t) atoi(left);
+}
+
+/* HTS_Question_initialize: initialize question */
+static void HTS_Question_initialize(HTS_Question * question)
+{
+ question->string = NULL;
+ question->head = NULL;
+ question->next = NULL;
+}
+
+/* HTS_Question_clear: clear loaded question */
+static void HTS_Question_clear(HTS_Question * question)
+{
+ HTS_Pattern *pattern, *next_pattern;
+
+ if (question->string != NULL)
+ HTS_free(question->string);
+ for (pattern = question->head; pattern; pattern = next_pattern) {
+ next_pattern = pattern->next;
+ HTS_free(pattern->string);
+ HTS_free(pattern);
+ }
+ HTS_Question_initialize(question);
+}
+
+/* HTS_Question_load: Load questions from file */
+static HTS_Boolean HTS_Question_load(HTS_Question * question, HTS_File * fp)
+{
+ char buff[HTS_MAXBUFLEN];
+ HTS_Pattern *pattern, *last_pattern;
+
+ if (question == NULL || fp == NULL)
+ return FALSE;
+
|
[-]
[+]
|
Added |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/src/hts/hts_engine_API/lib/HTS_pstream.c
^
|
@@ -0,0 +1,524 @@
+/* ----------------------------------------------------------------- */
+/* The HMM-Based Speech Synthesis Engine "hts_engine API" */
+/* developed by HTS Working Group */
+/* http://hts-engine.sourceforge.net/ */
+/* ----------------------------------------------------------------- */
+/* */
+/* Copyright (c) 2001-2015 Nagoya Institute of Technology */
+/* Department of Computer Science */
+/* */
+/* 2001-2008 Tokyo Institute of Technology */
+/* Interdisciplinary Graduate School of */
+/* Science and Engineering */
+/* */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or */
+/* without modification, are permitted provided that the following */
+/* conditions are met: */
+/* */
+/* - Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* - Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* - Neither the name of the HTS working group nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */
+/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */
+/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
+/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
+/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS */
+/* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
+/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
+/* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
+/* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, */
+/* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY */
+/* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/* POSSIBILITY OF SUCH DAMAGE. */
+/* ----------------------------------------------------------------- */
+
+#ifndef HTS_PSTREAM_C
+#define HTS_PSTREAM_C
+
+#ifdef __cplusplus
+#define HTS_PSTREAM_C_START extern "C" {
+#define HTS_PSTREAM_C_END }
+#else
+#define HTS_PSTREAM_C_START
+#define HTS_PSTREAM_C_END
+#endif /* __CPLUSPLUS */
+
+HTS_PSTREAM_C_START;
+
+#include <math.h> /* for sqrt() */
+
+/* hts_engine libraries */
+#include "HTS_hidden.h"
+
+/* HTS_finv: calculate 1.0/variance function */
+static double HTS_finv(const double x)
+{
+ if (x >= INFTY2)
+ return 0.0;
+ if (x <= -INFTY2)
+ return 0.0;
+ if (x <= INVINF2 && x >= 0)
+ return INFTY;
+ if (x >= -INVINF2 && x < 0)
+ return -INFTY;
+
+ return (1.0 / x);
+}
+
+/* HTS_PStream_calc_wuw_and_wum: calcurate W'U^{-1}W and W'U^{-1}M */
+static void HTS_PStream_calc_wuw_and_wum(HTS_PStream * pst, size_t m)
+{
+ size_t t, i, j;
+ int shift;
+ double wu;
+
+ for (t = 0; t < pst->length; t++) {
+ /* initialize */
+ pst->sm.wum[t] = 0.0;
+ for (i = 0; i < pst->width; i++)
+ pst->sm.wuw[t][i] = 0.0;
+
+ /* calc WUW & WUM */
+ for (i = 0; i < pst->win_size; i++)
+ for (shift = pst->win_l_width[i]; shift <= pst->win_r_width[i]; shift++)
+ if (((int) t + shift >= 0) && ((int) t + shift < pst->length) && (pst->win_coefficient[i][-shift] != 0.0)) {
+ wu = pst->win_coefficient[i][-shift] * pst->sm.ivar[t + shift][i * pst->vector_length + m];
+ pst->sm.wum[t] += wu * pst->sm.mean[t + shift][i * pst->vector_length + m];
+ for (j = 0; (j < pst->width) && (t + j < pst->length); j++)
+ if (((int) j <= pst->win_r_width[i] + shift) && (pst->win_coefficient[i][j - shift] != 0.0))
+ pst->sm.wuw[t][j] += wu * pst->win_coefficient[i][j - shift];
+ }
+ }
+}
+
+
+/* HTS_PStream_ldl_factorization: Factorize W'*U^{-1}*W to L*D*L' (L: lower triangular, D: diagonal) */
+static void HTS_PStream_ldl_factorization(HTS_PStream * pst)
+{
+ size_t t, i, j;
+
+ for (t = 0; t < pst->length; t++) {
+ for (i = 1; (i < pst->width) && (t >= i); i++)
+ pst->sm.wuw[t][0] -= pst->sm.wuw[t - i][i] * pst->sm.wuw[t - i][i] * pst->sm.wuw[t - i][0];
+
+ for (i = 1; i < pst->width; i++) {
+ for (j = 1; (i + j < pst->width) && (t >= j); j++)
+ pst->sm.wuw[t][i] -= pst->sm.wuw[t - j][j] * pst->sm.wuw[t - j][i + j] * pst->sm.wuw[t - j][0];
+ pst->sm.wuw[t][i] /= pst->sm.wuw[t][0];
+ }
+ }
+}
+
+/* HTS_PStream_forward_substitution: forward subtitution for mlpg */
+static void HTS_PStream_forward_substitution(HTS_PStream * pst)
+{
+ size_t t, i;
+
+ for (t = 0; t < pst->length; t++) {
+ pst->sm.g[t] = pst->sm.wum[t];
+ for (i = 1; (i < pst->width) && (t >= i); i++)
+ pst->sm.g[t] -= pst->sm.wuw[t - i][i] * pst->sm.g[t - i];
+ }
+}
+
+/* HTS_PStream_backward_substitution: backward subtitution for mlpg */
+static void HTS_PStream_backward_substitution(HTS_PStream * pst, size_t m)
+{
+ size_t rev, t, i;
+
+ for (rev = 0; rev < pst->length; rev++) {
+ t = pst->length - 1 - rev;
+ pst->par[t][m] = pst->sm.g[t] / pst->sm.wuw[t][0];
+ for (i = 1; (i < pst->width) && (t + i < pst->length); i++)
+ pst->par[t][m] -= pst->sm.wuw[t][i] * pst->par[t + i][m];
+ }
+}
+
+/* HTS_PStream_calc_gv: subfunction for mlpg using GV */
+static void HTS_PStream_calc_gv(HTS_PStream * pst, size_t m, double *mean, double *vari)
+{
+ size_t t;
+
+ *mean = 0.0;
+ for (t = 0; t < pst->length; t++)
+ if (pst->gv_switch[t])
+ *mean += pst->par[t][m];
+ *mean /= pst->gv_length;
+ *vari = 0.0;
+ for (t = 0; t < pst->length; t++)
+ if (pst->gv_switch[t])
+ *vari += (pst->par[t][m] - *mean) * (pst->par[t][m] - *mean);
+ *vari /= pst->gv_length;
+}
+
+/* HTS_PStream_conv_gv: subfunction for mlpg using GV */
+static void HTS_PStream_conv_gv(HTS_PStream * pst, size_t m)
+{
+ size_t t;
+ double ratio;
+ double mean;
+ double vari;
+
+ HTS_PStream_calc_gv(pst, m, &mean, &vari);
+ ratio = sqrt(pst->gv_mean[m] / vari);
+ for (t = 0; t < pst->length; t++)
+ if (pst->gv_switch[t])
+ pst->par[t][m] = ratio * (pst->par[t][m] - mean) + mean;
+}
+
+/* HTS_PStream_calc_derivative: subfunction for mlpg using GV */
+static double HTS_PStream_calc_derivative(HTS_PStream * pst, size_t m)
+{
+ size_t t, i;
+ double mean;
+ double vari;
+ double dv;
+ double h;
+ double gvobj;
+ double hmmobj;
+ double w = 1.0 / (pst->win_size * pst->length);
+
+ HTS_PStream_calc_gv(pst, m, &mean, &vari);
+ gvobj = -0.5 * W2 * vari * pst->gv_vari[m] * (vari - 2.0 * pst->gv_mean[m]);
+ dv = -2.0 * pst->gv_vari[m] * (vari - pst->gv_mean[m]) / pst->length;
+
+ for (t = 0; t < pst->length; t++) {
+ pst->sm.g[t] = pst->sm.wuw[t][0] * pst->par[t][m];
+ for (i = 1; i < pst->width; i++) {
+ if (t + i < pst->length)
+ pst->sm.g[t] += pst->sm.wuw[t][i] * pst->par[t + i][m];
|
[-]
[+]
|
Added |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/src/hts/hts_engine_API/lib/HTS_sstream.c
^
|
@@ -0,0 +1,512 @@
+/* ----------------------------------------------------------------- */
+/* The HMM-Based Speech Synthesis Engine "hts_engine API" */
+/* developed by HTS Working Group */
+/* http://hts-engine.sourceforge.net/ */
+/* ----------------------------------------------------------------- */
+/* */
+/* Copyright (c) 2001-2015 Nagoya Institute of Technology */
+/* Department of Computer Science */
+/* */
+/* 2001-2008 Tokyo Institute of Technology */
+/* Interdisciplinary Graduate School of */
+/* Science and Engineering */
+/* */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or */
+/* without modification, are permitted provided that the following */
+/* conditions are met: */
+/* */
+/* - Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* - Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* - Neither the name of the HTS working group nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */
+/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */
+/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
+/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
+/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS */
+/* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
+/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
+/* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
+/* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, */
+/* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY */
+/* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/* POSSIBILITY OF SUCH DAMAGE. */
+/* ----------------------------------------------------------------- */
+
+#ifndef HTS_SSTREAM_C
+#define HTS_SSTREAM_C
+
+#ifdef __cplusplus
+#define HTS_SSTREAM_C_START extern "C" {
+#define HTS_SSTREAM_C_END }
+#else
+#define HTS_SSTREAM_C_START
+#define HTS_SSTREAM_C_END
+#endif /* __CPLUSPLUS */
+
+HTS_SSTREAM_C_START;
+
+#include <stdlib.h>
+#include <math.h>
+
+/* hts_engine libraries */
+#include "HTS_hidden.h"
+
+/* HTS_set_default_duration: set default duration from state duration probability distribution */
+static double HTS_set_default_duration(size_t * duration, double *mean, double *vari, size_t size)
+{
+ size_t i;
+ double temp;
+ size_t sum = 0;
+
+ for (i = 0; i < size; i++) {
+ temp = mean[i] + 0.5;
+ if (temp < 1.0)
+ duration[i] = 1;
+ else
+ duration[i] = (size_t) temp;
+ sum += duration[i];
+ }
+
+ return (double) sum;
+}
+
+/* HTS_set_specified_duration: set duration from state duration probability distribution and specified frame length */
+static double HTS_set_specified_duration(size_t * duration, double *mean, double *vari, size_t size, double frame_length)
+{
+ size_t i;
+ int j;
+ double temp1, temp2;
+ double rho = 0.0;
+ size_t sum = 0;
+ size_t target_length;
+
+ /* get the target frame length */
+ if (frame_length + 0.5 < 1.0)
+ target_length = 1;
+ else
+ target_length = (size_t) (frame_length + 0.5);
+
+ /* check the specified duration */
+ if (target_length <= size) {
+ if (target_length < size)
+ HTS_error(-1, "HTS_set_specified_duration: Specified frame length is too short.\n");
+ for (i = 0; i < size; i++)
+ duration[i] = 1;
+ return (double) size;
+ }
+
+ /* RHO calculation */
+ temp1 = 0.0;
+ temp2 = 0.0;
+ for (i = 0; i < size; i++) {
+ temp1 += mean[i];
+ temp2 += vari[i];
+ }
+ rho = ((double) target_length - temp1) / temp2;
+
+ /* first estimation */
+ for (i = 0; i < size; i++) {
+ temp1 = mean[i] + rho * vari[i] + 0.5;
+ if (temp1 < 1.0)
+ duration[i] = 1;
+ else
+ duration[i] = (size_t) temp1;
+ sum += duration[i];
+ }
+
+ /* loop estimation */
+ while (target_length != sum) {
+ /* sarch flexible state and modify its duration */
+ if (target_length > sum) {
+ j = -1;
+ for (i = 0; i < size; i++) {
+ temp2 = fabs(rho - ((double) duration[i] + 1 - mean[i]) / vari[i]);
+ if (j < 0 || temp1 > temp2) {
+ j = i;
+ temp1 = temp2;
+ }
+ }
+ sum++;
+ duration[j]++;
+ } else {
+ j = -1;
+ for (i = 0; i < size; i++) {
+ if (duration[i] > 1) {
+ temp2 = fabs(rho - ((double) duration[i] - 1 - mean[i]) / vari[i]);
+ if (j < 0 || temp1 > temp2) {
+ j = i;
+ temp1 = temp2;
+ }
+ }
+ }
+ sum--;
+ duration[j]--;
+ }
+ }
+
+ return (double) target_length;
+}
+
+/* HTS_SStreamSet_initialize: initialize state stream set */
+void HTS_SStreamSet_initialize(HTS_SStreamSet * sss)
+{
+ sss->nstream = 0;
+ sss->nstate = 0;
+ sss->sstream = NULL;
+ sss->duration = NULL;
+ sss->total_state = 0;
+ sss->total_frame = 0;
+}
+
+/* HTS_SStreamSet_create: parse label and determine state duration */
+HTS_Boolean HTS_SStreamSet_create(HTS_SStreamSet * sss, HTS_ModelSet * ms, HTS_Label * label, HTS_Boolean phoneme_alignment_flag, double speed, double *duration_iw, double **parameter_iw, double **gv_iw)
+{
+ size_t i, j, k;
+ double temp;
+ int shift;
+ size_t state;
+ HTS_SStream *sst;
+ double *duration_mean, *duration_vari;
+ double frame_length;
+ size_t next_time;
+ size_t next_state;
+
+ if (HTS_Label_get_size(label) == 0)
+ return FALSE;
+
+ /* check interpolation weights */
+ for (i = 0, temp = 0.0; i < HTS_ModelSet_get_nvoices(ms); i++)
+ temp += duration_iw[i];
+ if (temp == 0.0) {
+ return FALSE;
+ } else if (temp != 1.0) {
+ for (i = 0; i < HTS_ModelSet_get_nvoices(ms); i++)
+ if (duration_iw[i] != 0.0)
+ duration_iw[i] /= temp;
+ }
+
+ for (i = 0; i < HTS_ModelSet_get_nstream(ms); i++) {
+ for (j = 0, temp = 0.0; j < HTS_ModelSet_get_nvoices(ms); j++)
|
[-]
[+]
|
Added |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/src/hts/hts_engine_API/lib/HTS_vocoder.c
^
|
@@ -0,0 +1,857 @@
+/* ----------------------------------------------------------------- */
+/* The HMM-Based Speech Synthesis Engine "hts_engine API" */
+/* developed by HTS Working Group */
+/* http://hts-engine.sourceforge.net/ */
+/* ----------------------------------------------------------------- */
+/* */
+/* Copyright (c) 2001-2015 Nagoya Institute of Technology */
+/* Department of Computer Science */
+/* */
+/* 2001-2008 Tokyo Institute of Technology */
+/* Interdisciplinary Graduate School of */
+/* Science and Engineering */
+/* */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or */
+/* without modification, are permitted provided that the following */
+/* conditions are met: */
+/* */
+/* - Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* - Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* - Neither the name of the HTS working group nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */
+/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */
+/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
+/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
+/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS */
+/* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
+/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
+/* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
+/* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, */
+/* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY */
+/* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/* POSSIBILITY OF SUCH DAMAGE. */
+/* ----------------------------------------------------------------- */
+
+#ifndef HTS_VOCODER_C
+#define HTS_VOCODER_C
+
+#ifdef __cplusplus
+#define HTS_VOCODER_C_START extern "C" {
+#define HTS_VOCODER_C_END }
+#else
+#define HTS_VOCODER_C_START
+#define HTS_VOCODER_C_END
+#endif /* __CPLUSPLUS */
+
+#define HTS_IMP
+#include "../src/filter/bb_mlsacore.c"
+HTS_VOCODER_C_START;
+
+#include <math.h> /* for sqrt(),log(),exp(),pow(),cos() */
+
+/* hts_engine libraries */
+#include "HTS_hidden.h"
+
+static const double HTS_pade[] = {
+ 1.00000000000,
+ 0.49993910000,
+ 0.11070980000,
+ 0.01369984000,
+ 0.00095648530,
+ 0.00003041721
+};
+
+/* HTS_movem: move memory */
+static void HTS_movem(double *a, double *b, const int nitem)
+{
+ long i = (long) nitem;
+
+ if (a > b)
+ while (i--)
+ *b++ = *a++;
+ else {
+ a += i;
+ b += i;
+ while (i--)
+ *--b = *--a;
+ }
+}
+
+/* HTS_nrandom: functions for gaussian random noise generation */
+static double HTS_nrandom(HTS_Vocoder * v)
+{
+ if (v->sw == 0) {
+ v->sw = 1;
+ do {
+ v->r1 = 2 * rnd(&v->next) - 1;
+ v->r2 = 2 * rnd(&v->next) - 1;
+ v->s = v->r1 * v->r1 + v->r2 * v->r2;
+ } while (v->s > 1 || v->s == 0);
+ v->s = sqrt(-2 * log(v->s) / v->s);
+ return (v->r1 * v->s);
+ } else {
+ v->sw = 0;
+ return (v->r2 * v->s);
+ }
+}
+
+/* HTS_mceq: function for M-sequence random noise generation */
+static int HTS_mseq(HTS_Vocoder * v)
+{
+ int x0, x28;
+
+ v->x >>= 1;
+ if (v->x & B0)
+ x0 = 1;
+ else
+ x0 = -1;
+ if (v->x & B28)
+ x28 = 1;
+ else
+ x28 = -1;
+ if (x0 + x28)
+ v->x &= B31_;
+ else
+ v->x |= B31;
+
+ return (x0);
+}
+
+/* HTS_mc2b: transform mel-cepstrum to MLSA digital fillter coefficients */
+static void HTS_mc2b(double *mc, double *b, int m, const double a)
+{
+ if (mc != b) {
+ if (a != 0.0) {
+ b[m] = mc[m];
+ for (m--; m >= 0; m--)
+ b[m] = mc[m] - a * b[m + 1];
+ } else
+ HTS_movem(mc, b, m + 1);
+ } else if (a != 0.0)
+ for (m--; m >= 0; m--)
+ b[m] -= a * b[m + 1];
+}
+
+/* HTS_c2ir: The minimum phase impulse response is evaluated from the minimum phase cepstrum */
+static void HTS_c2ir(const double *c, const int nc, double *h, const int leng)
+{
+ int n, k, upl;
+ double d;
+
+ h[0] = exp(c[0]);
+ for (n = 1; n < leng; n++) {
+ d = 0;
+ upl = (n >= nc) ? nc - 1 : n;
+ for (k = 1; k <= upl; k++)
+ d += k * c[k] * h[n - k];
+ h[n] = d / n;
+ }
+}
+
+/* HTS_b2en: calculate frame energy */
+static double HTS_b2en(HTS_Vocoder * v, const double *b, const int m, const double a)
+{
+ int i;
+ double en = 0.0;
+ double *cep;
+ double *ir;
+
+ if (v->spectrum2en_size < m) {
+ if (v->spectrum2en_buff != NULL)
+ HTS_free(v->spectrum2en_buff);
+ v->spectrum2en_buff = (double *) HTS_calloc((m + 1) + 2 * IRLENG, sizeof(double));
+ v->spectrum2en_size = m;
+ }
+ cep = v->spectrum2en_buff + m + 1;
+ ir = cep + IRLENG;
+
+ b2mc(b, v->spectrum2en_buff, m, a);
+ freqt(v->spectrum2en_buff, m, cep, IRLENG, -a);
+ HTS_c2ir(cep, IRLENG, ir, IRLENG);
+
+ for (i = 0; i < IRLENG; i++)
+ en += ir[i] * ir[i];
+
+ return (en);
+}
+
+/* HTS_ignorm: inverse gain normalization */
+static void HTS_ignorm(double *c1, double *c2, int m, const double g)
+{
+ double k;
+ if (g != 0.0) {
+ k = pow(c1[0], g);
+ for (; m >= 1; m--)
+ c2[m] = k * c1[m];
+ c2[0] = (k - 1.0) / g;
+ } else {
+ HTS_movem(&c1[1], &c2[1], m);
+ c2[0] = log(c1[0]);
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/src/lexicon/cst_lexicon.c
^
|
@@ -78,7 +78,7 @@
cst_val *na = NULL;
int i;
- lf = ts_open(lexfile, "\n", "", "", "");
+ lf = ts_open(lexfile, "\n", "", "", "", 0);
if (lf == NULL)
{
cst_errmsg("lex_add_addenda: cannot open lexicon file\n");
@@ -120,14 +120,14 @@
cst_string *pos;
int i;
- e = ts_open_string(entry, cst_ts_default_whitespacesymbols, "", "", "");
+ e = ts_open_string(entry, cst_ts_default_whitespacesymbols, "", "", "", 0);
w = ts_get(e);
if (w[0] == '"') /* it was a quoted entry */
{ /* so reparse it */
ts_close(e);
e = ts_open_string(entry,
- cst_ts_default_whitespacesymbols, "", "", "");
+ cst_ts_default_whitespacesymbols, "", "", "", 0);
w = ts_get_quoted_token(e, '"', '\\');
}
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/src/speech/cst_track_io.c
^
|
@@ -161,7 +161,7 @@
num_frames = 0;
num_channels = 0;
- ts = ts_open(filename, NULL, NULL, NULL, NULL);
+ ts = ts_open(filename, NULL, NULL, NULL, NULL, 0);
if (ts == NULL)
{
cst_errmsg("cst_track_load: can't open file \"%s\"\n", filename);
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/src/synth/cst_ffeatures.c
^
|
@@ -37,6 +37,50 @@
/* Some language independent features */
/* */
+/* ----------------------------------------------------------------- */
+/* The English TTS System "Flite+hts_engine" */
+/* developed by HTS Working Group */
+/* http://hts-engine.sourceforge.net/ */
+/* ----------------------------------------------------------------- */
+/* */
+/* Copyright (c) 2005-2016 Nagoya Institute of Technology */
+/* Department of Computer Science */
+/* */
+/* 2005-2008 Tokyo Institute of Technology */
+/* Interdisciplinary Graduate School of */
+/* Science and Engineering */
+/* */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or */
+/* without modification, are permitted provided that the following */
+/* conditions are met: */
+/* */
+/* - Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* - Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* - Neither the name of the HTS working group nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */
+/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */
+/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
+/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
+/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS */
+/* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
+/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
+/* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
+/* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, */
+/* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY */
+/* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/* POSSIBILITY OF SUCH DAMAGE. */
+/* ----------------------------------------------------------------- */
+
#include "cst_hrg.h"
#include "cst_phoneset.h"
#include "cst_regex.h"
@@ -50,7 +94,7 @@
static const cst_val *syl_break(const cst_item *syl);
static const cst_val *syl_codasize(const cst_item *syl);
static const cst_val *syl_onsetsize(const cst_item *syl);
-static const cst_val *accented(const cst_item *p);
+const cst_val *accented(const cst_item *p);
DEF_STATIC_CONST_VAL_STRING(val_string_onset, "onset");
DEF_STATIC_CONST_VAL_STRING(val_string_coda, "coda");
@@ -60,6 +104,9 @@
DEF_STATIC_CONST_VAL_STRING(val_string_mid, "mid");
DEF_STATIC_CONST_VAL_STRING(val_string_empty, "");
+/* Used at gpos */
+DEF_STATIC_CONST_VAL_STRING(val_string_content,"content");
+
const cst_val *ph_vc(const cst_item *p)
{
return phone_feature(item_phoneset(p), item_name(p), "vc");
@@ -344,7 +391,7 @@
}
-static const cst_val *accented(const cst_item *syl)
+const cst_val *accented(const cst_item *syl)
{
if ((item_feat_present(syl, "accent")) ||
(item_feat_present(syl, "endtone")))
@@ -605,21 +652,18 @@
fs = path_to_item(syl,
"R:SylStructure.parent.R:Phrase.parent.daughter.R:SylStructure.daughter");
-#if 1 /* fix by uratec */
if (item_equal(ss, fs))
return val_string_n(0);
-#else
- /* This should actually include the first syllable, but Festival's
- doesn't. */
-#endif
for (c = 0, p = item_prev(ss);
- p && (!item_equal(p, fs)) && (c < CST_CONST_INT_MAX);
- p = item_prev(p))
+ p && (c < CST_CONST_INT_MAX); p = item_prev(p))
{
if (cst_streq("1", ffeature_string(p, "stress")))
c++;
+ if (item_equal(p, fs))
+ break;
}
+
return val_string_n(c); /* its used randomly as int and float */
}
@@ -828,6 +872,305 @@
}
}
+const cst_val *content_words_in(const cst_item *p)
+{
+ const cst_item *s;
+ int i=0;
+ p=item_as(p,"Word");
+ s=item_as(path_to_item(p,"R:SylStructure.R:Phrase.parent.daughter1"),"Word");
+ for (;s && !item_equal(p,s);s=item_next(s))
+ {
+ if (!strcmp(ffeature_string(s,"gpos"),"content"))
+ {i++;}
+ }
+ // if(!strcmp(ffeature_string(p,"gpos"), "content")){i++;}
+ return val_string_n(i);
+}
+
+
+const cst_val *content_words_out(const cst_item *p)
+{
+ const cst_item *s;
+ int i=0;
+ p=item_as(p,"Word");
+ s=item_as(path_to_item(p,"R:SylStructure.R:Phrase.parent.daughtern"),"Word");
+#if 1 /* fix by uratec */
+ for (;s && !item_equal(p,s);s=item_prev(s))
+ {
+ if (!strcmp(ffeature_string(s,"gpos"),"content"))
+ {i++;}
+ }
+#else
+ for (;s && !item_equal(p,s);p=item_next(p))
+ {
+ if (!strcmp(ffeature_string(p,"gpos"),"content"))
+ {i++;}
+ }
+ if(!strcmp(ffeature_string(s,"gpos"), "content")){i++;}
+#endif
+ return val_string_n(i);
+}
+
+const cst_val *cg_content_words_in_phrase(const cst_item *p)
+{
+ return float_val(ffeature_float(p,"R:SylStructure.parent.parent.R:Word.content_words_in") + ffeature_float(p,"R:SylStructure.parent.parent.R:Word.content_words_out")) ;//- (strcmp(ffeature_string(p,"R:SylStructure.parent.parent.R:Word.gpos"),"content")==0?1:0));
+}
+
+/* HTS features
+
+ HTS voices use a model with more contextual features, such as the total
+ number of words in the sentence, or the total number of syllables. The
+ following functions extract those features for US English texts.
+ */
+
+/* 21 by Toda-san */
+static const cst_val *lisp_distance_to_p_stress(const cst_item *syl)
+{
+ const cst_item *s, *fs;
+ int c;
+
+ s = item_as(syl, "Syllable");
+ fs = path_to_item(syl,
+ "R:SylStructure.parent.R:Phrase.parent.daughter.R:SylStructure.daughter");
+ if (item_equal(s, fs))
+ return val_string_n(0);
+ s = item_prev(s);
+ for (c = 1; s && (!item_equal(s, fs)); s = item_prev(s), c++)
+ if (strcmp("1", ffeature_string(s, "stress")) == 0)
+ return val_string_n(c);
+ if (strcmp("1", ffeature_string(s, "stress")) == 0)
+ return val_string_n(c);
+ else
+ return val_string_n(0);
+}
+
+/* 22 by Toda-san */
+static const cst_val *lisp_distance_to_n_stress(const cst_item *syl)
+{
+ const cst_item *s, *fs;
+ int c;
+
+ s = item_as(syl, "Syllable");
+ fs = path_to_item(syl,
+ "R:SylStructure.parent.R:Phrase.parent.daughtern.R:SylStructure.daughtern");
+ if (item_equal(s, fs))
+ return val_string_n(0);
+ s = item_next(s);
+ for (c = 1; s && (!item_equal(s, fs)); s = item_next(s), c++)
+ if (strcmp("1", ffeature_string(s, "stress")) == 0)
+ return val_string_n(c);
+ if (strcmp("1", ffeature_string(s, "stress")) == 0)
+ return val_string_n(c);
+ else
+ return val_string_n(0);
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/src/synth/cst_ssml.c
^
|
@@ -47,7 +47,7 @@
/* <audio ...> </audio> */
/* <!-- ... --> */
/* <break .../> */
-/* <prosody ...> </prosody> rate volume (no pitch yet) */
+/* <prosody ...> </prosody> pitch range rate volume */
/* <emphasis ...> </emphasis> */
/* <sub alias="World Wide Web Consortium">W3C</sub> */
/* <phoneme ph="x x x"> </phoneme> */
@@ -94,16 +94,25 @@
while (!cst_streq(">", name))
{
/* I want names and values to be const */
- if (i == 0)
- {
- fnn = "_name0";
- vnn = "_val0";
- }
- else
+ fnn = "_name0";
+ vnn = "_val0";
+ // Tags with more than one attribute need to have additional
+ // attributes defined here.
+ if (cst_streq("volume", name))
{
fnn = "_name1";
vnn = "_val1";
}
+ else if (cst_streq("pitch", name))
+ {
+ fnn = "_name2";
+ vnn = "_val2";
+ }
+ else if (cst_streq("range", name))
+ {
+ fnn = "_name3";
+ vnn = "_val3";
+ }
if (cst_streq(name, "/"))
feat_set_string(a, "_type", "startend");
else
@@ -201,24 +210,47 @@
{
/* Note SSML doesn't do stretch it does reciprical of stretch */
if (cst_streq("rate", get_param_string(attributes, "_name0", "")))
- feat_set_float(word_feats, "local_duration_stretch",
- 1.0 / feat_float(attributes, "_val0"));
- if (cst_streq("rate", get_param_string(attributes, "_name1", "")))
- feat_set_float(word_feats, "local_duration_stretch",
- 1.0 / feat_float(attributes, "_val1"));
- if (cst_streq
- ("volume", get_param_string(attributes, "_name0", "")))
- feat_set_float(word_feats, "local_gain",
- feat_float(attributes, "_val0") / 100.0);
+ {
+ float val = feat_float(attributes, "_val0");
+ const char *str = feat_string(attributes, "_val0");
+ if (cst_streq(str, "x-slow"))
+ val = 0.3;
+ if (cst_streq(str, "slow"))
+ val = 0.5;
+ if (cst_streq(str, "fast"))
+ val = 1.5;
+ if (cst_streq(str, "x-fast"))
+ val = 2.0;
+ if (cst_streq(str, "medium"))
+ val = 1.0;
+ if (val > 0)
+ feat_set_float(word_feats, "local_duration_stretch",
+ 1.0 / val);
+ }
+ // volume is stored in _name1
if (cst_streq
("volume", get_param_string(attributes, "_name1", "")))
feat_set_float(word_feats, "local_gain",
feat_float(attributes, "_val1") / 100.0);
+ // pitch is stored in _name2
+ if (cst_streq("pitch", get_param_string(attributes, "_name2", "")))
+ {
+ feat_set_float(word_feats, "local_f0_mean", feat_float(attributes, "_val2"));
+ }
+ // range is stored in _name3
+ if (cst_streq("range", get_param_string(attributes, "_name3", "")))
+ {
+ feat_set_float(word_feats, "local_f0_range",
+ // shift by + 1.0 to allow 0.0 to be passed.
+ feat_float(attributes, "_val3") + 1.0);
+ }
}
else if (cst_streq("end", feat_string(attributes, "_type")))
{
feat_remove(word_feats, "local_duration_stretch");
feat_remove(word_feats, "local_gain");
+ feat_remove(word_feats, "local_f0_mean");
+ feat_remove(word_feats, "local_f0_range");
}
}
@@ -503,7 +535,9 @@
NULL),
get_param_string(voice->features,
"text_postpunctuation",
- NULL))) == NULL)
+ NULL),
+ get_param_int(voice->features,
+ "text_emoji_as_singlecharsymbols", 0))) == NULL)
{
cst_errmsg("failed to open file \"%s\" for ssml reading\n", filename);
return -ENOENT;
@@ -542,12 +576,19 @@
int err;
cst_wave *w;
+ // Workaround for the case "hello: there" (colon before the last word)
+ // In above case the last word won't be generated.
+ // Below is a workaround adding a silent space at the end of the sentence
+ // TODO fix for real
+ char * new_text = malloc(strlen(text) + 2);
+ sprintf(new_text, "%s ", text);
+
if ((dur == NULL) || (voice == NULL) || (text == NULL) || (outtype == NULL))
{
return -EINVAL;
}
- if ((ts = ts_open_string(text,
+ if ((ts = ts_open_string(new_text,
get_param_string(voice->features,
"text_whitespace", NULL),
get_param_string(voice->features,
@@ -556,7 +597,9 @@
"text_prepunctuation", NULL),
get_param_string(voice->features,
"text_postpunctuation",
- NULL))) == NULL)
+ NULL),
+ get_param_int(voice->features,
+ "text_emoji_as_singlecharsymbols", 0))) == NULL)
{
return -EINVAL;
}
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/src/synth/cst_synth.c
^
|
@@ -222,7 +222,9 @@
"text_prepunctuation",
NULL),
get_param_string(u->features,
- "text_postpunctuation", NULL));
+ "text_postpunctuation", NULL),
+ get_param_int(u->features,
+ "text_emoji_as_singlecharsymbols", 0));
while (!ts_eof(fd))
{
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/src/synth/mimic.c
^
|
@@ -246,7 +246,9 @@
NULL),
get_param_string(voice->features,
"text_postpunctuation",
- NULL))) == NULL)
+ NULL),
+ get_param_int(voice->features,
+ "text_emoji_as_singlecharsymbols", 0))) == NULL)
{
cst_errmsg("failed to open file \"%s\" for reading\n", filename);
return 1;
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/src/utils/cst_args.c
^
|
@@ -118,7 +118,7 @@
ts = ts_open_string(description, " \t\r\n", /* whitespace */
"{}[]|", /* singlecharsymbols */
"", /* prepunctuation */
- ""); /* postpunctuation */
+ "", 0); /* postpunctuation */
while (!ts_eof(ts))
{
op = cst_strdup(ts_get(ts));
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/src/utils/cst_file_stdio.c
^
|
@@ -45,9 +45,25 @@
#include "cst_error.h"
#include "cst_alloc.h"
+int cst_file_exists(const char *path)
+{
+ /* FIXME: There must be a better way to do this in a portable way... */
+ FILE *fp = fopen(path, "rb");
+ if (fp == NULL)
+ {
+ return 0;
+ }
+ else
+ {
+ fclose(fp);
+ return 1;
+ }
+}
+
cst_file cst_fopen(const char *path, int mode)
{
char cmode[4];
+ cmode[0] = '\0';
if (cst_urlp(path))
return cst_url_open(path);
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/src/utils/cst_tokenstream.c
^
|
@@ -39,6 +39,7 @@
/*************************************************************************/
#include "cst_tokenstream.h"
#include "cst_alloc.h"
+#include <stdint.h>
const cst_string *const cst_ts_default_whitespacesymbols = " \t\n\r";
const cst_string *const cst_ts_default_singlecharsymbols = "(){}[]";
@@ -51,11 +52,76 @@
static void ts_getc(cst_tokenstream *ts);
static void internal_ts_getc(cst_tokenstream *ts);
+static uint32_t utf8char_to_cp(const cst_string *const utf8char)
+{
+ unsigned char c1, c2, c3, c4;
+ unsigned char *c = (unsigned char *) utf8char;
+ uint32_t cp;
+ switch (cst_strlen(c))
+ {
+ case 1:
+ /* 1st byte must be 0xxxxxxx so we mask with b01111111 = 0x7f */
+ cp = c[0] & 0x7f;
+ return cp;
+ case 2:
+ /* 1st byte must be 110xxxxx so we mask with b00011111 = 0x1f */
+ c1 = c[0] & 0x1f;
+ /* 2nd byte must be 10xxxxxx so we mask with b00111111 = 0x3f */
+ c2 = c[1] & 0x3f;
+ /* We shift the bits of c1 6 positions to the left, and fill
+ * those 6 positions with c2 */
+ cp = (c1 << 6) | c2;
+ return cp;
+ case 3:
+ /* 1st byte must be 1110xxxx so we mask with b00011111 = 0x0f */
+ c1 = c[0] & 0x0f;
+ /* 2nd byte must be 10xxxxxx so we mask with b00111111 = 0x3f */
+ c2 = c[1] & 0x3f;
+ /* 3rd byte must be 10xxxxxx so we mask with b00111111 = 0x3f */
+ c3 = c[2] & 0x3f;
+ /* We shift the bits of c1 12 positions to the left, and fill
+ * the 12 positions with 6 bits from c2 and 6 bits from c3 */
+ cp = (c1 << 12) | (c2 << 6) | c3;
+ return cp;
+ case 4:
+ /* 1st byte must be 11110xxx so we mask with b00011111 = 0x07 */
+ c1 = c[0] & 0x07;
+ /* 2nd byte must be 10xxxxxx so we mask with b00111111 = 0x3f */
+ c2 = c[1] & 0x3f;
+ /* 3rd byte must be 10xxxxxx so we mask with b00111111 = 0x3f */
+ c3 = c[2] & 0x3f;
+ /* 4th byte must be 10xxxxxx so we mask with b00111111 = 0x3f */
+ c4 = c[3] & 0x3f;
+ cp = (c1 << 18) | (c2 << 12) | (c3 << 6) | c4;
+ return cp;
+ default:
+ return 0xfffd; /* replacement character */
+ }
+}
+
+static int is_emoji(uint32_t cp)
+{
+ /* http://stackoverflow.com/a/39425959/446149 */
+ if (cp == 0x00A9 || cp == 0x00AE || cp == 0x3030 || /* Special Characters */
+ (cp >=0x1D000 && cp <=0x1F77F) || /* Emoticons */
+ (cp >=0x2100 && cp <=0x27BF) || /* Misc symbols and Dingbats */
+ (cp >=0xFE00 && cp <=0xFE0F) || /* Variation selectors */
+ (cp >=0x1F900 && cp <=0x1F9FF) /* Supplemental Symbols and Pictographs */
+ )
+ return 1;
+ else
+ return 0;
+}
+
int ts_charclass(const cst_string *const utf8char, int cclass,
cst_tokenstream *ts)
{
unsigned char c1, c2, c3, c4;
unsigned char *c = (unsigned char *) utf8char;
+
+ if (ts->all_emoji_as_singlechars && is_emoji(utf8char_to_cp(utf8char)))
+ return TS_CHARCLASS_SINGLECHAR & cclass;
+
switch (cst_strlen(c))
{
case 1:
@@ -411,7 +477,8 @@
static cst_tokenstream *new_tokenstream(const cst_string *whitespace,
const cst_string *singlechars,
const cst_string *prepunct,
- const cst_string *postpunct)
+ const cst_string *postpunct,
+ int emoji_as_singlechar)
{ /* Constructor function */
cst_tokenstream *ts = cst_alloc(cst_tokenstream, 1);
ts->fd = NULL;
@@ -422,6 +489,13 @@
ts->token_pos = 0;
ts->whitespace = cst_alloc(cst_string, TS_BUFFER_SIZE);
ts->ws_max = TS_BUFFER_SIZE;
+ if (emoji_as_singlechar == 1)
+ {
+ ts->all_emoji_as_singlechars = 1;
+ } else
+ {
+ ts->all_emoji_as_singlechars = 0;
+ }
if (prepunct && prepunct[0])
{
ts->prepunctuation = cst_alloc(cst_string, TS_BUFFER_SIZE);
@@ -460,12 +534,14 @@
const cst_string *whitespace,
const cst_string *singlechars,
const cst_string *prepunct,
- const cst_string *postpunct)
+ const cst_string *postpunct,
+ int emoji_as_singlechars)
{
cst_tokenstream *ts = new_tokenstream(whitespace,
singlechars,
prepunct,
- postpunct);
+ postpunct,
+ emoji_as_singlechars);
if (cst_streq("-", filename))
ts->fd = stdin;
@@ -486,12 +562,14 @@
const cst_string *whitespace,
const cst_string *singlechars,
const cst_string *prepunct,
- const cst_string *postpunct)
+ const cst_string *postpunct,
+ int emoji_as_singlechars)
{
cst_tokenstream *ts = new_tokenstream(whitespace,
singlechars,
prepunct,
- postpunct);
+ postpunct,
+ emoji_as_singlechars);
ts->string_buffer = cst_strdup(string);
ts_getc(ts);
@@ -504,6 +582,7 @@
const cst_string *singlecharsymbols,
const cst_string *prepunctsymbols,
const cst_string *postpunctsymbols,
+ int emoji_as_singlechars,
void *streamtype_data,
int (*open) (cst_tokenstream *ts,
const char *filename),
@@ -518,7 +597,8 @@
cst_tokenstream *ts = new_tokenstream(whitespacesymbols,
singlecharsymbols,
prepunctsymbols,
- postpunctsymbols);
+ postpunctsymbols,
+ emoji_as_singlechars);
ts->streamtype_data = streamtype_data;
ts->open = open;
|
[-]
[+]
|
Added |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/src/utils/cst_uregex.c
^
|
@@ -0,0 +1,143 @@
+/*
+ * pcre2 functions
+ *
+ * Copyright 2016 Sergio Oller <sergioller@gmail.com>
+
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of the nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include <stdio.h>
+#include "cst_uregex.h"
+#include "cst_alloc.h"
+#include "cst_string.h"
+#include "cst_error.h"
+
+static cst_string *case_conv(const cst_string *in, int to_upper)
+{
+ if (in == NULL)
+ return NULL;
+ size_t out_len = 2 * strlen(in);
+ unsigned char *output = cst_alloc(unsigned char, out_len);
+ if (output == NULL)
+ {
+ return NULL;
+ }
+ cst_uregex *ureg = new_cst_uregex("(.*)", 0);
+ const char *repl;
+ if (to_upper == 1)
+ {
+ repl = "\\U$1";
+ }
+ else
+ {
+ repl = "\\L$1";
+ }
+ int result = pcre2_substitute(ureg, (const unsigned char *) in, -1, 0,
+ PCRE2_SUBSTITUTE_EXTENDED, NULL, NULL,
+ (const unsigned char *) repl,
+ -1, output, &out_len);
+ if (result < 0)
+ {
+ PCRE2_UCHAR8 buffer[120];
+ pcre2_get_error_message(result, buffer, 120);
+ fprintf(stderr, "Error case converting: %s\n", buffer);
+ }
+ delete_cst_uregex(ureg);
+ return (cst_string *) output;
+}
+
+
+
+cst_string *cst_tolower_utf8(const cst_string *in)
+{
+ return case_conv(in, 0);
+}
+
+cst_string *cst_toupper_utf8(const cst_string *in)
+{
+ return case_conv(in, 1);
+}
+
+/* Compile regex */
+cst_uregex *new_cst_uregex(cst_string *pattern, uint32_t options)
+{
+ int errorcode = 0;
+ PCRE2_SIZE erroroffset;
+ cst_uregex *ureg = pcre2_compile((const unsigned char *) pattern,
+ PCRE2_ZERO_TERMINATED,
+ options | PCRE2_UTF, &errorcode,
+ &erroroffset, NULL);
+ if (ureg == NULL)
+ {
+ PCRE2_UCHAR8 buffer[256];
+ pcre2_get_error_message(errorcode, buffer, 256);
+ fprintf(stderr, "Error creating uregex: %s\n", buffer);
+ /* Handle error */
+ return NULL;
+ }
+ return ureg;
+}
+
+/* free regex */
+void delete_cst_uregex(cst_uregex *uregex)
+{
+ pcre2_code_free(uregex);
+ return;
+}
+
+/* match regex string */
+int cst_uregex_match(cst_uregex *uregex, const cst_string *str)
+{
+ pcre2_match_data *match_data =
+ pcre2_match_data_create_from_pattern(uregex, NULL);
+ int rc =
+ pcre2_match(uregex, (const unsigned char *) str, -1, 0, 0, match_data,
+ NULL);
+ pcre2_match_data_free(match_data);
+ if (rc == PCRE2_ERROR_NOMATCH)
+ {
+ return 0;
+ }
+ else if (rc < 0)
+ {
+ PCRE2_UCHAR8 buffer[256];
+ pcre2_get_error_message(rc, buffer, 256);
+ fprintf(stderr, "Error matching uregex: %s\n", buffer);
+ return -1;
+ }
+ else if (rc == 0)
+ {
+ fprintf(stderr,
+ "Error in cst_uregex_match. This should not happen\n");
+ return -1;
+ }
+ else
+ {
+ return 1;
+ }
+}
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/src/utils/cst_url.c
^
|
@@ -84,7 +84,7 @@
int state, n;
char c;
- urlts = ts_open_string(url, "", ":/", "", "");
+ urlts = ts_open_string(url, "", ":/", "", "", 0);
protocol = ts_get(urlts);
if (cst_streq(protocol, "http"))
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/src/utils/cst_val.c
^
|
@@ -494,7 +494,12 @@
while ((c0 = *str))
{
charlength = utf8_sequence_length(c0);
- snprintf(utf8char, charlength + 1, "%s", str);
+ if (charlength > 0)
+ {
+ memcpy(utf8char, str, charlength);
+ }
+ utf8char[charlength] = 0;
+
chars = cons_val(string_val(utf8char), chars);
str += charlength;
}
@@ -705,7 +710,7 @@
cst_val *v = NULL;
const char *p;
- ts = ts_open_string(str, cst_ts_default_whitespacesymbols, "", "", "");
+ ts = ts_open_string(str, cst_ts_default_whitespacesymbols, "", "", "", 0);
while (!ts_eof(ts))
{
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/src/utils/cst_val_user.c
^
|
@@ -66,6 +66,7 @@
CST_VAL_REG_TD_TYPE(cg_db, cst_cg_db, 49);
CST_VAL_REG_TD_TYPE(voice, cst_voice, 51);
CST_VAL_REG_TD_TYPE(audio_streaming_info, cst_audio_streaming_info, 53);
+CST_VAL_REG_TD_TYPE(flitehtsengine, Flite_HTS_Engine, 55);
const cst_val_def cst_val_defs[] = {
/* These ones are never called */
{"int", NULL}, /* 1 INT */
@@ -96,5 +97,6 @@
{"cg_db", val_delete_cg_db}, /* 49 cg_db */
{"voice", val_delete_voice}, /* 51 cst_voice */
{"audio_streaming_info", val_delete_audio_streaming_info}, /* 53 asi */
+ {"flitehtsengine", val_delete_flitehtsengine}, /* 55 flitehtsengine */
{NULL, NULL} /* NULLs at end of list */
};
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/testsuite/combine_waves_main.c
^
|
@@ -55,7 +55,7 @@
const char *token;
int i = 0;
- ts = ts_open(wavelistfile, " \n\t", "", ".\"", "\".!");
+ ts = ts_open(wavelistfile, " \n\t", "", ".\"", "\".!", 0);
if (!ts)
{
fprintf(stderr, "combine_waves: can't open \"%s\"\n", wavelistfile);
|
[-]
[+]
|
Added |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/testsuite/time_voice_load.c
^
|
@@ -0,0 +1,71 @@
+#if __STDC_VERSION__ >= 199901L
+#define _XOPEN_SOURCE 600
+#else
+#define _XOPEN_SOURCE 500
+#endif /* __STDC_VERSION__ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include "mimic.h"
+
+#ifdef __MACH__
+#include <mach/clock.h>
+#include <mach/mach.h>
+#endif
+
+void current_utc_time(struct timespec *ts)
+{
+#ifdef __MACH__ // OS X does not have clock_gettime, use clock_get_time
+ clock_serv_t cclock;
+ mach_timespec_t mts;
+ host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
+ clock_get_time(cclock, &mts);
+ mach_port_deallocate(mach_task_self(), cclock);
+ ts->tv_sec = mts.tv_sec;
+ ts->tv_nsec = mts.tv_nsec;
+#else
+ clock_gettime(CLOCK_REALTIME, ts);
+#endif
+}
+
+void mimic_set_lang_list();
+
+
+void print_usage(char *prog_name)
+{
+ printf("%s voice-file [number of loads]\n", prog_name);
+}
+
+
+int main(int argc, char *argv[])
+{
+ int i, num;
+ long acc = 0;
+ struct timespec t1;
+ struct timespec t2;
+ cst_voice * v = NULL;
+ mimic_init();
+ mimic_set_lang_list();
+ if (argc < 3)
+ {
+ print_usage(argv[0]);
+ return -1;
+ }
+ else if (argc < 3)
+ num = 1;
+ else
+ num = atoi(argv[2]);
+
+ for(i = 0; i < num; i++)
+ {
+ current_utc_time(&t1);
+ v = mimic_voice_load(argv[1]);
+ current_utc_time(&t2);
+ acc += (t2.tv_sec - t1.tv_sec) * 1000000000 + (t2.tv_nsec - t1.tv_nsec);
+ }
+ if (v != NULL)
+ {
+ printf("voice name: %s, %ld\n", v->name, acc);
+ }
+ return 0;
+}
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/testsuite/utt_test_main.c
^
|
@@ -125,7 +125,7 @@
cst_item *item;
cst_tokenstream *fd;
- fd = ts_open(filename, "", "", "", "");
+ fd = ts_open(filename, "", "", "", "", 0);
if (fd == 0)
return 0;
|
[-]
[+]
|
Added |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/thirdparty/pcre2.patch
^
|
@@ -0,0 +1,12 @@
+diff --git pcre2-10.23/src/pcre2grep.c pcre2-10.23/src/pcre2grep.c
+--- pcre2-10.23/src/pcre2grep.c
++++ pcre2-10.23/src/pcre2grep.c
+@@ -628,7 +628,7 @@ z/OS, and "no support". */
+
+ /************* Directory scanning Unix-style and z/OS ***********/
+
+-#if (defined HAVE_SYS_STAT_H && defined HAVE_DIRENT_H && defined HAVE_SYS_TYPES_H) || defined NATIVE_ZOS
++#if ((defined HAVE_SYS_STAT_H && defined HAVE_DIRENT_H && defined HAVE_SYS_TYPES_H) || defined NATIVE_ZOS) && !defined WIN32
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <dirent.h>
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/tools/example.ssml
^
|
@@ -16,4 +16,12 @@
You say <phoneme ph="t ax m ey1 t ow">tomato </phoneme> while I
say <phoneme ph="t ax m ae1 t ow">tomato</phoneme>.
-</ssml>
\ No newline at end of file
+<break />
+
+<prosody rate=".25" pitch="131" range="6"><phoneme ph="ax" >A</phoneme></prosody>
+<prosody rate=".25" pitch="174" range="6"><phoneme ph="m ey">ma</phoneme></prosody>
+<prosody rate=".5" pitch="220" range="6"><phoneme ph="z ih" >zi</phoneme></prosody>
+<prosody rate=".5" pitch="174" range="6"><phoneme ph="ih ng">ng</phoneme></prosody>
+<prosody rate=".5" pitch="220" range="6">grace,</prosody>
+
+</ssml>
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/tools/mimic_sort_main.c
^
|
@@ -62,7 +62,7 @@
int s,i;
const cst_val **ll;
- ts = ts_open("-",NULL,"()","","");
+ ts = ts_open("-",NULL,"()","","", 0);
f = NULL;
s = 0;
|
[-]
[+]
|
Added |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/unittests/es_text.txt
^
|
@@ -0,0 +1,3 @@
+Hola, hoy es 17 de julio.
+«Patata» es un sustantivo.
+¡Qué día tan bonito! ¿Te gusta tomar el sol?
|
[-]
[+]
|
Added |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/unittests/es_tokenstream_test_main.c
^
|
@@ -0,0 +1,107 @@
+#include "cutest.h"
+#include <stdio.h>
+#include <string.h>
+#include <stdbool.h>
+#include "cst_tokenstream.h"
+#include "cst_lexicon.h"
+#include "cst_synth.h"
+
+#include "es_lang.h"
+
+#ifndef TEST_FILE
+#define TEST_FILE "es_text.txt"
+#endif
+
+static const cst_synth_module text_to_words[] = {
+ {"tokenizer_func", default_tokenization},
+ {"textanalysis_func", default_textanalysis},
+ {"pos_tagger_func", NULL},
+ {"phrasing_func", NULL},
+ {"lexical_insertion_func", NULL},
+ {"pause_insertion_func", NULL},
+ {"intonation_func", NULL},
+ {"postlex_func", NULL},
+ {"duration_model_func", NULL},
+ {"f0_model_func", NULL},
+ {"wave_synth_func", NULL},
+ {"post_synth_hook_func", NULL},
+ {NULL, NULL}
+};
+
+
+
+void test_es_tokenizer(void)
+{
+ /* One entry per token */
+ char *names[] = { "Hola", "hoy", "es", "17", "de", "julio", "Patata",
+ "es", "un", "sustantivo", "Qué", "día", "tan",
+ "bonito", "Te", "gusta", "tomar", "el", "sol"
+ };
+ char *puncs[] = { ",", "", "", "", "", ".",
+ "»", "", "", ".",
+ "", "", "", "!", "", "", "", "", "?"
+ };
+ char *prepuncs[] = { "", "", "", "", "", "",
+ "«", "", "", "",
+ "¡", "", "", "", "¿", "", "", "", ""
+ };
+ int expected_num_tok = 19; /* Expected number of tokens */
+ char *word_list[] = { "hola", "hoy", "es", "diecisiete", "de", "julio",
+ "patata", "es", "un", "sustantivo", "qué", "día", "tan", "bonito",
+ "te", "gusta", "tomar", "el", "sol"};
+ int expected_num_words = 19;
+
+ cst_tokenstream *ts;
+ cst_utterance *u;
+ cst_relation *rel;
+ cst_item *it;
+ int i = 0, j = 0;
+ const char *name, *prepunc, *punc;
+ cst_voice *v = new_voice();
+ const char *text_line;
+ es_init(v);
+ /* Read file line by line. Each ts_get(ts) will return a line */
+ ts = ts_open(TEST_FILE, "\n\r", "", "", "", 0);
+ TEST_CHECK(ts != NULL);
+ while (!ts_eof(ts))
+ {
+ /* For each line, create an utterance, create its tokens and
+ * convert it to words */
+ text_line = ts_get(ts);
+ u = new_utterance();
+ utt_set_input_text(u, text_line);
+ utt_init(u, v);
+ apply_synth_method(u, text_to_words);
+ /* First check: Tokens are correct */
+ rel = utt_relation(u, "Token");
+ TEST_CHECK(rel != NULL);
+ it = relation_head(rel);
+ while (it != NULL)
+ {
+ name = item_feat_string(it, "name");
+ /* printf("name: %s\n", name); */
+ TEST_CHECK(strcmp(name, names[i]) == 0);
+ prepunc = item_feat_string(it, "prepunctuation");
+ TEST_CHECK(strcmp(prepunc, prepuncs[i]) == 0);
+ punc = item_feat_string(it, "punc");
+ TEST_CHECK(strcmp(punc, puncs[i]) == 0);
+ it = item_next(it);
+ i++;
+ }
+ /* Second check: Words are correct */
+ rel = utt_relation(u, "Word");
+ TEST_CHECK(rel != NULL);
+ for (it = relation_head(rel); it; it = item_next(it)) {
+ /*printf("name: %s\n", item_feat_string(it, "name"));*/
+ TEST_CHECK(cst_streq(item_feat_string(it, "name"), word_list[j]));
+ j++;
+ }
+ delete_utterance(u);
+ }
+ TEST_CHECK(i == expected_num_tok); /* verify number of tokens */
+ TEST_CHECK(j == expected_num_words); /* verify number of words */
+ ts_close(ts);
+ delete_voice(v);
+}
+
+TEST_LIST = {{"Spanish token to words", test_es_tokenizer}, {0}};
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/unittests/string_test_main.c
^
|
@@ -31,7 +31,7 @@
*
*/
#include <stdio.h>
-#include "cst_icu.h"
+#include "cst_uregex.h"
#include "cst_alloc.h"
#include "cutest.h"
@@ -39,8 +39,9 @@
void test_uregex_match()
{
int match;
- URegularExpression *uregex;
- uregex = new_cst_uregex("^[àé]$", UREGEX_CASE_INSENSITIVE);
+ cst_uregex *uregex;
+ uregex = new_cst_uregex("^[àé]$", PCRE2_CASELESS);
+ TEST_CHECK(uregex != NULL);
match = cst_uregex_match(uregex, "a");
TEST_CHECK(match == 0);
match = cst_uregex_match(uregex, "à");
@@ -49,43 +50,38 @@
TEST_CHECK(match == 1);
delete_cst_uregex(uregex);
uregex = new_cst_uregex("^🐨.*$", 0);
+ TEST_CHECK(uregex != NULL);
match = cst_uregex_match(uregex, "🐨 is a koala");
TEST_CHECK(match == 1);
match = cst_uregex_match(uregex, "😀 is not a koala");
TEST_CHECK(match == 0);
delete_cst_uregex(uregex);
+ fprintf(stderr, "\n Test expected error message below:\n");
+ fflush(stderr);
uregex = new_cst_uregex(NULL, 0);
+ fprintf(stderr, "Test expected error message above:\n");
+ fflush(stderr);
TEST_CHECK(uregex == NULL);
return;
}
-void test_change_case_l()
+void test_change_case_utf8()
{
cst_string in[] = "¡hola MUNDO!";
cst_string *out;
- out = cst_tolower_l(in, "es_ES");
- printf("in: %s\nout: %s\n", in, out);
+ out = cst_tolower_utf8(in);
+ printf("\nin: '%s'\tout: '%s'\n", in, out);
TEST_CHECK(cst_streq(out, "¡hola mundo!"));
cst_free(out);
- out = cst_toupper_l(in, "es_ES");
- printf("in: %s\nout: %s\n", in, out);
+ out = cst_toupper_utf8(in);
+ printf("in: '%s'\tout: '%s'\n", in, out);
TEST_CHECK(cst_streq(out, "¡HOLA MUNDO!"));
cst_free(out);
- // Test NULL locale
- out = cst_tolower_l("TEST", NULL);
- printf("in: %s\nout: %s\n", "TEST", out);
- TEST_CHECK(cst_streq(out, "test"));
- cst_free(out);
- // Test invalid locale
- out = cst_tolower_l("TEST", "asdf_asdf");
- TEST_CHECK(cst_streq(out, "test"));
- cst_free(out);
// Test NULL input
- out = cst_tolower_l(NULL, "es_ES");
+ out = cst_tolower_utf8(NULL);
TEST_CHECK(out == NULL);
// Test empty input
- out = cst_toupper_l("", "es_ES");
- printf("in: %s\nout: %s\n", "", out);
+ out = cst_toupper_utf8("");
TEST_CHECK(cst_streq(out, ""));
cst_free(out);
return;
@@ -93,12 +89,7 @@
TEST_LIST =
{
- {
- "uregex_match", test_uregex_match}
- ,
- {
- "test_change_case_l", test_change_case_l}
- ,
- {
- 0}
+ {"uregex_match", test_uregex_match},
+ {"test_change_case_utf8", test_change_case_utf8},
+ {0}
};
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/unittests/token_test_main.c
^
|
@@ -19,7 +19,7 @@
cst_tokenstream *fd;
const char *token;
- fd = ts_open(TEST_FILE, " \n\t", NULL, "\"!", NULL);
+ fd = ts_open(TEST_FILE, " \r\n\t", NULL, "\"!", NULL, 0);
TEST_CHECK(fd != NULL);
token = ts_get(fd);
@@ -52,10 +52,11 @@
{
cst_tokenstream *fd;
const char *token;
- const char *singl = "€(){}[]😊"; /* EURO SIGN + defaults + emoji */
+ const char *singl = "€(){}[]"; /* EURO SIGN + defaults */
const char *prepunc = "¿¡\"!"; /* INVERTED QUESTION MARK, INV. EXCL. MARK, ", ! */
const char *postpunc = "\"'`.,:;!?(){}[]";
- fd = ts_open(TEST_FILE_UTF8, " \n\t", singl, prepunc, postpunc);
+ int emoji_as_singlecharsymbols = 1;
+ fd = ts_open(TEST_FILE_UTF8, " \r\n\t", singl, prepunc, postpunc, emoji_as_singlecharsymbols);
TEST_CHECK(fd != NULL);
token = ts_get(fd);
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/unittests/voice_select_test_main.c
^
|
@@ -82,9 +82,13 @@
void test_invalid_url(void)
{
common_init();
+ fprintf(stderr, "\nExpect error messages below:\n");
+ fflush(stderr);
TEST_CHECK(mimic_voice_select
("http://www.example.com/invalid.flitevox")
== NULL);
+ fprintf(stderr, "Expect error messages above:\n");
+ fflush(stderr);
}
void test_file_voice(void)
|
[-]
[+]
|
Changed |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/unittests/wave_test_main.c
^
|
@@ -69,7 +69,11 @@
w2 = mimic_text_to_wave("There", v);
w2->sample_rate *= 2; // create sample rate mismatch
+ fprintf(stderr, "\nExpect error message below:\n");
+ fflush(stderr);
concat_wave(w1, w2);
+ fprintf(stderr, "Expect error message above:\n");
+ fflush(stderr);
TEST_CHECK(w1->num_samples != w2->num_samples + original_len);
delete_wave(w1);
delete_wave(w2);
@@ -78,7 +82,11 @@
w2 = mimic_text_to_wave("There", v);
w2->num_channels *= 2; // create channel number mismatch
+ fprintf(stderr, "Expect error message below:\n");
+ fflush(stderr);
concat_wave(w1, w2);
+ fprintf(stderr, "Expect error message above:\n");
+ fflush(stderr);
TEST_CHECK(w1->num_samples != w2->num_samples + original_len);
delete_wave(w1);
delete_wave(w2);
|
|
Added |
_service:tar_git:mimic-1.3.0.1.tar.gz/mimic/voices/cmu_us_slt_hts.htsvoice
^
|