44using System . Linq ;
55using System . Reflection . Metadata ;
66using System . Text ;
7- using NumSharp . Utilities ;
87using OpenUtau . Api ;
98using OpenUtau . Core . G2p ;
109using Serilog ;
@@ -23,7 +22,7 @@ public class ArpasingPlusPhonemizer : SyllableBasedPhonemizer {
2322 "naan" , "an" , "axn" , "aen" , "ahn" , "aon" , "on" , "awn" , "aun" , "ayn" , "ain" , "ehn" , "en" , "eyn" , "ein" , "ihn" , "iyn" , "in" , "own" , "oun" , "oyn" , "oin" , "uhn" , "uwn" , "un" ,
2423 "aang" , "ang" , "axng" , "aeng" , "ahng" , "aong" , "ong" , "awng" , "aung" , "ayng" , "aing" , "ehng" , "eng" , "eyng" , "eing" , "ihng" , "iyng" , "ing" , "owng" , "oung" , "oyng" , "oing" , "uhng" , "uwng" , "ung" ,
2524 "aam" , "am" , "axm" , "aem" , "ahm" , "aom" , "om" , "awm" , "aum" , "aym" , "aim" , "ehm" , "em" , "eym" , "eim" , "ihm" , "iym" , "im" , "owm" , "oum" , "oym" , "oim" , "uhm" , "uwm" , "um" , "oh" ,
26- "eu" , "oe" , "yw" , "yx" , "wx"
25+ "eu" , "oe" , "yw" , "yx" , "wx" , "ox" , "ex"
2726 } ;
2827 private readonly string [ ] consonants = "b,ch,d,dh,dx,f,g,hh,jh,k,l,m,n,ng,p,q,r,s,sh,t,th,v,w,y,z,zh" . Split ( ',' ) ;
2928 private readonly string [ ] affricates = "ch,jh,j" . Split ( ',' ) ;
@@ -93,9 +92,9 @@ public class ArpasingPlusPhonemizer : SyllableBasedPhonemizer {
9392 { "el" , "l" } ,
9493 } ;
9594 private readonly string [ ] ccvException = { "ch" , "dh" , "dx" , "fh" , "gh" , "hh" , "jh" , "kh" , "ph" , "ng" , "sh" , "th" , "vh" , "wh" , "zh" } ;
96- private readonly string [ ] vc_cException = { "r" , "l" } ;
95+ private readonly string [ ] vc_cAcception = { "r" , "l" } ;
9796 private readonly string [ ] RomajiException = { "a" , "e" , "i" , "o" , "u" } ;
98-
97+
9998 protected override string [ ] GetSymbols ( Note note ) {
10099 string [ ] original = base . GetSymbols ( note ) ;
101100 if ( original == null ) {
@@ -252,7 +251,8 @@ protected override List<string> ProcessSyllable(Syllable syllable) {
252251 basePhoneme = crv ;
253252 }
254253 } else {
255- { if ( HasOto ( $ "{ prevV } { v } ", syllable . vowelTone ) || HasOto ( ValidateAlias ( $ "{ prevV } { v } ") , syllable . vowelTone ) ) {
254+ {
255+ if ( HasOto ( $ "{ prevV } { v } ", syllable . vowelTone ) || HasOto ( ValidateAlias ( $ "{ prevV } { v } ") , syllable . vowelTone ) ) {
256256 basePhoneme = $ "{ prevV } { v } ";
257257 } else if ( HasOto ( v , syllable . vowelTone ) || HasOto ( ValidateAlias ( v ) , syllable . vowelTone ) ) {
258258 basePhoneme = v ;
@@ -263,11 +263,14 @@ protected override List<string> ProcessSyllable(Syllable syllable) {
263263 }
264264 }
265265 }
266+ } else if ( HasOto ( $ "{ v } ", syllable . vowelTone ) || vowels . Contains ( v ) && ! CanMakeAliasExtension ( syllable ) ) {
267+ basePhoneme = v ;
266268 } else {
267- // PREVIOUS ALIAS WILL EXTEND
269+ // PREVIOUS ALIAS WILL EXTEND as V
268270 basePhoneme = null ;
269271 }
270- // [C V] or [CV]
272+
273+ // [- CV/C V] or [- C][CV/C V]
271274 } else if ( syllable . IsStartingCVWithOneConsonant ) {
272275 var rcv = $ "- { cc [ 0 ] } { v } ";
273276 var rcv1 = $ "- { cc [ 0 ] } { v } ";
@@ -293,7 +296,7 @@ protected override List<string> ProcessSyllable(Syllable syllable) {
293296 TryAddPhoneme ( phonemes , syllable . tone , $ "- { cc [ 0 ] } ", ValidateAlias ( $ "- { cc [ 0 ] } ") ) ;
294297 break ;
295298 }
296- // [CC V] or [C C] + [C V]
299+ // [CCV/ CC V] or [C C] + [CV/ C V]
297300 } else if ( syllable . IsStartingCVWithMoreThanOneConsonant ) {
298301 // TRY [- CCV]/[- CC V] or [- CC][CCV]/[CC V] or [- C][C C][C V]/[CV]
299302 var rccv = $ "- { string . Join ( "" , cc ) } { v } ";
@@ -319,9 +322,8 @@ protected override List<string> ProcessSyllable(Syllable syllable) {
319322 if ( ! ccvException . Contains ( cc [ 0 ] ) ) {
320323 if ( TryAddPhoneme ( phonemes , syllable . tone , $ "- { string . Join ( "" , cc . Take ( i ) ) } ", ValidateAlias ( $ "- { string . Join ( "" , cc . Take ( i ) ) } ") ) ) {
321324 firstC = i - 1 ;
322- break ;
323325 }
324- }
326+ } break ;
325327 }
326328 // [- C]
327329 if ( phonemes . Count == 0 ) {
@@ -375,9 +377,9 @@ protected override List<string> ProcessSyllable(Syllable syllable) {
375377 firstC = 1 ;
376378 break ;
377379 }
378- } else if ( vc_cException . Contains ( cc [ 0 ] ) && HasOto ( vc_c , syllable . tone ) || HasOto ( ValidateAlias ( vc_c ) , syllable . tone ) ) {
379- phonemes . Add ( vc_c ) ;
380- firstC = 1 ;
380+ // } else if (vc_cAcception .Contains(cc[0]) && syllable.PreviousWordCc.Length >= 2 && HasOto(vc_c, syllable.tone) && !HasOto($"{prevV}{string.Join(" ", cc.Take(1))}" , syllable.tone) || HasOto(ValidateAlias(vc_c), syllable.tone)) {
381+ // phonemes.Add(vc_c);
382+ // firstC = 1;
381383 break ;
382384 } else if ( HasOto ( vc , syllable . tone ) || HasOto ( ValidateAlias ( vc ) , syllable . tone ) ) {
383385 phonemes . Add ( vc ) ;
@@ -412,8 +414,8 @@ protected override List<string> ProcessSyllable(Syllable syllable) {
412414 cc1 = ValidateAlias ( cc1 ) ;
413415 }
414416 // CC V on multiple consonants ex [s tr ao] (only if the word starts with a CC)
415- if ( syllable . CurrentWordCc . Length >= 2 && ! ccvException . Contains ( cc [ 0 ] ) ) {
416- if ( HasOto ( ccv , syllable . vowelTone ) || HasOto ( ValidateAlias ( ccv ) , syllable . vowelTone ) ) {
417+ if ( syllable . CurrentWordCc . Length >= 2 ) {
418+ if ( HasOto ( ccv , syllable . vowelTone ) || HasOto ( ValidateAlias ( ccv ) , syllable . vowelTone ) && ! ccvException . Contains ( cc [ 0 ] ) ) {
417419 basePhoneme = ccv ;
418420 lastC = i ;
419421 break ;
@@ -452,8 +454,8 @@ protected override List<string> ProcessSyllable(Syllable syllable) {
452454 cc1 = ValidateAlias ( cc1 ) ;
453455 }
454456 // CC V on multiple consonants ex [s tr ao] (only if the word starts with a CC)
455- if ( syllable . CurrentWordCc . Length >= 2 && ! ccvException . Contains ( cc [ 0 ] ) ) {
456- if ( HasOto ( ccv , syllable . vowelTone ) || HasOto ( ValidateAlias ( ccv ) , syllable . vowelTone ) ) {
457+ if ( syllable . CurrentWordCc . Length >= 2 ) {
458+ if ( HasOto ( ccv , syllable . vowelTone ) || HasOto ( ValidateAlias ( ccv ) , syllable . vowelTone ) && ! ccvException . Contains ( cc [ 0 ] ) ) {
457459 basePhoneme = ccv ;
458460 lastC = i ;
459461 break ;
@@ -1874,7 +1876,7 @@ protected override double GetTransitionBasicLengthMs(string alias = "") {
18741876 foreach ( var c in semilongConsonants ) {
18751877 foreach ( var v in semilongConsonants . Except ( excludedEndings ) ) {
18761878 if ( alias . Contains ( c ) && ! alias . StartsWith ( c ) && ! alias . Contains ( $ "{ c } -") && ! alias . Contains ( $ "- q") ) {
1877- return base . GetTransitionBasicLengthMs ( ) * 2.0 ;
1879+ return base . GetTransitionBasicLengthMs ( ) * 1.5 ;
18781880 }
18791881 }
18801882 }
0 commit comments