Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EN X-SAMPA Phonemizer] Adjustment to recent SBP subbank refactor #925

Merged
merged 2 commits into from
Nov 25, 2023
Merged
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
25 changes: 5 additions & 20 deletions OpenUtau.Plugin.Builtin/EnXSampaPhonemizer.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.Design;
using System.IO;
using System.Linq;
using OpenUtau.Api;
Expand All @@ -24,8 +23,7 @@ public class EnXSampaPhonemizer : SyllableBasedPhonemizer {
private readonly string[] consonants = "b,tS,d,D,4,f,g,h,dZ,k,l,m,n,N,p,r,s,S,t,T,v,w,W,j,z,Z,t_},・,_".Split(',');
private readonly string[] affricates = "tS,dZ".Split(',');
private readonly string[] shortConsonants = "4".Split(",");
private readonly string[] longConsonants = "tS,f,dZ,k,p,s,S,t,T,t_}".Split(",");
private readonly string[] normalConsonants = "b,d,D,g,h,l,m,n,N,r,v,w,W,j,z,Z,・".Split(',');
private readonly string[] longConsonants = "tS,f,dZ,k,p,s,S,t,T,t_},t}".Split(",");
private readonly Dictionary<string, string> dictionaryReplacements = ("aa=A;ae={;ah=V;ao=O;aw=aU;ax=@;ay=aI;" +
"b=b;ch=tS;d=d;dh=D;" + "dx=4;eh=E;el=@l;em=@m;en=@n;eng=@N;er=3;ey=eI;f=f;g=g;hh=h;ih=I;iy=i;jh=dZ;k=k;l=l;m=m;n=n;ng=N;ow=oU;oy=OI;" +
"p=p;q=・;r=r;s=s;sh=S;t=t;th=T;" + "uh=U;uw=u;v=v;w=w;" + "y=j;z=z;zh=Z").Split(';')
Expand Down Expand Up @@ -642,27 +640,14 @@ protected override string ValidateAlias(string alias) {

protected override double GetTransitionBasicLengthMs(string alias = "") {
foreach (var c in longConsonants) {
if (alias.Contains(c)) {
if (!alias.StartsWith(c)) {
return base.GetTransitionBasicLengthMs() * 2.0;
}
}
}
foreach (var c in normalConsonants) {
if (!alias.Contains("_D")) {
if (alias.Contains(c)) {
if (!alias.StartsWith(c)) {
return base.GetTransitionBasicLengthMs();
}
}
if (alias.EndsWith(c)) {
return base.GetTransitionBasicLengthMs() * 2.0;
}
}

foreach (var c in shortConsonants) {
if (alias.Contains(c)) {
if (!alias.Contains(" _")) {
return base.GetTransitionBasicLengthMs() * 0.50;
}
if (alias.EndsWith(c)) {
return base.GetTransitionBasicLengthMs() * 0.5;
}
}
return base.GetTransitionBasicLengthMs();
Expand Down