Skip to content

Commit 7c5cb06

Browse files
authored
Merge pull request stakira#1087 from rokujyushi/FixAddVoicevox
Small Fix Voicevox
2 parents cd3bb62 + 3724daa commit 7c5cb06

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

OpenUtau.Core/Util/Base64.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public static void Base64ToFile(string base64str,string filePath) {
7070
File.WriteAllBytes(filePath, bytes);
7171

7272
} catch (Exception ex) {
73-
Log.Error(@"{ex}");
73+
Log.Error($"{ex}");
7474
}
7575
}
7676
}

OpenUtau.Core/Voicevox/VoicevoxClient.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ internal Tuple<string, byte[]> SendRequest(VoicevoxURL voicevoxURL) {
2424
if (!str.StartsWith("{") || !str.EndsWith("}")) {
2525
str = "{ \"json\":" + str + "}";
2626
}
27+
Log.Information($"VoicevoxResponse StatusCode :{response.Result.StatusCode}");
2728
return new Tuple<string, byte[]>(str, response.Result.Content.ReadAsByteArrayAsync().Result);
2829
}
2930
}
3031
} catch (Exception ex) {
31-
Log.Error(@"{ex}");
32+
Log.Error($"{ex}");
3233
}
3334
return new Tuple<string, byte[]>("", new byte[0]);
3435
}

OpenUtau.Core/Voicevox/VoicevoxSinger.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,12 @@ void Load() {
156156
}
157157

158158
public override bool TryGetOto(string phoneme, out UOto oto) {
159-
var parts = phoneme.Split();
160-
if (parts.All(p => phonemes.Contains(p))) {
161-
oto = UOto.OfDummy(phoneme);
162-
return true;
159+
if(phoneme != null) {
160+
var parts = phoneme.Split();
161+
if (parts.All(p => phonemes.Contains(p))) {
162+
oto = UOto.OfDummy(phoneme);
163+
return true;
164+
}
163165
}
164166
oto = null;
165167
return false;

OpenUtau.Core/Voicevox/VoicevoxUtils.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ public static VoicevoxQueryMain NoteGroupsToVoicevox(Note[][] notes, TimeAxis ti
7777
while (index < notes.Length) {
7878
string lyric = dic.Lyrictodic(notes, index);
7979
int length = (int)Math.Round(((timeAxis.TickPosToMsPos(notes[index].Sum(n => n.duration)) / 1000f) * VoicevoxUtils.fps), MidpointRounding.AwayFromZero);
80+
//Avoid synthesis without at least two frames.
81+
if (length < 2 ) {
82+
length = 2;
83+
}
8084
int? tone = null;
8185
if (!string.IsNullOrEmpty(lyric) || VoicevoxUtils.IsPau(lyric)) {
8286
if (notes[index][0].phonemeAttributes != null) {

0 commit comments

Comments
 (0)