コミットを比較
| 作成者 | SHA1 | 日付 | |
|---|---|---|---|
|
|
01fc7814b1
|
||
|
|
4e36bfe535
|
||
|
|
39408a7359
|
||
|
|
f9ff62307d
|
||
|
|
99adfa183b
|
||
|
|
5171590bff
|
||
|
|
6ce77748d5
|
||
|
|
4e301ef503
|
||
|
|
815f88c2ab
|
||
|
|
6c2c419de5
|
||
|
|
8043d5cfca
|
||
|
|
84a6e58fd3
|
||
|
|
61a3805c23
|
||
|
|
61d7ef99fe
|
検索条件に一致するファイルはありません
+16
-6
@@ -1,5 +1,5 @@
|
||||
========================================
|
||||
UTAU for YMM4 v1.0.0
|
||||
UTAU for YMM4 v1.2.0
|
||||
========================================
|
||||
YukkuriMovieMaker4(YMM4)上で動作する、UTAU 音源から歌声を合成する
|
||||
音声合成プラグインです。
|
||||
@@ -23,13 +23,20 @@ WorldNet で分析して合成し直します。
|
||||
追加してください。探索フォルダの 3 階層下までを調べ、character.txt・
|
||||
character.yaml・oto.ini のいずれかがあるフォルダを音源として扱います。
|
||||
|
||||
- セリフはかなで書きます。セリフの中に <!音名:長さ> と書くと、その直後の
|
||||
かなの音程と長さが決まります。長さはティックか 1/4 のような音符で書けます。
|
||||
- セリフはかなで書きます。セリフの中に <!音名:長さ> と書くと、以降の音程と
|
||||
直後のノートの長さが決まります。長さはティックか 1/4 のような音符で書けます。
|
||||
480 ティックが四分音符です。<!T=140> と書くと、そこから先のテンポが
|
||||
変わります。休符は <!R:200> と書きます。
|
||||
例: <!C4:1/4>ど<!D4>れ<!E4>み
|
||||
|
||||
- セリフか発音に .ust ファイルのパスを書くと、その UST を読み込みます。
|
||||
- セリフか発音に .ust ファイルのパスを書くと、その UST を読み込みます。歌詞の
|
||||
先頭の ? は prefix.map を無視し、! は直前の母音を付けた形を試しません。
|
||||
どちらも UTAU 本体と同じ意味です。
|
||||
|
||||
- 歌詞は、かなのほか a か のような連続音の形とローマ字でも書けます。歌詞の
|
||||
最後の空白より後ろをかなへ戻して照合するため、連続音の譜面を単独音の音源で
|
||||
歌わせたり、ローマ字の譜面をかなの音源で歌わせたりできます。ローマ字は
|
||||
ヘボン式と訓令式のどちらでも読みます。
|
||||
|
||||
- アイテムの編集画面の「ノートを編集」から、音程・長さ・ビブラート・
|
||||
ポルタメント・表現曲線を編集できます。
|
||||
@@ -49,8 +56,11 @@ WorldNet で分析して合成し直します。
|
||||
設定画面の説明書タブと、アイテムの編集画面の利用規約から読めます。
|
||||
使用する前に必ず確認してください。
|
||||
|
||||
- 漢字は読みへ変換しません。セリフはかなで書いてください。原音設定に一致する
|
||||
エイリアスがない歌詞は合成できません。
|
||||
- 漢字は読みへ変換しません。セリフはかなで書いてください。
|
||||
|
||||
- 原音設定に一致するエイリアスがない歌詞は無音のノートになります。見つからな
|
||||
かった歌詞はノートエディターの工具列に警告として並び、他のノートはそのまま
|
||||
合成します。どのノートも合成できないときだけエラーになります。
|
||||
|
||||
- 初回の合成: 音声ファイルの分析に時間がかかります。分析結果はメモリへ
|
||||
キャッシュするため、2 回目以降は速くなります。上限は既定で 512MB で、
|
||||
|
||||
@@ -86,9 +86,15 @@ YukkuriMovieMaker4(YMM4)上で動作する、UTAU 音源から歌声を合
|
||||
|
||||
セリフのかなを 1 モーラずつノートにします。拗音は前のかなとまとめ、「ー」は直前のノートを伸ばし、「っ」は短いノートにします。読点や中点や空白は短い休符に、句点や疑問符や感嘆符や改行は長い休符になります。既定では 1 モーラが 240 ティック、短い休符が 120 ティック、長い休符が 480 ティックです。
|
||||
|
||||
歌詞から原音設定のエイリアスを探すときは、直前の母音を付けた形を先に試し、続いて歌詞そのもの、ひらがな、カタカナ、ローマ字の順に試します。それぞれについて、声色と音域に合う接頭辞と接尾辞、`prefix.map` の接頭辞と接尾辞、接頭辞と接尾辞なしの順に照合します。
|
||||
歌詞から原音設定のエイリアスを探すときは、歌詞そのもの、ひらがな、カタカナ、モーラ、モーラのカタカナ、ローマ字の順に形を作り、直前の母音を付けた形を先に、何も付けない形を後に試します。直前が実際の母音のときは、その間に `* 歌詞` と `* モーラ` も試します。`*` は直前の母音を問わない連続音のエイリアスで、OpenUtau と同じ規約です。それぞれについて、声色と音域に合う接頭辞と接尾辞、`prefix.map` の接頭辞と接尾辞、接頭辞と接尾辞なしの順に照合します。
|
||||
|
||||
隣り合うノートの間には、前の母音と次の子音をつないだエイリアスがあれば差し込みます。長さは原音設定の先行発声に 30 ミリ秒を足した値で、前のノートの半分を上限とし、20 ミリ秒に満たないときは差し込みません。最後の母音には、母音と `-` をつないだエイリアスがあれば 120 ミリ秒だけ足します。
|
||||
モーラは、歌詞の最後の空白より後ろを取り出してかなへ寄せた形です。`a か` のような連続音の歌詞からは `か` を、`ka` のようなローマ字の歌詞からは `か` を取り出します。これにより、連続音で書かれた譜面を単独音の音源で歌わせたり、ローマ字で書かれた譜面をかなの音源で歌わせたりできます。ローマ字はヘボン式と訓令式のどちらでも読み、`si`・`ti`・`tu`・`zi`・`hu`・`wo` や `sya`・`tya`・`zya` のような綴りも対応するかなへ戻します。
|
||||
|
||||
連続音の歌詞に書かれた接頭辞よりも、実際の直前のノートの母音を優先します。`a あ` と書かれていても直前が `い` なら `i あ` を先に試します。
|
||||
|
||||
母音を持たない歌詞、たとえば CVVC の `a k` のようなノートの後では、直前の母音を付けた形を試しません。次のノートには語頭の `- き` ではなく `き` を当てます。
|
||||
|
||||
隣り合うノートの間には、前の母音と次の子音をつないだエイリアスがあれば差し込みます。長さは原音設定の先行発声に 30 ミリ秒を足した値で、前のノートの半分を上限とし、20 ミリ秒に満たないときは差し込みません。次のノートが `a か` のように前の母音を含むエイリアスへ解決したときは、そのエイリアスが渡りを含んでいるため差し込みません。最後の母音には、母音と `-` をつないだエイリアスがあれば 120 ミリ秒だけ足します。
|
||||
|
||||
### 3. UST ファイルの読み込み
|
||||
|
||||
@@ -96,6 +102,8 @@ YukkuriMovieMaker4(YMM4)上で動作する、UTAU 音源から歌声を合
|
||||
|
||||
テンポ、ノートの長さ、歌詞、音程、子音速度、音量、モジュレーション、先行発声、オーバーラップ、開始位置、エンベロープ、ビブラート、`PBS`・`PBW`・`PBY`・`PBM` の音程曲線を取り込みます。音程の値は 0.1 半音として扱います。ノートごとのテンポ変化にも対応します。文字コードは `Charset` の指定と BOM と内容から判別します。
|
||||
|
||||
歌詞の先頭の `?` は `prefix.map` を無視し、`!` は直前の母音を付けた形を試しません。どちらも UTAU 本体と同じ意味です。歌詞は NFC で正規化し、連続する空白は半角空白 1 つにまとめるため、全角空白で書かれた連続音の歌詞もそのまま解決します。
|
||||
|
||||
前後の休符は取り除きます。取り込んだノートの数と、取り除いた休符の長さと、取り込めなかった旧式の音程の有無をノートエディターに表示します。UST を読み込んでいる間は、基準の音程・テンポ・モジュレーションのパラメータを表示しません。
|
||||
|
||||
### 4. ノートエディター
|
||||
@@ -111,7 +119,8 @@ YukkuriMovieMaker4(YMM4)上で動作する、UTAU 音源から歌声を合
|
||||
- 下の帯では、子音速度・音量・モジュレーションをノートごとの棒として、フォルマントと息の量を曲線として引いて編集できます。
|
||||
- 休符の挿入、ノートの削除、すべてのノートの選択、表示範囲に合わせる操作をボタンから行えます。
|
||||
- ノートは隙間なく並びます。間を空けるときは休符を挿入します。
|
||||
- 編集内容は YMM4 の取り消しとやり直しに対応します。
|
||||
- 原音設定に見つからなかった歌詞があるときは、工具列の右端に警告として並びます。ノートエディターを開いたままでも、合成をやり直すたびに書き換わります。
|
||||
- 編集内容は YMM4 の取り消しとやり直しに対応します。合成の結果として作られる情報は取り消しの対象になりません。
|
||||
|
||||
### 5. WORLD による合成
|
||||
|
||||
@@ -221,7 +230,7 @@ YMM4 の設定画面の「音声」に「UTAU」として表示されます。
|
||||
## 制限事項
|
||||
|
||||
- 漢字は読みへ変換しません。セリフはかなで書いてください。
|
||||
- 原音設定に一致するエイリアスがない歌詞は合成できません。見つからなかった歌詞を挙げてエラーになります。
|
||||
- 原音設定に一致するエイリアスがない歌詞は無音のノートになります。見つからなかった歌詞はノートエディターの工具列に警告として並び、他のノートはそのまま合成します。どのノートも合成できないときだけ、見つからなかった歌詞を挙げてエラーになります。
|
||||
- UST の `Flags` は反映しません。
|
||||
- UST の旧式の音程には対応していません。`PBS`・`PBW`・`PBY`・`PBM` で書かれた音程だけを取り込みます。
|
||||
- UST のエンベロープは 3 つの時間だけを使い、音量の点は使いません。
|
||||
|
||||
@@ -5,6 +5,7 @@ using UTAU.ViewModels;
|
||||
|
||||
namespace UTAU.Tests;
|
||||
|
||||
[Collection("Wpf")]
|
||||
public sealed class CanvasAlignmentTests
|
||||
{
|
||||
static T RunSta<T>(Func<T> action)
|
||||
@@ -117,6 +118,7 @@ public sealed class CanvasAlignmentTests
|
||||
}
|
||||
}
|
||||
|
||||
[Collection("Wpf")]
|
||||
public sealed class KeyboardRowAlignmentTests
|
||||
{
|
||||
const int RowCount = 60;
|
||||
|
||||
@@ -8,6 +8,7 @@ using YukkuriMovieMaker.Controls;
|
||||
|
||||
namespace UTAU.Tests;
|
||||
|
||||
[Collection("Wpf")]
|
||||
public sealed class ExpressionStripAlignmentTests
|
||||
{
|
||||
const double PopupWidth = 980.0;
|
||||
@@ -40,7 +41,7 @@ public sealed class ExpressionStripAlignmentTests
|
||||
{
|
||||
var editor = new NoteEditor();
|
||||
var button = (PopupButton)editor.Content;
|
||||
var root = (Grid)button.PopupContent;
|
||||
var root = (Grid)button.PopupContent!;
|
||||
button.PopupContent = null;
|
||||
|
||||
var pronounce = new UTAUVoicePronounce();
|
||||
|
||||
@@ -314,6 +314,46 @@ public sealed class KanaRomanizationTests
|
||||
public void AmbiguousRomajiPicksTheCommonKana(string lyric, string expected)
|
||||
=> Assert.Equal(expected, KanaRomanization.ToMora(lyric));
|
||||
|
||||
[Theory]
|
||||
[InlineData("si", "し")]
|
||||
[InlineData("ti", "ち")]
|
||||
[InlineData("tu", "つ")]
|
||||
[InlineData("zi", "じ")]
|
||||
[InlineData("hu", "ふ")]
|
||||
[InlineData("di", "ぢ")]
|
||||
[InlineData("du", "づ")]
|
||||
[InlineData("wo", "を")]
|
||||
[InlineData("sya", "しゃ")]
|
||||
[InlineData("tyo", "ちょ")]
|
||||
[InlineData("zyu", "じゅ")]
|
||||
[InlineData("jya", "じゃ")]
|
||||
[InlineData("cyo", "ちょ")]
|
||||
public void KunreiRomajiReadsAsItsOwnKana(string lyric, string expected)
|
||||
=> Assert.Equal(expected, KanaRomanization.ToMora(lyric));
|
||||
|
||||
[Theory]
|
||||
[InlineData("すぃ", "si")]
|
||||
[InlineData("てぃ", "ti")]
|
||||
[InlineData("とぅ", "tu")]
|
||||
[InlineData("うぉ", "wo")]
|
||||
public void ExtendedKanaKeepsItsOwnRomaji(string mora, string expected)
|
||||
{
|
||||
Assert.True(KanaRomanization.TryGetRomaji(mora, out var romaji));
|
||||
Assert.Equal(expected, romaji);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("si", "sh", "i")]
|
||||
[InlineData("ti", "ch", "i")]
|
||||
[InlineData("tu", "ts", "u")]
|
||||
[InlineData("hu", "f", "u")]
|
||||
[InlineData("wo", null, "o")]
|
||||
public void KunreiRomajiExposesTheKanaVowelAndConsonant(string lyric, string? consonant, string vowel)
|
||||
{
|
||||
Assert.Equal(consonant, KanaRomanization.GetConsonant(lyric));
|
||||
Assert.Equal(vowel, KanaRomanization.GetVowel(lyric));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("a あ", "あ")]
|
||||
[InlineData("- あ", "あ")]
|
||||
|
||||
@@ -8,6 +8,7 @@ using YukkuriMovieMaker.Controls;
|
||||
|
||||
namespace UTAU.Tests;
|
||||
|
||||
[Collection("Wpf")]
|
||||
public sealed class NoteEditorMeasuredLayoutTests
|
||||
{
|
||||
const double PopupWidth = 980.0;
|
||||
@@ -41,7 +42,7 @@ public sealed class NoteEditorMeasuredLayoutTests
|
||||
{
|
||||
var editor = new NoteEditor();
|
||||
var button = (PopupButton)editor.Content;
|
||||
var root = (Grid)button.PopupContent;
|
||||
var root = (Grid)button.PopupContent!;
|
||||
button.PopupContent = null;
|
||||
|
||||
var pronounce = new UTAUVoicePronounce();
|
||||
|
||||
@@ -144,6 +144,18 @@ public sealed class AliasResolverTests
|
||||
Assert.Contains("a", candidates);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheWildcardFormFollowsARealPreviousVowel()
|
||||
{
|
||||
var following = AliasResolver.EnumerateCandidates("か", "a").ToArray();
|
||||
Assert.Contains("* か", following);
|
||||
Assert.True(Array.IndexOf(following, "* か") > Array.IndexOf(following, "a か"));
|
||||
Assert.True(Array.IndexOf(following, "* か") < Array.IndexOf(following, "か"));
|
||||
|
||||
Assert.DoesNotContain("* か", AliasResolver.EnumerateCandidates("か", "-").ToArray());
|
||||
Assert.DoesNotContain("* か", AliasResolver.EnumerateCandidates("か", string.Empty).ToArray());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AddedCandidatesStayDistinct()
|
||||
{
|
||||
@@ -274,6 +286,81 @@ public sealed class PhonemizerTests : IDisposable
|
||||
Assert.Equal(["- あ", "a か"], units.Select(x => x.Alias));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ContinuousAliasesDoNotTakeAnExtraTransition()
|
||||
{
|
||||
var bank = TestVoiceBank.CreateVcvAndCvvcBank(directory);
|
||||
var units = Phonemize(bank, Lyrics("- あ", "a か"));
|
||||
|
||||
Assert.Equal(["- あ", "a か", "a -"], units.Select(x => x.Alias));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SingleLyricsPreferTheContinuousAliasInTheSameBank()
|
||||
{
|
||||
var bank = TestVoiceBank.CreateVcvAndCvvcBank(directory);
|
||||
var units = Phonemize(bank, Lyrics("あ", "か"));
|
||||
|
||||
Assert.Equal(["- あ", "a か", "a -"], units.Select(x => x.Alias));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void VoicedConsonantNotesLeaveTheFollowingNotePlain()
|
||||
{
|
||||
var bank = TestVoiceBank.CreateCvvcBank(directory);
|
||||
var units = Phonemize(bank, Lyrics("か", "a k", "あ"));
|
||||
|
||||
Assert.Equal(["か", "a k", "あ", "a -"], units.Select(x => x.Alias));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SuppressedAutoVcvKeepsTheWrittenLyric()
|
||||
{
|
||||
var bank = TestVoiceBank.CreateVcvAndCvvcBank(directory);
|
||||
var plain = Phonemize(bank, Lyrics("あ", "か"));
|
||||
Assert.Equal(["- あ", "a か", "a -"], plain.Select(x => x.Alias));
|
||||
|
||||
var notes = Lyrics("あ", "か");
|
||||
notes[1].SuppressAutoVcv = true;
|
||||
Assert.Equal(["- あ", "a k", "か", "a -"], Phonemize(bank, notes).Select(x => x.Alias));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void IgnoredPrefixMapFallsBackToTheUnmappedAlias()
|
||||
{
|
||||
TestVoiceBank.WriteText(directory, VoiceBankLoader.CharacterFileName, "name=map\r\n");
|
||||
TestVoiceBank.WriteText(directory, VoiceBankLoader.PrefixMapFileName, "C4\t\t_C4\r\n");
|
||||
TestVoiceBank.WriteText(
|
||||
directory,
|
||||
VoiceBankLoader.OtoFileName,
|
||||
"a.wav=あ,50,80,-500,100,40\r\nam.wav=あ_C4,50,80,-500,100,40");
|
||||
TestVoiceBank.WriteSample(directory, "a.wav");
|
||||
TestVoiceBank.WriteSample(directory, "am.wav");
|
||||
var bank = VoiceBankLoader.Load("map", directory);
|
||||
|
||||
var mapped = Lyrics("あ");
|
||||
Assert.Equal("あ_C4", Phonemize(bank, mapped)[0].Entry?.Alias);
|
||||
|
||||
var ignored = Lyrics("あ");
|
||||
ignored[0].IgnorePrefixMap = true;
|
||||
Assert.Equal("あ", Phonemize(bank, ignored)[0].Entry?.Alias);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheWildcardAliasIsUsedWhenThePreviousVowelHasNoEntry()
|
||||
{
|
||||
TestVoiceBank.WriteText(directory, VoiceBankLoader.CharacterFileName, "name=wild\r\n");
|
||||
TestVoiceBank.WriteText(
|
||||
directory,
|
||||
VoiceBankLoader.OtoFileName,
|
||||
"s.wav=- あ,50,80,-500,100,40\r\nw.wav=* か,50,120,-500,140,50");
|
||||
TestVoiceBank.WriteSample(directory, "s.wav");
|
||||
TestVoiceBank.WriteSample(directory, "w.wav");
|
||||
var bank = VoiceBankLoader.Load("wild", directory);
|
||||
|
||||
Assert.Equal(["- あ", "* か"], Phonemize(bank, Lyrics("あ", "か")).Select(x => x.Alias));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void UnresolvedLyricsAreReportedWithoutAnEntry()
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.IO;
|
||||
using UTAU;
|
||||
using UTAU.Notes;
|
||||
using UTAU.ViewModels;
|
||||
using YukkuriMovieMaker.UndoRedo;
|
||||
|
||||
namespace UTAU.Tests;
|
||||
@@ -115,11 +116,60 @@ public sealed class PronounceChangeNotificationTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SourceTextChangesNotifyTheHost()
|
||||
public void SynthesisOutputsDoNotReachTheUndoHistory()
|
||||
{
|
||||
var (pronounce, count) = CreateObserved();
|
||||
pronounce.SourceText = "あ";
|
||||
Assert.True(count() > 0);
|
||||
pronounce.ImportMessage = "取り込みました";
|
||||
pronounce.RenderMessage = "見つかりません";
|
||||
pronounce.LipSyncFrames = [];
|
||||
Assert.Equal(0, count());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheEditorViewModelFollowsTheMessagesOnItsOwnThread()
|
||||
{
|
||||
var pronounce = new UTAUVoicePronounce();
|
||||
pronounce.Notes.Add(new UTAUNote { Lyric = "あ" });
|
||||
using var viewModel = new NoteEditorViewModel(pronounce);
|
||||
var raised = new List<string>();
|
||||
viewModel.PropertyChanged += (_, e) => raised.Add(e.PropertyName ?? string.Empty);
|
||||
|
||||
pronounce.RenderMessage = "警告";
|
||||
pronounce.ImportMessage = "取り込み";
|
||||
|
||||
Assert.Contains(nameof(NoteEditorViewModel.RenderMessage), raised);
|
||||
Assert.Contains(nameof(NoteEditorViewModel.ImportMessage), raised);
|
||||
Assert.Equal("警告", viewModel.RenderMessage);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheEditorViewModelStopsFollowingOnceDisposed()
|
||||
{
|
||||
var pronounce = new UTAUVoicePronounce();
|
||||
pronounce.Notes.Add(new UTAUNote { Lyric = "あ" });
|
||||
var viewModel = new NoteEditorViewModel(pronounce);
|
||||
var raised = 0;
|
||||
viewModel.PropertyChanged += (_, _) => raised++;
|
||||
viewModel.Dispose();
|
||||
|
||||
pronounce.RenderMessage = "警告";
|
||||
|
||||
Assert.Equal(0, raised);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SynthesisOutputsStillRaisePropertyChanged()
|
||||
{
|
||||
var pronounce = new UTAUVoicePronounce();
|
||||
var changed = new List<string>();
|
||||
pronounce.PropertyChanged += (_, e) => changed.Add(e.PropertyName ?? string.Empty);
|
||||
|
||||
pronounce.SourceText = "あ";
|
||||
pronounce.RenderMessage = "見つかりません";
|
||||
|
||||
Assert.Contains(nameof(UTAUVoicePronounce.SourceText), changed);
|
||||
Assert.Contains(nameof(UTAUVoicePronounce.RenderMessage), changed);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -128,6 +178,8 @@ public sealed class PronounceChangeNotificationTests
|
||||
var note = new UTAUNote
|
||||
{
|
||||
Lyric = "か",
|
||||
IgnorePrefixMap = true,
|
||||
SuppressAutoVcv = true,
|
||||
Tone = 64,
|
||||
LengthTicks = 960,
|
||||
Velocity = 80.0,
|
||||
@@ -146,6 +198,8 @@ public sealed class PronounceChangeNotificationTests
|
||||
var clone = note.Clone();
|
||||
|
||||
Assert.Equal(note.Lyric, clone.Lyric);
|
||||
Assert.Equal(note.IgnorePrefixMap, clone.IgnorePrefixMap);
|
||||
Assert.Equal(note.SuppressAutoVcv, clone.SuppressAutoVcv);
|
||||
Assert.Equal(note.Tone, clone.Tone);
|
||||
Assert.Equal(note.LengthTicks, clone.LengthTicks);
|
||||
Assert.Equal(note.Velocity, clone.Velocity);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
using UTAU.Notes;
|
||||
using UTAU.ViewModels;
|
||||
@@ -8,42 +9,24 @@ using YukkuriMovieMaker.Controls;
|
||||
|
||||
namespace UTAU.Tests;
|
||||
|
||||
[Collection("Wpf")]
|
||||
public sealed class RenderMessageDisplayTests
|
||||
{
|
||||
const double PopupWidth = 980.0;
|
||||
const double PopupHeight = 480.0;
|
||||
const string Warning = "見つからない歌詞";
|
||||
const string LongWarning = "原音設定に ぱ, ぴ, ぷ, ぺ, ぽ, ざ, じ, ず ... が見つかりません。";
|
||||
const string LongImport = "44個のノートを取り込みました 前後の休符を480ティック除きました";
|
||||
|
||||
[Fact]
|
||||
public void TheWarningReachesTheToolbarFromTheSynthesisThread()
|
||||
static T RunSta<T>(Func<T> action)
|
||||
{
|
||||
var result = default(T)!;
|
||||
Exception? error = null;
|
||||
string? shown = null;
|
||||
|
||||
var thread = new Thread(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var editor = new NoteEditor();
|
||||
var button = (PopupButton)editor.Content;
|
||||
var root = (Grid)button.PopupContent!;
|
||||
button.PopupContent = null;
|
||||
|
||||
var pronounce = new UTAUVoicePronounce();
|
||||
pronounce.Notes.Add(new UTAUNote { Lyric = "あ" });
|
||||
using var viewModel = new NoteEditorViewModel(pronounce);
|
||||
root.DataContext = viewModel;
|
||||
|
||||
var host = new Border { Width = PopupWidth, Height = PopupHeight, Child = root };
|
||||
host.Measure(new Size(PopupWidth, PopupHeight));
|
||||
host.Arrange(new Rect(0.0, 0.0, PopupWidth, PopupHeight));
|
||||
host.UpdateLayout();
|
||||
|
||||
Task.Run(() => pronounce.RenderMessage = Warning).GetAwaiter().GetResult();
|
||||
viewModel.InvalidateMessages();
|
||||
Dispatcher.CurrentDispatcher.Invoke(() => { }, DispatcherPriority.Background);
|
||||
|
||||
shown = ((StackPanel)root.Children[0]).Children.OfType<TextBlock>().Last().Text;
|
||||
result = action();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
@@ -53,8 +36,81 @@ public sealed class RenderMessageDisplayTests
|
||||
thread.SetApartmentState(ApartmentState.STA);
|
||||
thread.Start();
|
||||
thread.Join();
|
||||
if (error is not null)
|
||||
throw new InvalidOperationException(error.Message, error);
|
||||
return result;
|
||||
}
|
||||
|
||||
static IEnumerable<DependencyObject> Descend(DependencyObject root)
|
||||
{
|
||||
var count = VisualTreeHelper.GetChildrenCount(root);
|
||||
for (var index = 0; index < count; index++)
|
||||
{
|
||||
var child = VisualTreeHelper.GetChild(root, index);
|
||||
yield return child;
|
||||
foreach (var descendant in Descend(child))
|
||||
yield return descendant;
|
||||
}
|
||||
}
|
||||
|
||||
static Border Build(NoteEditorViewModel viewModel)
|
||||
{
|
||||
var editor = new NoteEditor();
|
||||
var button = (PopupButton)editor.Content;
|
||||
var root = (Grid)button.PopupContent!;
|
||||
button.PopupContent = null;
|
||||
root.DataContext = viewModel;
|
||||
|
||||
var host = new Border { Width = PopupWidth, Height = PopupHeight, Child = root };
|
||||
host.Measure(new Size(PopupWidth, PopupHeight));
|
||||
host.Arrange(new Rect(0.0, 0.0, PopupWidth, PopupHeight));
|
||||
host.UpdateLayout();
|
||||
return host;
|
||||
}
|
||||
|
||||
static TextBlock WarningBlock(Border host)
|
||||
=> Descend(host)
|
||||
.OfType<DockPanel>()
|
||||
.SelectMany(x => x.Children.OfType<TextBlock>())
|
||||
.First(x => DockPanel.GetDock(x) == Dock.Right);
|
||||
|
||||
[Fact]
|
||||
public void TheWarningReachesTheToolbarFromTheSynthesisThread()
|
||||
{
|
||||
var shown = RunSta(() =>
|
||||
{
|
||||
var pronounce = new UTAUVoicePronounce();
|
||||
pronounce.Notes.Add(new UTAUNote { Lyric = "あ" });
|
||||
using var viewModel = new NoteEditorViewModel(pronounce);
|
||||
var host = Build(viewModel);
|
||||
|
||||
Task.Run(() => pronounce.RenderMessage = Warning).GetAwaiter().GetResult();
|
||||
Dispatcher.CurrentDispatcher.Invoke(() => { }, DispatcherPriority.Background);
|
||||
|
||||
return WarningBlock(host).Text;
|
||||
});
|
||||
|
||||
Assert.Null(error);
|
||||
Assert.Equal(Warning, shown);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheWarningStaysInsideTheToolbarWhenEveryMessageIsLong()
|
||||
{
|
||||
var right = RunSta(() =>
|
||||
{
|
||||
var pronounce = new UTAUVoicePronounce
|
||||
{
|
||||
ImportMessage = LongImport,
|
||||
RenderMessage = LongWarning,
|
||||
};
|
||||
pronounce.Notes.Add(new UTAUNote { Lyric = "あ" });
|
||||
using var viewModel = new NoteEditorViewModel(pronounce);
|
||||
var host = Build(viewModel);
|
||||
|
||||
var warning = WarningBlock(host);
|
||||
return warning.TranslatePoint(new Point(0.0, 0.0), host).X + warning.ActualWidth;
|
||||
});
|
||||
|
||||
Assert.True(right <= PopupWidth, $"right={right}");
|
||||
}
|
||||
}
|
||||
@@ -105,6 +105,30 @@ internal static class TestVoiceBank
|
||||
return VoiceBankLoader.Load("vcv", directory);
|
||||
}
|
||||
|
||||
public static VoiceBank CreateVcvAndCvvcBank(string directory)
|
||||
{
|
||||
WriteText(directory, VoiceBankLoader.CharacterFileName, "name=連続音CVVC\r\n");
|
||||
WriteText(
|
||||
directory,
|
||||
VoiceBankLoader.OtoFileName,
|
||||
string.Join("\r\n",
|
||||
[
|
||||
"a.wav=あ,50,80,-500,100,40",
|
||||
"ka.wav=か,50,120,-500,140,50",
|
||||
"start.wav=- あ,50,80,-500,100,40",
|
||||
"aka.wav=a か,50,120,-500,140,50",
|
||||
"ak.wav=a k,50,40,-200,60,20",
|
||||
"aend.wav=a -,50,40,-200,60,20",
|
||||
]));
|
||||
WriteSample(directory, "a.wav");
|
||||
WriteSample(directory, "ka.wav");
|
||||
WriteSample(directory, "start.wav");
|
||||
WriteSample(directory, "aka.wav");
|
||||
WriteSample(directory, "ak.wav");
|
||||
WriteSample(directory, "aend.wav");
|
||||
return VoiceBankLoader.Load("vcvcvvc", directory);
|
||||
}
|
||||
|
||||
public static VoiceBank CreateCvvcBank(string directory)
|
||||
{
|
||||
WriteText(directory, VoiceBankLoader.CharacterFileName, "name=CVVC\r\n");
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Windows.Controls;
|
||||
|
||||
namespace UTAU.Tests;
|
||||
|
||||
[Collection("Wpf")]
|
||||
public sealed class ToolbarHeightTests
|
||||
{
|
||||
const double RowHeight = 26.0;
|
||||
|
||||
@@ -34,6 +34,38 @@ public sealed class UstTests
|
||||
|
||||
static string[] Sung(params string[] lines) => ["Length=480", "Lyric=a", "NoteNum=60", .. lines];
|
||||
|
||||
static UTAUNote SingleNote(string lyric)
|
||||
=> Import(Document(
|
||||
ExactTempo,
|
||||
["Length=480", "Lyric=あ", "NoteNum=60"],
|
||||
["Length=480", $"Lyric={lyric}", "NoteNum=60"],
|
||||
["Length=480", "Lyric=あ", "NoteNum=60"])).Notes[1];
|
||||
|
||||
[Theory]
|
||||
[InlineData("?か", "か", true, false)]
|
||||
[InlineData("!a か", "a か", false, true)]
|
||||
[InlineData("?!か", "か", true, true)]
|
||||
[InlineData("!?か", "か", true, true)]
|
||||
[InlineData("か", "か", false, false)]
|
||||
public void LyricMarkersBecomeNoteFlags(string written, string expected, bool ignorePrefixMap, bool suppressAutoVcv)
|
||||
{
|
||||
var note = SingleNote(written);
|
||||
|
||||
Assert.Equal(expected, note.Lyric);
|
||||
Assert.Equal(ignorePrefixMap, note.IgnorePrefixMap);
|
||||
Assert.Equal(suppressAutoVcv, note.SuppressAutoVcv);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("a か", "a か")]
|
||||
[InlineData("a か", "a か")]
|
||||
[InlineData("が", "が")]
|
||||
[InlineData("- あ", "- あ")]
|
||||
[InlineData("R", "R")]
|
||||
[InlineData("-", "-")]
|
||||
public void ImportedLyricsAreComposedAndSpacedConsistently(string written, string expected)
|
||||
=> Assert.Equal(expected, SingleNote(written).Lyric);
|
||||
|
||||
[Fact]
|
||||
public void ShiftJisIsTheDefaultEncoding()
|
||||
{
|
||||
@@ -799,6 +831,48 @@ public sealed class UstPronounceTests
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task UnresolvedLyricsBecomeAWarningWhileTheRestIsRendered()
|
||||
{
|
||||
var directory = TestVoiceBank.CreateTemporaryDirectory();
|
||||
try
|
||||
{
|
||||
var speaker = new UTAUVoiceSpeaker(TestVoiceBank.CreateSingleKanaBank(directory));
|
||||
var output = Path.Combine(directory, "partial.wav");
|
||||
|
||||
var pronounce = (UTAUVoicePronounce?)await speaker.CreateVoiceAsync("あぱあ", null, new UTAUVoiceParameter(), output);
|
||||
|
||||
Assert.NotNull(pronounce);
|
||||
Assert.Equal(string.Format(Texts.AliasNotFoundMessage, "ぱ"), pronounce.RenderMessage);
|
||||
Assert.True(File.Exists(output));
|
||||
}
|
||||
finally
|
||||
{
|
||||
TestVoiceBank.DeleteDirectory(directory);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task NothingResolvableFailsWithTheMissingLyrics()
|
||||
{
|
||||
var directory = TestVoiceBank.CreateTemporaryDirectory();
|
||||
try
|
||||
{
|
||||
var speaker = new UTAUVoiceSpeaker(TestVoiceBank.CreateSingleKanaBank(directory));
|
||||
var output = Path.Combine(directory, "none.wav");
|
||||
|
||||
var error = await Assert.ThrowsAsync<InvalidOperationException>(
|
||||
() => speaker.CreateVoiceAsync("ぱぴ", null, new UTAUVoiceParameter(), output));
|
||||
|
||||
Assert.Equal(string.Format(Texts.AliasNotFoundMessage, "ぱ, ぴ"), error.Message);
|
||||
Assert.False(File.Exists(output));
|
||||
}
|
||||
finally
|
||||
{
|
||||
TestVoiceBank.DeleteDirectory(directory);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task PlainTextIsStillNormalised()
|
||||
{
|
||||
|
||||
@@ -71,18 +71,18 @@ internal sealed class VoiceBank
|
||||
|
||||
public OtoEntry? Find(string alias) => aliases.GetValueOrDefault(alias);
|
||||
|
||||
public OtoEntry? Resolve(string lyric, int noteNumber, string? color)
|
||||
public OtoEntry? Resolve(string lyric, int noteNumber, string? color, bool ignorePrefixMap = false)
|
||||
{
|
||||
foreach (var alias in EnumerateAliasCandidates(lyric, noteNumber, color))
|
||||
foreach (var alias in EnumerateAliasCandidates(lyric, noteNumber, color, ignorePrefixMap))
|
||||
if (aliases.TryGetValue(alias, out var entry))
|
||||
return entry;
|
||||
return null;
|
||||
}
|
||||
|
||||
public IEnumerable<string> EnumerateAliasCandidates(string lyric, int noteNumber, string? color)
|
||||
public IEnumerable<string> EnumerateAliasCandidates(string lyric, int noteNumber, string? color, bool ignorePrefixMap = false)
|
||||
{
|
||||
var seen = new HashSet<string>(StringComparer.Ordinal);
|
||||
foreach (var (prefix, suffix) in EnumerateAffixes(noteNumber, color))
|
||||
foreach (var (prefix, suffix) in EnumerateAffixes(noteNumber, color, ignorePrefixMap))
|
||||
{
|
||||
var candidate = prefix + lyric + suffix;
|
||||
if (seen.Add(candidate))
|
||||
@@ -90,7 +90,7 @@ internal sealed class VoiceBank
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerable<(string Prefix, string Suffix)> EnumerateAffixes(int noteNumber, string? color)
|
||||
IEnumerable<(string Prefix, string Suffix)> EnumerateAffixes(int noteNumber, string? color, bool ignorePrefixMap)
|
||||
{
|
||||
foreach (var subBank in SubBanks)
|
||||
{
|
||||
@@ -99,7 +99,7 @@ internal sealed class VoiceBank
|
||||
yield return (subBank.Prefix, subBank.Suffix);
|
||||
}
|
||||
|
||||
if (PrefixMap is not null)
|
||||
if (PrefixMap is not null && !ignorePrefixMap)
|
||||
{
|
||||
var mapped = PrefixMap.Resolve(noteNumber);
|
||||
if (mapped.Prefix.Length > 0 || mapped.Suffix.Length > 0)
|
||||
|
||||
@@ -20,6 +20,8 @@ internal sealed class UTAUNote : UndoRedoable
|
||||
public const string RestLyric = "R";
|
||||
|
||||
string lyric = string.Empty;
|
||||
bool ignorePrefixMap;
|
||||
bool suppressAutoVcv;
|
||||
int tone = MusicalTone.MiddleC.NoteNumber;
|
||||
int lengthTicks = DefaultLengthTicks;
|
||||
double velocity = 100.0;
|
||||
@@ -46,6 +48,20 @@ internal sealed class UTAUNote : UndoRedoable
|
||||
set => Set(ref lyric, value ?? string.Empty);
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public bool IgnorePrefixMap
|
||||
{
|
||||
get => ignorePrefixMap;
|
||||
set => Set(ref ignorePrefixMap, value);
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public bool SuppressAutoVcv
|
||||
{
|
||||
get => suppressAutoVcv;
|
||||
set => Set(ref suppressAutoVcv, value);
|
||||
}
|
||||
|
||||
[Display(GroupName = nameof(Texts.NoteGroupBasic), Name = nameof(Texts.NoteTone), ResourceType = typeof(Texts))]
|
||||
[ToneComboBox]
|
||||
public int Tone
|
||||
@@ -181,6 +197,8 @@ internal sealed class UTAUNote : UndoRedoable
|
||||
var clone = new UTAUNote
|
||||
{
|
||||
Lyric = Lyric,
|
||||
IgnorePrefixMap = IgnorePrefixMap,
|
||||
SuppressAutoVcv = SuppressAutoVcv,
|
||||
Tone = Tone,
|
||||
LengthTicks = LengthTicks,
|
||||
TempoOverride = TempoOverride,
|
||||
|
||||
+44
-5
@@ -1,4 +1,5 @@
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using UTAU.Models;
|
||||
|
||||
namespace UTAU.Notes;
|
||||
@@ -67,9 +68,12 @@ internal static class UstImporter
|
||||
|
||||
static UTAUNote CreateNote(UstSection section, int lengthTicks, TimeBase timeBase)
|
||||
{
|
||||
var lyric = ReadLyric(section.Find(UstKeys.Lyric));
|
||||
var note = new UTAUNote
|
||||
{
|
||||
Lyric = NormalizeLyric(section.Find(UstKeys.Lyric)),
|
||||
Lyric = lyric.Text,
|
||||
IgnorePrefixMap = lyric.IgnorePrefixMap,
|
||||
SuppressAutoVcv = lyric.SuppressAutoVcv,
|
||||
LengthTicks = lengthTicks,
|
||||
Tone = ParseInteger(section.Find(UstKeys.NoteNum)) ?? MusicalTone.MiddleC.NoteNumber,
|
||||
};
|
||||
@@ -204,13 +208,48 @@ internal static class UstImporter
|
||||
|
||||
static bool IsUsableTempo(double? tempo) => tempo is > 0.0 and <= MaximumDeclaredTempo;
|
||||
|
||||
static string NormalizeLyric(string? text)
|
||||
static (string Text, bool IgnorePrefixMap, bool SuppressAutoVcv) ReadLyric(string? text)
|
||||
{
|
||||
var lyric = (text ?? string.Empty).Trim();
|
||||
while (lyric.Length > 0 && lyric[0] is UstKeys.IgnorePrefixMapMarker or UstKeys.SuppressAutoVcvMarker)
|
||||
lyric = lyric[1..].Trim();
|
||||
var ignorePrefixMap = false;
|
||||
var suppressAutoVcv = false;
|
||||
|
||||
return lyric.Equals(UstKeys.RestLyric, StringComparison.OrdinalIgnoreCase) ? UTAUNote.RestLyric : lyric;
|
||||
while (lyric.Length > 0 && lyric[0] is UstKeys.IgnorePrefixMapMarker or UstKeys.SuppressAutoVcvMarker)
|
||||
{
|
||||
ignorePrefixMap |= lyric[0] == UstKeys.IgnorePrefixMapMarker;
|
||||
suppressAutoVcv |= lyric[0] == UstKeys.SuppressAutoVcvMarker;
|
||||
lyric = lyric[1..].Trim();
|
||||
}
|
||||
|
||||
return (NormalizeLyric(lyric), ignorePrefixMap, suppressAutoVcv);
|
||||
}
|
||||
|
||||
static string NormalizeLyric(string lyric)
|
||||
{
|
||||
if (lyric.Equals(UstKeys.RestLyric, StringComparison.OrdinalIgnoreCase))
|
||||
return UTAUNote.RestLyric;
|
||||
|
||||
var normalized = lyric.Normalize(NormalizationForm.FormC);
|
||||
var builder = new StringBuilder(normalized.Length);
|
||||
var pendingSpace = false;
|
||||
|
||||
foreach (var c in normalized)
|
||||
{
|
||||
if (char.IsWhiteSpace(c))
|
||||
{
|
||||
pendingSpace = builder.Length > 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pendingSpace)
|
||||
{
|
||||
builder.Append(' ');
|
||||
pendingSpace = false;
|
||||
}
|
||||
builder.Append(c);
|
||||
}
|
||||
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
static (double Milliseconds, double Cents) ParsePitchBendStart(string? text)
|
||||
|
||||
@@ -4,11 +4,11 @@ namespace UTAU.Phonemes;
|
||||
|
||||
internal static class AliasResolver
|
||||
{
|
||||
public static OtoEntry? Resolve(VoiceBank bank, string lyric, string previousVowel, int tone, string? color, out string alias)
|
||||
public static OtoEntry? Resolve(VoiceBank bank, string lyric, string previousVowel, int tone, string? color, bool ignorePrefixMap, out string alias)
|
||||
{
|
||||
foreach (var candidate in EnumerateCandidates(lyric, previousVowel))
|
||||
{
|
||||
var entry = bank.Resolve(candidate, tone, color);
|
||||
var entry = bank.Resolve(candidate, tone, color, ignorePrefixMap);
|
||||
if (entry is null)
|
||||
continue;
|
||||
alias = candidate;
|
||||
@@ -44,6 +44,11 @@ internal static class AliasResolver
|
||||
yield return previousVowel + " " + moraKatakana;
|
||||
if (romaji is not null)
|
||||
yield return previousVowel + " " + romaji;
|
||||
if (previousVowel != KanaRomanization.StartVowel)
|
||||
{
|
||||
yield return KanaRomanization.AnyVowel + " " + lyric;
|
||||
yield return KanaRomanization.AnyVowel + " " + mora;
|
||||
}
|
||||
}
|
||||
|
||||
yield return lyric;
|
||||
|
||||
@@ -4,6 +4,7 @@ internal static class KanaRomanization
|
||||
{
|
||||
public const string StartVowel = "-";
|
||||
public const string SilenceConsonant = "-";
|
||||
public const string AnyVowel = "*";
|
||||
public const char AliasSeparator = ' ';
|
||||
|
||||
static readonly Dictionary<string, string> Table = new(StringComparer.Ordinal)
|
||||
@@ -48,6 +49,20 @@ internal static class KanaRomanization
|
||||
["ぐぁ"] = "gwa", ["ぐぃ"] = "gwi", ["ぐぇ"] = "gwe", ["ぐぉ"] = "gwo",
|
||||
};
|
||||
|
||||
static readonly Dictionary<string, string> RomajiAliases = new(StringComparer.Ordinal)
|
||||
{
|
||||
["si"] = "し", ["ti"] = "ち", ["tu"] = "つ", ["zi"] = "じ", ["hu"] = "ふ",
|
||||
["di"] = "ぢ", ["du"] = "づ", ["wo"] = "を",
|
||||
["sya"] = "しゃ", ["syu"] = "しゅ", ["syo"] = "しょ", ["sye"] = "しぇ",
|
||||
["shya"] = "しゃ", ["shyu"] = "しゅ", ["shyo"] = "しょ", ["shye"] = "しぇ",
|
||||
["tya"] = "ちゃ", ["tyu"] = "ちゅ", ["tyo"] = "ちょ", ["tye"] = "ちぇ",
|
||||
["cya"] = "ちゃ", ["cyu"] = "ちゅ", ["cyo"] = "ちょ", ["cye"] = "ちぇ",
|
||||
["chya"] = "ちゃ", ["chyu"] = "ちゅ", ["chyo"] = "ちょ", ["chye"] = "ちぇ",
|
||||
["zya"] = "じゃ", ["zyu"] = "じゅ", ["zyo"] = "じょ", ["zye"] = "じぇ",
|
||||
["jya"] = "じゃ", ["jyu"] = "じゅ", ["jyo"] = "じょ", ["jye"] = "じぇ",
|
||||
["dya"] = "ぢゃ", ["dyu"] = "ぢゅ", ["dyo"] = "ぢょ",
|
||||
};
|
||||
|
||||
static readonly char[] Vowels = ['a', 'i', 'u', 'e', 'o'];
|
||||
|
||||
static readonly Dictionary<string, string> Kana = BuildKana();
|
||||
@@ -74,6 +89,9 @@ internal static class KanaRomanization
|
||||
continue;
|
||||
kana[pair.Value] = pair.Key;
|
||||
}
|
||||
|
||||
foreach (var pair in RomajiAliases)
|
||||
kana[pair.Key] = pair.Value;
|
||||
return kana;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,11 +40,12 @@ internal static class Phonemizer
|
||||
continue;
|
||||
}
|
||||
|
||||
var entry = AliasResolver.Resolve(bank, note.Lyric, previousVowel, note.Tone, color, out var alias);
|
||||
var context = note.SuppressAutoVcv ? string.Empty : previousVowel;
|
||||
var entry = AliasResolver.Resolve(bank, note.Lyric, context, note.Tone, color, note.IgnorePrefixMap, out var alias);
|
||||
units.Add(new PhonemeUnit(note, entry, alias, start, length, start, length, note.Tone));
|
||||
|
||||
var vowel = KanaRomanization.GetVowel(note.Lyric);
|
||||
previousVowel = entry is null || vowel is null ? KanaRomanization.StartVowel : vowel;
|
||||
previousVowel = entry is null ? KanaRomanization.StartVowel : vowel ?? string.Empty;
|
||||
}
|
||||
|
||||
InsertTransitions(bank, units, color, options);
|
||||
@@ -64,6 +65,8 @@ internal static class Phonemizer
|
||||
var next = units[i + 1];
|
||||
if (current.IsSilent || next.IsSilent)
|
||||
continue;
|
||||
if (next.Alias.Contains(KanaRomanization.AliasSeparator))
|
||||
continue;
|
||||
|
||||
var vowel = KanaRomanization.GetVowel(current.Note.Lyric);
|
||||
var consonant = KanaRomanization.GetConsonant(next.Note.Lyric);
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
<UseWPF>true</UseWPF>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>1.1.0</Version>
|
||||
<Version>1.2.0</Version>
|
||||
<Platforms>AnyCPU;x64;x64</Platforms>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
|
||||
@@ -56,28 +56,28 @@ internal sealed class UTAUVoicePronounce : UndoRedoable, IVoicePronounce
|
||||
public string SourceText
|
||||
{
|
||||
get => sourceText;
|
||||
set => Set(ref sourceText, value ?? string.Empty);
|
||||
set => SetWithoutUndoRedo(ref sourceText, value ?? string.Empty);
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public string ImportMessage
|
||||
{
|
||||
get => importMessage;
|
||||
set => Set(ref importMessage, value ?? string.Empty);
|
||||
set => SetWithoutUndoRedo(ref importMessage, value ?? string.Empty);
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public string RenderMessage
|
||||
{
|
||||
get => renderMessage;
|
||||
set => Set(ref renderMessage, value ?? string.Empty);
|
||||
set => SetWithoutUndoRedo(ref renderMessage, value ?? string.Empty);
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public LipSyncFrame[]? LipSyncFrames
|
||||
{
|
||||
get => lipSyncFrames;
|
||||
set => Set(ref lipSyncFrames, value);
|
||||
set => SetWithoutUndoRedo(ref lipSyncFrames, value);
|
||||
}
|
||||
|
||||
public void BeginEdit()
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
using UTAU.Models;
|
||||
using UTAU.Notes;
|
||||
using YukkuriMovieMaker.Commons;
|
||||
@@ -33,6 +34,7 @@ internal sealed class NoteEditorViewModel : Bindable, IDisposable
|
||||
public const double MinimumFitSemitoneHeight = 10.0;
|
||||
|
||||
readonly UTAUVoicePronounce pronounce;
|
||||
readonly Dispatcher dispatcher;
|
||||
readonly ObservableCollection<UTAUNote> source;
|
||||
readonly List<NoteViewModel> selectedNotes = [];
|
||||
readonly List<NoteViewModel> transformTargets = [];
|
||||
@@ -77,6 +79,8 @@ internal sealed class NoteEditorViewModel : Bindable, IDisposable
|
||||
public NoteEditorViewModel(UTAUVoicePronounce pronounce)
|
||||
{
|
||||
this.pronounce = pronounce;
|
||||
dispatcher = Dispatcher.CurrentDispatcher;
|
||||
pronounce.PropertyChanged += OnPronouncePropertyChanged;
|
||||
source = pronounce.Notes;
|
||||
Notes = [.. source.Select(x => new NoteViewModel(x, this))];
|
||||
Notes.CollectionChanged += OnNotesChanged;
|
||||
@@ -407,10 +411,15 @@ internal sealed class NoteEditorViewModel : Bindable, IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
public void InvalidateMessages()
|
||||
void OnPronouncePropertyChanged(object? sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
OnPropertyChanged(nameof(ImportMessage));
|
||||
OnPropertyChanged(nameof(RenderMessage));
|
||||
if (e.PropertyName is not (nameof(UTAUVoicePronounce.ImportMessage) or nameof(UTAUVoicePronounce.RenderMessage)))
|
||||
return;
|
||||
|
||||
if (dispatcher.CheckAccess())
|
||||
OnPropertyChanged(e.PropertyName);
|
||||
else
|
||||
dispatcher.BeginInvoke(() => OnPropertyChanged(e.PropertyName));
|
||||
}
|
||||
|
||||
public void InvalidateTones()
|
||||
@@ -958,6 +967,7 @@ internal sealed class NoteEditorViewModel : Bindable, IDisposable
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
pronounce.PropertyChanged -= OnPronouncePropertyChanged;
|
||||
ObservePitchPoints(null);
|
||||
Notes.CollectionChanged -= OnNotesChanged;
|
||||
VisibleNotes.Clear();
|
||||
|
||||
+46
-37
@@ -36,43 +36,52 @@
|
||||
<RowDefinition Height="14"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Grid.Row="0" Grid.ColumnSpan="2" Orientation="Horizontal">
|
||||
<Button Width="26" Height="26" Command="{Binding ZoomOutCommand}" ToolTip="{x:Static root:Texts.ZoomOut}"
|
||||
Content="{DynamicResource {x:Static icons:IconKeys.MagnifyMinusOutline}}"/>
|
||||
<Button Width="26" Height="26" Command="{Binding ZoomInCommand}" ToolTip="{x:Static root:Texts.ZoomIn}"
|
||||
Content="{DynamicResource {x:Static icons:IconKeys.MagnifyPlusOutline}}"/>
|
||||
<Button Width="26" Height="26" Command="{Binding ZoomVerticalOutCommand}" ToolTip="{x:Static root:Texts.ZoomVerticalOut}"
|
||||
Content="{DynamicResource {x:Static icons:IconKeys.ArrowCollapseVertical}}"/>
|
||||
<Button Width="26" Height="26" Command="{Binding ZoomVerticalInCommand}" ToolTip="{x:Static root:Texts.ZoomVerticalIn}"
|
||||
Content="{DynamicResource {x:Static icons:IconKeys.ArrowExpandVertical}}"/>
|
||||
<Button Width="26" Height="26" Command="{Binding FitCommand}" ToolTip="{x:Static root:Texts.FitToWindow}"
|
||||
Content="{DynamicResource {x:Static icons:IconKeys.FitToScreenOutline}}"/>
|
||||
<Button Width="26" Height="26" Command="{Binding InsertRestCommand}" ToolTip="{x:Static root:Texts.InsertRest}"
|
||||
Content="{DynamicResource {x:Static icons:IconKeys.Plus}}"/>
|
||||
<Button Width="26" Height="26" Command="{Binding RemoveNoteCommand}" ToolTip="{x:Static root:Texts.RemoveNote}"
|
||||
Content="{DynamicResource {x:Static icons:IconKeys.Delete}}"/>
|
||||
<Button Width="26" Height="26" Command="{Binding SelectAllCommand}" ToolTip="{x:Static root:Texts.SelectAllNotes}"
|
||||
Content="{DynamicResource {x:Static icons:IconKeys.SelectAll}}"/>
|
||||
<TextBlock Text="{x:Static root:Texts.SnapLabel}" VerticalAlignment="Center" Margin="6,0,3,0"/>
|
||||
<ComboBox Width="88" Height="26" VerticalContentAlignment="Center"
|
||||
ItemsSource="{Binding SnapDivisions}"
|
||||
SelectedItem="{Binding SnapDivision}"
|
||||
DisplayMemberPath="Name"/>
|
||||
<TextBlock Text="{x:Static root:Texts.ExpressionLabel}" VerticalAlignment="Center" Margin="12,0,3,0"/>
|
||||
<ComboBox Width="110" Height="26" VerticalContentAlignment="Center"
|
||||
ItemsSource="{Binding Expressions}"
|
||||
SelectedItem="{Binding SelectedExpression}"
|
||||
DisplayMemberPath="Name"/>
|
||||
<Button Width="26" Height="26" Command="{Binding ResetExpressionCommand}" ToolTip="{x:Static root:Texts.ResetExpression}"
|
||||
Content="{DynamicResource {x:Static icons:IconKeys.Restore}}"/>
|
||||
<TextBlock Text="{Binding SelectionText}" VerticalAlignment="Center" Margin="12,0,0,0" Opacity="0.75"/>
|
||||
<TextBlock Text="{Binding GuideText}" VerticalAlignment="Center" Margin="12,0,0,0" Opacity="0.75"/>
|
||||
<TextBlock Text="{Binding ImportMessage}" VerticalAlignment="Center" Margin="12,0,0,0" Opacity="0.75"
|
||||
TextTrimming="CharacterEllipsis"/>
|
||||
<TextBlock Text="{Binding RenderMessage}" VerticalAlignment="Center" Margin="12,0,0,0"
|
||||
Foreground="{DynamicResource {x:Static theme:YMM4Colors.WarningBannerForegroundBrushKey}}"
|
||||
TextTrimming="CharacterEllipsis"/>
|
||||
</StackPanel>
|
||||
<Grid Grid.Row="0" Grid.ColumnSpan="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" Orientation="Horizontal">
|
||||
<Button Width="26" Height="26" Command="{Binding ZoomOutCommand}" ToolTip="{x:Static root:Texts.ZoomOut}"
|
||||
Content="{DynamicResource {x:Static icons:IconKeys.MagnifyMinusOutline}}"/>
|
||||
<Button Width="26" Height="26" Command="{Binding ZoomInCommand}" ToolTip="{x:Static root:Texts.ZoomIn}"
|
||||
Content="{DynamicResource {x:Static icons:IconKeys.MagnifyPlusOutline}}"/>
|
||||
<Button Width="26" Height="26" Command="{Binding ZoomVerticalOutCommand}" ToolTip="{x:Static root:Texts.ZoomVerticalOut}"
|
||||
Content="{DynamicResource {x:Static icons:IconKeys.ArrowCollapseVertical}}"/>
|
||||
<Button Width="26" Height="26" Command="{Binding ZoomVerticalInCommand}" ToolTip="{x:Static root:Texts.ZoomVerticalIn}"
|
||||
Content="{DynamicResource {x:Static icons:IconKeys.ArrowExpandVertical}}"/>
|
||||
<Button Width="26" Height="26" Command="{Binding FitCommand}" ToolTip="{x:Static root:Texts.FitToWindow}"
|
||||
Content="{DynamicResource {x:Static icons:IconKeys.FitToScreenOutline}}"/>
|
||||
<Button Width="26" Height="26" Command="{Binding InsertRestCommand}" ToolTip="{x:Static root:Texts.InsertRest}"
|
||||
Content="{DynamicResource {x:Static icons:IconKeys.Plus}}"/>
|
||||
<Button Width="26" Height="26" Command="{Binding RemoveNoteCommand}" ToolTip="{x:Static root:Texts.RemoveNote}"
|
||||
Content="{DynamicResource {x:Static icons:IconKeys.Delete}}"/>
|
||||
<Button Width="26" Height="26" Command="{Binding SelectAllCommand}" ToolTip="{x:Static root:Texts.SelectAllNotes}"
|
||||
Content="{DynamicResource {x:Static icons:IconKeys.SelectAll}}"/>
|
||||
<TextBlock Text="{x:Static root:Texts.SnapLabel}" VerticalAlignment="Center" Margin="6,0,3,0"/>
|
||||
<ComboBox Width="88" Height="26" VerticalContentAlignment="Center"
|
||||
ItemsSource="{Binding SnapDivisions}"
|
||||
SelectedItem="{Binding SnapDivision}"
|
||||
DisplayMemberPath="Name"/>
|
||||
<TextBlock Text="{x:Static root:Texts.ExpressionLabel}" VerticalAlignment="Center" Margin="12,0,3,0"/>
|
||||
<ComboBox Width="110" Height="26" VerticalContentAlignment="Center"
|
||||
ItemsSource="{Binding Expressions}"
|
||||
SelectedItem="{Binding SelectedExpression}"
|
||||
DisplayMemberPath="Name"/>
|
||||
<Button Width="26" Height="26" Command="{Binding ResetExpressionCommand}" ToolTip="{x:Static root:Texts.ResetExpression}"
|
||||
Content="{DynamicResource {x:Static icons:IconKeys.Restore}}"/>
|
||||
<TextBlock Text="{Binding SelectionText}" VerticalAlignment="Center" Margin="12,0,0,0" Opacity="0.75"/>
|
||||
<TextBlock Text="{Binding GuideText}" VerticalAlignment="Center" Margin="12,0,0,0" Opacity="0.75"/>
|
||||
</StackPanel>
|
||||
|
||||
<DockPanel Grid.Column="1">
|
||||
<TextBlock DockPanel.Dock="Right" Text="{Binding RenderMessage}" VerticalAlignment="Center" Margin="12,0,0,0"
|
||||
Foreground="{DynamicResource {x:Static theme:YMM4Colors.WarningBannerForegroundBrushKey}}"
|
||||
TextTrimming="CharacterEllipsis"/>
|
||||
<TextBlock Text="{Binding ImportMessage}" VerticalAlignment="Center" Margin="12,0,0,0" Opacity="0.75"
|
||||
TextTrimming="CharacterEllipsis"/>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
|
||||
<ScrollViewer x:Name="VerticalScroller" Grid.Row="1" Grid.Column="0"
|
||||
VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled"
|
||||
|
||||
@@ -80,11 +80,7 @@ public partial class NoteEditor : UserControl, IPropertyEditorControl
|
||||
|
||||
void Scroller_SizeChanged(object sender, SizeChangedEventArgs e) => UpdateFit();
|
||||
|
||||
void PopupButton_BeginEdit(object sender, EventArgs e)
|
||||
{
|
||||
ViewModel?.InvalidateMessages();
|
||||
BeginEdit?.Invoke(this, e);
|
||||
}
|
||||
void PopupButton_BeginEdit(object sender, EventArgs e) => BeginEdit?.Invoke(this, e);
|
||||
|
||||
void PopupButton_EndEdit(object sender, EventArgs e) => EndEdit?.Invoke(this, e);
|
||||
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする