Skip to content

Commit

Permalink
Merge pull request #78 from stakira/master
Browse files Browse the repository at this point in the history
merge from official
  • Loading branch information
oxygen-dioxide authored May 19, 2024
2 parents efc9284 + b969d52 commit 4fb1528
Show file tree
Hide file tree
Showing 41 changed files with 601 additions and 744 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/pr-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@ jobs:
os:
- runs-on: windows-latest
arch: win-x64
- runs-on: macos-latest
- runs-on: macos-13
arch: osx-x64
- runs-on: ubuntu-latest
arch: linux-x64

steps:
- uses: actions/checkout@v1

- uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'

- name: restore
run: dotnet restore OpenUtau -r ${{ matrix.os.arch }}

Expand Down
3 changes: 2 additions & 1 deletion OpenUtau.Core/Api/G2pPack.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text.RegularExpressions;
using Microsoft.ML.OnnxRuntime;
Expand Down Expand Up @@ -82,7 +83,7 @@ public string[] UnpackHint(string hint, char separator = ' ') {
return Dict.UnpackHint(hint, separator);
}

protected string[] Predict(string grapheme) {
protected virtual string[] Predict(string grapheme) {
Tensor<int> src = EncodeWord(grapheme);
if (src.Length == 0 || Session == null) {
return new string[0];
Expand Down
2 changes: 1 addition & 1 deletion OpenUtau.Core/Classic/ClassicRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public Task<RenderResult> RenderExternal(RenderPhrase phrase, Progress progress,
result.samples = Wave.GetSamples(waveStream.ToSampleProvider().ToMono(1, 0));
}
} catch (Exception e) {
Log.Error(e, "Failed to render.");
Log.Error(e, $"Failed to render: failed to open {wavPath}");
}
}
if (result.samples == null) {
Expand Down
8 changes: 6 additions & 2 deletions OpenUtau.Core/Commands/Notifications.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,20 +103,24 @@ public SelectExpressionNotification(string expKey, int index, bool updateShadow)
public class SetPlayPosTickNotification : UNotification {
public readonly int playPosTick;
public readonly bool waitingRendering;
public readonly bool pause;
public override bool Silent => true;
public SetPlayPosTickNotification(int tick, bool waitingRendering = false) {
public SetPlayPosTickNotification(int tick, bool waitingRendering = false, bool pause = false) {
playPosTick = tick;
this.waitingRendering = waitingRendering;
this.pause = pause;
}
public override string ToString() => $"Set play position to tick {playPosTick}";
}

// Notification for playback manager to change play position
public class SeekPlayPosTickNotification : UNotification {
public int playPosTick;
public readonly bool pause;
public override bool Silent => true;
public SeekPlayPosTickNotification(int tick) {
public SeekPlayPosTickNotification(int tick, bool pause = false) {
playPosTick = tick;
this.pause = pause;
}
public override string ToString() => $"Seek play position to tick {playPosTick}";
}
Expand Down
2 changes: 2 additions & 0 deletions OpenUtau.Core/Commands/ProjectCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ public ConfigureExpressionsCommand(
public override string ToString() => "Configure expressions";
public override void Execute() {
project.expressions = newDescriptors.ToDictionary(descriptor => descriptor.abbr);
Format.Ustx.AddDefaultExpressions(project);
project.parts
.Where(part => part is UVoicePart)
.ToList()
Expand All @@ -175,6 +176,7 @@ public override void Execute() {
}
public override void Unexecute() {
project.expressions = oldDescriptors.ToDictionary(descriptor => descriptor.abbr);
Format.Ustx.AddDefaultExpressions(project);
project.parts
.Where(part => part is UVoicePart)
.ToList()
Expand Down
2 changes: 1 addition & 1 deletion OpenUtau.Core/DiffSinger/DiffSingerRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ float[] InvokeDiffsinger(RenderPhrase phrase, double depth, int steps, Cancellat
}
if (singer.dsConfig.mel_scale != "slaney" && singer.dsConfig.mel_scale != "htk") {
throw new Exception(
$"Mel scale must be \"slaney\" or \"htk\", but got \"{vocoder.mel_scale}\" from acoustic model");
$"Mel scale must be \"slaney\" or \"htk\", but got \"{singer.dsConfig.mel_scale}\" from acoustic model");
}
//mel specification matching checks
if(vocoder.sample_rate != singer.dsConfig.sample_rate) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using OpenUtau.Api;
using OpenUtau.Core.G2p;

namespace OpenUtau.Core.DiffSinger
{
[Phonemizer("DiffSinger Korean G2P Phonemizer", "DIFFS KO", language: "KO", author: "Cardroid6")]
public class DiffSingerKoreanG2PPhonemizer : DiffSingerG2pPhonemizer
{
protected override string GetDictionaryName() => "dsdict-ko.yaml";
protected override IG2p LoadBaseG2p() => new KoreanG2p();
protected override string[] GetBaseG2pVowels() => new string[] {
"a", "e", "eo", "eu", "i", "o", "u", "w", "y"
};

protected override string[] GetBaseG2pConsonants() => new string[] {
"K", "L", "M", "N", "NG", "P", "T", "b", "ch", "d",
"g", "h", "j", "jj", "k", "kk", "m", "n", "p", "pp",
"r", "s", "ss", "t", "tt"
};
}
}
Loading

0 comments on commit 4fb1528

Please sign in to comment.