Aida-chiyo-Talk-app

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit c4dc6f1211ba412906bca438621b1f42bb6b1cdf
parent 0dfe4fbc2a16399270537bdc63fe7096c129763a
Author: Minerva-Juppiter <ryouturn@gmail.com>
Date:   Sat, 19 Aug 2023 03:25:30 +0900


Diffstat:
MMainController.cs | 14+++++++++-----
MProgram.cs | 4++--
MVoiceVox.cs | 25+++++++++++++++++++++++--
Atest.cs | 17+++++++++++++++++
4 files changed, 51 insertions(+), 9 deletions(-)

diff --git a/MainController.cs b/MainController.cs @@ -16,16 +16,20 @@ namespace Aida_chiyo_Talk_app //wakeup Console.WriteLine("we are waking up..."); - //Process.Start(VOICEVOX.exe); + VoiceVox voiceVox = new VoiceVox(); + voiceVox.VoiceVoxOnChecker(); Console.WriteLine("We have woke up."); - Console.WriteLine("Input someting you like."); - //VoicevoxUtility.EnumerateSpeakers().ToString(); + //Let's talk + /* + test test = new test(); + test.tester(); - Talkcon(); + */ + await Talkcon(); } public async Task Talkcon() @@ -49,7 +53,7 @@ namespace Aida_chiyo_Talk_app input = inputs.InputConsole(); } */ - + } } } diff --git a/Program.cs b/Program.cs @@ -5,4 +5,4 @@ MainController mainController = new MainController(); // mainController.MainCon(); //await mainController.MainCon(); -mainController.Talkcon();- \ No newline at end of file +await mainController.MainCon();+ \ No newline at end of file diff --git a/VoiceVox.cs b/VoiceVox.cs @@ -1,6 +1,7 @@ using Microsoft.Scripting.Hosting.Shell; using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Media; using System.Net.Http.Headers; @@ -8,6 +9,7 @@ using System.Text; using System.Text.Json; using System.Text.Json.Serialization; using System.Threading.Tasks; +using System.Xml.Serialization; namespace Aida_chiyo_Talk_app { @@ -20,7 +22,7 @@ namespace Aida_chiyo_Talk_app using (var httpClient = new HttpClient()) { string query; - int speaker = 1; + int speaker = 10; string text = input; // 音声クエリを生成 @@ -38,7 +40,7 @@ namespace Aida_chiyo_Talk_app } // 音声クエリから音声合成 - using (var request = new HttpRequestMessage(new HttpMethod("POST"), "http://localhost:50021/synthesis?speaker=1&enable_interrogative_upspeak=true")) + using (var request = new HttpRequestMessage(new HttpMethod("POST"), "http://localhost:50021/synthesis?speaker=10&enable_interrogative_upspeak=true")) { request.Headers.TryAddWithoutValidation("accept", "audio/wav"); @@ -71,6 +73,22 @@ namespace Aida_chiyo_Talk_app [JsonPropertyName("id")] public int Id { get; set; } + + public void VoiceVoxOnChecker() + { + if (Process.GetProcessesByName("VOICEVOX").Length > 0) + { + Console.WriteLine("voicevox was woked up"); + } + else + { + Console.WriteLine("Pleace wokeup voicevox!!"); + while(Process.GetProcessesByName("VOICEVOX").Length == 0) + { + + } + } + } } public class SupportedFeatures @@ -95,6 +113,7 @@ namespace Aida_chiyo_Talk_app [JsonPropertyName("version")] public string Version { get; set; } + } public static class VoicevoxUtility @@ -128,5 +147,7 @@ namespace Aida_chiyo_Talk_app var response = await httpClient.SendAsync(requestMessage); return await response.Content.ReadAsStringAsync(); } + + } } diff --git a/test.cs b/test.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Aida_chiyo_Talk_app +{ + internal class test + { + public void tester() + { + + } + } +}