From: qwerty2501 Date: Sun, 19 Feb 2012 15:15:29 +0000 (+0900) Subject: 読み上げ機能実装途中 X-Git-Tag: v0.100~16 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=882195eec2c256c7df2d04ed3ce3888a16d10203;p=nlite%2Fnlite.git 読み上げ機能実装途中 --- diff --git a/nlite.sln b/nlite.sln index 8d07067..9b86048 100644 --- a/nlite.sln +++ b/nlite.sln @@ -40,6 +40,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nlite_stub", "nlite_stub\nl EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "open_jtalk_lib", "open_jtalk_lib\open_jtalk_lib.vcxproj", "{125DDEDE-934B-4B5D-B2F3-6635B1E99EC1}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "speaker", "speaker\speaker.vcxproj", "{FBE9021E-5717-4EEE-A3AC-E4516C8A29AD}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -82,6 +84,10 @@ Global {125DDEDE-934B-4B5D-B2F3-6635B1E99EC1}.Debug|Win32.Build.0 = Debug|Win32 {125DDEDE-934B-4B5D-B2F3-6635B1E99EC1}.Release|Win32.ActiveCfg = Release|Win32 {125DDEDE-934B-4B5D-B2F3-6635B1E99EC1}.Release|Win32.Build.0 = Release|Win32 + {FBE9021E-5717-4EEE-A3AC-E4516C8A29AD}.Debug|Win32.ActiveCfg = Debug|Win32 + {FBE9021E-5717-4EEE-A3AC-E4516C8A29AD}.Debug|Win32.Build.0 = Debug|Win32 + {FBE9021E-5717-4EEE-A3AC-E4516C8A29AD}.Release|Win32.ActiveCfg = Release|Win32 + {FBE9021E-5717-4EEE-A3AC-E4516C8A29AD}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/nlite.suo b/nlite.suo index 05d20bc..409e1de 100644 Binary files a/nlite.suo and b/nlite.suo differ diff --git a/open_jtalk_lib/open_jtalk_lib.h b/open_jtalk_lib/open_jtalk_lib.h index 2a02ff2..7505dc1 100644 --- a/open_jtalk_lib/open_jtalk_lib.h +++ b/open_jtalk_lib/open_jtalk_lib.h @@ -57,7 +57,6 @@ #include "open_jtalk\mecab\src\mecab.h" #include "hts_engine_API\include\HTS_engine.h" -#include "hts_engine_API\lib\HTS_hidden.h" #include "open_jtalk\jpcommon\jpcommon.h" #include "open_jtalk\njd\njd.h" #include "open_jtalk\mecab2njd\mecab2njd.h" diff --git a/speaker/ReadMe.txt b/speaker/ReadMe.txt new file mode 100644 index 0000000..6eee5a0 --- /dev/null +++ b/speaker/ReadMe.txt @@ -0,0 +1,43 @@ +======================================================================== + スタティック ライブラリ: speaker プロジェクトの概要 +======================================================================== + +この speaker ライブラリ プロジェクトは、AppWizard +により作成されました。 + +このファイルには、speaker +アプリケーションを構成する各ファイルの内容の概要が含まれています。 + + +speaker.vcxproj + これは、アプリケーション ウィザードを使用して生成された VC++ + プロジェクトのメイン プロジェクト ファイルです。 + ファイルを生成した Visual C++ のバージョンに関する情報と、アプリケーション + ウィザードで選択されたプラットフォーム、 + 構成、およびプロジェクト機能に関する情報が含まれています。 + +speaker.vcxproj.filters + これは、アプリケーション ウィザードで生成された VC++ プロジェクトのフィルター + ファイルです。 + このファイルには、プロジェクト内のファイルとフィルターとの間の関連付けに関する + 情報が含まれています。 この関連付けは、特定のノー + ドで同様の拡張子を持つファイルのグループ化を + 示すために IDE で使用されます (たとえば、".cpp" ファイルは "ソース ファイル" + フィルターに関連付けられています)。 + + +///////////////////////////////////////////////////////////////////////////// + +StdAfx.h、StdAfx.cpp + これらのファイルは、speaker.pch + という名前のプリコンパイル済みヘッダー (PCH) ファイルと、StdAfx.obj + という名前のプリコンパイル済みの型ファイルを構築するために使用されます。 + +///////////////////////////////////////////////////////////////////////////// +その他のメモ : + +AppWizard では "TODO:" +コメントを使用して、ユーザーが追加またはカスタマイズする必要のあるソース +コードを示します。 + +///////////////////////////////////////////////////////////////////////////// diff --git a/speaker/mei_normal.cpp b/speaker/mei_normal.cpp new file mode 100644 index 0000000..4f7e340 --- /dev/null +++ b/speaker/mei_normal.cpp @@ -0,0 +1,35 @@ +#include "stdafx.h" +#include "speaker_include.h" + + +namespace speaker{ +namespace openJtalk{ + + +/// +///ƒRƒ“ƒXƒgƒ‰ƒNƒ^ +/// +CMeiNormal::CMeiNormal() +{} + + +/// +///‰Šú‰»ŠÖ” +/// +void CMeiNormal::Initialize(){ + + COpenJtalkCore::Initialize(true,48000,240,0.55,0,0.0,1600,0.5,false,0.7,0.5,1.0); + + return; +} + + +void CMeiNormal::Load(const TChar_P voiceDataDir,const TChar_P dictionaryDataDir){ + + //COpenJtalkCore::Load(voiceDataDir,dictionaryDataDir,"dur.pdf","tree-dur.inf","mgc.pdf", + return; +} + + +} +} \ No newline at end of file diff --git a/speaker/mei_normal.h b/speaker/mei_normal.h new file mode 100644 index 0000000..c80a5a3 --- /dev/null +++ b/speaker/mei_normal.h @@ -0,0 +1,30 @@ +#pragma once + + +namespace speaker{ +namespace openJtalk{ + + class CMeiNormal:public COpenJtalkCore{ + + + /// + ///ƒRƒ“ƒXƒgƒ‰ƒNƒ^ + /// + CMeiNormal(); + + + /// + ///‰Šú‰»ŠÖ” + /// + void Initialize(); + + + /// + ///‰¹ºƒf[ƒ^“Ç‚ÝŽæ‚è + /// + void Load(const TChar_P voiceDataDir,const TChar_P dictionaryDataDir); + }; + + +} +} \ No newline at end of file diff --git a/speaker/open_jtalk_core.cpp b/speaker/open_jtalk_core.cpp new file mode 100644 index 0000000..fe8a611 --- /dev/null +++ b/speaker/open_jtalk_core.cpp @@ -0,0 +1,100 @@ +#include "stdafx.h" +#include "speaker_include.h" + +namespace speaker{ +namespace openJtalk{ + + + +COpenJtalkCore::COpenJtalkCore(): +manageFlag(false){} + + +COpenJtalkCore::~COpenJtalkCore(){ + if(this->manageFlag == true)this->Clear(); +} + +void COpenJtalkCore::Initialize( HTS_Boolean use_lpf, int sampling_rate, + int fperiod, double alpha, int stage, double beta, int audio_buff_size, + double uv_threshold, HTS_Boolean use_log_gain, double gv_weight_mgc, + double gv_weight_lf0, double gv_weight_lpf){ + if(this->manageFlag == true)this->Clear(); + ::OpenJTalk_initialize(&this->openJtalk_internal,use_lpf,sampling_rate,fperiod,alpha,stage, + beta,audio_buff_size,uv_threshold,use_log_gain,gv_weight_mgc,gv_weight_lf0,gv_weight_lpf); + + this->manageFlag = true; +} + +void COpenJtalkCore::Load( const TChar_P in_voiceDataDir,const TChar_P in_dictinalyDataDir, Char_P fn_ms_dur, Char_P fn_ts_dur, + Char_P fn_ms_mgc, Char_P fn_ts_mgc, Char_P *fn_ws_mgc, int num_ws_mgc, + Char_P fn_ms_lf0, Char_P fn_ts_lf0, Char_P *fn_ws_lf0, int num_ws_lf0, + Char_P fn_ms_lpf, Char_P fn_ts_lpf, Char_P *fn_ws_lpf, int num_ws_lpf, + Char_P fn_ms_gvm, Char_P fn_ts_gvm, Char_P fn_ms_gvl, Char_P fn_ts_gvl, + Char_P fn_ms_gvf, Char_P fn_ts_gvf,Char_P fn_gv_switch){ + + if(this->manageFlag == true){ + + CStringA dictionaryDataDir(in_dictinalyDataDir); //Ž«‘ƒf[ƒ^ƒfƒBƒŒƒNƒgƒŠ + CStringA voiceDataDir(in_voiceDataDir); //‰¹º[ƒf[ƒ^ƒfƒBƒŒƒNƒgƒŠ + + std::vector ws_mgcList(num_ws_mgc); + + + for(int ws_mgc_index = 0;ws_mgc_index < num_ws_mgc;++ws_mgc_index){ + + ws_mgcList.push_back((char *)(const char*)(voiceDataDir + fn_ws_mgc[ws_mgc_index])); + } + + std::vector ws_lf0List(num_ws_lf0); + + for(int ws_lf0Index = 0;ws_lf0Index < num_ws_lf0;++ws_lf0Index){ + + ws_mgcList.push_back((char *)(const char*)(voiceDataDir + fn_ws_mgc[ws_lf0Index])); + } + + std::vector ws_lpfList(num_ws_lpf); + + for(int ws_lpfIndex = 0;ws_lpfIndex < num_ws_lpf;++ws_lpfIndex){ + + ws_mgcList.push_back((char *)(const char*)(voiceDataDir + fn_ws_mgc[ws_lpfIndex])); + } + + ::OpenJTalk_load(&this->openJtalk_internal, + (char *)(const char*)(dictionaryDataDir), + (char *)(const char*)(voiceDataDir +fn_ms_dur), + (char *)(const char*)(voiceDataDir +fn_ts_dur), + (char *)(const char*)(voiceDataDir +fn_ms_mgc), + (char *)(const char*)(voiceDataDir +fn_ts_mgc), + &ws_mgcList[0], + num_ws_mgc, + (char *)(const char*)(voiceDataDir +fn_ms_lf0), + (char *)(const char*)(voiceDataDir +fn_ts_lf0), + &ws_mgcList[0], + num_ws_lf0, + (char *)(const char*)(voiceDataDir +fn_ms_lpf), + (char *)(const char*)(voiceDataDir +fn_ts_lpf), + &ws_lpfList[0], + num_ws_lpf, + (char *)(const char*)(voiceDataDir +fn_ms_gvm), + (char *)(const char*)(voiceDataDir +fn_ts_gvm), + (char *)(const char*)(voiceDataDir +fn_ms_gvl), + (char *)(const char*)(voiceDataDir +fn_ts_gvl), + (char *)(const char*)(voiceDataDir +fn_ms_gvf), + (char *)(const char*)(voiceDataDir +fn_ts_gvf), + fn_gv_switch + ); + } +} + +void COpenJtalkCore::Synthesis( Char_P txt, FILE * wavfp, FILE * logfp){ + ::OpenJTalk_synthesis(&this->openJtalk_internal,txt,wavfp,logfp); +} + + +void COpenJtalkCore::Clear(){ + ::OpenJTalk_clear(&this->openJtalk_internal); + this->manageFlag = false; +} + +} +} \ No newline at end of file diff --git a/speaker/open_jtalk_core.h b/speaker/open_jtalk_core.h new file mode 100644 index 0000000..ad76cc5 --- /dev/null +++ b/speaker/open_jtalk_core.h @@ -0,0 +1,71 @@ +#pragma once + +namespace speaker{ +namespace openJtalk{ + + /// + ///OpenJtalk‚ðƒ‰ƒbƒv‚µ‚½ƒNƒ‰ƒX + ///ƒfƒBƒŒƒNƒgƒŠ‚̈µ‚¢‚̊ȈՉ»‚ƃIƒuƒWƒFƒNƒg‚ðƒfƒXƒgƒ‰ƒNƒ^‚ÅŽ©“®”jŠü‚³‚ê‚é‚悤‚É‚µ‚½‚à‚Ì + /// + class COpenJtalkCore{ + + private: + OpenJTalk openJtalk_internal; //“à•”ƒIƒuƒWƒFƒNƒg + bool manageFlag; //ŠÇ—ƒtƒ‰ƒO + + + protected: + /// + ///ƒRƒ“ƒXƒgƒ‰ƒNƒ^ + /// + COpenJtalkCore(); + + /// + ///ƒfƒXƒgƒ‰ƒNƒ^ + /// + virtual ~COpenJtalkCore(); + + //ƒRƒs[ƒK[ƒh + private: + COpenJtalkCore (const COpenJtalkCore&); + COpenJtalkCore& operator=(const COpenJtalkCore&); + + protected: + /// + ///‰Šú‰»ŠÖ” + /// + void Initialize( HTS_Boolean use_lpf, int sampling_rate, + int fperiod, double alpha, int stage, double beta, int audio_buff_size, + double uv_threshold, HTS_Boolean use_log_gain, double gv_weight_mgc, + double gv_weight_lf0, double gv_weight_lpf); + + + /// + ///‰¹ºƒtƒ@ƒCƒ‹“ǂݍž‚Ý + /// + void Load( const TChar_P in_voiceDataDir,const TChar_P in_dictinalyDataDir, Char_P fn_ms_dur, Char_P fn_ts_dur, + Char_P fn_ms_mgc, Char_P fn_ts_mgc, Char_P *fn_ws_mgc, int num_ws_mgc, + Char_P fn_ms_lf0, Char_P fn_ts_lf0, Char_P *fn_ws_lf0, int num_ws_lf0, + Char_P fn_ms_lpf, Char_P fn_ts_lpf, Char_P *fn_ws_lpf, int num_ws_lpf, + Char_P fn_ms_gvm, Char_P fn_ts_gvm, Char_P fn_ms_gvl, Char_P fn_ts_gvl, + Char_P fn_ms_gvf, Char_P fn_ts_gvf, Char_P fn_gv_switch); + + public: + + /// + ///‰¹º‡¬ + /// + void Synthesis( Char_P txt, FILE * wavfp, FILE * logfp); + + + + /// + ///ƒIƒuƒWƒFƒNƒg‚̃NƒŠƒA + /// + void Clear(); + + }; + + +} +} \ No newline at end of file diff --git a/speaker/speaker.vcxproj b/speaker/speaker.vcxproj new file mode 100644 index 0000000..d5a802c --- /dev/null +++ b/speaker/speaker.vcxproj @@ -0,0 +1,96 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {FBE9021E-5717-4EEE-A3AC-E4516C8A29AD} + Win32Proj + speaker + + + + StaticLibrary + true + Unicode + + + StaticLibrary + false + true + Unicode + + + + + + + + + + + + + $(solutiondir)open_jtalk_lib;$(IncludePath) + + + $(solutiondir)open_jtalk_lib;$(IncludePath) + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions);%(PreprocessorDefinitions) + + + Windows + true + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions);%(PreprocessorDefinitions) + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + Create + Create + + + + + + \ No newline at end of file diff --git a/speaker/speaker.vcxproj.filters b/speaker/speaker.vcxproj.filters new file mode 100644 index 0000000..e18f22f --- /dev/null +++ b/speaker/speaker.vcxproj.filters @@ -0,0 +1,51 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + ヘッダー ファイル + + + ヘッダー ファイル + + + ヘッダー ファイル + + + ヘッダー ファイル + + + ヘッダー ファイル + + + ヘッダー ファイル + + + + + ソース ファイル + + + ソース ファイル + + + ソース ファイル + + + \ No newline at end of file diff --git a/speaker/speaker.vcxproj.user b/speaker/speaker.vcxproj.user new file mode 100644 index 0000000..ace9a86 --- /dev/null +++ b/speaker/speaker.vcxproj.user @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/speaker/speaker_define.h b/speaker/speaker_define.h new file mode 100644 index 0000000..48d9b31 --- /dev/null +++ b/speaker/speaker_define.h @@ -0,0 +1,22 @@ +#pragma once + +namespace speaker{ + + typedef char Char; + typedef wchar_t WChar; + +#ifdef _UNICODE + + typedef WChar TChar; + +#else + + typedef Char TChar; + +#endif + + + typedef Char *Char_P; + typedef WChar *WChar_P; + typedef TChar *TChar_P; +} \ No newline at end of file diff --git a/speaker/speaker_include.h b/speaker/speaker_include.h new file mode 100644 index 0000000..0636735 --- /dev/null +++ b/speaker/speaker_include.h @@ -0,0 +1,8 @@ +#pragma once + +#include + +#include "speaker_define.h" + +#include "open_jtalk_core.h" +#include "mei_normal.h" \ No newline at end of file diff --git a/speaker/stdafx.cpp b/speaker/stdafx.cpp new file mode 100644 index 0000000..c511a01 --- /dev/null +++ b/speaker/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : •W€ƒCƒ“ƒNƒ‹[ƒh speaker.pch ‚Ì‚Ý‚ð +// ŠÜ‚Þƒ\[ƒX ƒtƒ@ƒCƒ‹‚́AƒvƒŠƒRƒ“ƒpƒCƒ‹Ï‚݃wƒbƒ_[‚É‚È‚è‚Ü‚·B +// stdafx.obj ‚ɂ̓vƒŠƒRƒ“ƒpƒCƒ‹Ï‚ÝŒ^î•ñ‚ªŠÜ‚Ü‚ê‚Ü‚·B + +#include "stdafx.h" + +// TODO: ‚±‚̃tƒ@ƒCƒ‹‚Å‚Í‚È‚­ASTDAFX.H ‚Å•K—v‚È +// ’ljÁƒwƒbƒ_[‚ðŽQÆ‚µ‚Ä‚­‚¾‚³‚¢B diff --git a/speaker/stdafx.h b/speaker/stdafx.h new file mode 100644 index 0000000..d7efdb3 --- /dev/null +++ b/speaker/stdafx.h @@ -0,0 +1,16 @@ +// stdafx.h : •W€‚̃VƒXƒeƒ€ ƒCƒ“ƒNƒ‹[ƒh ƒtƒ@ƒCƒ‹‚̃Cƒ“ƒNƒ‹[ƒh ƒtƒ@ƒCƒ‹A‚Ü‚½‚Í +// ŽQÆ‰ñ”‚ª‘½‚­A‚©‚‚ ‚Ü‚è•ÏX‚³‚ê‚È‚¢AƒvƒƒWƒFƒNƒgê—p‚̃Cƒ“ƒNƒ‹[ƒh ƒtƒ@ƒCƒ‹ +// ‚ð‹Lq‚µ‚Ü‚·B +// + +#pragma once + +#include "targetver.h" + +#define WIN32_LEAN_AND_MEAN // Windows ƒwƒbƒ_[‚©‚çŽg—p‚³‚ê‚Ä‚¢‚È‚¢•”•ª‚ðœŠO‚µ‚Ü‚·B + + + +// TODO: ƒvƒƒOƒ‰ƒ€‚É•K—v‚ȒljÁƒwƒbƒ_[‚ð‚±‚±‚ÅŽQÆ‚µ‚Ä‚­‚¾‚³‚¢B +#include +#include diff --git a/speaker/targetver.h b/speaker/targetver.h new file mode 100644 index 0000000..10b7ccd --- /dev/null +++ b/speaker/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// SDKDDKVer.h ‚ðƒCƒ“ƒNƒ‹[ƒh‚·‚é‚ƁA—˜—p‚Å‚«‚éÅ‚àãˆÊ‚Ì Windows ƒvƒ‰ƒbƒgƒtƒH[ƒ€‚ª’è‹`‚³‚ê‚Ü‚·B + +// ˆÈ‘O‚Ì Windows ƒvƒ‰ƒbƒgƒtƒH[ƒ€—p‚ɃAƒvƒŠƒP[ƒVƒ‡ƒ“‚ðƒrƒ‹ƒh‚·‚éê‡‚́AWinSDKVer.h ‚ðƒCƒ“ƒNƒ‹[ƒh‚µA +// SDKDDKVer.h ‚ðƒCƒ“ƒNƒ‹[ƒh‚·‚é‘O‚ɁAƒTƒ|[ƒg‘ΏۂƂ·‚éƒvƒ‰ƒbƒgƒtƒH[ƒ€‚ðŽ¦‚·‚悤‚É _WIN32_WINNT ƒ}ƒNƒ‚ðÝ’肵‚Ü‚·B + +#include