From 8b2008be917ef7a03ffba184414ec2392854a0a8 Mon Sep 17 00:00:00 2001 From: aiueo-1234 <130837816+aiueo-1234@users.noreply.github.com> Date: Thu, 2 May 2024 14:27:36 +0900 Subject: [PATCH 1/2] =?UTF-8?q?#49=20style=20bert=20vit2=E5=91=A8=E3=82=8A?= =?UTF-8?q?=E3=81=AE=E7=B4=B0=E3=81=8B=E3=81=84=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KoeBook.Core/Services/ClaudeAnalyzerService.cs | 2 +- KoeBook.Core/Services/SoundGenerationSelectorService.cs | 2 +- KoeBook.Core/Services/SoundGenerationService.cs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/KoeBook.Core/Services/ClaudeAnalyzerService.cs b/KoeBook.Core/Services/ClaudeAnalyzerService.cs index f47aeaf..3d1dd8a 100644 --- a/KoeBook.Core/Services/ClaudeAnalyzerService.cs +++ b/KoeBook.Core/Services/ClaudeAnalyzerService.cs @@ -71,7 +71,7 @@ private Dictionary ExtractCharacterVoiceMapping(string response, .Select(l => { var characterId = l[1..l.IndexOf('.')]; - var voiceTypeSpan = l.AsSpan()[(l.IndexOf(':') + 2)..]; + var voiceTypeSpan = l.AsSpan()[(l.IndexOf(':') + 2)..].Trim(); // ボイス割り当てが複数あたったときに先頭のものを使う(例:群衆 AdultMan, AdultWoman) var separatorIndex = voiceTypeSpan.IndexOfAny(_searchValues); if (separatorIndex > 0) diff --git a/KoeBook.Core/Services/SoundGenerationSelectorService.cs b/KoeBook.Core/Services/SoundGenerationSelectorService.cs index 4304f87..783db0b 100644 --- a/KoeBook.Core/Services/SoundGenerationSelectorService.cs +++ b/KoeBook.Core/Services/SoundGenerationSelectorService.cs @@ -18,7 +18,7 @@ public async ValueTask InitializeAsync(CancellationToken cancellationToken) .GetFromJsonAsync>("/models/info", ExceptionType.InitializeFailed, cancellationToken) .ConfigureAwait(false); - Models = models.Select(kvp => new SoundModel(kvp.Key, kvp.Value.FirstSpk, kvp.Value.Styles)).ToArray(); + Models = models.Select(kvp => new SoundModel(kvp.Key, kvp.Value.FirstSpk.Replace(" ",""), kvp.Value.Styles)).ToArray(); } catch (EbookException e) when (e.ExceptionType == ExceptionType.UnknownStyleBertVitsRoot) { } } diff --git a/KoeBook.Core/Services/SoundGenerationService.cs b/KoeBook.Core/Services/SoundGenerationService.cs index 79a2d72..350ab6b 100644 --- a/KoeBook.Core/Services/SoundGenerationService.cs +++ b/KoeBook.Core/Services/SoundGenerationService.cs @@ -20,8 +20,8 @@ public async ValueTask GenerateLineSoundAsync(ScriptLine scriptLine, Boo var queryCollection = HttpUtility.ParseQueryString(string.Empty); queryCollection.Add("text", scriptLine.Text); queryCollection.Add("model_id", soundModel.Id); - queryCollection.Add("style", scriptLine.Style); + queryCollection.Add("style", style); return await _styleBertVitsClientService - .GetAsByteArrayAsync($"/voice/{queryCollection}", ExceptionType.SoundGenerationFailed, cancellationToken).ConfigureAwait(false); + .GetAsByteArrayAsync($"/voice?{queryCollection}", ExceptionType.SoundGenerationFailed, cancellationToken).ConfigureAwait(false); } } From 2a6c2fd96b49368e0a8fdeb4d31df23449d6f3bf Mon Sep 17 00:00:00 2001 From: aiueo-1234 <130837816+aiueo-1234@users.noreply.github.com> Date: Thu, 2 May 2024 14:32:56 +0900 Subject: [PATCH 2/2] =?UTF-8?q?#49=20=E3=83=95=E3=82=A9=E3=83=BC=E3=83=9E?= =?UTF-8?q?=E3=83=83=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KoeBook.Core/Services/SoundGenerationSelectorService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KoeBook.Core/Services/SoundGenerationSelectorService.cs b/KoeBook.Core/Services/SoundGenerationSelectorService.cs index 783db0b..dce8365 100644 --- a/KoeBook.Core/Services/SoundGenerationSelectorService.cs +++ b/KoeBook.Core/Services/SoundGenerationSelectorService.cs @@ -18,7 +18,7 @@ public async ValueTask InitializeAsync(CancellationToken cancellationToken) .GetFromJsonAsync>("/models/info", ExceptionType.InitializeFailed, cancellationToken) .ConfigureAwait(false); - Models = models.Select(kvp => new SoundModel(kvp.Key, kvp.Value.FirstSpk.Replace(" ",""), kvp.Value.Styles)).ToArray(); + Models = models.Select(kvp => new SoundModel(kvp.Key, kvp.Value.FirstSpk.Replace(" ", ""), kvp.Value.Styles)).ToArray(); } catch (EbookException e) when (e.ExceptionType == ExceptionType.UnknownStyleBertVitsRoot) { } }