| Revision | fd5af30d5819fe21c24aef88bf5980bb9e262584 (tree) |
|---|---|
| Time | 2012-02-16 00:50:03 |
| Author | qwerty2501 <riot313@gmai...> |
| Commiter | qwerty2501 |
backup
| @@ -0,0 +1,30 @@ | ||
| 1 | +@echo off | |
| 2 | +if not exist open_jtalk_test.exe goto err | |
| 3 | +set VOICE=hts_voice_nitech_jp_atr503_m001 | |
| 4 | +open_jtalk_test ^ | |
| 5 | +-td %VOICE%/tree-dur.inf ^ | |
| 6 | +-s 48000 -z 6000 -p 240 -a 0.55 ^ | |
| 7 | +-tf %VOICE%/tree-lf0.inf ^ | |
| 8 | +-tm %VOICE%/tree-mgc.inf ^ | |
| 9 | +-md %VOICE%/dur.pdf ^ | |
| 10 | +-mf %VOICE%/lf0.pdf ^ | |
| 11 | +-mm %VOICE%/mgc.pdf ^ | |
| 12 | +-df %VOICE%/lf0.win1 ^ | |
| 13 | +-df %VOICE%/lf0.win2 ^ | |
| 14 | +-df %VOICE%/lf0.win3 ^ | |
| 15 | +-dm %VOICE%/mgc.win1 ^ | |
| 16 | +-dm %VOICE%/mgc.win2 ^ | |
| 17 | +-dm %VOICE%/mgc.win3 ^ | |
| 18 | +-ef %VOICE%/tree-gv-lf0.inf ^ | |
| 19 | +-em %VOICE%/tree-gv-mgc.inf ^ | |
| 20 | +-cf %VOICE%/gv-lf0.pdf ^ | |
| 21 | +-cm %VOICE%/gv-mgc.pdf ^ | |
| 22 | +-k %VOICE%/gv-switch.inf ^ | |
| 23 | +-x open_jtalk_dic ^ | |
| 24 | +test.txt | |
| 25 | +goto end | |
| 26 | +:err | |
| 27 | +echo open_jtalk.exe が見つかりません。 | |
| 28 | +echo 何か押したら、終了します。 | |
| 29 | +pause >NUL | |
| 30 | +:end | |
| \ No newline at end of file |
| @@ -0,0 +1,2 @@ | ||
| 1 | +git add *.cpp *.c *.h *.sln *.vcxproj* *.bat | |
| 2 | +git gui | |
| \ No newline at end of file |
| @@ -3,6 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 11.00 | ||
| 3 | 3 | # Visual C++ Express 2010 |
| 4 | 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "open_jtalk_lib", "open_jtalk_lib\open_jtalk_lib.vcxproj", "{125DDEDE-934B-4B5D-B2F3-6635B1E99EC1}" |
| 5 | 5 | EndProject |
| 6 | +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "open_jtalk_test", "open_jtalk_test\open_jtalk_test.vcxproj", "{5DC94545-EE5F-478F-AB3C-2EBFD0CDA896}" | |
| 7 | + ProjectSection(ProjectDependencies) = postProject | |
| 8 | + {125DDEDE-934B-4B5D-B2F3-6635B1E99EC1} = {125DDEDE-934B-4B5D-B2F3-6635B1E99EC1} | |
| 9 | + EndProjectSection | |
| 10 | +EndProject | |
| 6 | 11 | Global |
| 7 | 12 | GlobalSection(SolutionConfigurationPlatforms) = preSolution |
| 8 | 13 | Debug|Win32 = Debug|Win32 |
| @@ -13,6 +18,10 @@ Global | ||
| 13 | 18 | {125DDEDE-934B-4B5D-B2F3-6635B1E99EC1}.Debug|Win32.Build.0 = Debug|Win32 |
| 14 | 19 | {125DDEDE-934B-4B5D-B2F3-6635B1E99EC1}.Release|Win32.ActiveCfg = Release|Win32 |
| 15 | 20 | {125DDEDE-934B-4B5D-B2F3-6635B1E99EC1}.Release|Win32.Build.0 = Release|Win32 |
| 21 | + {5DC94545-EE5F-478F-AB3C-2EBFD0CDA896}.Debug|Win32.ActiveCfg = Debug|Win32 | |
| 22 | + {5DC94545-EE5F-478F-AB3C-2EBFD0CDA896}.Debug|Win32.Build.0 = Debug|Win32 | |
| 23 | + {5DC94545-EE5F-478F-AB3C-2EBFD0CDA896}.Release|Win32.ActiveCfg = Release|Win32 | |
| 24 | + {5DC94545-EE5F-478F-AB3C-2EBFD0CDA896}.Release|Win32.Build.0 = Release|Win32 | |
| 16 | 25 | EndGlobalSection |
| 17 | 26 | GlobalSection(SolutionProperties) = preSolution |
| 18 | 27 | HideSolutionNode = FALSE |
| @@ -40,23 +40,11 @@ | ||
| 40 | 40 | #include <string.h> |
| 41 | 41 | #include <math.h> |
| 42 | 42 | |
| 43 | -/* Main headers */ | |
| 44 | 43 | #include "mecab.h" |
| 45 | 44 | #include "njd.h" |
| 46 | 45 | #include "jpcommon.h" |
| 47 | 46 | #include "HTS_engine.h" |
| 48 | 47 | |
| 49 | -/* Sub headers */ | |
| 50 | -#include "text2mecab.h" | |
| 51 | -#include "mecab2njd.h" | |
| 52 | -#include "njd_set_pronunciation.h" | |
| 53 | -#include "njd_set_digit.h" | |
| 54 | -#include "njd_set_accent_phrase.h" | |
| 55 | -#include "njd_set_accent_type.h" | |
| 56 | -#include "njd_set_unvoiced_vowel.h" | |
| 57 | -#include "njd_set_long_vowel.h" | |
| 58 | -#include "njd2jpcommon.h" | |
| 59 | - | |
| 60 | 48 | #define OPENJTALK_EXPORTS |
| 61 | 49 | #include "open_jtalk_lib.h" |
| 62 | 50 |
| @@ -55,6 +55,21 @@ | ||
| 55 | 55 | #endif /* OPENJTALKOPENJTALK_EXPORTS */ |
| 56 | 56 | #endif /*OPENJTALK_STATIC_MACRO*/ |
| 57 | 57 | |
| 58 | +#include "open_jtalk\mecab\src\mecab.h" | |
| 59 | +#include "hts_engine_API\include\HTS_engine.h" | |
| 60 | +#include "hts_engine_API\lib\HTS_hidden.h" | |
| 61 | +#include "open_jtalk\jpcommon\jpcommon.h" | |
| 62 | +#include "open_jtalk\njd\njd.h" | |
| 63 | +#include "open_jtalk\mecab2njd\mecab2njd.h" | |
| 64 | +#include "open_jtalk\njd_set_accent_phrase\njd_set_accent_phrase.h" | |
| 65 | +#include "open_jtalk\njd_set_accent_type\njd_set_accent_type.h" | |
| 66 | +#include "open_jtalk\njd_set_digit\njd_set_digit.h" | |
| 67 | +#include "open_jtalk\njd_set_long_vowel\njd_set_long_vowel.h" | |
| 68 | +#include "open_jtalk\njd_set_pronunciation\njd_set_pronunciation.h" | |
| 69 | +#include "open_jtalk\njd_set_unvoiced_vowel\njd_set_unvoiced_vowel.h" | |
| 70 | +#include "open_jtalk\njd2jpcommon\njd2jpcommon.h" | |
| 71 | +#include "open_jtalk\text2mecab\text2mecab.h" | |
| 72 | + | |
| 58 | 73 | typedef struct _OpenJTalk { |
| 59 | 74 | Mecab mecab; |
| 60 | 75 | NJD njd; |
| @@ -62,6 +77,10 @@ typedef struct _OpenJTalk { | ||
| 62 | 77 | HTS_Engine engine; |
| 63 | 78 | } OpenJTalk; |
| 64 | 79 | |
| 80 | +#ifdef __cplusplus | |
| 81 | +extern "C"{ | |
| 82 | +#endif | |
| 83 | + | |
| 65 | 84 | OPENJTALK_EXPORT void OpenJTalk_initialize(OpenJTalk * open_jtalk, int sampling_rate, int fperiod, double alpha, |
| 66 | 85 | int stage, double beta, int audio_buff_size, double uv_threshold, |
| 67 | 86 | HTS_Boolean use_log_gain, double gv_weight_mcp, double gv_weight_lf0); |
| @@ -77,3 +96,6 @@ OPENJTALK_EXPORT void OpenJTalk_synthesis(OpenJTalk * open_jtalk, char *txt, FIL | ||
| 77 | 96 | OPENJTALK_EXPORT void OpenJTalk_clear(OpenJTalk * open_jtalk); |
| 78 | 97 | |
| 79 | 98 | |
| 99 | +#ifdef __cplusplus | |
| 100 | +} | |
| 101 | +#endif | |
| \ No newline at end of file |
| @@ -38,10 +38,10 @@ | ||
| 38 | 38 | </ImportGroup> |
| 39 | 39 | <PropertyGroup Label="UserMacros" /> |
| 40 | 40 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
| 41 | - <IncludePath>$(ProjectDir)hts_engine_API\include;$(ProjectDir)hts_engine_API\lib;$(ProjectDir)open_jtalk\jpcommon;$(ProjectDir)open_jtalk\mecab\src;$(ProjectDir)open_jtalk\mecab2njd;$(ProjectDir)open_jtalk\mecab-naist-jdic;$(ProjectDir)open_jtalk\njd;$(ProjectDir)open_jtalk\njd_set_accent_phrase;$(ProjectDir)open_jtalk\njd_set_accent_type;$(ProjectDir)open_jtalk\njd_set_digit;$(ProjectDir)open_jtalk\njd_set_long_vowel;$(ProjectDir)open_jtalk\njd_set_pronunciation;$(ProjectDir)open_jtalk\njd_set_unvoiced_vowel;$(ProjectDir)open_jtalk\njd2jpcommon;$(ProjectDir)open_jtalk\text2mecab;$(IncludePath)</IncludePath> | |
| 41 | + <IncludePath>$(ProjectDir)hts_engine_API\include;$(ProjectDir)open_jtalk\mecab\src;$(ProjectDir)open_jtalk\mecab2njd;$(ProjectDir)open_jtalk\njd;$(ProjectDir)open_jtalk\njd_set_accent_phrase;$(ProjectDir)open_jtalk\njd_set_accent_type;$(ProjectDir)open_jtalk\njd_set_digit;$(ProjectDir)open_jtalk\njd_set_long_vowel;$(ProjectDir)open_jtalk\njd_set_pronunciation;$(ProjectDir)open_jtalk\njd_set_unvoiced_vowel;$(ProjectDir)open_jtalk\njd2jpcommon;$(ProjectDir)open_jtalk\text2mecab;$(ProjectDir)open_jtalk\jpcommon;$(IncludePath)</IncludePath> | |
| 42 | 42 | </PropertyGroup> |
| 43 | 43 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
| 44 | - <IncludePath>$(ProjectDir)hts_engine_API\include;$(ProjectDir)hts_engine_API\lib;$(ProjectDir)open_jtalk\jpcommon;$(ProjectDir)open_jtalk\mecab\src;$(ProjectDir)open_jtalk\mecab2njd;$(ProjectDir)open_jtalk\mecab-naist-jdic;$(ProjectDir)open_jtalk\njd;$(ProjectDir)open_jtalk\njd_set_accent_phrase;$(ProjectDir)open_jtalk\njd_set_accent_type;$(ProjectDir)open_jtalk\njd_set_digit;$(ProjectDir)open_jtalk\njd_set_long_vowel;$(ProjectDir)open_jtalk\njd_set_pronunciation;$(ProjectDir)open_jtalk\njd_set_unvoiced_vowel;$(ProjectDir)open_jtalk\njd2jpcommon;$(ProjectDir)open_jtalk\text2mecab;$(IncludePath)</IncludePath> | |
| 44 | + <IncludePath>$(IncludePath)</IncludePath> | |
| 45 | 45 | </PropertyGroup> |
| 46 | 46 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
| 47 | 47 | <ClCompile> |
| @@ -74,14 +74,6 @@ | ||
| 74 | 74 | </Link> |
| 75 | 75 | </ItemDefinitionGroup> |
| 76 | 76 | <ItemGroup> |
| 77 | - <None Include="open_jtalk\mecab-naist-jdic\char.def" /> | |
| 78 | - <None Include="open_jtalk\mecab-naist-jdic\feature.def" /> | |
| 79 | - <None Include="open_jtalk\mecab-naist-jdic\left-id.def" /> | |
| 80 | - <None Include="open_jtalk\mecab-naist-jdic\matrix.def" /> | |
| 81 | - <None Include="open_jtalk\mecab-naist-jdic\pos-id.def" /> | |
| 82 | - <None Include="open_jtalk\mecab-naist-jdic\rewrite.def" /> | |
| 83 | - <None Include="open_jtalk\mecab-naist-jdic\right-id.def" /> | |
| 84 | - <None Include="open_jtalk\mecab-naist-jdic\unk.def" /> | |
| 85 | 77 | <None Include="ReadMe.txt" /> |
| 86 | 78 | </ItemGroup> |
| 87 | 79 | <ItemGroup> |
| @@ -16,30 +16,6 @@ | ||
| 16 | 16 | </ItemGroup> |
| 17 | 17 | <ItemGroup> |
| 18 | 18 | <None Include="ReadMe.txt" /> |
| 19 | - <None Include="open_jtalk\mecab-naist-jdic\char.def"> | |
| 20 | - <Filter>ソース ファイル</Filter> | |
| 21 | - </None> | |
| 22 | - <None Include="open_jtalk\mecab-naist-jdic\feature.def"> | |
| 23 | - <Filter>ソース ファイル</Filter> | |
| 24 | - </None> | |
| 25 | - <None Include="open_jtalk\mecab-naist-jdic\left-id.def"> | |
| 26 | - <Filter>ソース ファイル</Filter> | |
| 27 | - </None> | |
| 28 | - <None Include="open_jtalk\mecab-naist-jdic\matrix.def"> | |
| 29 | - <Filter>ソース ファイル</Filter> | |
| 30 | - </None> | |
| 31 | - <None Include="open_jtalk\mecab-naist-jdic\pos-id.def"> | |
| 32 | - <Filter>ソース ファイル</Filter> | |
| 33 | - </None> | |
| 34 | - <None Include="open_jtalk\mecab-naist-jdic\rewrite.def"> | |
| 35 | - <Filter>ソース ファイル</Filter> | |
| 36 | - </None> | |
| 37 | - <None Include="open_jtalk\mecab-naist-jdic\right-id.def"> | |
| 38 | - <Filter>ソース ファイル</Filter> | |
| 39 | - </None> | |
| 40 | - <None Include="open_jtalk\mecab-naist-jdic\unk.def"> | |
| 41 | - <Filter>ソース ファイル</Filter> | |
| 42 | - </None> | |
| 43 | 19 | </ItemGroup> |
| 44 | 20 | <ItemGroup> |
| 45 | 21 | <ClCompile Include="open_jtalk_lib.c"> |
| @@ -0,0 +1,342 @@ | ||
| 1 | +/* ----------------------------------------------------------------- */ | |
| 2 | +/* The HMM-Based Speech Synthesis System (HTS) */ | |
| 3 | +/* Open JTalk developed by HTS Working Group */ | |
| 4 | +/* http://open-jtalk.sourceforge.net/ */ | |
| 5 | +/* ----------------------------------------------------------------- */ | |
| 6 | +/* */ | |
| 7 | +/* Copyright (c) 2008-2010 Nagoya Institute of Technology */ | |
| 8 | +/* Department of Computer Science */ | |
| 9 | +/* */ | |
| 10 | +/* All rights reserved. */ | |
| 11 | +/* */ | |
| 12 | +/* Redistribution and use in source and binary forms, with or */ | |
| 13 | +/* without modification, are permitted provided that the following */ | |
| 14 | +/* conditions are met: */ | |
| 15 | +/* */ | |
| 16 | +/* - Redistributions of source code must retain the above copyright */ | |
| 17 | +/* notice, this list of conditions and the following disclaimer. */ | |
| 18 | +/* - Redistributions in binary form must reproduce the above */ | |
| 19 | +/* copyright notice, this list of conditions and the following */ | |
| 20 | +/* disclaimer in the documentation and/or other materials provided */ | |
| 21 | +/* with the distribution. */ | |
| 22 | +/* - Neither the name of the HTS working group nor the names of its */ | |
| 23 | +/* contributors may be used to endorse or promote products derived */ | |
| 24 | +/* from this software without specific prior written permission. */ | |
| 25 | +/* */ | |
| 26 | +/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ | |
| 27 | +/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ | |
| 28 | +/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ | |
| 29 | +/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ | |
| 30 | +/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS */ | |
| 31 | +/* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */ | |
| 32 | +/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */ | |
| 33 | +/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */ | |
| 34 | +/* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */ | |
| 35 | +/* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, */ | |
| 36 | +/* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY */ | |
| 37 | +/* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */ | |
| 38 | +/* POSSIBILITY OF SUCH DAMAGE. */ | |
| 39 | +/* ----------------------------------------------------------------- */ | |
| 40 | + | |
| 41 | + | |
| 42 | +#include <string> | |
| 43 | +#include <vector> | |
| 44 | +#include "open_jtalk_lib.h" | |
| 45 | + | |
| 46 | +#define MAXBUFLEN 1024 | |
| 47 | +#pragma comment(lib,"..\\Debug\\open_jtalk_lib.lib") | |
| 48 | +#pragma comment(lib,"winmm.lib") | |
| 49 | +#pragma comment(lib,"Advapi32.lib") | |
| 50 | +/* Getfp: wrapper for fopen */ | |
| 51 | +FILE *Getfp(const char *name, const char *opt) | |
| 52 | +{ | |
| 53 | + FILE *fp = fopen(name, opt); | |
| 54 | + | |
| 55 | + if (fp == NULL) { | |
| 56 | + fprintf(stderr, "ERROR: Getfp() in open_jtalk.c: Cannot open %s.\n", name); | |
| 57 | + exit(1); | |
| 58 | + } | |
| 59 | + | |
| 60 | + return (fp); | |
| 61 | +} | |
| 62 | + | |
| 63 | +int main(int argc, char **argv) | |
| 64 | +{ | |
| 65 | + FILE *txtfp = stdin; | |
| 66 | + char *txtfn = NULL; | |
| 67 | + FILE *wavfp = NULL; | |
| 68 | + FILE *logfp = NULL; | |
| 69 | + | |
| 70 | + /* text */ | |
| 71 | + char buff[MAXBUFLEN]; | |
| 72 | + | |
| 73 | + /* engine */ | |
| 74 | + OpenJTalk open_jtalk; | |
| 75 | + | |
| 76 | + /* directory name of dictionary */ | |
| 77 | + char *dn_mecab = NULL; | |
| 78 | + | |
| 79 | + /* file names of models */ | |
| 80 | + char *fn_ms_lf0 = NULL; | |
| 81 | + char *fn_ms_mcp = NULL; | |
| 82 | + char *fn_ms_dur = NULL; | |
| 83 | + | |
| 84 | + /* file names of trees */ | |
| 85 | + char *fn_ts_lf0 = NULL; | |
| 86 | + char *fn_ts_mcp = NULL; | |
| 87 | + char *fn_ts_dur = NULL; | |
| 88 | + | |
| 89 | + /* file names of windows */ | |
| 90 | + char **fn_ws_lf0; | |
| 91 | + char **fn_ws_mcp; | |
| 92 | + int num_ws_lf0 = 0, num_ws_mcp = 0; | |
| 93 | + | |
| 94 | + /* file names of global variance */ | |
| 95 | + char *fn_ms_gvl = NULL; | |
| 96 | + char *fn_ms_gvm = NULL; | |
| 97 | + | |
| 98 | + /* file names of global variance trees */ | |
| 99 | + char *fn_ts_gvl = NULL; | |
| 100 | + char *fn_ts_gvm = NULL; | |
| 101 | + | |
| 102 | + /* file names of global variance switch */ | |
| 103 | + char *fn_gv_switch = NULL; | |
| 104 | + | |
| 105 | + /* global parameter */ | |
| 106 | + int sampling_rate = 16000; | |
| 107 | + int fperiod = 80; | |
| 108 | + double alpha = 0.42; | |
| 109 | + int stage = 0; /* gamma = -1.0/stage */ | |
| 110 | + double beta = 0.0; | |
| 111 | + int audio_buff_size = 1600; | |
| 112 | + double uv_threshold = 0.5; | |
| 113 | + double gv_weight_lf0 = 0.7; | |
| 114 | + double gv_weight_mcp = 1.0; | |
| 115 | + HTS_Boolean use_log_gain = FALSE; | |
| 116 | + | |
| 117 | + | |
| 118 | + /* delta window handler for log f0 */ | |
| 119 | + fn_ws_lf0 = (char **) calloc(argc, sizeof(char *)); | |
| 120 | + /* delta window handler for mel-cepstrum */ | |
| 121 | + fn_ws_mcp = (char **) calloc(argc, sizeof(char *)); | |
| 122 | + | |
| 123 | + /* read command */ | |
| 124 | + while (--argc) { | |
| 125 | + if (**++argv == '-') { | |
| 126 | + switch (*(*argv + 1)) { | |
| 127 | + case 'x': | |
| 128 | + dn_mecab = *(++argv); | |
| 129 | + --argc; | |
| 130 | + break; | |
| 131 | + case 't': | |
| 132 | + switch (*(*argv + 2)) { | |
| 133 | + case 'f': | |
| 134 | + case 'p': | |
| 135 | + fn_ts_lf0 = *(++argv); | |
| 136 | + break; | |
| 137 | + case 'm': | |
| 138 | + fn_ts_mcp = *(++argv); | |
| 139 | + break; | |
| 140 | + case 'd': | |
| 141 | + fn_ts_dur = *(++argv); | |
| 142 | + break; | |
| 143 | + default: | |
| 144 | + fprintf(stderr, | |
| 145 | + "ERROR: main() in open_jtalk.c: Invalid option '-t%c'.\n", *(*argv + 2)); | |
| 146 | + exit(1); | |
| 147 | + } | |
| 148 | + --argc; | |
| 149 | + break; | |
| 150 | + case 'm': | |
| 151 | + switch (*(*argv + 2)) { | |
| 152 | + case 'f': | |
| 153 | + case 'p': | |
| 154 | + fn_ms_lf0 = *(++argv); | |
| 155 | + break; | |
| 156 | + case 'm': | |
| 157 | + fn_ms_mcp = *(++argv); | |
| 158 | + break; | |
| 159 | + case 'd': | |
| 160 | + fn_ms_dur = *(++argv); | |
| 161 | + break; | |
| 162 | + default: | |
| 163 | + fprintf(stderr, | |
| 164 | + "ERROR: main() in open_jtalk.c: Invalid option '-m%c'.\n", *(*argv + 2)); | |
| 165 | + exit(1); | |
| 166 | + } | |
| 167 | + --argc; | |
| 168 | + break; | |
| 169 | + case 'd': | |
| 170 | + switch (*(*argv + 2)) { | |
| 171 | + case 'f': | |
| 172 | + case 'p': | |
| 173 | + fn_ws_lf0[num_ws_lf0] = *(++argv); | |
| 174 | + num_ws_lf0++; | |
| 175 | + break; | |
| 176 | + case 'm': | |
| 177 | + fn_ws_mcp[num_ws_mcp] = *(++argv); | |
| 178 | + num_ws_mcp++; | |
| 179 | + break; | |
| 180 | + default: | |
| 181 | + fprintf(stderr, | |
| 182 | + "ERROR: main() in open_jtalk.c: Invalid option '-d%c'.\n", *(*argv + 2)); | |
| 183 | + exit(1); | |
| 184 | + } | |
| 185 | + --argc; | |
| 186 | + break; | |
| 187 | + case 'o': | |
| 188 | + switch (*(*argv + 2)) { | |
| 189 | + case 'w': | |
| 190 | + wavfp = Getfp(*(++argv), "wb"); | |
| 191 | + break; | |
| 192 | + case 't': | |
| 193 | + logfp = Getfp(*(++argv), "w"); | |
| 194 | + break; | |
| 195 | + default: | |
| 196 | + fprintf(stderr, "ERROR: main() in open_jtalk.c: Invalid option '-o%c'.\n", | |
| 197 | + *(*argv + 2)); | |
| 198 | + exit(1); | |
| 199 | + } | |
| 200 | + --argc; | |
| 201 | + break; | |
| 202 | + case 's': | |
| 203 | + sampling_rate = atoi(*++argv); | |
| 204 | + --argc; | |
| 205 | + break; | |
| 206 | + case 'p': | |
| 207 | + fperiod = atoi(*++argv); | |
| 208 | + --argc; | |
| 209 | + break; | |
| 210 | + case 'a': | |
| 211 | + alpha = atof(*++argv); | |
| 212 | + --argc; | |
| 213 | + break; | |
| 214 | + case 'g': | |
| 215 | + stage = atoi(*++argv); | |
| 216 | + --argc; | |
| 217 | + break; | |
| 218 | + case 'l': | |
| 219 | + use_log_gain = TRUE; | |
| 220 | + break; | |
| 221 | + case 'b': | |
| 222 | + beta = atof(*++argv); | |
| 223 | + --argc; | |
| 224 | + break; | |
| 225 | + case 'u': | |
| 226 | + uv_threshold = atof(*++argv); | |
| 227 | + --argc; | |
| 228 | + break; | |
| 229 | + case 'e': | |
| 230 | + switch (*(*argv + 2)) { | |
| 231 | + case 'f': | |
| 232 | + case 'p': | |
| 233 | + fn_ts_gvl = *(++argv); | |
| 234 | + break; | |
| 235 | + case 'm': | |
| 236 | + fn_ts_gvm = *(++argv); | |
| 237 | + break; | |
| 238 | + default: | |
| 239 | + fprintf(stderr, | |
| 240 | + "ERROR: main() in open_jtalk.c: Invalid option '-e%c'.\n", *(*argv + 2)); | |
| 241 | + exit(1); | |
| 242 | + } | |
| 243 | + --argc; | |
| 244 | + break; | |
| 245 | + case 'c': | |
| 246 | + switch (*(*argv + 2)) { | |
| 247 | + case 'f': | |
| 248 | + case 'p': | |
| 249 | + fn_ms_gvl = *(++argv); | |
| 250 | + break; | |
| 251 | + case 'm': | |
| 252 | + fn_ms_gvm = *(++argv); | |
| 253 | + break; | |
| 254 | + default: | |
| 255 | + fprintf(stderr, | |
| 256 | + "ERROR: main() in open_jtalk.c: Invalid option '-c%c'.\n", *(*argv + 2)); | |
| 257 | + exit(1); | |
| 258 | + } | |
| 259 | + --argc; | |
| 260 | + break; | |
| 261 | + case 'j': | |
| 262 | + switch (*(*argv + 2)) { | |
| 263 | + case 'f': | |
| 264 | + case 'p': | |
| 265 | + gv_weight_lf0 = atof(*(++argv)); | |
| 266 | + break; | |
| 267 | + case 'm': | |
| 268 | + gv_weight_mcp = atof(*(++argv)); | |
| 269 | + break; | |
| 270 | + default: | |
| 271 | + fprintf(stderr, | |
| 272 | + "ERROR: main() in open_jtalk.c: Invalid option '-j%c'.\n", *(*argv + 2)); | |
| 273 | + exit(1); | |
| 274 | + } | |
| 275 | + --argc; | |
| 276 | + break; | |
| 277 | + case 'k': | |
| 278 | + fn_gv_switch = *++argv; | |
| 279 | + --argc; | |
| 280 | + break; | |
| 281 | + case 'z': | |
| 282 | + audio_buff_size = atoi(*++argv); | |
| 283 | + --argc; | |
| 284 | + break; | |
| 285 | + default: | |
| 286 | + fprintf(stderr, "ERROR: main() in open_jtalk.c: Invalid option '-%c'.\n", *(*argv + 1)); | |
| 287 | + exit(1); | |
| 288 | + } | |
| 289 | + } else { | |
| 290 | + txtfn = *argv; | |
| 291 | + txtfp = Getfp(txtfn, "rt"); | |
| 292 | + } | |
| 293 | + } | |
| 294 | + /* dictionary directory check */ | |
| 295 | + if (dn_mecab == NULL) { | |
| 296 | + fprintf(stderr, "ERROR: main() in open_jtalk.c: No dictionary directory.\n"); | |
| 297 | + exit(1); | |
| 298 | + } | |
| 299 | + /* number of models,trees check */ | |
| 300 | + if (fn_ms_dur == NULL || fn_ms_mcp == NULL || fn_ms_lf0 == NULL || | |
| 301 | + fn_ts_dur == NULL || fn_ts_mcp == NULL || fn_ts_lf0 == NULL || | |
| 302 | + fn_ws_mcp == NULL || fn_ws_lf0 == NULL) { | |
| 303 | + fprintf(stderr, | |
| 304 | + "ERROR: main() in open_jtalk.c: Specify models (trees) for each parameter.\n"); | |
| 305 | + exit(1); | |
| 306 | + } | |
| 307 | + | |
| 308 | + /* initialize and load */ | |
| 309 | + OpenJTalk_initialize(&open_jtalk, sampling_rate, fperiod, alpha, stage, beta, audio_buff_size, | |
| 310 | + uv_threshold, use_log_gain, gv_weight_mcp, gv_weight_lf0); | |
| 311 | + OpenJTalk_load(&open_jtalk, dn_mecab, fn_ms_dur, fn_ts_dur, fn_ms_mcp, fn_ts_mcp, fn_ws_mcp, | |
| 312 | + num_ws_mcp, fn_ms_lf0, fn_ts_lf0, fn_ws_lf0, num_ws_lf0, fn_ms_gvm, fn_ts_gvm, | |
| 313 | + fn_ms_gvl, fn_ts_gvl, fn_gv_switch); | |
| 314 | + | |
| 315 | + | |
| 316 | + /* synthesis */ | |
| 317 | + fgets(buff, MAXBUFLEN - 1, txtfp); | |
| 318 | + | |
| 319 | + char *sample = "テストコメント"; | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + OpenJTalk_synthesis(&open_jtalk, buff, wavfp, logfp); | |
| 324 | + OpenJTalk_synthesis(&open_jtalk, sample, wavfp, logfp); | |
| 325 | + | |
| 326 | + Sleep(10000); | |
| 327 | + ::OpenJTalk_clear(&open_jtalk); | |
| 328 | + Sleep(10000); | |
| 329 | + /* free */ | |
| 330 | +// OpenJTalk_clear(&open_jtalk); | |
| 331 | +// free(fn_ws_mcp); | |
| 332 | +// free(fn_ws_lf0); | |
| 333 | + if (txtfn != NULL) | |
| 334 | + fclose(txtfp); | |
| 335 | +// if (wavfp != NULL) | |
| 336 | +// fclose(wavfp); | |
| 337 | +// if (logfp != NULL) | |
| 338 | +// fclose(logfp); | |
| 339 | + | |
| 340 | + | |
| 341 | + return 0; | |
| 342 | +} |
| @@ -0,0 +1,85 @@ | ||
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
| 3 | + <ItemGroup Label="ProjectConfigurations"> | |
| 4 | + <ProjectConfiguration Include="Debug|Win32"> | |
| 5 | + <Configuration>Debug</Configuration> | |
| 6 | + <Platform>Win32</Platform> | |
| 7 | + </ProjectConfiguration> | |
| 8 | + <ProjectConfiguration Include="Release|Win32"> | |
| 9 | + <Configuration>Release</Configuration> | |
| 10 | + <Platform>Win32</Platform> | |
| 11 | + </ProjectConfiguration> | |
| 12 | + </ItemGroup> | |
| 13 | + <PropertyGroup Label="Globals"> | |
| 14 | + <ProjectGuid>{5DC94545-EE5F-478F-AB3C-2EBFD0CDA896}</ProjectGuid> | |
| 15 | + <Keyword>Win32Proj</Keyword> | |
| 16 | + <RootNamespace>open_jtalk_test</RootNamespace> | |
| 17 | + </PropertyGroup> | |
| 18 | + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | |
| 19 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> | |
| 20 | + <ConfigurationType>Application</ConfigurationType> | |
| 21 | + <UseDebugLibraries>true</UseDebugLibraries> | |
| 22 | + <CharacterSet>Unicode</CharacterSet> | |
| 23 | + </PropertyGroup> | |
| 24 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> | |
| 25 | + <ConfigurationType>Application</ConfigurationType> | |
| 26 | + <UseDebugLibraries>false</UseDebugLibraries> | |
| 27 | + <WholeProgramOptimization>true</WholeProgramOptimization> | |
| 28 | + <CharacterSet>Unicode</CharacterSet> | |
| 29 | + </PropertyGroup> | |
| 30 | + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | |
| 31 | + <ImportGroup Label="ExtensionSettings"> | |
| 32 | + </ImportGroup> | |
| 33 | + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | |
| 34 | + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | |
| 35 | + </ImportGroup> | |
| 36 | + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | |
| 37 | + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | |
| 38 | + </ImportGroup> | |
| 39 | + <PropertyGroup Label="UserMacros" /> | |
| 40 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | |
| 41 | + <LinkIncremental>true</LinkIncremental> | |
| 42 | + <IncludePath>$(SolutionDir)open_jtalk_lib;$(IncludePath);$(SolutionDir)open_jtalk_lib\hts_engine_API\include;$(SolutionDir)open_jtalk_lib\hts_engine_API\include</IncludePath> | |
| 43 | + </PropertyGroup> | |
| 44 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | |
| 45 | + <LinkIncremental>false</LinkIncremental> | |
| 46 | + <IncludePath>$(SolutionDir)open_jtalk_lib;$(APR)include;$(boost);$(WINDDK)inc\atl71;$(IncludePath);$(IncludePath);$(SolutionDir)open_jtalk_lib\hts_engine_API\include;$(SolutionDir)open_jtalk_lib\hts_engine_API\include</IncludePath> | |
| 47 | + </PropertyGroup> | |
| 48 | + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | |
| 49 | + <ClCompile> | |
| 50 | + <PrecompiledHeader>NotUsing</PrecompiledHeader> | |
| 51 | + <WarningLevel>Level3</WarningLevel> | |
| 52 | + <Optimization>Disabled</Optimization> | |
| 53 | + <PreprocessorDefinitions>WIN32;OPENJTALK_STATIC_MACRO;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |
| 54 | + </ClCompile> | |
| 55 | + <Link> | |
| 56 | + <SubSystem>Console</SubSystem> | |
| 57 | + <GenerateDebugInformation>true</GenerateDebugInformation> | |
| 58 | + </Link> | |
| 59 | + </ItemDefinitionGroup> | |
| 60 | + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | |
| 61 | + <ClCompile> | |
| 62 | + <WarningLevel>Level3</WarningLevel> | |
| 63 | + <PrecompiledHeader>Use</PrecompiledHeader> | |
| 64 | + <Optimization>MaxSpeed</Optimization> | |
| 65 | + <FunctionLevelLinking>true</FunctionLevelLinking> | |
| 66 | + <IntrinsicFunctions>true</IntrinsicFunctions> | |
| 67 | + <PreprocessorDefinitions>WIN32;OPENJTALK_STATIC_MACRO;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |
| 68 | + </ClCompile> | |
| 69 | + <Link> | |
| 70 | + <SubSystem>Console</SubSystem> | |
| 71 | + <GenerateDebugInformation>true</GenerateDebugInformation> | |
| 72 | + <EnableCOMDATFolding>true</EnableCOMDATFolding> | |
| 73 | + <OptimizeReferences>true</OptimizeReferences> | |
| 74 | + </Link> | |
| 75 | + </ItemDefinitionGroup> | |
| 76 | + <ItemGroup> | |
| 77 | + <None Include="ReadMe.txt" /> | |
| 78 | + </ItemGroup> | |
| 79 | + <ItemGroup> | |
| 80 | + <ClCompile Include="open_jtalk_test.cpp" /> | |
| 81 | + </ItemGroup> | |
| 82 | + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | |
| 83 | + <ImportGroup Label="ExtensionTargets"> | |
| 84 | + </ImportGroup> | |
| 85 | +</Project> | |
| \ No newline at end of file |
| @@ -0,0 +1,25 @@ | ||
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
| 3 | + <ItemGroup> | |
| 4 | + <Filter Include="ソース ファイル"> | |
| 5 | + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> | |
| 6 | + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> | |
| 7 | + </Filter> | |
| 8 | + <Filter Include="ヘッダー ファイル"> | |
| 9 | + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> | |
| 10 | + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> | |
| 11 | + </Filter> | |
| 12 | + <Filter Include="リソース ファイル"> | |
| 13 | + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> | |
| 14 | + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> | |
| 15 | + </Filter> | |
| 16 | + </ItemGroup> | |
| 17 | + <ItemGroup> | |
| 18 | + <None Include="ReadMe.txt" /> | |
| 19 | + </ItemGroup> | |
| 20 | + <ItemGroup> | |
| 21 | + <ClCompile Include="open_jtalk_test.cpp"> | |
| 22 | + <Filter>ソース ファイル</Filter> | |
| 23 | + </ClCompile> | |
| 24 | + </ItemGroup> | |
| 25 | +</Project> | |
| \ No newline at end of file |
| @@ -0,0 +1,3 @@ | ||
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
| 3 | +</Project> | |
| \ No newline at end of file |
| @@ -0,0 +1,8 @@ | ||
| 1 | +// stdafx.cpp : 標準インクルード open_jtalk_test.pch のみを | |
| 2 | +// 含むソース ファイルは、プリコンパイル済みヘッダーになります。 | |
| 3 | +// stdafx.obj にはプリコンパイル済み型情報が含まれます。 | |
| 4 | + | |
| 5 | +#include "stdafx.h" | |
| 6 | + | |
| 7 | +// TODO: このファイルではなく、STDAFX.H で必要な | |
| 8 | +// 追加ヘッダーを参照してください。 |