From 16417744aadff97239ec026e1139a2c085e4b25f Mon Sep 17 00:00:00 2001 From: ray45422 Date: Mon, 18 Jul 2022 19:09:10 +0900 Subject: [PATCH 01/17] =?UTF-8?q?=E9=9F=B3=E5=A3=B0=E3=82=92=E3=83=95?= =?UTF-8?q?=E3=82=A1=E3=82=A4=E3=83=AB=E3=81=A8=E3=81=97=E3=81=A6=E6=9B=B8?= =?UTF-8?q?=E3=81=8D=E5=87=BA=E3=81=99=E3=83=A1=E3=82=BD=E3=83=83=E3=83=89?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CeVIOとVOICEBOX以外は未実装 --- src/Speech/Controller/AIVOICEController.cs | 18 ++++ src/Speech/Controller/CeVIO64Controller.cs | 23 +++++ src/Speech/Controller/CeVIOAIController.cs | 18 ++++ src/Speech/Controller/CeVIOController.cs | 23 +++++ src/Speech/Controller/ISpeechController.cs | 12 +++ .../Controller/OtomachiUnaTalkController.cs | 18 ++++ src/Speech/Controller/SAPI5Controller.cs | 18 ++++ src/Speech/Controller/VOICEVOXController.cs | 84 +++++++++++-------- src/Speech/Controller/Voiceroid2Controller.cs | 18 ++++ .../Controller/Voiceroid64Controller.cs | 18 ++++ .../Controller/VoiceroidPlusController.cs | 18 ++++ 11 files changed, 235 insertions(+), 33 deletions(-) diff --git a/src/Speech/Controller/AIVOICEController.cs b/src/Speech/Controller/AIVOICEController.cs index 9579055..2722f46 100644 --- a/src/Speech/Controller/AIVOICEController.cs +++ b/src/Speech/Controller/AIVOICEController.cs @@ -300,6 +300,24 @@ public float GetPitchRange() return GetMaster().PitchRange; } + /// + /// 音声合成エンジンに設定済みのテキストを音声ファイルとして書き出します + /// + /// 出力された音声 + public Stream Export() + { + throw new NotImplementedException(); + } + /// + /// 文字列を音声ファイルとして書き出します + /// + /// 再生する文字列 + /// 出力された音声 + public Stream Export(string text) + { + throw new NotImplementedException(); + } + #region IDisposable Support private bool disposedValue = false; diff --git a/src/Speech/Controller/CeVIO64Controller.cs b/src/Speech/Controller/CeVIO64Controller.cs index 2dab7ee..a4fd0b6 100644 --- a/src/Speech/Controller/CeVIO64Controller.cs +++ b/src/Speech/Controller/CeVIO64Controller.cs @@ -258,6 +258,29 @@ public uint GetVoiceQuality() return _talker.Alpha; } + /// + /// 音声合成エンジンに設定済みのテキストを音声ファイルとして書き出します + /// + /// 出力された音声 + public Stream Export() + { + throw new NotSupportedException(); + } + /// + /// 文字列を音声ファイルとして書き出します + /// + /// 再生する文字列 + /// 出力された音声 + public Stream Export(string text) + { + string tempFile = Path.GetTempFileName(); + if (_talker.OutputWaveToFile(text, tempFile)) + { + return File.OpenRead(tempFile); + } + return null; + } + #region IDisposable Support private bool disposedValue = false; diff --git a/src/Speech/Controller/CeVIOAIController.cs b/src/Speech/Controller/CeVIOAIController.cs index 7fadbe5..15e1ae5 100644 --- a/src/Speech/Controller/CeVIOAIController.cs +++ b/src/Speech/Controller/CeVIOAIController.cs @@ -259,6 +259,24 @@ public uint GetVoiceQuality() return _talker.Alpha; } + /// + /// 音声合成エンジンに設定済みのテキストを音声ファイルとして書き出します + /// + /// 出力された音声 + public Stream Export() + { + throw new NotImplementedException(); + } + /// + /// 文字列を音声ファイルとして書き出します + /// + /// 再生する文字列 + /// 出力された音声 + public Stream Export(string text) + { + throw new NotImplementedException(); + } + #region IDisposable Support private bool disposedValue = false; diff --git a/src/Speech/Controller/CeVIOController.cs b/src/Speech/Controller/CeVIOController.cs index 5a3465f..67058fa 100644 --- a/src/Speech/Controller/CeVIOController.cs +++ b/src/Speech/Controller/CeVIOController.cs @@ -258,6 +258,29 @@ public uint GetVoiceQuality() return _talker.Alpha; } + /// + /// 音声合成エンジンに設定済みのテキストを音声ファイルとして書き出します + /// + /// 出力された音声 + public Stream Export() + { + throw new NotSupportedException(); + } + /// + /// 文字列を音声ファイルとして書き出します + /// + /// 再生する文字列 + /// 出力された音声 + public Stream Export(string text) + { + string tempFile = Path.GetTempFileName(); + if (_talker.OutputWaveToFile(text, tempFile)) + { + return File.OpenRead(tempFile); + } + return null; + } + #region IDisposable Support private bool disposedValue = false; diff --git a/src/Speech/Controller/ISpeechController.cs b/src/Speech/Controller/ISpeechController.cs index 16f09f3..ebcf632 100644 --- a/src/Speech/Controller/ISpeechController.cs +++ b/src/Speech/Controller/ISpeechController.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using System.IO; namespace Speech { @@ -76,6 +77,17 @@ public interface ISpeechController /// /// 起動していれば true bool IsActive(); + /// + /// 音声合成エンジンに設定済みのテキストを音声ファイルとして書き出します + /// + /// 出力された音声 + Stream Export(); + /// + /// 文字列を音声ファイルとして書き出します + /// + /// 再生する文字列 + /// 出力された音声 + Stream Export(string text); } } diff --git a/src/Speech/Controller/OtomachiUnaTalkController.cs b/src/Speech/Controller/OtomachiUnaTalkController.cs index c00611e..c2728dd 100644 --- a/src/Speech/Controller/OtomachiUnaTalkController.cs +++ b/src/Speech/Controller/OtomachiUnaTalkController.cs @@ -254,6 +254,24 @@ private void RestoreMinimizedWindow() } } + /// + /// 音声合成エンジンに設定済みのテキストを音声ファイルとして書き出します + /// + /// 出力された音声 + public Stream Export() + { + throw new NotImplementedException(); + } + /// + /// 文字列を音声ファイルとして書き出します + /// + /// 再生する文字列 + /// 出力された音声 + public Stream Export(string text) + { + throw new NotImplementedException(); + } + #region IDisposable Support private bool disposedValue = false; diff --git a/src/Speech/Controller/SAPI5Controller.cs b/src/Speech/Controller/SAPI5Controller.cs index 131e909..72c64c1 100644 --- a/src/Speech/Controller/SAPI5Controller.cs +++ b/src/Speech/Controller/SAPI5Controller.cs @@ -176,6 +176,24 @@ public float GetPitchRange() return 1f; } + /// + /// 音声合成エンジンに設定済みのテキストを音声ファイルとして書き出します + /// + /// 出力された音声 + public Stream Export() + { + throw new NotImplementedException(); + } + /// + /// 文字列を音声ファイルとして書き出します + /// + /// 再生する文字列 + /// 出力された音声 + public Stream Export(string text) + { + throw new NotImplementedException(); + } + #region IDisposable Support private bool disposedValue = false; diff --git a/src/Speech/Controller/VOICEVOXController.cs b/src/Speech/Controller/VOICEVOXController.cs index 7822649..fa72228 100644 --- a/src/Speech/Controller/VOICEVOXController.cs +++ b/src/Speech/Controller/VOICEVOXController.cs @@ -100,43 +100,23 @@ private string ReplaceParam(string str, string key, float value) public void Play(string text) { string tempFile = Path.GetTempFileName(); - - var content = new StringContent("", Encoding.UTF8, @"application/json"); - var encodeText = Uri.EscapeDataString(text); - - int talkerNo = _enumerator.Names[_libraryName]; - - string queryData = ""; - using (var client = new HttpClient()) + try { - try - { - var response = client.PostAsync($"{_baseUrl}/audio_query?text={encodeText}&speaker={talkerNo}", content).GetAwaiter().GetResult(); - if (response.StatusCode != HttpStatusCode.OK) { return; } - queryData = response.Content.ReadAsStringAsync().GetAwaiter().GetResult(); - - // 音量等のパラメータを反映させる - queryData = UpdateParam(queryData); - - content = new StringContent(queryData, Encoding.UTF8, @"application/json"); - response = client.PostAsync($"{_baseUrl}/synthesis?speaker={talkerNo}", content).GetAwaiter().GetResult(); - if (response.StatusCode != HttpStatusCode.OK) { return; } + var soundData = Export(text); - var soundData = response.Content.ReadAsStreamAsync().GetAwaiter().GetResult(); - - using (var fileStream = new FileStream(tempFile, FileMode.Create, FileAccess.Write, FileShare.None)) - { - soundData.CopyTo(fileStream); - - } - - SoundPlayer sp = new SoundPlayer(); - sp.Play(tempFile); - } - finally + using (var fileStream = new FileStream(tempFile, FileMode.Create, FileAccess.Write, FileShare.None)) { - OnFinished(); + soundData.CopyTo(fileStream); + } + + SoundPlayer sp = new SoundPlayer(); + sp.Play(tempFile); + File.Delete(tempFile); + } + finally + { + OnFinished(); } } @@ -219,6 +199,44 @@ public float GetPitchRange() { return Intonation; } + /// + /// このメソッドは無効です。発話する文字列を指定してください。 + /// + public Stream Export() + { + throw new NotSupportedException("このメソッドは無効です。発話する文字列を指定してください。"); + } + + /// + /// 文字列を音声ファイルとして書き出します + /// + /// 再生する文字列 + /// 出力された音声 + public Stream Export(string text) + { + var content = new StringContent("", Encoding.UTF8, @"application/json"); + var encodeText = Uri.EscapeDataString(text); + + int talkerNo = _enumerator.Names[_libraryName]; + + string queryData = ""; + using (var client = new HttpClient()) + { + var response = client.PostAsync($"{_baseUrl}/audio_query?text={encodeText}&speaker={talkerNo}", content).GetAwaiter().GetResult(); + if (response.StatusCode != HttpStatusCode.OK) { return null; } + queryData = response.Content.ReadAsStringAsync().GetAwaiter().GetResult(); + + // 音量等のパラメータを反映させる + queryData = UpdateParam(queryData); + + content = new StringContent(queryData, Encoding.UTF8, @"application/json"); + response = client.PostAsync($"{_baseUrl}/synthesis?speaker={talkerNo}", content).GetAwaiter().GetResult(); + if (response.StatusCode != HttpStatusCode.OK) { return null; } + + return response.Content.ReadAsStreamAsync().GetAwaiter().GetResult(); + } + } + #region IDisposable Support diff --git a/src/Speech/Controller/Voiceroid2Controller.cs b/src/Speech/Controller/Voiceroid2Controller.cs index 992f3dd..e1ce010 100644 --- a/src/Speech/Controller/Voiceroid2Controller.cs +++ b/src/Speech/Controller/Voiceroid2Controller.cs @@ -297,6 +297,24 @@ private float GetEffect(EffectType t) return Convert.ToSingle(textbox.Text); } + /// + /// 音声合成エンジンに設定済みのテキストを音声ファイルとして書き出します + /// + /// 出力された音声 + public Stream Export() + { + throw new NotImplementedException(); + } + /// + /// 文字列を音声ファイルとして書き出します + /// + /// 再生する文字列 + /// 出力された音声 + public Stream Export(string text) + { + throw new NotImplementedException(); + } + #region IDisposable Support private bool disposedValue = false; diff --git a/src/Speech/Controller/Voiceroid64Controller.cs b/src/Speech/Controller/Voiceroid64Controller.cs index 0b3e2be..8c0c94f 100644 --- a/src/Speech/Controller/Voiceroid64Controller.cs +++ b/src/Speech/Controller/Voiceroid64Controller.cs @@ -295,6 +295,24 @@ private float GetEffect(EffectType t) return Convert.ToSingle(textbox.Text); } + /// + /// 音声合成エンジンに設定済みのテキストを音声ファイルとして書き出します + /// + /// 出力された音声 + public Stream Export() + { + throw new NotImplementedException(); + } + /// + /// 文字列を音声ファイルとして書き出します + /// + /// 再生する文字列 + /// 出力された音声 + public Stream Export(string text) + { + throw new NotImplementedException(); + } + #region IDisposable Support private bool disposedValue = false; diff --git a/src/Speech/Controller/VoiceroidPlusController.cs b/src/Speech/Controller/VoiceroidPlusController.cs index 722b65d..1036476 100644 --- a/src/Speech/Controller/VoiceroidPlusController.cs +++ b/src/Speech/Controller/VoiceroidPlusController.cs @@ -262,6 +262,24 @@ protected void RestoreMinimizedWindow() } } + /// + /// 音声合成エンジンに設定済みのテキストを音声ファイルとして書き出します + /// + /// 出力された音声 + public Stream Export() + { + throw new NotImplementedException(); + } + /// + /// 文字列を音声ファイルとして書き出します + /// + /// 再生する文字列 + /// 出力された音声 + public Stream Export(string text) + { + throw new NotImplementedException(); + } + #region IDisposable Support private bool disposedValue = false; From e1beca7a07af8c96eb38e35ed8cd917ae20186ca Mon Sep 17 00:00:00 2001 From: ray45422 Date: Sun, 7 Aug 2022 23:35:40 +0900 Subject: [PATCH 02/17] =?UTF-8?q?nuget=E3=83=91=E3=83=83=E3=82=B1=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E8=BF=BD=E5=8A=A0=E3=83=BB=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Codeer.Friendly.Windows.NativeStandardControlsの追加と関連パッケージの更新 --- src/Speech/Speech.csproj | 48 ++++++++++++++++++++++++-------------- src/Speech/app.config | 10 +++++++- src/Speech/packages.config | 9 +++---- 3 files changed, 44 insertions(+), 23 deletions(-) diff --git a/src/Speech/Speech.csproj b/src/Speech/Speech.csproj index 694273f..4d462f6 100644 --- a/src/Speech/Speech.csproj +++ b/src/Speech/Speech.csproj @@ -56,37 +56,49 @@ ..\packages\Codeer.Friendly.2.6.1\lib\net40\Codeer.Friendly.Dynamic.dll - - ..\packages\Codeer.Friendly.Windows.2.15.0\lib\net20\Codeer.Friendly.Windows.dll + + ..\packages\Codeer.Friendly.Windows.2.16.0\lib\net20\Codeer.Friendly.Windows.dll - - ..\packages\Codeer.Friendly.Windows.Grasp.2.12.0\lib\net35\Codeer.Friendly.Windows.Grasp.2.0.dll + + ..\packages\Codeer.Friendly.Windows.Grasp.2.14.1\lib\net35\Codeer.Friendly.Windows.Grasp.2.0.dll - - ..\packages\Codeer.Friendly.Windows.Grasp.2.12.0\lib\net35\Codeer.Friendly.Windows.Grasp.3.5.dll + + ..\packages\Codeer.Friendly.Windows.Grasp.2.14.1\lib\net35\Codeer.Friendly.Windows.Grasp.3.5.dll - - ..\packages\Codeer.TestAssistant.GeneratorToolKit.3.10.0\lib\net20\Codeer.TestAssistant.GeneratorToolKit.dll + + ..\packages\Codeer.Friendly.Windows.NativeStandardControls.2.16.9\lib\net40\Codeer.Friendly.Windows.NativeStandardControls.dll + + + ..\packages\Codeer.Friendly.Windows.NativeStandardControls.2.16.9\lib\net40\Codeer.Friendly.Windows.NativeStandardControls.4.0.dll + + + ..\packages\Codeer.Friendly.Windows.NativeStandardControls.2.16.9\lib\net40\Codeer.Friendly.Windows.NativeStandardControls.Generator.dll + + + ..\packages\Codeer.TestAssistant.GeneratorToolKit.3.13.0\lib\net40\Codeer.TestAssistant.GeneratorToolKit.dll + + + ..\packages\Codeer.TestAssistant.GeneratorToolKit.3.13.0\lib\net40\Codeer.TestAssistant.GeneratorToolKit.4.0.dll ..\packages\NAudio.1.8.4\lib\net35\NAudio.dll - - ..\packages\RM.Friendly.WPFStandardControls.1.46.1\lib\net40\RM.Friendly.WPFStandardControls.3.0.dll + + ..\packages\RM.Friendly.WPFStandardControls.1.59.0\lib\net40\RM.Friendly.WPFStandardControls.3.0.dll - - ..\packages\RM.Friendly.WPFStandardControls.1.46.1\lib\net40\RM.Friendly.WPFStandardControls.3.0.Generator.dll + + ..\packages\RM.Friendly.WPFStandardControls.1.59.0\lib\net40\RM.Friendly.WPFStandardControls.3.0.Generator.dll - - ..\packages\RM.Friendly.WPFStandardControls.1.46.1\lib\net40\RM.Friendly.WPFStandardControls.3.5.dll + + ..\packages\RM.Friendly.WPFStandardControls.1.59.0\lib\net40\RM.Friendly.WPFStandardControls.3.5.dll - - ..\packages\RM.Friendly.WPFStandardControls.1.46.1\lib\net40\RM.Friendly.WPFStandardControls.4.0.dll + + ..\packages\RM.Friendly.WPFStandardControls.1.59.0\lib\net40\RM.Friendly.WPFStandardControls.4.0.dll - - ..\packages\RM.Friendly.WPFStandardControls.1.46.1\lib\net40\RM.Friendly.WPFStandardControls.4.0.Generator.dll + + ..\packages\RM.Friendly.WPFStandardControls.1.59.0\lib\net40\RM.Friendly.WPFStandardControls.4.0.Generator.dll diff --git a/src/Speech/app.config b/src/Speech/app.config index 3c048ae..92d2591 100644 --- a/src/Speech/app.config +++ b/src/Speech/app.config @@ -8,12 +8,20 @@ - + + + + + + + + + \ No newline at end of file diff --git a/src/Speech/packages.config b/src/Speech/packages.config index 42ddcee..1bcef8f 100644 --- a/src/Speech/packages.config +++ b/src/Speech/packages.config @@ -1,9 +1,10 @@  - - - + + + + - + \ No newline at end of file From 4168803ae04bd22e6cbbf8f6965b4933f26cef27 Mon Sep 17 00:00:00 2001 From: ray45422 Date: Sun, 7 Aug 2022 23:38:29 +0900 Subject: [PATCH 03/17] =?UTF-8?q?Export=E3=83=A1=E3=82=BD=E3=83=83?= =?UTF-8?q?=E3=83=89=E3=81=AE=E6=88=BB=E3=82=8A=E5=80=A4=E3=82=92=E5=B0=82?= =?UTF-8?q?=E7=94=A8=E3=81=AE=E3=82=B9=E3=83=88=E3=83=AA=E3=83=BC=E3=83=A0?= =?UTF-8?q?=E5=9E=8B=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Speech/Controller/AIVOICEController.cs | 4 +- src/Speech/Controller/CeVIO64Controller.cs | 6 +- src/Speech/Controller/CeVIOAIController.cs | 4 +- src/Speech/Controller/CeVIOController.cs | 6 +- src/Speech/Controller/ISpeechController.cs | 4 +- .../Controller/OtomachiUnaTalkController.cs | 4 +- src/Speech/Controller/SAPI5Controller.cs | 4 +- src/Speech/Controller/VOICEVOXController.cs | 6 +- src/Speech/Controller/Voiceroid2Controller.cs | 4 +- .../Controller/Voiceroid64Controller.cs | 4 +- .../Controller/VoiceroidPlusController.cs | 4 +- src/Speech/SoundStream.cs | 78 +++++++++++++++++++ src/Speech/Speech.csproj | 1 + 13 files changed, 104 insertions(+), 25 deletions(-) create mode 100644 src/Speech/SoundStream.cs diff --git a/src/Speech/Controller/AIVOICEController.cs b/src/Speech/Controller/AIVOICEController.cs index 2722f46..6bfe3e5 100644 --- a/src/Speech/Controller/AIVOICEController.cs +++ b/src/Speech/Controller/AIVOICEController.cs @@ -304,7 +304,7 @@ public float GetPitchRange() /// 音声合成エンジンに設定済みのテキストを音声ファイルとして書き出します /// /// 出力された音声 - public Stream Export() + public SoundStream Export() { throw new NotImplementedException(); } @@ -313,7 +313,7 @@ public Stream Export() /// /// 再生する文字列 /// 出力された音声 - public Stream Export(string text) + public SoundStream Export(string text) { throw new NotImplementedException(); } diff --git a/src/Speech/Controller/CeVIO64Controller.cs b/src/Speech/Controller/CeVIO64Controller.cs index a4fd0b6..8693b3a 100644 --- a/src/Speech/Controller/CeVIO64Controller.cs +++ b/src/Speech/Controller/CeVIO64Controller.cs @@ -262,7 +262,7 @@ public uint GetVoiceQuality() /// 音声合成エンジンに設定済みのテキストを音声ファイルとして書き出します /// /// 出力された音声 - public Stream Export() + public SoundStream Export() { throw new NotSupportedException(); } @@ -271,12 +271,12 @@ public Stream Export() /// /// 再生する文字列 /// 出力された音声 - public Stream Export(string text) + public SoundStream Export(string text) { string tempFile = Path.GetTempFileName(); if (_talker.OutputWaveToFile(text, tempFile)) { - return File.OpenRead(tempFile); + return SoundStream.Open(tempFile); } return null; } diff --git a/src/Speech/Controller/CeVIOAIController.cs b/src/Speech/Controller/CeVIOAIController.cs index 15e1ae5..df958c8 100644 --- a/src/Speech/Controller/CeVIOAIController.cs +++ b/src/Speech/Controller/CeVIOAIController.cs @@ -263,7 +263,7 @@ public uint GetVoiceQuality() /// 音声合成エンジンに設定済みのテキストを音声ファイルとして書き出します /// /// 出力された音声 - public Stream Export() + public SoundStream Export() { throw new NotImplementedException(); } @@ -272,7 +272,7 @@ public Stream Export() /// /// 再生する文字列 /// 出力された音声 - public Stream Export(string text) + public SoundStream Export(string text) { throw new NotImplementedException(); } diff --git a/src/Speech/Controller/CeVIOController.cs b/src/Speech/Controller/CeVIOController.cs index 67058fa..f14443a 100644 --- a/src/Speech/Controller/CeVIOController.cs +++ b/src/Speech/Controller/CeVIOController.cs @@ -262,7 +262,7 @@ public uint GetVoiceQuality() /// 音声合成エンジンに設定済みのテキストを音声ファイルとして書き出します /// /// 出力された音声 - public Stream Export() + public SoundStream Export() { throw new NotSupportedException(); } @@ -271,12 +271,12 @@ public Stream Export() /// /// 再生する文字列 /// 出力された音声 - public Stream Export(string text) + public SoundStream Export(string text) { string tempFile = Path.GetTempFileName(); if (_talker.OutputWaveToFile(text, tempFile)) { - return File.OpenRead(tempFile); + return SoundStream.Open(tempFile); } return null; } diff --git a/src/Speech/Controller/ISpeechController.cs b/src/Speech/Controller/ISpeechController.cs index ebcf632..6d1b529 100644 --- a/src/Speech/Controller/ISpeechController.cs +++ b/src/Speech/Controller/ISpeechController.cs @@ -81,13 +81,13 @@ public interface ISpeechController /// 音声合成エンジンに設定済みのテキストを音声ファイルとして書き出します /// /// 出力された音声 - Stream Export(); + SoundStream Export(); /// /// 文字列を音声ファイルとして書き出します /// /// 再生する文字列 /// 出力された音声 - Stream Export(string text); + SoundStream Export(string text); } } diff --git a/src/Speech/Controller/OtomachiUnaTalkController.cs b/src/Speech/Controller/OtomachiUnaTalkController.cs index c2728dd..228c733 100644 --- a/src/Speech/Controller/OtomachiUnaTalkController.cs +++ b/src/Speech/Controller/OtomachiUnaTalkController.cs @@ -258,7 +258,7 @@ private void RestoreMinimizedWindow() /// 音声合成エンジンに設定済みのテキストを音声ファイルとして書き出します /// /// 出力された音声 - public Stream Export() + public SoundStream Export() { throw new NotImplementedException(); } @@ -267,7 +267,7 @@ public Stream Export() /// /// 再生する文字列 /// 出力された音声 - public Stream Export(string text) + public SoundStream Export(string text) { throw new NotImplementedException(); } diff --git a/src/Speech/Controller/SAPI5Controller.cs b/src/Speech/Controller/SAPI5Controller.cs index 72c64c1..ebcf1de 100644 --- a/src/Speech/Controller/SAPI5Controller.cs +++ b/src/Speech/Controller/SAPI5Controller.cs @@ -180,7 +180,7 @@ public float GetPitchRange() /// 音声合成エンジンに設定済みのテキストを音声ファイルとして書き出します /// /// 出力された音声 - public Stream Export() + public SoundStream Export() { throw new NotImplementedException(); } @@ -189,7 +189,7 @@ public Stream Export() /// /// 再生する文字列 /// 出力された音声 - public Stream Export(string text) + public SoundStream Export(string text) { throw new NotImplementedException(); } diff --git a/src/Speech/Controller/VOICEVOXController.cs b/src/Speech/Controller/VOICEVOXController.cs index fa72228..daef3dc 100644 --- a/src/Speech/Controller/VOICEVOXController.cs +++ b/src/Speech/Controller/VOICEVOXController.cs @@ -202,7 +202,7 @@ public float GetPitchRange() /// /// このメソッドは無効です。発話する文字列を指定してください。 /// - public Stream Export() + public SoundStream Export() { throw new NotSupportedException("このメソッドは無効です。発話する文字列を指定してください。"); } @@ -212,7 +212,7 @@ public Stream Export() /// /// 再生する文字列 /// 出力された音声 - public Stream Export(string text) + public SoundStream Export(string text) { var content = new StringContent("", Encoding.UTF8, @"application/json"); var encodeText = Uri.EscapeDataString(text); @@ -233,7 +233,7 @@ public Stream Export(string text) response = client.PostAsync($"{_baseUrl}/synthesis?speaker={talkerNo}", content).GetAwaiter().GetResult(); if (response.StatusCode != HttpStatusCode.OK) { return null; } - return response.Content.ReadAsStreamAsync().GetAwaiter().GetResult(); + return new SoundStream(response.Content.ReadAsStreamAsync().GetAwaiter().GetResult()); } } diff --git a/src/Speech/Controller/Voiceroid2Controller.cs b/src/Speech/Controller/Voiceroid2Controller.cs index e1ce010..b4d6934 100644 --- a/src/Speech/Controller/Voiceroid2Controller.cs +++ b/src/Speech/Controller/Voiceroid2Controller.cs @@ -301,7 +301,7 @@ private float GetEffect(EffectType t) /// 音声合成エンジンに設定済みのテキストを音声ファイルとして書き出します /// /// 出力された音声 - public Stream Export() + public SoundStream Export() { throw new NotImplementedException(); } @@ -310,7 +310,7 @@ public Stream Export() /// /// 再生する文字列 /// 出力された音声 - public Stream Export(string text) + public SoundStream Export(string text) { throw new NotImplementedException(); } diff --git a/src/Speech/Controller/Voiceroid64Controller.cs b/src/Speech/Controller/Voiceroid64Controller.cs index 8c0c94f..646dc21 100644 --- a/src/Speech/Controller/Voiceroid64Controller.cs +++ b/src/Speech/Controller/Voiceroid64Controller.cs @@ -299,7 +299,7 @@ private float GetEffect(EffectType t) /// 音声合成エンジンに設定済みのテキストを音声ファイルとして書き出します /// /// 出力された音声 - public Stream Export() + public SoundStream Export() { throw new NotImplementedException(); } @@ -308,7 +308,7 @@ public Stream Export() /// /// 再生する文字列 /// 出力された音声 - public Stream Export(string text) + public SoundStream Export(string text) { throw new NotImplementedException(); } diff --git a/src/Speech/Controller/VoiceroidPlusController.cs b/src/Speech/Controller/VoiceroidPlusController.cs index 1036476..43d9783 100644 --- a/src/Speech/Controller/VoiceroidPlusController.cs +++ b/src/Speech/Controller/VoiceroidPlusController.cs @@ -266,7 +266,7 @@ protected void RestoreMinimizedWindow() /// 音声合成エンジンに設定済みのテキストを音声ファイルとして書き出します /// /// 出力された音声 - public Stream Export() + public SoundStream Export() { throw new NotImplementedException(); } @@ -275,7 +275,7 @@ public Stream Export() /// /// 再生する文字列 /// 出力された音声 - public Stream Export(string text) + public SoundStream Export(string text) { throw new NotImplementedException(); } diff --git a/src/Speech/SoundStream.cs b/src/Speech/SoundStream.cs new file mode 100644 index 0000000..39e487b --- /dev/null +++ b/src/Speech/SoundStream.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.IO; + +namespace Speech +{ + public class SoundStream : Stream, IDisposable + { + /// + /// ファイルパスを指定してインスタンスを初期化します + /// + /// ファイルパス + /// Close時にファイルを削除するか指定します + public static SoundStream Open(string path, bool deleteOnClose = true) + { + var fo = FileOptions.SequentialScan; + if(deleteOnClose) + { + fo |= FileOptions.DeleteOnClose; + } + var fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.None, 524288, fo); + return new SoundStream(fs); + } + + /// + /// 元となるStreamを指定してインスタンスを初期化します + /// + /// 元となるStreamインスタンス + public SoundStream(Stream stream) + { + this.BaseStream = stream; + } + public Stream BaseStream { get; private set; } + + public override bool CanRead => BaseStream.CanRead; + + public override bool CanSeek => BaseStream.CanSeek; + + public override bool CanWrite => BaseStream.CanWrite; + + public override long Length => BaseStream.Length; + + public override long Position { get => BaseStream.Position; set => BaseStream.Position = value; } + + public override void Flush() + { + BaseStream.Flush(); + } + + public override int Read(byte[] buffer, int offset, int count) + { + return BaseStream.Read(buffer, offset, count); + } + + public override long Seek(long offset, SeekOrigin origin) + { + return BaseStream.Seek(offset, origin); + } + + public override void SetLength(long value) + { + BaseStream.SetLength(value); + } + + public override void Write(byte[] buffer, int offset, int count) + { + BaseStream.Write(buffer, offset, count); + } + + public new void Dispose() + { + BaseStream?.Dispose(); + } + } +} diff --git a/src/Speech/Speech.csproj b/src/Speech/Speech.csproj index 4d462f6..59c9704 100644 --- a/src/Speech/Speech.csproj +++ b/src/Speech/Speech.csproj @@ -140,6 +140,7 @@ + From 18e4de32929349497096f1c11b16a0fe2877470b Mon Sep 17 00:00:00 2001 From: ray45422 Date: Fri, 19 Aug 2022 22:26:54 +0900 Subject: [PATCH 04/17] =?UTF-8?q?VOICEROID2=E3=81=AE=E5=AE=9F=E8=A3=85?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Speech/Controller/Voiceroid2Controller.cs | 234 +++++++++++++++++- src/Speech/SaveFileDialog.cs | 55 ++++ src/Speech/Speech.csproj | 1 + 3 files changed, 285 insertions(+), 5 deletions(-) create mode 100644 src/Speech/SaveFileDialog.cs diff --git a/src/Speech/Controller/Voiceroid2Controller.cs b/src/Speech/Controller/Voiceroid2Controller.cs index b4d6934..1527c7f 100644 --- a/src/Speech/Controller/Voiceroid2Controller.cs +++ b/src/Speech/Controller/Voiceroid2Controller.cs @@ -1,6 +1,7 @@ using Codeer.Friendly; using Codeer.Friendly.Windows; using Codeer.Friendly.Windows.Grasp; +using Codeer.Friendly.Windows.NativeStandardControls; using RM.Friendly.WPFStandardControls; using System; using System.Collections.Generic; @@ -107,6 +108,14 @@ private void timer_Elapsed(object sender, EventArgs e) } } + private bool CheckPlaying() + { + WPFButtonBase playButton = new WPFButtonBase(_root.IdentifyFromLogicalTreeIndex(0, 4, 3, 5, 3, 0, 3, 0)); + var d = playButton.LogicalTree(); + System.Windows.Visibility v = (System.Windows.Visibility)(d[2])["Visibility"]().Core; + return !System.Windows.Visibility.Visible.Equals(v); + } + private void StopSpeech() { _timer.Stop(); @@ -179,12 +188,11 @@ public void Activate() /// 再生する文字列 public void Play(string text) { - SetText(text); + SetTextAndPlay(text); } - internal virtual void SetText(string text) + internal virtual void SetTextAndPlay(string text) { - text = text.Trim() == "" ? "." : text; - string t = _libraryName + _promptString + text; + string t = AssembleText(text); if (_queue.Count == 0) { WPFTextBox textbox = new WPFTextBox(_root.IdentifyFromLogicalTreeIndex(0, 4, 3, 5, 3, 0, 2)); @@ -196,6 +204,17 @@ internal virtual void SetText(string text) _queue.Enqueue(t); } } + internal virtual void SetText(string text) + { + string t = AssembleText(text); + WPFTextBox textbox = new WPFTextBox(_root.IdentifyFromLogicalTreeIndex(0, 4, 3, 5, 3, 0, 2)); + textbox.EmulateChangeText(t); + } + internal virtual string AssembleText(string text) + { + text = text.Trim() == "" ? "." : text; + return _libraryName + _promptString + text; + } /// /// VOICEROID2 に入力された文字列を再生します @@ -305,6 +324,93 @@ public SoundStream Export() { throw new NotImplementedException(); } + + /// + /// ファイル分割設定 + /// + enum ExportSplitSetting + { + /// + /// 一つのファイルに書き出す + /// + OneFile, + /// + /// 1文毎に区切って複数のファイルに書き出す + /// + Sentence, + /// + /// 指定された文字列で区切って複数のファイルに書き出す + /// + Delimiter + } + + /// + /// 音声保存設定を保持するクラス + /// + class ExportSettings + { + /// + /// ファイル分割設定 + /// + public ExportSplitSetting SplitSetting { get; set; } = ExportSplitSetting.OneFile; + /// + /// 区切り文字列 + /// + public string SplitString { get; set; } = "/"; + /// + /// 開始ポーズ(ミリ秒) + /// + public long PauseStart { get; set; } = 0; + /// + /// 終了ポーズ(ミリ秒) + /// + public long PauseEnd { get; set; } = 800; + /// + /// テキストファイルを音声ファイルと一緒に保存する + /// + public bool SaveWithText { get; set; } = false; + /// + /// 音声保存時に毎回設定を表示する + /// + public bool ShowSettings { get; set; } = true; + public override string ToString() + { + var sb = new StringBuilder(); + + sb.Append(nameof(SplitSetting)); + sb.Append(":"); + sb.Append(SplitSetting); + sb.Append(", "); + + sb.Append(nameof(SplitString)); + sb.Append(":"); + sb.Append(SplitString); + sb.Append(", "); + + sb.Append(nameof(PauseStart)); + sb.Append(":"); + sb.Append(PauseStart); + sb.Append(", "); + + sb.Append(nameof(PauseEnd)); + sb.Append(":"); + sb.Append(PauseEnd); + sb.Append(", "); + + sb.Append(nameof(SaveWithText)); + sb.Append(":"); + sb.Append(SaveWithText); + sb.Append(", "); + + sb.Append(nameof(ShowSettings)); + sb.Append(":"); + sb.Append(ShowSettings); + sb.Append(", "); + + return sb.ToString(); + } + } + /// /// 文字列を音声ファイルとして書き出します /// @@ -312,7 +418,125 @@ public SoundStream Export() /// 出力された音声 public SoundStream Export(string text) { - throw new NotImplementedException(); + void Settings(WindowControl win, bool isSet, ExportSettings exsettings) + { + var export1File = new WPFToggleButton(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 6, 1, 3, 4)); + var exportSentence = new WPFToggleButton(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 6, 1, 3, 5)); + var exportSplit = new WPFToggleButton(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 6, 1, 3, 6)); + var splitString = new WPFTextBox(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 6, 1, 3, 7, 1)); + var pauseStart = new WPFTextBox(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 7, 1, 9, 0, 4)); + var pauseEnd = new WPFTextBox(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 7, 1, 12, 0, 4)); + var saveWithText = new WPFToggleButton(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 9, 1, 2)); + var showSettings = new WPFToggleButton(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 10)); + if (isSet) + { + switch (exsettings.SplitSetting) + { + case ExportSplitSetting.OneFile: + export1File.EmulateCheck(true); + break; + case ExportSplitSetting.Sentence: + exportSentence.EmulateCheck(true); + break; + case ExportSplitSetting.Delimiter: + exportSplit.EmulateCheck(true); + break; + } + splitString.EmulateChangeText(exsettings.SplitString); + pauseStart.EmulateChangeText(exsettings.PauseStart.ToString()); + pauseEnd.EmulateChangeText(exsettings.PauseEnd.ToString()); + saveWithText.EmulateCheck(exsettings.SaveWithText); + showSettings.EmulateCheck(exsettings.ShowSettings); + return; + } + if (export1File.IsChecked.GetValueOrDefault(true)) + { + exsettings.SplitSetting = ExportSplitSetting.OneFile; + } + if (exportSentence.IsChecked.GetValueOrDefault(false)) + { + exsettings.SplitSetting = ExportSplitSetting.Sentence; + } + if (exportSplit.IsChecked.GetValueOrDefault(false)) + { + exsettings.SplitSetting = ExportSplitSetting.Delimiter; + } + exsettings.SplitString = splitString.Text; + exsettings.PauseStart = long.Parse(pauseStart.Text); + exsettings.PauseEnd = long.Parse(pauseEnd.Text); + exsettings.SaveWithText = saveWithText.IsChecked.GetValueOrDefault(false); + exsettings.ShowSettings = showSettings.IsChecked.GetValueOrDefault(true); + } + if (CheckPlaying()) + { + // 再生中だと音声保存メニューを開けない + throw new InvalidOperationException("再生中のため処理できません"); + } + + var top = _app.FromZTop(); + if (top.TypeFullName != "AI.Talk.Editor.MainWindow") + { + // TODO: 復帰処理を書く + throw new InvalidOperationException("何らかのウィンドウが開かれているため処理できません"); + } + SetText(text); + + var saveSoundMenu = new WPFMenuItem(_root.IdentifyFromLogicalTreeIndex(0, 3, 0, 7)); + var saveWaveAsync = new Async(); + saveSoundMenu.EmulateClick(saveWaveAsync); + + var saveWaveWindow = _root.WaitForNextModal(); + SaveFileDialog saveFileDialog = null; + Async okAsync = null; + if (saveWaveWindow.TypeFullName == "AI.Talk.Editor.SaveWaveWindow") + { + ExportSettings settings = new ExportSettings(); + Settings(saveWaveWindow, false, settings); + settings.SplitSetting = ExportSplitSetting.OneFile; + settings.SaveWithText = false; + Settings(saveWaveWindow, true, settings); + + var okButton = new WPFButtonBase(saveWaveWindow.IdentifyFromLogicalTreeIndex(0, 1, 0)); + okAsync = new Async(); + okButton.EmulateClick(okAsync); + + saveFileDialog = new SaveFileDialog(saveWaveWindow.WaitForNextModal()); + } + else + { + // 設定の「音声保存時に毎回設定を表示する」の場合は設定画面が出ない + // 設定を変更できないのであとの処理でエラーになる可能性がある + Console.Error.WriteLine("「音声保存時に毎回設定を表示する」にチェックが入っていないためエラーが発生する可能性があります"); + saveFileDialog = new SaveFileDialog(saveWaveWindow); + } + + var filePath = Path.Combine(Path.GetTempPath(), $"{this.GetType().Name}_{(uint)text.GetHashCode()}.wav"); + if (File.Exists(filePath)) + { + File.Delete(filePath); + } + saveFileDialog.Save(filePath); + + while (true) + { + var dialog = _app.FromZTop(); + var name = dialog.GetWindowText(); + if (dialog.TypeFullName == "AI.Talk.Editor.ProgressWindow") + { + Thread.Sleep(50); + continue; + } + var button = dialog.GetFromWindowClass("Button"); + foreach (var b in button) + { + var nb = new NativeButton(b); + nb.EmulateClick(); + } + break; + } + okAsync?.WaitForCompletion(); + saveWaveAsync.WaitForCompletion(); + return SoundStream.Open(filePath); } #region IDisposable Support diff --git a/src/Speech/SaveFileDialog.cs b/src/Speech/SaveFileDialog.cs new file mode 100644 index 0000000..6ad6ec6 --- /dev/null +++ b/src/Speech/SaveFileDialog.cs @@ -0,0 +1,55 @@ +using Codeer.Friendly.Windows.Grasp; +using Codeer.Friendly.Windows.NativeStandardControls; + +namespace Speech +{ + /// + /// 名前を付けて保存ダイアログをラップします + /// + internal class SaveFileDialog + { + /// + /// このクラスでラップしているWindowControlインスタンスを取得します + /// + public WindowControl Window { get; private set; } + + /// + /// ファイル保存ダイアログを指定して初期化します + /// + /// 名前を付けて保存ダイアログのインスタンス + public SaveFileDialog(WindowControl dialog) + { + Window = dialog; + } + + /// + /// ダイアログのファイル名を設定します + /// + /// 保存先パス + public void SetFilePath(string path) + { + var combobox = Window.GetFromWindowClass("ComboBox"); + var textbox = new NativeEdit(combobox[combobox.Length - 1]); // 一番最後に取得できたものをファイルパス指定とする + textbox.EmulateChangeText(path); + } + + /// + /// 保存ボタンを押します + /// + public void Save() + { + var save = new NativeButton(Window.IdentifyFromWindowText("保存(&S)")); // TODO: 日本語環境でしか動かない + save.EmulateClick(); + } + + /// + /// ファイル名を設定して保存ボタンを押します + /// + /// 保存先パス + public void Save(string path) + { + SetFilePath(path); + Save(); + } + } +} diff --git a/src/Speech/Speech.csproj b/src/Speech/Speech.csproj index 59c9704..2165b46 100644 --- a/src/Speech/Speech.csproj +++ b/src/Speech/Speech.csproj @@ -116,6 +116,7 @@ + From f4ffb370676a8f643a9da1aa194b2ca503e35ca7 Mon Sep 17 00:00:00 2001 From: ray45422 Date: Sun, 21 Aug 2022 14:59:34 +0900 Subject: [PATCH 05/17] =?UTF-8?q?SpeechWebServer=20=E3=81=AB=E9=9F=B3?= =?UTF-8?q?=E5=A3=B0=E5=87=BA=E5=8A=9B=E6=A9=9F=E8=83=BD=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit パラメータに "export=true" を追加することで音声ファイルを取得できるようにした --- src/SpeechWebServer/Program.cs | 38 ++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/SpeechWebServer/Program.cs b/src/SpeechWebServer/Program.cs index 106e7fa..925f116 100644 --- a/src/SpeechWebServer/Program.cs +++ b/src/SpeechWebServer/Program.cs @@ -158,7 +158,31 @@ static void Main(string[] args) whisper = true; } + bool export = false; + if (queryString["export"] != null) + { + bool.TryParse(queryString["export"], out export); + } + Console.WriteLine("=> " + context.Request.RemoteEndPoint.Address); + if (export) + { + try + { + using (var result = ExportMode(voiceName, engineName, voiceText, location, ep)) + { + response.StatusCode = 200; + response.ContentType = "audio/wav"; + result.CopyTo(response.OutputStream); + } + } + catch (Exception ex) + { + response.StatusCode = 500; + throw new Exception("Error", ex); + } + continue; + } response.StatusCode = 200; response.ContentType = "text/plain; charset=utf-8"; @@ -235,6 +259,20 @@ private static ISpeechController ActivateInstance(string libraryName, string eng return engine; } + private static Stream ExportMode(string libraryName, string engineName, string text, string location, EngineParameters ep) + { + var engine = ActivateInstance(libraryName, engineName, text, location, ep); + if (engine == null) + { + return null; + } + engine.Finished += (s, a) => + { + engine.Dispose(); + }; + return engine.Export(text); + } + private static void OneShotPlayMode(string libraryName, string engineName, string text, string location, EngineParameters ep) { var engine = ActivateInstance(libraryName, engineName, text, location, ep); From 12c5fc974e638247956f7a4c1eb5a521875db3ab Mon Sep 17 00:00:00 2001 From: ray45422 Date: Sun, 21 Aug 2022 16:22:16 +0900 Subject: [PATCH 06/17] =?UTF-8?q?VOICEROID=E3=81=AE=E5=AE=9F=E8=A3=85?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/VoiceroidPlusController.cs | 40 +++++++++++++++++-- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/src/Speech/Controller/VoiceroidPlusController.cs b/src/Speech/Controller/VoiceroidPlusController.cs index 43d9783..8556caf 100644 --- a/src/Speech/Controller/VoiceroidPlusController.cs +++ b/src/Speech/Controller/VoiceroidPlusController.cs @@ -9,6 +9,7 @@ using System.Linq; using System.Runtime.InteropServices; using System.Text; +using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; using System.Windows.Threading; @@ -120,9 +121,7 @@ public void Activate() /// 再生する文字列 public void Play(string text) { - WindowControl speechTextBox = _root.IdentifyFromZIndex(2, 0, 0, 1, 0, 1, 1); - AppVar textbox = speechTextBox.AppVar; - textbox["Text"](text); + SetText(text); Play(); } /// @@ -140,6 +139,12 @@ public virtual void Play() _timer.Start(); } } + internal virtual void SetText(string text) + { + WindowControl speechTextBox = _root.IdentifyFromZIndex(2, 0, 0, 1, 0, 1, 1); + AppVar textbox = speechTextBox.AppVar; + textbox["Text"](text); + } /// /// VOICEROID+ の再生を停止します(停止ボタンを押す) /// @@ -277,7 +282,34 @@ public SoundStream Export() /// 出力された音声 public SoundStream Export(string text) { - throw new NotImplementedException(); + SetText(text); + + WindowControl playButton = _root.IdentifyFromZIndex(2, 0, 0, 1, 0, 1, 0, 1); + AppVar button = playButton.AppVar; + string ButtonText = (string)button["Text"]().Core; + if (ButtonText.Trim() != "音声保存") + { + return null; + } + var saveTask = Task.Run(() => button["PerformClick"]()); + var saveFileDialog = new SaveFileDialog(_root.WaitForNextModal()); + + var filePathBase = Path.Combine(Path.GetTempPath(), $"{this.GetType().Name}_{(uint)text.GetHashCode()}"); + var filePath = $"{filePathBase}.wav"; + var textFilePath = $"{filePathBase}.txt"; + if (File.Exists(filePath)) + { + File.Delete(filePath); + } + if (File.Exists(textFilePath)) + { + // テキストファイルを出力する設定の場合テキストファイルが出力されるので削除する + File.Delete(textFilePath); + } + saveFileDialog.Save(filePath); + + saveTask.Wait(); + return SoundStream.Open(filePath); } #region IDisposable Support From 9c3100a2664b3973a7cd58f9d164f9e586d26730 Mon Sep 17 00:00:00 2001 From: ray45422 Date: Sun, 21 Aug 2022 16:24:13 +0900 Subject: [PATCH 07/17] =?UTF-8?q?VOICEROID2=E3=81=AE=E5=AE=9F=E8=A3=85?= =?UTF-8?q?=E3=81=AE=E6=9C=AA=E4=BD=BF=E7=94=A8=E5=A4=89=E6=95=B0=E3=82=92?= =?UTF-8?q?=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Speech/Controller/Voiceroid2Controller.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Speech/Controller/Voiceroid2Controller.cs b/src/Speech/Controller/Voiceroid2Controller.cs index 1527c7f..310e308 100644 --- a/src/Speech/Controller/Voiceroid2Controller.cs +++ b/src/Speech/Controller/Voiceroid2Controller.cs @@ -520,7 +520,6 @@ void Settings(WindowControl win, bool isSet, ExportSettings exsettings) while (true) { var dialog = _app.FromZTop(); - var name = dialog.GetWindowText(); if (dialog.TypeFullName == "AI.Talk.Editor.ProgressWindow") { Thread.Sleep(50); From 708a45e385dff4b7b0137a2a500c2a8a3f190302 Mon Sep 17 00:00:00 2001 From: ray45422 Date: Sun, 21 Aug 2022 16:29:04 +0900 Subject: [PATCH 08/17] =?UTF-8?q?=E3=83=86=E3=82=AD=E3=82=B9=E3=83=88?= =?UTF-8?q?=E3=82=92=E6=8C=87=E5=AE=9A=E3=81=97=E3=81=AA=E3=81=84Export?= =?UTF-8?q?=E3=83=A1=E3=82=BD=E3=83=83=E3=83=89=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Speech/Controller/AIVOICEController.cs | 8 -------- src/Speech/Controller/CeVIO64Controller.cs | 8 -------- src/Speech/Controller/CeVIOAIController.cs | 8 -------- src/Speech/Controller/CeVIOController.cs | 8 -------- src/Speech/Controller/ISpeechController.cs | 5 ----- src/Speech/Controller/OtomachiUnaTalkController.cs | 8 -------- src/Speech/Controller/SAPI5Controller.cs | 8 -------- src/Speech/Controller/VOICEVOXController.cs | 7 ------- src/Speech/Controller/Voiceroid2Controller.cs | 9 --------- src/Speech/Controller/Voiceroid64Controller.cs | 8 -------- src/Speech/Controller/VoiceroidPlusController.cs | 8 -------- 11 files changed, 85 deletions(-) diff --git a/src/Speech/Controller/AIVOICEController.cs b/src/Speech/Controller/AIVOICEController.cs index 6bfe3e5..8b64c85 100644 --- a/src/Speech/Controller/AIVOICEController.cs +++ b/src/Speech/Controller/AIVOICEController.cs @@ -300,14 +300,6 @@ public float GetPitchRange() return GetMaster().PitchRange; } - /// - /// 音声合成エンジンに設定済みのテキストを音声ファイルとして書き出します - /// - /// 出力された音声 - public SoundStream Export() - { - throw new NotImplementedException(); - } /// /// 文字列を音声ファイルとして書き出します /// diff --git a/src/Speech/Controller/CeVIO64Controller.cs b/src/Speech/Controller/CeVIO64Controller.cs index 8693b3a..7b6136a 100644 --- a/src/Speech/Controller/CeVIO64Controller.cs +++ b/src/Speech/Controller/CeVIO64Controller.cs @@ -258,14 +258,6 @@ public uint GetVoiceQuality() return _talker.Alpha; } - /// - /// 音声合成エンジンに設定済みのテキストを音声ファイルとして書き出します - /// - /// 出力された音声 - public SoundStream Export() - { - throw new NotSupportedException(); - } /// /// 文字列を音声ファイルとして書き出します /// diff --git a/src/Speech/Controller/CeVIOAIController.cs b/src/Speech/Controller/CeVIOAIController.cs index df958c8..c41b5d7 100644 --- a/src/Speech/Controller/CeVIOAIController.cs +++ b/src/Speech/Controller/CeVIOAIController.cs @@ -259,14 +259,6 @@ public uint GetVoiceQuality() return _talker.Alpha; } - /// - /// 音声合成エンジンに設定済みのテキストを音声ファイルとして書き出します - /// - /// 出力された音声 - public SoundStream Export() - { - throw new NotImplementedException(); - } /// /// 文字列を音声ファイルとして書き出します /// diff --git a/src/Speech/Controller/CeVIOController.cs b/src/Speech/Controller/CeVIOController.cs index f14443a..86a6dbd 100644 --- a/src/Speech/Controller/CeVIOController.cs +++ b/src/Speech/Controller/CeVIOController.cs @@ -258,14 +258,6 @@ public uint GetVoiceQuality() return _talker.Alpha; } - /// - /// 音声合成エンジンに設定済みのテキストを音声ファイルとして書き出します - /// - /// 出力された音声 - public SoundStream Export() - { - throw new NotSupportedException(); - } /// /// 文字列を音声ファイルとして書き出します /// diff --git a/src/Speech/Controller/ISpeechController.cs b/src/Speech/Controller/ISpeechController.cs index 6d1b529..a650f62 100644 --- a/src/Speech/Controller/ISpeechController.cs +++ b/src/Speech/Controller/ISpeechController.cs @@ -78,11 +78,6 @@ public interface ISpeechController /// 起動していれば true bool IsActive(); /// - /// 音声合成エンジンに設定済みのテキストを音声ファイルとして書き出します - /// - /// 出力された音声 - SoundStream Export(); - /// /// 文字列を音声ファイルとして書き出します /// /// 再生する文字列 diff --git a/src/Speech/Controller/OtomachiUnaTalkController.cs b/src/Speech/Controller/OtomachiUnaTalkController.cs index 228c733..815d3f2 100644 --- a/src/Speech/Controller/OtomachiUnaTalkController.cs +++ b/src/Speech/Controller/OtomachiUnaTalkController.cs @@ -254,14 +254,6 @@ private void RestoreMinimizedWindow() } } - /// - /// 音声合成エンジンに設定済みのテキストを音声ファイルとして書き出します - /// - /// 出力された音声 - public SoundStream Export() - { - throw new NotImplementedException(); - } /// /// 文字列を音声ファイルとして書き出します /// diff --git a/src/Speech/Controller/SAPI5Controller.cs b/src/Speech/Controller/SAPI5Controller.cs index ebcf1de..285ebf2 100644 --- a/src/Speech/Controller/SAPI5Controller.cs +++ b/src/Speech/Controller/SAPI5Controller.cs @@ -176,14 +176,6 @@ public float GetPitchRange() return 1f; } - /// - /// 音声合成エンジンに設定済みのテキストを音声ファイルとして書き出します - /// - /// 出力された音声 - public SoundStream Export() - { - throw new NotImplementedException(); - } /// /// 文字列を音声ファイルとして書き出します /// diff --git a/src/Speech/Controller/VOICEVOXController.cs b/src/Speech/Controller/VOICEVOXController.cs index daef3dc..b486d57 100644 --- a/src/Speech/Controller/VOICEVOXController.cs +++ b/src/Speech/Controller/VOICEVOXController.cs @@ -199,13 +199,6 @@ public float GetPitchRange() { return Intonation; } - /// - /// このメソッドは無効です。発話する文字列を指定してください。 - /// - public SoundStream Export() - { - throw new NotSupportedException("このメソッドは無効です。発話する文字列を指定してください。"); - } /// /// 文字列を音声ファイルとして書き出します diff --git a/src/Speech/Controller/Voiceroid2Controller.cs b/src/Speech/Controller/Voiceroid2Controller.cs index 310e308..a58dda0 100644 --- a/src/Speech/Controller/Voiceroid2Controller.cs +++ b/src/Speech/Controller/Voiceroid2Controller.cs @@ -316,15 +316,6 @@ private float GetEffect(EffectType t) return Convert.ToSingle(textbox.Text); } - /// - /// 音声合成エンジンに設定済みのテキストを音声ファイルとして書き出します - /// - /// 出力された音声 - public SoundStream Export() - { - throw new NotImplementedException(); - } - /// /// ファイル分割設定 /// diff --git a/src/Speech/Controller/Voiceroid64Controller.cs b/src/Speech/Controller/Voiceroid64Controller.cs index 646dc21..88f87b9 100644 --- a/src/Speech/Controller/Voiceroid64Controller.cs +++ b/src/Speech/Controller/Voiceroid64Controller.cs @@ -295,14 +295,6 @@ private float GetEffect(EffectType t) return Convert.ToSingle(textbox.Text); } - /// - /// 音声合成エンジンに設定済みのテキストを音声ファイルとして書き出します - /// - /// 出力された音声 - public SoundStream Export() - { - throw new NotImplementedException(); - } /// /// 文字列を音声ファイルとして書き出します /// diff --git a/src/Speech/Controller/VoiceroidPlusController.cs b/src/Speech/Controller/VoiceroidPlusController.cs index 8556caf..791227b 100644 --- a/src/Speech/Controller/VoiceroidPlusController.cs +++ b/src/Speech/Controller/VoiceroidPlusController.cs @@ -267,14 +267,6 @@ protected void RestoreMinimizedWindow() } } - /// - /// 音声合成エンジンに設定済みのテキストを音声ファイルとして書き出します - /// - /// 出力された音声 - public SoundStream Export() - { - throw new NotImplementedException(); - } /// /// 文字列を音声ファイルとして書き出します /// From 8f446bc707e32951b486a4033dec86df3bd2a70e Mon Sep 17 00:00:00 2001 From: ray45422 Date: Sun, 21 Aug 2022 17:07:48 +0900 Subject: [PATCH 09/17] =?UTF-8?q?VOICEROID2=20Editor=202.1.1.0=20=E3=81=A7?= =?UTF-8?q?=E3=81=AE=E5=A4=89=E6=9B=B4=E3=81=AB=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Speech/Controller/Voiceroid2Controller.cs | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/Speech/Controller/Voiceroid2Controller.cs b/src/Speech/Controller/Voiceroid2Controller.cs index a58dda0..acea1b2 100644 --- a/src/Speech/Controller/Voiceroid2Controller.cs +++ b/src/Speech/Controller/Voiceroid2Controller.cs @@ -411,12 +411,23 @@ public SoundStream Export(string text) { void Settings(WindowControl win, bool isSet, ExportSettings exsettings) { + Functions.WriteTreeIndex(win); var export1File = new WPFToggleButton(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 6, 1, 3, 4)); var exportSentence = new WPFToggleButton(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 6, 1, 3, 5)); var exportSplit = new WPFToggleButton(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 6, 1, 3, 6)); var splitString = new WPFTextBox(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 6, 1, 3, 7, 1)); - var pauseStart = new WPFTextBox(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 7, 1, 9, 0, 4)); - var pauseEnd = new WPFTextBox(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 7, 1, 12, 0, 4)); + WPFTextBox pauseStart = null; + WPFTextBox pauseEnd = null; + try + { + pauseStart = new WPFTextBox(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 7, 1, 9, 0, 4)); ; + pauseEnd = new WPFTextBox(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 7, 1, 12, 0, 4)); + } + catch (WindowIdentifyException e) + { + // VOICEROID2 Editor 2.1.1.0 で要素が取得できなくなった + // 取得に失敗した場合はないものとして扱う + } var saveWithText = new WPFToggleButton(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 9, 1, 2)); var showSettings = new WPFToggleButton(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 10)); if (isSet) @@ -434,8 +445,8 @@ void Settings(WindowControl win, bool isSet, ExportSettings exsettings) break; } splitString.EmulateChangeText(exsettings.SplitString); - pauseStart.EmulateChangeText(exsettings.PauseStart.ToString()); - pauseEnd.EmulateChangeText(exsettings.PauseEnd.ToString()); + pauseStart?.EmulateChangeText(exsettings.PauseStart.ToString()); + pauseEnd?.EmulateChangeText(exsettings.PauseEnd.ToString()); saveWithText.EmulateCheck(exsettings.SaveWithText); showSettings.EmulateCheck(exsettings.ShowSettings); return; @@ -453,8 +464,14 @@ void Settings(WindowControl win, bool isSet, ExportSettings exsettings) exsettings.SplitSetting = ExportSplitSetting.Delimiter; } exsettings.SplitString = splitString.Text; - exsettings.PauseStart = long.Parse(pauseStart.Text); - exsettings.PauseEnd = long.Parse(pauseEnd.Text); + if (pauseStart != null) + { + exsettings.PauseStart = long.Parse(pauseStart.Text); + } + if (pauseEnd != null) + { + exsettings.PauseEnd = long.Parse(pauseEnd.Text); + } exsettings.SaveWithText = saveWithText.IsChecked.GetValueOrDefault(false); exsettings.ShowSettings = showSettings.IsChecked.GetValueOrDefault(true); } From 115f7888088dae3020dd03a77e6219d49d882b0d Mon Sep 17 00:00:00 2001 From: ray45422 Date: Sun, 21 Aug 2022 18:10:59 +0900 Subject: [PATCH 10/17] =?UTF-8?q?VOICEROID2=2064bit=E7=89=88=E3=81=AE?= =?UTF-8?q?=E5=AE=9F=E8=A3=85=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Speech/Controller/Voiceroid2Controller.cs | 140 +++++++++--------- .../Controller/Voiceroid64Controller.cs | 97 +++++++++++- 2 files changed, 162 insertions(+), 75 deletions(-) diff --git a/src/Speech/Controller/Voiceroid2Controller.cs b/src/Speech/Controller/Voiceroid2Controller.cs index acea1b2..a3b718a 100644 --- a/src/Speech/Controller/Voiceroid2Controller.cs +++ b/src/Speech/Controller/Voiceroid2Controller.cs @@ -319,7 +319,7 @@ private float GetEffect(EffectType t) /// /// ファイル分割設定 /// - enum ExportSplitSetting + public enum ExportSplitSetting { /// /// 一つのファイルに書き出す @@ -338,7 +338,7 @@ enum ExportSplitSetting /// /// 音声保存設定を保持するクラス /// - class ExportSettings + public class ExportSettings { /// /// ファイル分割設定 @@ -402,6 +402,72 @@ public override string ToString() } } + public static void ExportSetting(WindowControl win, bool isSet, ExportSettings exsettings) + { + var export1File = new WPFToggleButton(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 6, 1, 3, 4)); + var exportSentence = new WPFToggleButton(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 6, 1, 3, 5)); + var exportSplit = new WPFToggleButton(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 6, 1, 3, 6)); + var splitString = new WPFTextBox(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 6, 1, 3, 7, 1)); + WPFTextBox pauseStart = null; + WPFTextBox pauseEnd = null; + try + { + pauseStart = new WPFTextBox(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 7, 1, 9, 0, 4)); ; + pauseEnd = new WPFTextBox(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 7, 1, 12, 0, 4)); + } + catch (WindowIdentifyException e) + { + // VOICEROID2 Editor 2.1.1.0 で要素が取得できなくなった + // 取得に失敗した場合はないものとして扱う + } + var saveWithText = new WPFToggleButton(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 9, 1, 2)); + var showSettings = new WPFToggleButton(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 10)); + if (isSet) + { + switch (exsettings.SplitSetting) + { + case ExportSplitSetting.OneFile: + export1File.EmulateCheck(true); + break; + case ExportSplitSetting.Sentence: + exportSentence.EmulateCheck(true); + break; + case ExportSplitSetting.Delimiter: + exportSplit.EmulateCheck(true); + break; + } + splitString.EmulateChangeText(exsettings.SplitString); + pauseStart?.EmulateChangeText(exsettings.PauseStart.ToString()); + pauseEnd?.EmulateChangeText(exsettings.PauseEnd.ToString()); + saveWithText.EmulateCheck(exsettings.SaveWithText); + showSettings.EmulateCheck(exsettings.ShowSettings); + return; + } + if (export1File.IsChecked.GetValueOrDefault(true)) + { + exsettings.SplitSetting = ExportSplitSetting.OneFile; + } + if (exportSentence.IsChecked.GetValueOrDefault(false)) + { + exsettings.SplitSetting = ExportSplitSetting.Sentence; + } + if (exportSplit.IsChecked.GetValueOrDefault(false)) + { + exsettings.SplitSetting = ExportSplitSetting.Delimiter; + } + exsettings.SplitString = splitString.Text; + if (pauseStart != null) + { + exsettings.PauseStart = long.Parse(pauseStart.Text); + } + if (pauseEnd != null) + { + exsettings.PauseEnd = long.Parse(pauseEnd.Text); + } + exsettings.SaveWithText = saveWithText.IsChecked.GetValueOrDefault(false); + exsettings.ShowSettings = showSettings.IsChecked.GetValueOrDefault(true); + } + /// /// 文字列を音声ファイルとして書き出します /// @@ -409,72 +475,6 @@ public override string ToString() /// 出力された音声 public SoundStream Export(string text) { - void Settings(WindowControl win, bool isSet, ExportSettings exsettings) - { - Functions.WriteTreeIndex(win); - var export1File = new WPFToggleButton(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 6, 1, 3, 4)); - var exportSentence = new WPFToggleButton(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 6, 1, 3, 5)); - var exportSplit = new WPFToggleButton(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 6, 1, 3, 6)); - var splitString = new WPFTextBox(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 6, 1, 3, 7, 1)); - WPFTextBox pauseStart = null; - WPFTextBox pauseEnd = null; - try - { - pauseStart = new WPFTextBox(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 7, 1, 9, 0, 4)); ; - pauseEnd = new WPFTextBox(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 7, 1, 12, 0, 4)); - } - catch (WindowIdentifyException e) - { - // VOICEROID2 Editor 2.1.1.0 で要素が取得できなくなった - // 取得に失敗した場合はないものとして扱う - } - var saveWithText = new WPFToggleButton(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 9, 1, 2)); - var showSettings = new WPFToggleButton(win.IdentifyFromLogicalTreeIndex(0, 0, 0, 10)); - if (isSet) - { - switch (exsettings.SplitSetting) - { - case ExportSplitSetting.OneFile: - export1File.EmulateCheck(true); - break; - case ExportSplitSetting.Sentence: - exportSentence.EmulateCheck(true); - break; - case ExportSplitSetting.Delimiter: - exportSplit.EmulateCheck(true); - break; - } - splitString.EmulateChangeText(exsettings.SplitString); - pauseStart?.EmulateChangeText(exsettings.PauseStart.ToString()); - pauseEnd?.EmulateChangeText(exsettings.PauseEnd.ToString()); - saveWithText.EmulateCheck(exsettings.SaveWithText); - showSettings.EmulateCheck(exsettings.ShowSettings); - return; - } - if (export1File.IsChecked.GetValueOrDefault(true)) - { - exsettings.SplitSetting = ExportSplitSetting.OneFile; - } - if (exportSentence.IsChecked.GetValueOrDefault(false)) - { - exsettings.SplitSetting = ExportSplitSetting.Sentence; - } - if (exportSplit.IsChecked.GetValueOrDefault(false)) - { - exsettings.SplitSetting = ExportSplitSetting.Delimiter; - } - exsettings.SplitString = splitString.Text; - if (pauseStart != null) - { - exsettings.PauseStart = long.Parse(pauseStart.Text); - } - if (pauseEnd != null) - { - exsettings.PauseEnd = long.Parse(pauseEnd.Text); - } - exsettings.SaveWithText = saveWithText.IsChecked.GetValueOrDefault(false); - exsettings.ShowSettings = showSettings.IsChecked.GetValueOrDefault(true); - } if (CheckPlaying()) { // 再生中だと音声保存メニューを開けない @@ -499,10 +499,10 @@ void Settings(WindowControl win, bool isSet, ExportSettings exsettings) if (saveWaveWindow.TypeFullName == "AI.Talk.Editor.SaveWaveWindow") { ExportSettings settings = new ExportSettings(); - Settings(saveWaveWindow, false, settings); + ExportSetting(saveWaveWindow, false, settings); settings.SplitSetting = ExportSplitSetting.OneFile; settings.SaveWithText = false; - Settings(saveWaveWindow, true, settings); + ExportSetting(saveWaveWindow, true, settings); var okButton = new WPFButtonBase(saveWaveWindow.IdentifyFromLogicalTreeIndex(0, 1, 0)); okAsync = new Async(); diff --git a/src/Speech/Controller/Voiceroid64Controller.cs b/src/Speech/Controller/Voiceroid64Controller.cs index 88f87b9..31e8c16 100644 --- a/src/Speech/Controller/Voiceroid64Controller.cs +++ b/src/Speech/Controller/Voiceroid64Controller.cs @@ -1,6 +1,7 @@ using Codeer.Friendly; using Codeer.Friendly.Windows; using Codeer.Friendly.Windows.Grasp; +using Codeer.Friendly.Windows.NativeStandardControls; using RM.Friendly.WPFStandardControls; using System; using System.Collections.Generic; @@ -104,6 +105,14 @@ private void timer_Elapsed(object sender, EventArgs e) } } + private bool CheckPlaying() + { + WPFButtonBase playButton = new WPFButtonBase(_root.IdentifyFromLogicalTreeIndex(0, 4, 3, 5, 3, 0, 3, 0)); + var d = playButton.LogicalTree(); + System.Windows.Visibility v = (System.Windows.Visibility)(d[2])["Visibility"]().Core; + return !System.Windows.Visibility.Visible.Equals(v); + } + private void StopSpeech() { _timer.Stop(); @@ -177,12 +186,11 @@ public void Activate() /// 再生する文字列 public void Play(string text) { - SetText(text); + SetTextAndPlay(text); } - internal virtual void SetText(string text) + internal virtual void SetTextAndPlay(string text) { - text = text.Trim() == "" ? "." : text; - string t = _libraryName + _promptString + text; + string t = AssembleText(text); if (_queue.Count == 0) { WPFTextBox textbox = new WPFTextBox(_root.IdentifyFromLogicalTreeIndex(0, 4, 3, 5, 3, 0, 2)); @@ -194,6 +202,17 @@ internal virtual void SetText(string text) _queue.Enqueue(t); } } + internal virtual void SetText(string text) + { + string t = AssembleText(text); + WPFTextBox textbox = new WPFTextBox(_root.IdentifyFromLogicalTreeIndex(0, 4, 3, 5, 3, 0, 2)); + textbox.EmulateChangeText(t); + } + internal virtual string AssembleText(string text) + { + text = text.Trim() == "" ? "." : text; + return _libraryName + _promptString + text; + } /// /// VOICEROID2 に入力された文字列を再生します @@ -302,7 +321,75 @@ private float GetEffect(EffectType t) /// 出力された音声 public SoundStream Export(string text) { - throw new NotImplementedException(); + if (CheckPlaying()) + { + // 再生中だと音声保存メニューを開けない + throw new InvalidOperationException("再生中のため処理できません"); + } + + var top = _app.FromZTop(); + if (top.TypeFullName != "AI.Talk.Editor.MainWindow") + { + // TODO: 復帰処理を書く + throw new InvalidOperationException("何らかのウィンドウが開かれているため処理できません"); + } + SetText(text); + + var saveSoundMenu = new WPFMenuItem(_root.IdentifyFromLogicalTreeIndex(0, 3, 0, 7)); + var saveWaveAsync = new Async(); + saveSoundMenu.EmulateClick(saveWaveAsync); + + var saveWaveWindow = _root.WaitForNextModal(); + SaveFileDialog saveFileDialog = null; + Async okAsync = null; + if (saveWaveWindow.TypeFullName == "AI.Talk.Editor.SaveWaveWindow") + { + Voiceroid2Controller.ExportSettings settings = new Voiceroid2Controller.ExportSettings(); + Voiceroid2Controller.ExportSetting(saveWaveWindow, false, settings); + settings.SplitSetting = Voiceroid2Controller.ExportSplitSetting.OneFile; + settings.SaveWithText = false; + Voiceroid2Controller.ExportSetting(saveWaveWindow, true, settings); + + var okButton = new WPFButtonBase(saveWaveWindow.IdentifyFromLogicalTreeIndex(0, 1, 0)); + okAsync = new Async(); + okButton.EmulateClick(okAsync); + + saveFileDialog = new SaveFileDialog(saveWaveWindow.WaitForNextModal()); + } + else + { + // 設定の「音声保存時に毎回設定を表示する」の場合は設定画面が出ない + // 設定を変更できないのであとの処理でエラーになる可能性がある + Console.Error.WriteLine("「音声保存時に毎回設定を表示する」にチェックが入っていないためエラーが発生する可能性があります"); + saveFileDialog = new SaveFileDialog(saveWaveWindow); + } + + var filePath = Path.Combine(Path.GetTempPath(), $"{this.GetType().Name}_{(uint)text.GetHashCode()}.wav"); + if (File.Exists(filePath)) + { + File.Delete(filePath); + } + saveFileDialog.Save(filePath); + + while (true) + { + var dialog = _app.FromZTop(); + if (dialog.TypeFullName == "AI.Talk.Editor.ProgressWindow") + { + Thread.Sleep(50); + continue; + } + var button = dialog.GetFromWindowClass("Button"); + foreach (var b in button) + { + var nb = new NativeButton(b); + nb.EmulateClick(); + } + break; + } + okAsync?.WaitForCompletion(); + saveWaveAsync.WaitForCompletion(); + return SoundStream.Open(filePath); } #region IDisposable Support From 137e93a52e6e2928207656bc3a67112b1dfff414 Mon Sep 17 00:00:00 2001 From: ray45422 Date: Sun, 21 Aug 2022 19:32:17 +0900 Subject: [PATCH 11/17] =?UTF-8?q?SAPI5=E3=81=AE=E5=AE=9F=E8=A3=85=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Speech/Controller/SAPI5Controller.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Speech/Controller/SAPI5Controller.cs b/src/Speech/Controller/SAPI5Controller.cs index 285ebf2..0fbb3ca 100644 --- a/src/Speech/Controller/SAPI5Controller.cs +++ b/src/Speech/Controller/SAPI5Controller.cs @@ -183,7 +183,12 @@ public float GetPitchRange() /// 出力された音声 public SoundStream Export(string text) { - throw new NotImplementedException(); + var ms = new MemoryStream(); + synthesizer.SetOutputToWaveStream(ms); + synthesizer.Speak(text); + synthesizer.SetOutputToDefaultAudioDevice(); + ms.Position = 0; + return new SoundStream(ms); } #region IDisposable Support From 6152e22ff9de2e51408205c46285abaaf9512560 Mon Sep 17 00:00:00 2001 From: ray45422 Date: Sun, 21 Aug 2022 21:27:41 +0900 Subject: [PATCH 12/17] =?UTF-8?q?CeVIO=20AI=E3=81=AE=E5=AE=9F=E8=A3=85?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 未所持のため未検証 --- src/Speech/Controller/CeVIOAIController.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Speech/Controller/CeVIOAIController.cs b/src/Speech/Controller/CeVIOAIController.cs index c41b5d7..865e929 100644 --- a/src/Speech/Controller/CeVIOAIController.cs +++ b/src/Speech/Controller/CeVIOAIController.cs @@ -266,7 +266,12 @@ public uint GetVoiceQuality() /// 出力された音声 public SoundStream Export(string text) { - throw new NotImplementedException(); + string tempFile = Path.GetTempFileName(); + if (_talker.OutputWaveToFile(text, tempFile)) + { + return SoundStream.Open(tempFile); + } + return null; } From 6f7c8c2f481238d041260031f3e77c1a401c59ff Mon Sep 17 00:00:00 2001 From: ray45422 Date: Sun, 21 Aug 2022 22:06:36 +0900 Subject: [PATCH 13/17] =?UTF-8?q?Stream=E3=82=92=E8=BF=94=E3=81=97?= =?UTF-8?q?=E3=81=A6=E3=81=84=E3=82=8B=E3=81=AE=E3=81=AB=E3=83=95=E3=82=A1?= =?UTF-8?q?=E3=82=A4=E3=83=AB=E3=82=92=E8=BF=94=E3=81=99=E3=81=A8=E6=9B=B8?= =?UTF-8?q?=E3=81=84=E3=81=A6=E3=81=84=E3=81=9F=E3=81=AE=E3=81=A7=E3=82=B3?= =?UTF-8?q?=E3=83=A1=E3=83=B3=E3=83=88=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Speech/Controller/AIVOICEController.cs | 5 ----- src/Speech/Controller/CeVIO64Controller.cs | 5 ----- src/Speech/Controller/CeVIOAIController.cs | 5 ----- src/Speech/Controller/CeVIOController.cs | 5 ----- src/Speech/Controller/ISpeechController.cs | 6 +++--- src/Speech/Controller/OtomachiUnaTalkController.cs | 5 ----- src/Speech/Controller/SAPI5Controller.cs | 5 ----- src/Speech/Controller/VOICEVOXController.cs | 5 ----- src/Speech/Controller/Voiceroid2Controller.cs | 5 ----- src/Speech/Controller/Voiceroid64Controller.cs | 5 ----- src/Speech/Controller/VoiceroidPlusController.cs | 5 ----- 11 files changed, 3 insertions(+), 53 deletions(-) diff --git a/src/Speech/Controller/AIVOICEController.cs b/src/Speech/Controller/AIVOICEController.cs index 8b64c85..88dca95 100644 --- a/src/Speech/Controller/AIVOICEController.cs +++ b/src/Speech/Controller/AIVOICEController.cs @@ -300,11 +300,6 @@ public float GetPitchRange() return GetMaster().PitchRange; } - /// - /// 文字列を音声ファイルとして書き出します - /// - /// 再生する文字列 - /// 出力された音声 public SoundStream Export(string text) { throw new NotImplementedException(); diff --git a/src/Speech/Controller/CeVIO64Controller.cs b/src/Speech/Controller/CeVIO64Controller.cs index 7b6136a..c0c3753 100644 --- a/src/Speech/Controller/CeVIO64Controller.cs +++ b/src/Speech/Controller/CeVIO64Controller.cs @@ -258,11 +258,6 @@ public uint GetVoiceQuality() return _talker.Alpha; } - /// - /// 文字列を音声ファイルとして書き出します - /// - /// 再生する文字列 - /// 出力された音声 public SoundStream Export(string text) { string tempFile = Path.GetTempFileName(); diff --git a/src/Speech/Controller/CeVIOAIController.cs b/src/Speech/Controller/CeVIOAIController.cs index 865e929..ebe9e52 100644 --- a/src/Speech/Controller/CeVIOAIController.cs +++ b/src/Speech/Controller/CeVIOAIController.cs @@ -259,11 +259,6 @@ public uint GetVoiceQuality() return _talker.Alpha; } - /// - /// 文字列を音声ファイルとして書き出します - /// - /// 再生する文字列 - /// 出力された音声 public SoundStream Export(string text) { string tempFile = Path.GetTempFileName(); diff --git a/src/Speech/Controller/CeVIOController.cs b/src/Speech/Controller/CeVIOController.cs index 86a6dbd..fcda2a6 100644 --- a/src/Speech/Controller/CeVIOController.cs +++ b/src/Speech/Controller/CeVIOController.cs @@ -258,11 +258,6 @@ public uint GetVoiceQuality() return _talker.Alpha; } - /// - /// 文字列を音声ファイルとして書き出します - /// - /// 再生する文字列 - /// 出力された音声 public SoundStream Export(string text) { string tempFile = Path.GetTempFileName(); diff --git a/src/Speech/Controller/ISpeechController.cs b/src/Speech/Controller/ISpeechController.cs index a650f62..d663d40 100644 --- a/src/Speech/Controller/ISpeechController.cs +++ b/src/Speech/Controller/ISpeechController.cs @@ -78,10 +78,10 @@ public interface ISpeechController /// 起動していれば true bool IsActive(); /// - /// 文字列を音声ファイルとして書き出します + /// 指定した文字列を合成した音声を取得します /// - /// 再生する文字列 - /// 出力された音声 + /// 合成する文字列 + /// 出力された音声の Stream SoundStream Export(string text); } diff --git a/src/Speech/Controller/OtomachiUnaTalkController.cs b/src/Speech/Controller/OtomachiUnaTalkController.cs index 815d3f2..67f9a97 100644 --- a/src/Speech/Controller/OtomachiUnaTalkController.cs +++ b/src/Speech/Controller/OtomachiUnaTalkController.cs @@ -254,11 +254,6 @@ private void RestoreMinimizedWindow() } } - /// - /// 文字列を音声ファイルとして書き出します - /// - /// 再生する文字列 - /// 出力された音声 public SoundStream Export(string text) { throw new NotImplementedException(); diff --git a/src/Speech/Controller/SAPI5Controller.cs b/src/Speech/Controller/SAPI5Controller.cs index 0fbb3ca..f67faf0 100644 --- a/src/Speech/Controller/SAPI5Controller.cs +++ b/src/Speech/Controller/SAPI5Controller.cs @@ -176,11 +176,6 @@ public float GetPitchRange() return 1f; } - /// - /// 文字列を音声ファイルとして書き出します - /// - /// 再生する文字列 - /// 出力された音声 public SoundStream Export(string text) { var ms = new MemoryStream(); diff --git a/src/Speech/Controller/VOICEVOXController.cs b/src/Speech/Controller/VOICEVOXController.cs index b486d57..607b75a 100644 --- a/src/Speech/Controller/VOICEVOXController.cs +++ b/src/Speech/Controller/VOICEVOXController.cs @@ -200,11 +200,6 @@ public float GetPitchRange() return Intonation; } - /// - /// 文字列を音声ファイルとして書き出します - /// - /// 再生する文字列 - /// 出力された音声 public SoundStream Export(string text) { var content = new StringContent("", Encoding.UTF8, @"application/json"); diff --git a/src/Speech/Controller/Voiceroid2Controller.cs b/src/Speech/Controller/Voiceroid2Controller.cs index a3b718a..3855b00 100644 --- a/src/Speech/Controller/Voiceroid2Controller.cs +++ b/src/Speech/Controller/Voiceroid2Controller.cs @@ -468,11 +468,6 @@ public static void ExportSetting(WindowControl win, bool isSet, ExportSettings e exsettings.ShowSettings = showSettings.IsChecked.GetValueOrDefault(true); } - /// - /// 文字列を音声ファイルとして書き出します - /// - /// 再生する文字列 - /// 出力された音声 public SoundStream Export(string text) { if (CheckPlaying()) diff --git a/src/Speech/Controller/Voiceroid64Controller.cs b/src/Speech/Controller/Voiceroid64Controller.cs index 31e8c16..77be540 100644 --- a/src/Speech/Controller/Voiceroid64Controller.cs +++ b/src/Speech/Controller/Voiceroid64Controller.cs @@ -314,11 +314,6 @@ private float GetEffect(EffectType t) return Convert.ToSingle(textbox.Text); } - /// - /// 文字列を音声ファイルとして書き出します - /// - /// 再生する文字列 - /// 出力された音声 public SoundStream Export(string text) { if (CheckPlaying()) diff --git a/src/Speech/Controller/VoiceroidPlusController.cs b/src/Speech/Controller/VoiceroidPlusController.cs index 791227b..d1b2aca 100644 --- a/src/Speech/Controller/VoiceroidPlusController.cs +++ b/src/Speech/Controller/VoiceroidPlusController.cs @@ -267,11 +267,6 @@ protected void RestoreMinimizedWindow() } } - /// - /// 文字列を音声ファイルとして書き出します - /// - /// 再生する文字列 - /// 出力された音声 public SoundStream Export(string text) { SetText(text); From eae520a12ed6c5c844dbadfe6906fb97fc2d33ee Mon Sep 17 00:00:00 2001 From: ray45422 Date: Mon, 22 Aug 2022 00:22:06 +0900 Subject: [PATCH 14/17] =?UTF-8?q?=E3=83=A1=E3=82=BD=E3=83=83=E3=83=89?= =?UTF-8?q?=E5=90=8D=E3=82=92=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Speech/Controller/AIVOICEController.cs | 2 +- src/Speech/Controller/CeVIO64Controller.cs | 2 +- src/Speech/Controller/CeVIOAIController.cs | 2 +- src/Speech/Controller/CeVIOController.cs | 2 +- src/Speech/Controller/ISpeechController.cs | 2 +- src/Speech/Controller/OtomachiUnaTalkController.cs | 2 +- src/Speech/Controller/SAPI5Controller.cs | 2 +- src/Speech/Controller/VOICEVOXController.cs | 4 ++-- src/Speech/Controller/Voiceroid2Controller.cs | 2 +- src/Speech/Controller/Voiceroid64Controller.cs | 2 +- src/Speech/Controller/VoiceroidPlusController.cs | 2 +- 11 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Speech/Controller/AIVOICEController.cs b/src/Speech/Controller/AIVOICEController.cs index 88dca95..11f54dc 100644 --- a/src/Speech/Controller/AIVOICEController.cs +++ b/src/Speech/Controller/AIVOICEController.cs @@ -300,7 +300,7 @@ public float GetPitchRange() return GetMaster().PitchRange; } - public SoundStream Export(string text) + public SoundStream ExportToStream(string text) { throw new NotImplementedException(); } diff --git a/src/Speech/Controller/CeVIO64Controller.cs b/src/Speech/Controller/CeVIO64Controller.cs index c0c3753..280d256 100644 --- a/src/Speech/Controller/CeVIO64Controller.cs +++ b/src/Speech/Controller/CeVIO64Controller.cs @@ -258,7 +258,7 @@ public uint GetVoiceQuality() return _talker.Alpha; } - public SoundStream Export(string text) + public SoundStream ExportToStream(string text) { string tempFile = Path.GetTempFileName(); if (_talker.OutputWaveToFile(text, tempFile)) diff --git a/src/Speech/Controller/CeVIOAIController.cs b/src/Speech/Controller/CeVIOAIController.cs index ebe9e52..d74f10f 100644 --- a/src/Speech/Controller/CeVIOAIController.cs +++ b/src/Speech/Controller/CeVIOAIController.cs @@ -259,7 +259,7 @@ public uint GetVoiceQuality() return _talker.Alpha; } - public SoundStream Export(string text) + public SoundStream ExportToStream(string text) { string tempFile = Path.GetTempFileName(); if (_talker.OutputWaveToFile(text, tempFile)) diff --git a/src/Speech/Controller/CeVIOController.cs b/src/Speech/Controller/CeVIOController.cs index fcda2a6..fe08e88 100644 --- a/src/Speech/Controller/CeVIOController.cs +++ b/src/Speech/Controller/CeVIOController.cs @@ -258,7 +258,7 @@ public uint GetVoiceQuality() return _talker.Alpha; } - public SoundStream Export(string text) + public SoundStream ExportToStream(string text) { string tempFile = Path.GetTempFileName(); if (_talker.OutputWaveToFile(text, tempFile)) diff --git a/src/Speech/Controller/ISpeechController.cs b/src/Speech/Controller/ISpeechController.cs index d663d40..e51e4d1 100644 --- a/src/Speech/Controller/ISpeechController.cs +++ b/src/Speech/Controller/ISpeechController.cs @@ -82,7 +82,7 @@ public interface ISpeechController /// /// 合成する文字列 /// 出力された音声の Stream - SoundStream Export(string text); + SoundStream ExportToStream(string text); } } diff --git a/src/Speech/Controller/OtomachiUnaTalkController.cs b/src/Speech/Controller/OtomachiUnaTalkController.cs index 67f9a97..4a97b63 100644 --- a/src/Speech/Controller/OtomachiUnaTalkController.cs +++ b/src/Speech/Controller/OtomachiUnaTalkController.cs @@ -254,7 +254,7 @@ private void RestoreMinimizedWindow() } } - public SoundStream Export(string text) + public SoundStream ExportToStream(string text) { throw new NotImplementedException(); } diff --git a/src/Speech/Controller/SAPI5Controller.cs b/src/Speech/Controller/SAPI5Controller.cs index f67faf0..28c87eb 100644 --- a/src/Speech/Controller/SAPI5Controller.cs +++ b/src/Speech/Controller/SAPI5Controller.cs @@ -176,7 +176,7 @@ public float GetPitchRange() return 1f; } - public SoundStream Export(string text) + public SoundStream ExportToStream(string text) { var ms = new MemoryStream(); synthesizer.SetOutputToWaveStream(ms); diff --git a/src/Speech/Controller/VOICEVOXController.cs b/src/Speech/Controller/VOICEVOXController.cs index 607b75a..bcec96b 100644 --- a/src/Speech/Controller/VOICEVOXController.cs +++ b/src/Speech/Controller/VOICEVOXController.cs @@ -102,7 +102,7 @@ public void Play(string text) string tempFile = Path.GetTempFileName(); try { - var soundData = Export(text); + var soundData = ExportToStream(text); using (var fileStream = new FileStream(tempFile, FileMode.Create, FileAccess.Write, FileShare.None)) { @@ -200,7 +200,7 @@ public float GetPitchRange() return Intonation; } - public SoundStream Export(string text) + public SoundStream ExportToStream(string text) { var content = new StringContent("", Encoding.UTF8, @"application/json"); var encodeText = Uri.EscapeDataString(text); diff --git a/src/Speech/Controller/Voiceroid2Controller.cs b/src/Speech/Controller/Voiceroid2Controller.cs index 3855b00..75d4df1 100644 --- a/src/Speech/Controller/Voiceroid2Controller.cs +++ b/src/Speech/Controller/Voiceroid2Controller.cs @@ -468,7 +468,7 @@ public static void ExportSetting(WindowControl win, bool isSet, ExportSettings e exsettings.ShowSettings = showSettings.IsChecked.GetValueOrDefault(true); } - public SoundStream Export(string text) + public SoundStream ExportToStream(string text) { if (CheckPlaying()) { diff --git a/src/Speech/Controller/Voiceroid64Controller.cs b/src/Speech/Controller/Voiceroid64Controller.cs index 77be540..88f6d61 100644 --- a/src/Speech/Controller/Voiceroid64Controller.cs +++ b/src/Speech/Controller/Voiceroid64Controller.cs @@ -314,7 +314,7 @@ private float GetEffect(EffectType t) return Convert.ToSingle(textbox.Text); } - public SoundStream Export(string text) + public SoundStream ExportToStream(string text) { if (CheckPlaying()) { diff --git a/src/Speech/Controller/VoiceroidPlusController.cs b/src/Speech/Controller/VoiceroidPlusController.cs index d1b2aca..9de7321 100644 --- a/src/Speech/Controller/VoiceroidPlusController.cs +++ b/src/Speech/Controller/VoiceroidPlusController.cs @@ -267,7 +267,7 @@ protected void RestoreMinimizedWindow() } } - public SoundStream Export(string text) + public SoundStream ExportToStream(string text) { SetText(text); From b8a0f4f50ba30d25460c410dd7753aeacb58f144 Mon Sep 17 00:00:00 2001 From: ray45422 Date: Sun, 20 Nov 2022 00:13:14 +0900 Subject: [PATCH 15/17] =?UTF-8?q?=E3=83=A1=E3=82=BD=E3=83=83=E3=83=89?= =?UTF-8?q?=E5=90=8D=E3=82=92=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit eae520a12ed6c5c844dbadfe6906fb97fc2d33ee のコミット漏れ --- src/SpeechWebServer/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SpeechWebServer/Program.cs b/src/SpeechWebServer/Program.cs index 925f116..fbf11ce 100644 --- a/src/SpeechWebServer/Program.cs +++ b/src/SpeechWebServer/Program.cs @@ -270,7 +270,7 @@ private static Stream ExportMode(string libraryName, string engineName, string t { engine.Dispose(); }; - return engine.Export(text); + return engine.ExportToStream(text); } private static void OneShotPlayMode(string libraryName, string engineName, string text, string location, EngineParameters ep) From 452288b124d65bf90d3703fb59868f9e033f8d50 Mon Sep 17 00:00:00 2001 From: ray45422 Date: Sun, 20 Nov 2022 00:31:33 +0900 Subject: [PATCH 16/17] =?UTF-8?q?A.I.VOICE=E3=81=AE=E5=AE=9F=E8=A3=85?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Speech/Controller/AIVOICEController.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Speech/Controller/AIVOICEController.cs b/src/Speech/Controller/AIVOICEController.cs index 11f54dc..2237373 100644 --- a/src/Speech/Controller/AIVOICEController.cs +++ b/src/Speech/Controller/AIVOICEController.cs @@ -302,7 +302,19 @@ public float GetPitchRange() public SoundStream ExportToStream(string text) { - throw new NotImplementedException(); + _ttsControl.Text = text; + + var filePath = Path.Combine(Path.GetTempPath(), $"{this.GetType().Name}_{(uint)text.GetHashCode()}.wav"); + if (File.Exists(filePath)) + { + File.Delete(filePath); + } + _ttsControl.SaveAudioToFile(filePath); + if(File.Exists(filePath)) + { + return SoundStream.Open(filePath); + } + return null; } #region IDisposable Support From f66093d05e15c5f19c46cf011b04275a08f4208b Mon Sep 17 00:00:00 2001 From: ray45422 Date: Sun, 20 Nov 2022 01:14:27 +0900 Subject: [PATCH 17/17] =?UTF-8?q?=E3=83=AA=E3=83=95=E3=82=A1=E3=82=AF?= =?UTF-8?q?=E3=82=BF=E3=83=AA=E3=83=B3=E3=82=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 不要なusingを削除 --- src/Speech/Controller/ISpeechController.cs | 1 - src/Speech/Controller/VoiceroidPlusController.cs | 1 - src/Speech/SoundStream.cs | 4 ---- 3 files changed, 6 deletions(-) diff --git a/src/Speech/Controller/ISpeechController.cs b/src/Speech/Controller/ISpeechController.cs index e51e4d1..8372273 100644 --- a/src/Speech/Controller/ISpeechController.cs +++ b/src/Speech/Controller/ISpeechController.cs @@ -3,7 +3,6 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -using System.IO; namespace Speech { diff --git a/src/Speech/Controller/VoiceroidPlusController.cs b/src/Speech/Controller/VoiceroidPlusController.cs index 9de7321..7c86c9d 100644 --- a/src/Speech/Controller/VoiceroidPlusController.cs +++ b/src/Speech/Controller/VoiceroidPlusController.cs @@ -9,7 +9,6 @@ using System.Linq; using System.Runtime.InteropServices; using System.Text; -using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; using System.Windows.Threading; diff --git a/src/Speech/SoundStream.cs b/src/Speech/SoundStream.cs index 39e487b..fa0989c 100644 --- a/src/Speech/SoundStream.cs +++ b/src/Speech/SoundStream.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.IO; namespace Speech