Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using OpenUtau.Api;
using OpenUtau.Core.G2p;

namespace OpenUtau.Core.DiffSinger
{
[Phonemizer("DiffSinger Filipino Phonemizer", "DIFFS FIL", language: "FIL", author: "julieraptor")]
public class DiffSingerFilipinoPhonemizer : DiffSingerG2pPhonemizer
{
protected override string GetDictionaryName()=>"dsdict-fil.yaml";
public override string GetLangCode()=>"fil";
protected override IG2p LoadBaseG2p() => new FilipinoG2p();
protected override string[] GetBaseG2pVowels() => new string[] {
"a", "e", "i", "o", "u"
};

protected override string[] GetBaseG2pConsonants() => new string[] {
"q", "b", "d", "dy", "f", "g", "H", "hh", "j", "k", "l",
"m", "n", "ng", "ny", "p", "dx", "s", "sy", "t", "th",
"ch", "v", "w", "z"
};
}
}
10 changes: 10 additions & 0 deletions OpenUtau.Core/G2p/Data/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions OpenUtau.Core/G2p/Data/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@
<data name="g2p-es" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>g2p-es.zip;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="g2p-fil" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>g2p-fil.zip;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="g2p-fr" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>g2p-fr.zip;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
Expand Down
Binary file added OpenUtau.Core/G2p/Data/g2p-fil.zip
Binary file not shown.
48 changes: 48 additions & 0 deletions OpenUtau.Core/G2p/FilipinoG2p.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.ML.OnnxRuntime;
using OpenUtau.Api;

namespace OpenUtau.Core.G2p {
public class FilipinoG2p : G2pPack {
private static readonly string[] graphemes = new string[] {
"", "", "", "", "\'", "-", "a", "b", "c", "d", "e", "f", "g",
"h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t",
"u", "v", "w", "x", "y", "z", "ñ"
};

private static readonly string[] phonemes = new string[] {
"", "", "", "", "a", "b", "d", "dx", "dy", "e", "f", "g", "h", "hh", "i",
"j", "k", "l", "m", "n", "ng", "ny", "o", "p", "q", "s",
"sy", "t", "th", "ts", "u", "v", "w", "z"
};

private static object lockObj = new object();
private static Dictionary<string, int> graphemeIndexes;
private static IG2p dict;
private static InferenceSession session;
private static Dictionary<string, string[]> predCache = new Dictionary<string, string[]>();

public FilipinoG2p() {
lock (lockObj) {
if (graphemeIndexes == null) {
graphemeIndexes = graphemes
.Skip(4)
.Select((g, i) => Tuple.Create(g, i))
.ToDictionary(t => t.Item1, t => t.Item2 + 4);
var tuple = LoadPack(Data.Resources.g2p_fil,
s => s.ToLowerInvariant(),
s => RemoveTailDigits(s.ToLowerInvariant()));
dict = tuple.Item1;
session = tuple.Item2;
}
}
GraphemeIndexes = graphemeIndexes;
Phonemes = phonemes;
Dict = dict;
Session = session;
PredCache = predCache;
}
}
}
4 changes: 4 additions & 0 deletions OpenUtau.Core/Util/LyricsHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public Type GetPreferred() {
typeof(JyutpingLyricsHelper),
typeof(ArpabetG2pLyricsHelper),
typeof(ArpabetPlusG2pLyricsHelper),
typeof(FilipinoG2pLyricsHelper),
typeof(FrenchG2pLyricsHelper),
typeof(FrenchMillefeuilleG2pLyricsHelper),
typeof(GermanG2pLyricsHelper),
Expand Down Expand Up @@ -93,6 +94,9 @@ public class ArpabetPlusG2pLyricsHelper : G2pLyricsHelper {
public ArpabetPlusG2pLyricsHelper() : base(new ArpabetPlusG2p()) { }
}

public class FilipinoG2pLyricsHelper : G2pLyricsHelper {
public FilipinoG2pLyricsHelper() : base(new FilipinoG2p()) { }
}
public class FrenchG2pLyricsHelper : G2pLyricsHelper {
public FrenchG2pLyricsHelper() : base(new FrenchG2p()) { }
}
Expand Down
1 change: 1 addition & 0 deletions OpenUtau/ViewModels/PhoneticAssistantViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public G2pOption(Type klass) {
new G2pOption(typeof(RussianG2p)),
new G2pOption(typeof(SpanishG2p)),
new G2pOption(typeof(KoreanG2p)),
new G2pOption(typeof(FilipinoG2p)),
};

private Api.G2pPack? g2p;
Expand Down