コミットを比較
| 作成者 | SHA1 | 日付 | |
|---|---|---|---|
|
|
01fc7814b1
|
||
|
|
4e36bfe535
|
||
|
|
39408a7359
|
||
|
|
f9ff62307d
|
||
|
|
99adfa183b
|
検索条件に一致するファイルはありません
@@ -1,5 +1,5 @@
|
||||
========================================
|
||||
UTAU for YMM4 v1.1.1
|
||||
UTAU for YMM4 v1.2.0
|
||||
========================================
|
||||
YukkuriMovieMaker4(YMM4)上で動作する、UTAU 音源から歌声を合成する
|
||||
音声合成プラグインです。
|
||||
@@ -23,13 +23,15 @@ 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 か のような連続音の形とローマ字でも書けます。歌詞の
|
||||
最後の空白より後ろをかなへ戻して照合するため、連続音の譜面を単独音の音源で
|
||||
|
||||
@@ -86,12 +86,14 @@ YukkuriMovieMaker4(YMM4)上で動作する、UTAU 音源から歌声を合
|
||||
|
||||
セリフのかなを 1 モーラずつノートにします。拗音は前のかなとまとめ、「ー」は直前のノートを伸ばし、「っ」は短いノートにします。読点や中点や空白は短い休符に、句点や疑問符や感嘆符や改行は長い休符になります。既定では 1 モーラが 240 ティック、短い休符が 120 ティック、長い休符が 480 ティックです。
|
||||
|
||||
歌詞から原音設定のエイリアスを探すときは、直前の母音を付けた形を先に試し、続いて歌詞そのもの、ひらがな、カタカナ、モーラ、モーラのカタカナ、ローマ字の順に試します。それぞれについて、声色と音域に合う接頭辞と接尾辞、`prefix.map` の接頭辞と接尾辞、接頭辞と接尾辞なしの順に照合します。
|
||||
歌詞から原音設定のエイリアスを探すときは、歌詞そのもの、ひらがな、カタカナ、モーラ、モーラのカタカナ、ローマ字の順に形を作り、直前の母音を付けた形を先に、何も付けない形を後に試します。直前が実際の母音のときは、その間に `* 歌詞` と `* モーラ` も試します。`*` は直前の母音を問わない連続音のエイリアスで、OpenUtau と同じ規約です。それぞれについて、声色と音域に合う接頭辞と接尾辞、`prefix.map` の接頭辞と接尾辞、接頭辞と接尾辞なしの順に照合します。
|
||||
|
||||
モーラは、歌詞の最後の空白より後ろを取り出してかなへ寄せた形です。`a か` のような連続音の歌詞からは `か` を、`ka` のようなローマ字の歌詞からは `か` を取り出します。これにより、連続音で書かれた譜面を単独音の音源で歌わせたり、ローマ字で書かれた譜面をかなの音源で歌わせたりできます。ローマ字はヘボン式と訓令式のどちらでも読み、`si`・`ti`・`tu`・`zi`・`hu`・`wo` や `sya`・`tya`・`zya` のような綴りも対応するかなへ戻します。
|
||||
|
||||
連続音の歌詞に書かれた接頭辞よりも、実際の直前のノートの母音を優先します。`a あ` と書かれていても直前が `い` なら `i あ` を先に試します。
|
||||
|
||||
母音を持たない歌詞、たとえば CVVC の `a k` のようなノートの後では、直前の母音を付けた形を試しません。次のノートには語頭の `- き` ではなく `き` を当てます。
|
||||
|
||||
隣り合うノートの間には、前の母音と次の子音をつないだエイリアスがあれば差し込みます。長さは原音設定の先行発声に 30 ミリ秒を足した値で、前のノートの半分を上限とし、20 ミリ秒に満たないときは差し込みません。次のノートが `a か` のように前の母音を含むエイリアスへ解決したときは、そのエイリアスが渡りを含んでいるため差し込みません。最後の母音には、母音と `-` をつないだエイリアスがあれば 120 ミリ秒だけ足します。
|
||||
|
||||
### 3. UST ファイルの読み込み
|
||||
@@ -100,6 +102,8 @@ YukkuriMovieMaker4(YMM4)上で動作する、UTAU 音源から歌声を合
|
||||
|
||||
テンポ、ノートの長さ、歌詞、音程、子音速度、音量、モジュレーション、先行発声、オーバーラップ、開始位置、エンベロープ、ビブラート、`PBS`・`PBW`・`PBY`・`PBM` の音程曲線を取り込みます。音程の値は 0.1 半音として扱います。ノートごとのテンポ変化にも対応します。文字コードは `Charset` の指定と BOM と内容から判別します。
|
||||
|
||||
歌詞の先頭の `?` は `prefix.map` を無視し、`!` は直前の母音を付けた形を試しません。どちらも UTAU 本体と同じ意味です。歌詞は NFC で正規化し、連続する空白は半角空白 1 つにまとめるため、全角空白で書かれた連続音の歌詞もそのまま解決します。
|
||||
|
||||
前後の休符は取り除きます。取り込んだノートの数と、取り除いた休符の長さと、取り込めなかった旧式の音程の有無をノートエディターに表示します。UST を読み込んでいる間は、基準の音程・テンポ・モジュレーションのパラメータを表示しません。
|
||||
|
||||
### 4. ノートエディター
|
||||
@@ -115,7 +119,7 @@ YukkuriMovieMaker4(YMM4)上で動作する、UTAU 音源から歌声を合
|
||||
- 下の帯では、子音速度・音量・モジュレーションをノートごとの棒として、フォルマントと息の量を曲線として引いて編集できます。
|
||||
- 休符の挿入、ノートの削除、すべてのノートの選択、表示範囲に合わせる操作をボタンから行えます。
|
||||
- ノートは隙間なく並びます。間を空けるときは休符を挿入します。
|
||||
- 原音設定に見つからなかった歌詞があるときは、工具列の右端に警告として並びます。ノートエディターを開いたときの内容を表示します。
|
||||
- 原音設定に見つからなかった歌詞があるときは、工具列の右端に警告として並びます。ノートエディターを開いたままでも、合成をやり直すたびに書き換わります。
|
||||
- 編集内容は YMM4 の取り消しとやり直しに対応します。合成の結果として作られる情報は取り消しの対象になりません。
|
||||
|
||||
### 5. WORLD による合成
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
@@ -292,6 +304,63 @@ public sealed class PhonemizerTests : IDisposable
|
||||
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;
|
||||
@@ -125,6 +126,38 @@ public sealed class PronounceChangeNotificationTests
|
||||
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()
|
||||
{
|
||||
@@ -145,6 +178,8 @@ public sealed class PronounceChangeNotificationTests
|
||||
var note = new UTAUNote
|
||||
{
|
||||
Lyric = "か",
|
||||
IgnorePrefixMap = true,
|
||||
SuppressAutoVcv = true,
|
||||
Tone = 64,
|
||||
LengthTicks = 960,
|
||||
Velocity = 80.0,
|
||||
@@ -163,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);
|
||||
|
||||
@@ -85,7 +85,6 @@ public sealed class RenderMessageDisplayTests
|
||||
var host = Build(viewModel);
|
||||
|
||||
Task.Run(() => pronounce.RenderMessage = Warning).GetAwaiter().GetResult();
|
||||
viewModel.InvalidateMessages();
|
||||
Dispatcher.CurrentDispatcher.Invoke(() => { }, DispatcherPriority.Background);
|
||||
|
||||
return WarningBlock(host).Text;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
<UseWPF>true</UseWPF>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>1.1.1</Version>
|
||||
<Version>1.2.0</Version>
|
||||
<Platforms>AnyCPU;x64;x64</Platforms>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする