From 2fbe8cc0e7db6ee8166ce2cfbf6f7193e4ab113f Mon Sep 17 00:00:00 2001 From: oxygen-dioxide <54425948+oxygen-dioxide@users.noreply.github.com> Date: Fri, 20 Oct 2023 13:17:18 +0800 Subject: [PATCH 001/204] publish voicebank (unfinished) --- OpenUtau.Core/Classic/VoicebankPublisher.cs | 94 +++++++++++++++++++++ OpenUtau.Core/OpenUtau.Core.csproj | 1 + 2 files changed, 95 insertions(+) create mode 100644 OpenUtau.Core/Classic/VoicebankPublisher.cs diff --git a/OpenUtau.Core/Classic/VoicebankPublisher.cs b/OpenUtau.Core/Classic/VoicebankPublisher.cs new file mode 100644 index 000000000..9f90fbf68 --- /dev/null +++ b/OpenUtau.Core/Classic/VoicebankPublisher.cs @@ -0,0 +1,94 @@ +using Ignore; +using System; +using System.Collections.Generic; +using System.IO; +using SharpCompress.Archives.Zip; +using SharpCompress.Common; +using SharpCompress.Writers; +using System.Linq; + +using OpenUtau.Core.Ustx; + +namespace OpenUtau.Classic { + public class VoicebankPublisher { + private readonly Action progress; + private readonly Ignore.Ignore? ignore; + + public VoicebankPublisher(Action progress, string? gitIgnore) { + this.progress = progress; + if(gitIgnore != null) { + ignore = new Ignore.Ignore(); + ignore.Add(gitIgnore.Split("\n")); + } + } + + private static void ModifyConfig(USinger singer, Action modify) { + var yamlFile = Path.Combine(singer.Location, "character.yaml"); + VoicebankConfig? config = null; + if (File.Exists(yamlFile)) { + using (var stream = File.OpenRead(yamlFile)) { + config = VoicebankConfig.Load(stream); + } + } + if (config == null) { + config = new VoicebankConfig(); + } + modify(config); + using (var stream = File.Open(yamlFile, FileMode.Create)) { + config.Save(stream); + } + } + + private bool IsIgnored(string relativePath){ + return ignore?.IsIgnored(relativePath) ?? false; + } + + private List GetFilesToPack(string singerPath) + { + List fileList = Directory.EnumerateFiles(singerPath, "*.*", SearchOption.AllDirectories).ToList(); + List packList = fileList.FindAll(x => !(IsIgnored(System.IO.Path.GetRelativePath(singerPath, x)))); + return packList; + } + + public void Publish(USinger singer, string outputPath){ + /// + ///Compress a voicebank into an optimized zip archive for distribution. + ///This function only supports voicebanks that follow the classic packaging model, + ///including utau, enunu and diffsinger. + ///Vogen voicebanks aren't supported. + /// + var location = singer.Location; + if(!Directory.Exists(location)){ + return; + } + progress.Invoke(0, $"Publishing {singer.Name}"); + //Write singer type into character.yaml + try { + ModifyConfig(singer, config => config.SingerType = singer.SingerType.ToString().ToLower()); + } catch (Exception e) { } + var packList = GetFilesToPack(location); + int index = 0; + int fileCount = packList.Count(); + var options = new WriterOptions(compressionType: CompressionType.Deflate); + options.ArchiveEncoding = new ArchiveEncoding{ + Forced = System.Text.Encoding.UTF8 + }; + using(var archive = ZipArchive.Create()) + { + foreach (var absFilePath in packList) + { + index++; + progress.Invoke(100.0 * index / fileCount, $"Compressing {absFilePath}"); + string reFilePath = Path.GetRelativePath(location, absFilePath); + using(var inputStream = File.OpenRead(absFilePath)){ + archive.AddEntry(reFilePath, inputStream); + } + } + using(var outputStream = File.OpenWrite(outputPath)){ + archive.SaveTo(outputStream, options); + } + } + progress.Invoke(0, $"Published {singer.Name} to {outputPath}"); + } + } +} diff --git a/OpenUtau.Core/OpenUtau.Core.csproj b/OpenUtau.Core/OpenUtau.Core.csproj index 306b5e2e0..df1953711 100644 --- a/OpenUtau.Core/OpenUtau.Core.csproj +++ b/OpenUtau.Core/OpenUtau.Core.csproj @@ -10,6 +10,7 @@ + From 45b5748b5b63497f9dd4486b17ad07c3367cbb4f Mon Sep 17 00:00:00 2001 From: yqzhishen Date: Sun, 22 Oct 2023 14:49:10 +0800 Subject: [PATCH 002/204] Support tension as TENC (experimental) --- OpenUtau.Core/DiffSinger/DiffSingerConfig.cs | 6 +- .../DiffSinger/DiffSingerRenderer.cs | 16 +++- .../DiffSinger/DiffSingerVariance.cs | 74 +++++++++++++------ 3 files changed, 69 insertions(+), 27 deletions(-) diff --git a/OpenUtau.Core/DiffSinger/DiffSingerConfig.cs b/OpenUtau.Core/DiffSinger/DiffSingerConfig.cs index f75ce88dd..2be651944 100644 --- a/OpenUtau.Core/DiffSinger/DiffSingerConfig.cs +++ b/OpenUtau.Core/DiffSinger/DiffSingerConfig.cs @@ -23,7 +23,8 @@ public class DsConfig { public bool useKeyShiftEmbed = false; public bool useSpeedEmbed = false; public bool useEnergyEmbed = false; - public bool useBreathinessEmbed= false; + public bool useBreathinessEmbed = false; + public bool useTensionEmbed = false; public AugmentationArgs augmentationArgs; public bool useShallowDiffusion = false; public int maxDepth = -1; @@ -34,6 +35,9 @@ public class DsConfig { public int hop_size = 512; public int sample_rate = 44100; public bool predict_dur = true; + public bool predict_energy = true; + public bool predict_breathiness = true; + public bool predict_tension = false; public bool use_expr = false; public bool use_note_rest = false; public float frameMs(){ diff --git a/OpenUtau.Core/DiffSinger/DiffSingerRenderer.cs b/OpenUtau.Core/DiffSinger/DiffSingerRenderer.cs index 792c2aafb..12ab6b88e 100644 --- a/OpenUtau.Core/DiffSinger/DiffSingerRenderer.cs +++ b/OpenUtau.Core/DiffSinger/DiffSingerRenderer.cs @@ -29,6 +29,7 @@ public class DiffSingerRenderer : IRenderer { Format.Ustx.GENC, Format.Ustx.CLR, Format.Ustx.BREC, + Format.Ustx.TENC, VELC, ENE, PEXP, @@ -218,7 +219,7 @@ float[] InvokeDiffsinger(RenderPhrase phrase, int depth, int speedup) { } //Variance: Energy and Breathiness - if(singer.dsConfig.useBreathinessEmbed || singer.dsConfig.useEnergyEmbed){ + if(singer.dsConfig.useBreathinessEmbed || singer.dsConfig.useEnergyEmbed || singer.dsConfig.useTensionEmbed){ var varianceResult = singer.getVariancePredictor().Process(phrase); //TODO: let user edit variance curves if(singer.dsConfig.useEnergyEmbed){ @@ -231,7 +232,7 @@ float[] InvokeDiffsinger(RenderPhrase phrase, int depth, int speedup) { } else{ userEnergy = Enumerable.Repeat(0d, totalFrames); } - var energy = varianceResult.energy.Zip(userEnergy, (x,y)=>(float)Math.Min(x + y*12/100, 0)).ToArray(); + var energy = varianceResult.energy!.Zip(userEnergy, (x,y)=>(float)Math.Min(x + y*12/100, 0)).ToArray(); acousticInputs.Add(NamedOnnxValue.CreateFromTensor("energy", new DenseTensor(energy, new int[] { energy.Length }) .Reshape(new int[] { 1, energy.Length }))); @@ -240,11 +241,20 @@ float[] InvokeDiffsinger(RenderPhrase phrase, int depth, int speedup) { var userBreathiness = DiffSingerUtils.SampleCurve(phrase, phrase.breathiness, 0, frameMs, totalFrames, headFrames, tailFrames, x => x); - var breathiness = varianceResult.breathiness.Zip(userBreathiness, (x,y)=>(float)Math.Min(x + y*12/100, 0)).ToArray(); + var breathiness = varianceResult.breathiness!.Zip(userBreathiness, (x,y)=>(float)Math.Min(x + y*12/100, 0)).ToArray(); acousticInputs.Add(NamedOnnxValue.CreateFromTensor("breathiness", new DenseTensor(breathiness, new int[] { breathiness.Length }) .Reshape(new int[] { 1, breathiness.Length }))); } + if(singer.dsConfig.useTensionEmbed){ + var userTension = DiffSingerUtils.SampleCurve(phrase, phrase.tension, + 0, frameMs, totalFrames, headFrames, tailFrames, + x => x); + var tension = varianceResult.tension!.Zip(userTension, (x,y)=>(float)(x + y * 5 / 100)).ToArray(); + acousticInputs.Add(NamedOnnxValue.CreateFromTensor("tension", + new DenseTensor(tension, new int[] { tension.Length }) + .Reshape(new int[] { 1, tension.Length }))); + } } Tensor mel; diff --git a/OpenUtau.Core/DiffSinger/DiffSingerVariance.cs b/OpenUtau.Core/DiffSinger/DiffSingerVariance.cs index 853736f7f..cfaeefc33 100644 --- a/OpenUtau.Core/DiffSinger/DiffSingerVariance.cs +++ b/OpenUtau.Core/DiffSinger/DiffSingerVariance.cs @@ -14,8 +14,9 @@ namespace OpenUtau.Core.DiffSinger{ public struct VarianceResult{ - public float[] energy; - public float[] breathiness; + public float[]? energy; + public float[]? breathiness; + public float[]? tension; } public class DsVariance{ string rootPath; @@ -115,7 +116,7 @@ public VarianceResult Process(RenderPhrase phrase){ new DenseTensor(ph_dur.Select(x=>(Int64)x).ToArray(), new int[] { ph_dur.Length }, false) .Reshape(new int[] { 1, ph_dur.Length }))); } - + var linguisticOutputs = linguisticModel.Run(linguisticInputs); Tensor encoder_out = linguisticOutputs .Where(o => o.Name == "encoder_out") @@ -126,9 +127,6 @@ public VarianceResult Process(RenderPhrase phrase){ var pitch = DiffSingerUtils.SampleCurve(phrase, phrase.pitches, 0, frameMs, totalFrames, headFrames, tailFrames, x => x * 0.01) .Select(f => (float)f).ToArray(); - var energy = Enumerable.Repeat(0f, totalFrames).ToArray(); - var breathiness = Enumerable.Repeat(0f, totalFrames).ToArray(); - var retake = Enumerable.Repeat(true, totalFrames*2).ToArray(); var speedup = Preferences.Default.DiffsingerSpeedup; var varianceInputs = new List(); @@ -139,15 +137,34 @@ public VarianceResult Process(RenderPhrase phrase){ varianceInputs.Add(NamedOnnxValue.CreateFromTensor("pitch", new DenseTensor(pitch, new int[] { pitch.Length }, false) .Reshape(new int[] { 1, totalFrames }))); - varianceInputs.Add(NamedOnnxValue.CreateFromTensor("energy", - new DenseTensor(energy, new int[] { energy.Length }, false) - .Reshape(new int[] { 1, totalFrames }))); - varianceInputs.Add(NamedOnnxValue.CreateFromTensor("breathiness", - new DenseTensor(breathiness, new int[] { breathiness.Length }, false) - .Reshape(new int[] { 1, totalFrames }))); + if (dsConfig.predict_energy) { + var energy = Enumerable.Repeat(0f, totalFrames).ToArray(); + varianceInputs.Add(NamedOnnxValue.CreateFromTensor("energy", + new DenseTensor(energy, new int[] { energy.Length }, false) + .Reshape(new int[] { 1, totalFrames }))); + } + if (dsConfig.predict_breathiness) { + var breathiness = Enumerable.Repeat(0f, totalFrames).ToArray(); + varianceInputs.Add(NamedOnnxValue.CreateFromTensor("breathiness", + new DenseTensor(breathiness, new int[] { breathiness.Length }, false) + .Reshape(new int[] { 1, totalFrames }))); + } + if (dsConfig.predict_tension) { + var tension = Enumerable.Repeat(0f, totalFrames).ToArray(); + varianceInputs.Add(NamedOnnxValue.CreateFromTensor("tension", + new DenseTensor(tension, new int[] { tension.Length }, false) + .Reshape(new int[] { 1, totalFrames }))); + } + + var numVariances = new[] { + dsConfig.predict_energy, + dsConfig.predict_breathiness, + dsConfig.predict_tension, + }.Sum(Convert.ToInt32); + var retake = Enumerable.Repeat(true, totalFrames * numVariances).ToArray(); varianceInputs.Add(NamedOnnxValue.CreateFromTensor("retake", new DenseTensor(retake, new int[] { retake.Length }, false) - .Reshape(new int[] { 1, totalFrames, 2 }))); + .Reshape(new int[] { 1, totalFrames, numVariances }))); varianceInputs.Add(NamedOnnxValue.CreateFromTensor("speedup", new DenseTensor(new long[] { speedup }, new int[] { 1 },false))); //Speaker @@ -157,17 +174,28 @@ public VarianceResult Process(RenderPhrase phrase){ varianceInputs.Add(NamedOnnxValue.CreateFromTensor("spk_embed", spkEmbedTensor)); } var varianceOutputs = varianceModel.Run(varianceInputs); - Tensor energy_pred = varianceOutputs - .Where(o => o.Name == "energy_pred") - .First() - .AsTensor(); - Tensor breathiness_pred = varianceOutputs - .Where(o => o.Name == "breathiness_pred") - .First() - .AsTensor(); + Tensor? energy_pred = dsConfig.predict_energy + ? varianceOutputs + .Where(o => o.Name == "energy_pred") + .First() + .AsTensor() + : null; + Tensor? breathiness_pred = dsConfig.predict_breathiness + ? varianceOutputs + .Where(o => o.Name == "breathiness_pred") + .First() + .AsTensor() + : null; + Tensor? tension_pred = dsConfig.predict_tension + ? varianceOutputs + .Where(o => o.Name == "tension_pred") + .First() + .AsTensor() + : null; return new VarianceResult{ - energy = energy_pred.ToArray(), - breathiness = breathiness_pred.ToArray() + energy = energy_pred?.ToArray(), + breathiness = breathiness_pred?.ToArray(), + tension = tension_pred?.ToArray(), }; } } From de3edf8d1f241756619b999eca6d3b937824bd2f Mon Sep 17 00:00:00 2001 From: yqzhishen Date: Sun, 22 Oct 2023 00:24:59 +0800 Subject: [PATCH 003/204] Fix invalid tensor in memory when errors occur during *.emb loading --- OpenUtau.Core/DiffSinger/DiffSingerSpeakerEmbedManager.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/OpenUtau.Core/DiffSinger/DiffSingerSpeakerEmbedManager.cs b/OpenUtau.Core/DiffSinger/DiffSingerSpeakerEmbedManager.cs index 551d6c826..979d49dd7 100644 --- a/OpenUtau.Core/DiffSinger/DiffSingerSpeakerEmbedManager.cs +++ b/OpenUtau.Core/DiffSinger/DiffSingerSpeakerEmbedManager.cs @@ -37,10 +37,11 @@ public NDArray getSpeakerEmbeds() { if(dsConfig.speakers == null) { return null; } else { - speakerEmbeds = np.zeros(dsConfig.hiddenSize, dsConfig.speakers.Count); + var embeds = np.zeros(dsConfig.hiddenSize, dsConfig.speakers.Count); foreach(var spkId in Enumerable.Range(0, dsConfig.speakers.Count)) { - speakerEmbeds[":", spkId] = loadSpeakerEmbed(dsConfig.speakers[spkId]); + embeds[":", spkId] = loadSpeakerEmbed(dsConfig.speakers[spkId]); } + speakerEmbeds = embeds; } } return speakerEmbeds; From f4de0ed63847919c05e7ed993f311a7391a6e38a Mon Sep 17 00:00:00 2001 From: yqzhishen Date: Sun, 22 Oct 2023 01:26:21 +0800 Subject: [PATCH 004/204] Fix wrong logic to get rest note groups --- OpenUtau.Core/DiffSinger/DiffSingerPitch.cs | 22 +++++++-------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/OpenUtau.Core/DiffSinger/DiffSingerPitch.cs b/OpenUtau.Core/DiffSinger/DiffSingerPitch.cs index 7cbec606d..22177a696 100644 --- a/OpenUtau.Core/DiffSinger/DiffSingerPitch.cs +++ b/OpenUtau.Core/DiffSinger/DiffSingerPitch.cs @@ -162,21 +162,13 @@ public RenderPitchResult Process(RenderPhrase phrase){ .Prepend((float)phrase.notes[0].tone) .ToArray(); //get the index of groups of consecutive rest notes - int restGroupStart = 0; - var restGroups = new List>{}; - foreach(int noteIndex in Enumerable.Range(1,note_rest.Count - 1)) { - if(!note_rest[noteIndex-1] && note_rest[noteIndex]) { - //start a new rest group - restGroupStart = noteIndex; - } - if(note_rest[noteIndex-1] && !note_rest[noteIndex]) { - //end the current rest group - restGroups.Add(new Tuple(restGroupStart,noteIndex)); - } - } - if(!note_rest[^1]) { - //end the last rest group - restGroups.Add(new Tuple(restGroupStart,note_rest.Count)); + var restGroups = new List>(); + for (var i = 0; i < note_rest.Count; ++i) { + if (!note_rest[i]) continue; + var j = i + 1; + for (; j < note_rest.Count && note_rest[j]; ++j) { } + restGroups.Add(new Tuple(i, j)); + i = j; } //Set tone for each rest group foreach(var restGroup in restGroups){ From 3dfb8f4e7378a6003cc53e976bdcb7ec720c7092 Mon Sep 17 00:00:00 2001 From: rokujyushi Date: Sun, 26 Nov 2023 19:07:21 +0900 Subject: [PATCH 005/204] =?UTF-8?q?lab=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB?= =?UTF-8?q?=E3=82=A8=E3=82=AF=E3=82=B9=E3=83=9D=E3=83=BC=E3=83=88=E6=A9=9F?= =?UTF-8?q?=E8=83=BD=E8=BF=BD=E5=8A=A0=E4=B8=AD=20ENUNU=E3=81=AE=E4=B8=80?= =?UTF-8?q?=E9=83=A8=E4=BB=95=E6=A7=98=E3=82=92DiffSinger=E3=81=AB?= =?UTF-8?q?=E5=90=88=E3=81=9B=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OpenUtau.Core/Enunu/EnunuRenderer.cs | 14 ++--- OpenUtau.Core/Enunu/EnunuUtils.cs | 2 + OpenUtau.Core/Format/Lab.cs | 87 ++++++++++++++++++++++++++++ OpenUtau/FilePicker.cs | 3 + OpenUtau/Strings/Strings.axaml | 2 + OpenUtau/Strings/Strings.ja-JP.axaml | 2 + OpenUtau/Views/MainWindow.axaml | 2 + OpenUtau/Views/MainWindow.axaml.cs | 36 ++++++++++++ 8 files changed, 140 insertions(+), 8 deletions(-) create mode 100644 OpenUtau.Core/Format/Lab.cs diff --git a/OpenUtau.Core/Enunu/EnunuRenderer.cs b/OpenUtau.Core/Enunu/EnunuRenderer.cs index d5545f86a..fed3b84ff 100644 --- a/OpenUtau.Core/Enunu/EnunuRenderer.cs +++ b/OpenUtau.Core/Enunu/EnunuRenderer.cs @@ -14,8 +14,6 @@ namespace OpenUtau.Core.Enunu { public class EnunuRenderer : IRenderer { - public const int headTicks = 240; - public const int tailTicks = 240; static readonly HashSet supportedExp = new HashSet(){ Format.Ustx.DYN, @@ -59,8 +57,8 @@ public bool SupportsExpression(UExpressionDescriptor descriptor) { } public RenderResult Layout(RenderPhrase phrase) { - var headMs = phrase.positionMs - phrase.timeAxis.TickPosToMsPos(phrase.position - headTicks); - var tailMs = phrase.timeAxis.TickPosToMsPos(phrase.end + tailTicks) - phrase.endMs; + var headMs = phrase.positionMs - phrase.timeAxis.TickPosToMsPos(phrase.position - EnunuUtils.headTicks); + var tailMs = phrase.timeAxis.TickPosToMsPos(phrase.end + EnunuUtils.tailTicks) - phrase.endMs; return new RenderResult() { leadingMs = headMs, positionMs = phrase.positionMs, @@ -113,8 +111,8 @@ public Task Render(RenderPhrase phrase, Progress progress, int tra var sp = np.Load(spPath); var ap = np.Load(apPath); int totalFrames = f0.Length; - var headMs = phrase.positionMs - phrase.timeAxis.TickPosToMsPos(phrase.position - headTicks); - var tailMs = phrase.timeAxis.TickPosToMsPos(phrase.end + tailTicks) - phrase.endMs; + var headMs = phrase.positionMs - phrase.timeAxis.TickPosToMsPos(phrase.position - EnunuUtils.headTicks); + var tailMs = phrase.timeAxis.TickPosToMsPos(phrase.end + EnunuUtils.tailTicks) - phrase.endMs; int headFrames = (int)Math.Round(headMs / config.framePeriod); int tailFrames = (int)Math.Round(tailMs / config.framePeriod); var editorF0 = SampleCurve(phrase, phrase.pitches, 0, config.framePeriod, totalFrames, headFrames, tailFrames, x => MusicMath.ToneToFreq(x * 0.01)); @@ -209,7 +207,7 @@ static EnunuNote[] PhraseToEnunuNotes(RenderPhrase phrase) { var notes = new List(); notes.Add(new EnunuNote { lyric = "R", - length = headTicks, + length = EnunuUtils.headTicks, noteNum = 60, }); foreach (var phone in phrase.phones) { @@ -222,7 +220,7 @@ static EnunuNote[] PhraseToEnunuNotes(RenderPhrase phrase) { } notes.Add(new EnunuNote { lyric = "R", - length = tailTicks, + length = EnunuUtils.tailTicks, noteNum = 60, }); return notes.ToArray(); diff --git a/OpenUtau.Core/Enunu/EnunuUtils.cs b/OpenUtau.Core/Enunu/EnunuUtils.cs index b5bb15b4e..ba63e9057 100644 --- a/OpenUtau.Core/Enunu/EnunuUtils.cs +++ b/OpenUtau.Core/Enunu/EnunuUtils.cs @@ -15,6 +15,8 @@ public struct EnunuNote { internal static class EnunuUtils { static readonly Encoding ShiftJIS = Encoding.GetEncoding("shift_jis"); + public const int headTicks = 240; + public const int tailTicks = 240; internal static void WriteUst(IList notes, double tempo, USinger singer, string ustPath) { using (var writer = new StreamWriter(ustPath, false, ShiftJIS)) { diff --git a/OpenUtau.Core/Format/Lab.cs b/OpenUtau.Core/Format/Lab.cs new file mode 100644 index 000000000..f9327b7d0 --- /dev/null +++ b/OpenUtau.Core/Format/Lab.cs @@ -0,0 +1,87 @@ +using System; +using System.IO; +using System.Linq; +using System.Text; +using Format; +using OpenUtau.Core.DiffSinger; +using OpenUtau.Core.Enunu; +using OpenUtau.Core.Render; +using OpenUtau.Core.Ustx; + +namespace Format { + public class Lab { + + public double offsetMs; + public string[] ph_seq; + public double[] phDurMs; + public double frameMs; + public double preMs =0; + + + + public Lab(RenderPhrase phrase) { + + var notes = phrase.notes; + var phones = phrase.phones; + double headMs = 0; + double tailMs = 0; + string silentstr = "pan"; + + if (phrase.singer.SingerType.Equals(USingerType.Enunu)) { + headMs = phrase.positionMs - phrase.timeAxis.TickPosToMsPos(phrase.position - EnunuUtils.headTicks); + tailMs = phrase.timeAxis.TickPosToMsPos(phrase.end + EnunuUtils.tailTicks) - phrase.endMs; + frameMs = 10; + } else if (phrase.singer.SingerType.Equals(USingerType.DiffSinger)) { + headMs = DiffSingerUtils.headMs; + tailMs = DiffSingerUtils.tailMs; + frameMs = 10; + } else { + return; + } + ph_seq = phones + .Select(p => p.phoneme) + .Prepend(silentstr) + .Append(silentstr) + .ToArray(); + phDurMs = phones + .Select(p => p.durationMs) + .Prepend(headMs) + .Append(tailMs) + .ToArray(); + + int headFrames = (int)(headMs / frameMs); + int tailFrames = (int)(tailMs / frameMs); + var totalFrames = (int)(phDurMs.Sum() / frameMs); + offsetMs = phrase.phones[0].positionMs - headMs; + } + + public RawLab toRaw() { + var labRow = new RawLab(this); + preMs = labRow.ph_start + labRow.ph_end; + return labRow; + } + + static public void SavePart(UProject project, UVoicePart part, string filePath) { + var LabList = RenderPhrase.FromPart(project, project.tracks[part.trackNo], part) + .Select(x => new Lab(x)) + .ToArray(); + RawLab[] ScriptArray = new RawLab[LabList.Count()]; + for (int j = 1; j < LabList.Count(); j++) { + ScriptArray = LabList.Select(x => x.toRaw()).ToArray(); + } + File.WriteAllText(filePath, ScriptArray.Select(A => String.Join(A.ph_start.ToString(), " ", A.ph_end.ToString(), " ", A.ph_seq)).ToString(), + new UTF8Encoding(false)); + } + } +} +public class RawLab { + public string ph_seq; + public double ph_start; + public double ph_end; + + public RawLab(Lab script) { + ph_seq = script.ph_seq; + ph_start = script.preMs; + ph_end = double.Parse(script.phDurMs.Select(x => x).ToString()); + } +} diff --git a/OpenUtau/FilePicker.cs b/OpenUtau/FilePicker.cs index def25c868..961b84223 100644 --- a/OpenUtau/FilePicker.cs +++ b/OpenUtau/FilePicker.cs @@ -44,6 +44,9 @@ internal class FilePicker { public static FilePickerFileType DS { get; } = new("DS") { Patterns = new[] { "*.ds" }, }; + public static FilePickerFileType LAB { get; } = new("LAB") { + Patterns = new[] { "*.lab" }, + }; public async static Task OpenFile( Window window, string titleKey, params FilePickerFileType[] types) { diff --git a/OpenUtau/Strings/Strings.axaml b/OpenUtau/Strings/Strings.axaml index 195597b30..505aed817 100644 --- a/OpenUtau/Strings/Strings.axaml +++ b/OpenUtau/Strings/Strings.axaml @@ -105,6 +105,8 @@ Export DiffSinger Scripts To Export DiffSinger Scripts To (v2) Export DiffSinger Scripts To (v2, without pitch curve) + Export Lab File To + Export Lab And Wav File To Export Midi File Mixdown To Wav File Export Project diff --git a/OpenUtau/Strings/Strings.ja-JP.axaml b/OpenUtau/Strings/Strings.ja-JP.axaml index 1671598b9..b4c13786d 100644 --- a/OpenUtau/Strings/Strings.ja-JP.axaml +++ b/OpenUtau/Strings/Strings.ja-JP.axaml @@ -99,6 +99,8 @@ ファイル OpenUTAUを終了 音声をエクスポート + Labファイルをエクスポート + LabとWavファイルをエクスポート MIDIをエクスポート ミックスダウンしたWavファイルを出力 プロジェクトファイルをエクスポート diff --git a/OpenUtau/Views/MainWindow.axaml b/OpenUtau/Views/MainWindow.axaml index 9969385f1..123481a00 100644 --- a/OpenUtau/Views/MainWindow.axaml +++ b/OpenUtau/Views/MainWindow.axaml @@ -61,6 +61,8 @@ + + diff --git a/OpenUtau/Views/MainWindow.axaml.cs b/OpenUtau/Views/MainWindow.axaml.cs index a76d4c080..bdf32a632 100644 --- a/OpenUtau/Views/MainWindow.axaml.cs +++ b/OpenUtau/Views/MainWindow.axaml.cs @@ -23,6 +23,8 @@ using Point = Avalonia.Point; using OpenUtau.Core.DiffSinger; +using Format; +using System.Collections.Generic; namespace OpenUtau.App.Views { public partial class MainWindow : Window, ICmdSubscriber { @@ -401,6 +403,40 @@ async void OnMenuExportDsV2WithoutPitchTo(object sender, RoutedEventArgs e) { } } + async void OnMenuExportLabTo(object sender, RoutedEventArgs e) { + var project = DocManager.Inst.Project; + var file = await FilePicker.SaveFile( + this, "menu.file.exportlab", FilePicker.LAB); + if (!string.IsNullOrEmpty(file)) { + for (var i = 0; i < project.parts.Count; i++) { + var part = project.parts[i]; + if (part is UVoicePart voicePart) { + var savePath = PathManager.Inst.GetPartSavePath(file, voicePart.DisplayName, i)[..^4] + ".lab"; + Lab.SavePart(project, voicePart, savePath); + DocManager.Inst.ExecuteCmd(new ProgressBarNotification(0, $"{savePath}.")); + } + } + } + } + + async void OnMenuExportLabAndWavTo(object sender, RoutedEventArgs e) { + var project = DocManager.Inst.Project; + var file = await FilePicker.SaveFile( + this, "menu.file.exportlabandwav", FilePicker.WAV); + if (!string.IsNullOrEmpty(file)) { + List paths = new List(); + for (var i = 0; i < project.parts.Count; i++) { + var part = project.parts[i]; + if (part is UVoicePart voicePart) { + paths.Add(PathManager.Inst.GetExportPath(file, project.tracks[i])[..^4]); + Lab.SavePart(project, voicePart, paths[i] + ".lab"); + DocManager.Inst.ExecuteCmd(new ProgressBarNotification(0, $"{paths[i] + ".lab"}.")); + } + } + PlaybackManager.Inst.RenderToFiles(project, file + ".wav"); + } + } + async void OnMenuExportUst(object sender, RoutedEventArgs e) { var project = DocManager.Inst.Project; if (await WarnToSave(project)) { From 3e0697123bb3e5d073211cc4ad6d1ac97a6d393d Mon Sep 17 00:00:00 2001 From: rokujyushi Date: Thu, 30 Nov 2023 01:35:45 +0900 Subject: [PATCH 006/204] =?UTF-8?q?Revert=20"lab=E3=83=95=E3=82=A1?= =?UTF-8?q?=E3=82=A4=E3=83=AB=E3=82=A8=E3=82=AF=E3=82=B9=E3=83=9D=E3=83=BC?= =?UTF-8?q?=E3=83=88=E6=A9=9F=E8=83=BD=E8=BF=BD=E5=8A=A0=E4=B8=AD"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 3dfb8f4e7378a6003cc53e976bdcb7ec720c7092. --- OpenUtau.Core/Enunu/EnunuRenderer.cs | 14 +++-- OpenUtau.Core/Enunu/EnunuUtils.cs | 2 - OpenUtau.Core/Format/Lab.cs | 87 ---------------------------- OpenUtau/FilePicker.cs | 3 - OpenUtau/Strings/Strings.axaml | 2 - OpenUtau/Strings/Strings.ja-JP.axaml | 2 - OpenUtau/Views/MainWindow.axaml | 2 - OpenUtau/Views/MainWindow.axaml.cs | 36 ------------ 8 files changed, 8 insertions(+), 140 deletions(-) delete mode 100644 OpenUtau.Core/Format/Lab.cs diff --git a/OpenUtau.Core/Enunu/EnunuRenderer.cs b/OpenUtau.Core/Enunu/EnunuRenderer.cs index fed3b84ff..d5545f86a 100644 --- a/OpenUtau.Core/Enunu/EnunuRenderer.cs +++ b/OpenUtau.Core/Enunu/EnunuRenderer.cs @@ -14,6 +14,8 @@ namespace OpenUtau.Core.Enunu { public class EnunuRenderer : IRenderer { + public const int headTicks = 240; + public const int tailTicks = 240; static readonly HashSet supportedExp = new HashSet(){ Format.Ustx.DYN, @@ -57,8 +59,8 @@ public bool SupportsExpression(UExpressionDescriptor descriptor) { } public RenderResult Layout(RenderPhrase phrase) { - var headMs = phrase.positionMs - phrase.timeAxis.TickPosToMsPos(phrase.position - EnunuUtils.headTicks); - var tailMs = phrase.timeAxis.TickPosToMsPos(phrase.end + EnunuUtils.tailTicks) - phrase.endMs; + var headMs = phrase.positionMs - phrase.timeAxis.TickPosToMsPos(phrase.position - headTicks); + var tailMs = phrase.timeAxis.TickPosToMsPos(phrase.end + tailTicks) - phrase.endMs; return new RenderResult() { leadingMs = headMs, positionMs = phrase.positionMs, @@ -111,8 +113,8 @@ public Task Render(RenderPhrase phrase, Progress progress, int tra var sp = np.Load(spPath); var ap = np.Load(apPath); int totalFrames = f0.Length; - var headMs = phrase.positionMs - phrase.timeAxis.TickPosToMsPos(phrase.position - EnunuUtils.headTicks); - var tailMs = phrase.timeAxis.TickPosToMsPos(phrase.end + EnunuUtils.tailTicks) - phrase.endMs; + var headMs = phrase.positionMs - phrase.timeAxis.TickPosToMsPos(phrase.position - headTicks); + var tailMs = phrase.timeAxis.TickPosToMsPos(phrase.end + tailTicks) - phrase.endMs; int headFrames = (int)Math.Round(headMs / config.framePeriod); int tailFrames = (int)Math.Round(tailMs / config.framePeriod); var editorF0 = SampleCurve(phrase, phrase.pitches, 0, config.framePeriod, totalFrames, headFrames, tailFrames, x => MusicMath.ToneToFreq(x * 0.01)); @@ -207,7 +209,7 @@ static EnunuNote[] PhraseToEnunuNotes(RenderPhrase phrase) { var notes = new List(); notes.Add(new EnunuNote { lyric = "R", - length = EnunuUtils.headTicks, + length = headTicks, noteNum = 60, }); foreach (var phone in phrase.phones) { @@ -220,7 +222,7 @@ static EnunuNote[] PhraseToEnunuNotes(RenderPhrase phrase) { } notes.Add(new EnunuNote { lyric = "R", - length = EnunuUtils.tailTicks, + length = tailTicks, noteNum = 60, }); return notes.ToArray(); diff --git a/OpenUtau.Core/Enunu/EnunuUtils.cs b/OpenUtau.Core/Enunu/EnunuUtils.cs index ba63e9057..b5bb15b4e 100644 --- a/OpenUtau.Core/Enunu/EnunuUtils.cs +++ b/OpenUtau.Core/Enunu/EnunuUtils.cs @@ -15,8 +15,6 @@ public struct EnunuNote { internal static class EnunuUtils { static readonly Encoding ShiftJIS = Encoding.GetEncoding("shift_jis"); - public const int headTicks = 240; - public const int tailTicks = 240; internal static void WriteUst(IList notes, double tempo, USinger singer, string ustPath) { using (var writer = new StreamWriter(ustPath, false, ShiftJIS)) { diff --git a/OpenUtau.Core/Format/Lab.cs b/OpenUtau.Core/Format/Lab.cs deleted file mode 100644 index f9327b7d0..000000000 --- a/OpenUtau.Core/Format/Lab.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System; -using System.IO; -using System.Linq; -using System.Text; -using Format; -using OpenUtau.Core.DiffSinger; -using OpenUtau.Core.Enunu; -using OpenUtau.Core.Render; -using OpenUtau.Core.Ustx; - -namespace Format { - public class Lab { - - public double offsetMs; - public string[] ph_seq; - public double[] phDurMs; - public double frameMs; - public double preMs =0; - - - - public Lab(RenderPhrase phrase) { - - var notes = phrase.notes; - var phones = phrase.phones; - double headMs = 0; - double tailMs = 0; - string silentstr = "pan"; - - if (phrase.singer.SingerType.Equals(USingerType.Enunu)) { - headMs = phrase.positionMs - phrase.timeAxis.TickPosToMsPos(phrase.position - EnunuUtils.headTicks); - tailMs = phrase.timeAxis.TickPosToMsPos(phrase.end + EnunuUtils.tailTicks) - phrase.endMs; - frameMs = 10; - } else if (phrase.singer.SingerType.Equals(USingerType.DiffSinger)) { - headMs = DiffSingerUtils.headMs; - tailMs = DiffSingerUtils.tailMs; - frameMs = 10; - } else { - return; - } - ph_seq = phones - .Select(p => p.phoneme) - .Prepend(silentstr) - .Append(silentstr) - .ToArray(); - phDurMs = phones - .Select(p => p.durationMs) - .Prepend(headMs) - .Append(tailMs) - .ToArray(); - - int headFrames = (int)(headMs / frameMs); - int tailFrames = (int)(tailMs / frameMs); - var totalFrames = (int)(phDurMs.Sum() / frameMs); - offsetMs = phrase.phones[0].positionMs - headMs; - } - - public RawLab toRaw() { - var labRow = new RawLab(this); - preMs = labRow.ph_start + labRow.ph_end; - return labRow; - } - - static public void SavePart(UProject project, UVoicePart part, string filePath) { - var LabList = RenderPhrase.FromPart(project, project.tracks[part.trackNo], part) - .Select(x => new Lab(x)) - .ToArray(); - RawLab[] ScriptArray = new RawLab[LabList.Count()]; - for (int j = 1; j < LabList.Count(); j++) { - ScriptArray = LabList.Select(x => x.toRaw()).ToArray(); - } - File.WriteAllText(filePath, ScriptArray.Select(A => String.Join(A.ph_start.ToString(), " ", A.ph_end.ToString(), " ", A.ph_seq)).ToString(), - new UTF8Encoding(false)); - } - } -} -public class RawLab { - public string ph_seq; - public double ph_start; - public double ph_end; - - public RawLab(Lab script) { - ph_seq = script.ph_seq; - ph_start = script.preMs; - ph_end = double.Parse(script.phDurMs.Select(x => x).ToString()); - } -} diff --git a/OpenUtau/FilePicker.cs b/OpenUtau/FilePicker.cs index 961b84223..def25c868 100644 --- a/OpenUtau/FilePicker.cs +++ b/OpenUtau/FilePicker.cs @@ -44,9 +44,6 @@ internal class FilePicker { public static FilePickerFileType DS { get; } = new("DS") { Patterns = new[] { "*.ds" }, }; - public static FilePickerFileType LAB { get; } = new("LAB") { - Patterns = new[] { "*.lab" }, - }; public async static Task OpenFile( Window window, string titleKey, params FilePickerFileType[] types) { diff --git a/OpenUtau/Strings/Strings.axaml b/OpenUtau/Strings/Strings.axaml index 505aed817..195597b30 100644 --- a/OpenUtau/Strings/Strings.axaml +++ b/OpenUtau/Strings/Strings.axaml @@ -105,8 +105,6 @@ Export DiffSinger Scripts To Export DiffSinger Scripts To (v2) Export DiffSinger Scripts To (v2, without pitch curve) - Export Lab File To - Export Lab And Wav File To Export Midi File Mixdown To Wav File Export Project diff --git a/OpenUtau/Strings/Strings.ja-JP.axaml b/OpenUtau/Strings/Strings.ja-JP.axaml index b4c13786d..1671598b9 100644 --- a/OpenUtau/Strings/Strings.ja-JP.axaml +++ b/OpenUtau/Strings/Strings.ja-JP.axaml @@ -99,8 +99,6 @@ ファイル OpenUTAUを終了 音声をエクスポート - Labファイルをエクスポート - LabとWavファイルをエクスポート MIDIをエクスポート ミックスダウンしたWavファイルを出力 プロジェクトファイルをエクスポート diff --git a/OpenUtau/Views/MainWindow.axaml b/OpenUtau/Views/MainWindow.axaml index 123481a00..9969385f1 100644 --- a/OpenUtau/Views/MainWindow.axaml +++ b/OpenUtau/Views/MainWindow.axaml @@ -61,8 +61,6 @@ - - diff --git a/OpenUtau/Views/MainWindow.axaml.cs b/OpenUtau/Views/MainWindow.axaml.cs index bdf32a632..a76d4c080 100644 --- a/OpenUtau/Views/MainWindow.axaml.cs +++ b/OpenUtau/Views/MainWindow.axaml.cs @@ -23,8 +23,6 @@ using Point = Avalonia.Point; using OpenUtau.Core.DiffSinger; -using Format; -using System.Collections.Generic; namespace OpenUtau.App.Views { public partial class MainWindow : Window, ICmdSubscriber { @@ -403,40 +401,6 @@ async void OnMenuExportDsV2WithoutPitchTo(object sender, RoutedEventArgs e) { } } - async void OnMenuExportLabTo(object sender, RoutedEventArgs e) { - var project = DocManager.Inst.Project; - var file = await FilePicker.SaveFile( - this, "menu.file.exportlab", FilePicker.LAB); - if (!string.IsNullOrEmpty(file)) { - for (var i = 0; i < project.parts.Count; i++) { - var part = project.parts[i]; - if (part is UVoicePart voicePart) { - var savePath = PathManager.Inst.GetPartSavePath(file, voicePart.DisplayName, i)[..^4] + ".lab"; - Lab.SavePart(project, voicePart, savePath); - DocManager.Inst.ExecuteCmd(new ProgressBarNotification(0, $"{savePath}.")); - } - } - } - } - - async void OnMenuExportLabAndWavTo(object sender, RoutedEventArgs e) { - var project = DocManager.Inst.Project; - var file = await FilePicker.SaveFile( - this, "menu.file.exportlabandwav", FilePicker.WAV); - if (!string.IsNullOrEmpty(file)) { - List paths = new List(); - for (var i = 0; i < project.parts.Count; i++) { - var part = project.parts[i]; - if (part is UVoicePart voicePart) { - paths.Add(PathManager.Inst.GetExportPath(file, project.tracks[i])[..^4]); - Lab.SavePart(project, voicePart, paths[i] + ".lab"); - DocManager.Inst.ExecuteCmd(new ProgressBarNotification(0, $"{paths[i] + ".lab"}.")); - } - } - PlaybackManager.Inst.RenderToFiles(project, file + ".wav"); - } - } - async void OnMenuExportUst(object sender, RoutedEventArgs e) { var project = DocManager.Inst.Project; if (await WarnToSave(project)) { From de32b157fcffa8afd04042f0c74c692b7d6038d3 Mon Sep 17 00:00:00 2001 From: oxygen-dioxide <54425948+oxygen-dioxide@users.noreply.github.com> Date: Wed, 10 Jan 2024 08:28:20 +0800 Subject: [PATCH 007/204] move all diffsinger phonemizers to a subfolder --- .../DiffSinger/{ => Phonemizers}/DiffSingerBasePhonemizer.cs | 0 .../DiffSinger/{ => Phonemizers}/DiffSingerChinesePhonemizer.cs | 0 .../DiffSinger/{ => Phonemizers}/DiffSingerEnglishPhonemizer.cs | 0 .../DiffSinger/{ => Phonemizers}/DiffSingerG2pPhonemizer.cs | 0 .../DiffSinger/{ => Phonemizers}/DiffSingerJyutpingPhonemizer.cs | 0 .../DiffSinger/{ => Phonemizers}/DiffSingerPhonemizer.cs | 0 .../{ => Phonemizers}/DiffSingerPortuguesePhonemizer.cs | 0 .../{ => Phonemizers}/DiffSingerRhythmizerPhonemizer.cs | 0 .../DiffSinger/{ => Phonemizers}/DiffSingerRussianPhonemizer.cs | 0 9 files changed, 0 insertions(+), 0 deletions(-) rename OpenUtau.Core/DiffSinger/{ => Phonemizers}/DiffSingerBasePhonemizer.cs (100%) rename OpenUtau.Core/DiffSinger/{ => Phonemizers}/DiffSingerChinesePhonemizer.cs (100%) rename OpenUtau.Core/DiffSinger/{ => Phonemizers}/DiffSingerEnglishPhonemizer.cs (100%) rename OpenUtau.Core/DiffSinger/{ => Phonemizers}/DiffSingerG2pPhonemizer.cs (100%) rename OpenUtau.Core/DiffSinger/{ => Phonemizers}/DiffSingerJyutpingPhonemizer.cs (100%) rename OpenUtau.Core/DiffSinger/{ => Phonemizers}/DiffSingerPhonemizer.cs (100%) rename OpenUtau.Core/DiffSinger/{ => Phonemizers}/DiffSingerPortuguesePhonemizer.cs (100%) rename OpenUtau.Core/DiffSinger/{ => Phonemizers}/DiffSingerRhythmizerPhonemizer.cs (100%) rename OpenUtau.Core/DiffSinger/{ => Phonemizers}/DiffSingerRussianPhonemizer.cs (100%) diff --git a/OpenUtau.Core/DiffSinger/DiffSingerBasePhonemizer.cs b/OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerBasePhonemizer.cs similarity index 100% rename from OpenUtau.Core/DiffSinger/DiffSingerBasePhonemizer.cs rename to OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerBasePhonemizer.cs diff --git a/OpenUtau.Core/DiffSinger/DiffSingerChinesePhonemizer.cs b/OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerChinesePhonemizer.cs similarity index 100% rename from OpenUtau.Core/DiffSinger/DiffSingerChinesePhonemizer.cs rename to OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerChinesePhonemizer.cs diff --git a/OpenUtau.Core/DiffSinger/DiffSingerEnglishPhonemizer.cs b/OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerEnglishPhonemizer.cs similarity index 100% rename from OpenUtau.Core/DiffSinger/DiffSingerEnglishPhonemizer.cs rename to OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerEnglishPhonemizer.cs diff --git a/OpenUtau.Core/DiffSinger/DiffSingerG2pPhonemizer.cs b/OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerG2pPhonemizer.cs similarity index 100% rename from OpenUtau.Core/DiffSinger/DiffSingerG2pPhonemizer.cs rename to OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerG2pPhonemizer.cs diff --git a/OpenUtau.Core/DiffSinger/DiffSingerJyutpingPhonemizer.cs b/OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerJyutpingPhonemizer.cs similarity index 100% rename from OpenUtau.Core/DiffSinger/DiffSingerJyutpingPhonemizer.cs rename to OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerJyutpingPhonemizer.cs diff --git a/OpenUtau.Core/DiffSinger/DiffSingerPhonemizer.cs b/OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerPhonemizer.cs similarity index 100% rename from OpenUtau.Core/DiffSinger/DiffSingerPhonemizer.cs rename to OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerPhonemizer.cs diff --git a/OpenUtau.Core/DiffSinger/DiffSingerPortuguesePhonemizer.cs b/OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerPortuguesePhonemizer.cs similarity index 100% rename from OpenUtau.Core/DiffSinger/DiffSingerPortuguesePhonemizer.cs rename to OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerPortuguesePhonemizer.cs diff --git a/OpenUtau.Core/DiffSinger/DiffSingerRhythmizerPhonemizer.cs b/OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerRhythmizerPhonemizer.cs similarity index 100% rename from OpenUtau.Core/DiffSinger/DiffSingerRhythmizerPhonemizer.cs rename to OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerRhythmizerPhonemizer.cs diff --git a/OpenUtau.Core/DiffSinger/DiffSingerRussianPhonemizer.cs b/OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerRussianPhonemizer.cs similarity index 100% rename from OpenUtau.Core/DiffSinger/DiffSingerRussianPhonemizer.cs rename to OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerRussianPhonemizer.cs From a52aa4f3786f8ecd5f3304ee7e6f2d3885b431c1 Mon Sep 17 00:00:00 2001 From: oxygen-dioxide <54425948+oxygen-dioxide@users.noreply.github.com> Date: Wed, 10 Jan 2024 08:58:57 +0800 Subject: [PATCH 008/204] diffsinger chinese phonemizer load dsdict-zh.yaml; add diffsinger japanese phonemizer --- .../Phonemizers/DiffSingerBasePhonemizer.cs | 17 +++++---- .../DiffSingerChinesePhonemizer.cs | 7 ++-- .../Phonemizers/DiffSingerG2pPhonemizer.cs | 36 +++++++++---------- .../DiffSingerJapanesePhonemizer.cs | 10 ++++++ .../DiffSingerJyutpingPhonemizer.cs | 1 + 5 files changed, 42 insertions(+), 29 deletions(-) create mode 100644 OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerJapanesePhonemizer.cs diff --git a/OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerBasePhonemizer.cs b/OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerBasePhonemizer.cs index 9615b7248..cb5678ca1 100644 --- a/OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerBasePhonemizer.cs +++ b/OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerBasePhonemizer.cs @@ -24,6 +24,7 @@ public abstract class DiffSingerBasePhonemizer : MachineLearningPhonemizer DiffSingerSpeakerEmbedManager speakerEmbedManager; string defaultPause = "SP"; + protected virtual string GetDictionaryName()=>"dsdict.yaml"; public override void SetSinger(USinger singer) { this.singer = singer; @@ -66,13 +67,17 @@ public override void SetSinger(USinger singer) { protected virtual IG2p LoadG2p(string rootPath) { var g2ps = new List(); + var dictionaryNames = new string[] {GetDictionaryName(), "dsdict.yaml"}; // Load dictionary from singer folder. - string file = Path.Combine(rootPath, "dsdict.yaml"); - if (File.Exists(file)) { - try { - g2ps.Add(G2pDictionary.NewBuilder().Load(File.ReadAllText(file)).Build()); - } catch (Exception e) { - Log.Error(e, $"Failed to load {file}"); + foreach(var dictionaryName in dictionaryNames){ + string dictionaryPath = Path.Combine(rootPath, dictionaryName); + if (File.Exists(dictionaryPath)) { + try { + g2ps.Add(G2pDictionary.NewBuilder().Load(File.ReadAllText(dictionaryPath)).Build()); + } catch (Exception e) { + Log.Error(e, $"Failed to load {dictionaryPath}"); + } + break; } } return new G2pFallbacks(g2ps.ToArray()); diff --git a/OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerChinesePhonemizer.cs b/OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerChinesePhonemizer.cs index c93329175..e32a6d0d0 100644 --- a/OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerChinesePhonemizer.cs +++ b/OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerChinesePhonemizer.cs @@ -2,11 +2,10 @@ using OpenUtau.Api; -namespace OpenUtau.Core.DiffSinger -{ +namespace OpenUtau.Core.DiffSinger { [Phonemizer("DiffSinger Chinese Phonemizer", "DIFFS ZH", language: "ZH")] - public class DiffSingerChinesePhonemizer : DiffSingerBasePhonemizer - { + public class DiffSingerChinesePhonemizer : DiffSingerBasePhonemizer { + protected override string GetDictionaryName()=>"dsdict-zh.yaml"; protected override string[] Romanize(IEnumerable lyrics) { return BaseChinesePhonemizer.Romanize(lyrics); } diff --git a/OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerG2pPhonemizer.cs b/OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerG2pPhonemizer.cs index 93638f0b1..05290e503 100644 --- a/OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerG2pPhonemizer.cs +++ b/OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerG2pPhonemizer.cs @@ -29,37 +29,35 @@ public Dictionary toDict(){ } } + /// + /// Base class for DiffSinger phonemizers based on OpenUtau's builtin G2p. + /// public abstract class DiffSingerG2pPhonemizer : DiffSingerBasePhonemizer { - protected virtual string GetDictionaryName()=>"dsdict.yaml"; - protected virtual IG2p LoadBaseG2p()=>null; //vowels and consonants of BaseG2p protected virtual string[] GetBaseG2pVowels()=>new string[]{}; protected virtual string[] GetBaseG2pConsonants()=>new string[]{}; protected override IG2p LoadG2p(string rootPath) { - var dictionaryName = GetDictionaryName(); + //Each phonemizer has a delicated dictionary name, such as dsdict-en.yaml, dsdict-ru.yaml. + //If this dictionary exists, load it. + //If not, load dsdict.yaml. + var dictionaryNames = new string[] {GetDictionaryName(), "dsdict.yaml"}; var g2ps = new List(); - // Load dictionary from plugin folder. - string path = Path.Combine(PluginDir, dictionaryName); - if (File.Exists(path)) { - try { - g2ps.Add(G2pDictionary.NewBuilder().Load(File.ReadAllText(path)).Build()); - } catch (Exception e) { - Log.Error(e, $"Failed to load {path}"); - } - } // Load dictionary from singer folder. var replacements = new Dictionary(); - string file = Path.Combine(rootPath, dictionaryName); - if (File.Exists(file)) { - try { - g2ps.Add(G2pDictionary.NewBuilder().Load(File.ReadAllText(file)).Build()); - replacements = G2pReplacementsData.Load(File.ReadAllText(file)).toDict(); - } catch (Exception e) { - Log.Error(e, $"Failed to load {file}"); + foreach(var dictionaryName in dictionaryNames){ + string dictionaryPath = Path.Combine(rootPath, dictionaryName); + if (File.Exists(dictionaryPath)) { + try { + g2ps.Add(G2pDictionary.NewBuilder().Load(File.ReadAllText(dictionaryPath)).Build()); + replacements = G2pReplacementsData.Load(File.ReadAllText(dictionaryPath)).toDict(); + } catch (Exception e) { + Log.Error(e, $"Failed to load {dictionaryPath}"); + } + break; } } diff --git a/OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerJapanesePhonemizer.cs b/OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerJapanesePhonemizer.cs new file mode 100644 index 000000000..344cad86e --- /dev/null +++ b/OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerJapanesePhonemizer.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; + +using OpenUtau.Api; + +namespace OpenUtau.Core.DiffSinger { + [Phonemizer("DiffSinger Japanese Phonemizer", "DIFFS JA", language: "JA")] + public class DiffSingerJapanesePhonemizer : DiffSingerBasePhonemizer { + protected override string GetDictionaryName()=>"dsdict-ja.yaml"; + } +} diff --git a/OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerJyutpingPhonemizer.cs b/OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerJyutpingPhonemizer.cs index b4a4d01c3..9a5d1c9a1 100644 --- a/OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerJyutpingPhonemizer.cs +++ b/OpenUtau.Core/DiffSinger/Phonemizers/DiffSingerJyutpingPhonemizer.cs @@ -6,6 +6,7 @@ namespace OpenUtau.Core.DiffSinger { [Phonemizer("DiffSinger Jyutping Phonemizer", "DIFFS ZH-YUE", language: "ZH")] public class DiffSingerJyutpingPhonemizer : DiffSingerBasePhonemizer { + protected override string GetDictionaryName() => "dsdict-zh-yue.yaml"; protected override string[] Romanize(IEnumerable lyrics) { return ZhG2p.CantoneseInstance.Convert(lyrics.ToList(), false, true).Split(" "); } From a048f139966fbaa8833c961f2a3661d70eadea24 Mon Sep 17 00:00:00 2001 From: oxygen-dioxide <54425948+oxygen-dioxide@users.noreply.github.com> Date: Wed, 10 Jan 2024 10:36:40 +0800 Subject: [PATCH 009/204] language name localization --- OpenUtau/Strings/Strings.axaml | 18 ++++++++++++++++-- OpenUtau/Strings/Strings.de-DE.axaml | 19 +++++++++++++++++++ OpenUtau/Strings/Strings.es-ES.axaml | 19 +++++++++++++++++++ OpenUtau/Strings/Strings.es-MX.axaml | 19 +++++++++++++++++++ OpenUtau/Strings/Strings.fi-FI.axaml | 19 +++++++++++++++++++ OpenUtau/Strings/Strings.fr-FR.axaml | 19 +++++++++++++++++++ OpenUtau/Strings/Strings.id-ID.axaml | 19 +++++++++++++++++++ OpenUtau/Strings/Strings.it-IT.axaml | 19 +++++++++++++++++++ OpenUtau/Strings/Strings.ja-JP.axaml | 18 ++++++++++++++++++ OpenUtau/Strings/Strings.ko-KR.axaml | 19 +++++++++++++++++++ OpenUtau/Strings/Strings.nl-NL.axaml | 19 +++++++++++++++++++ OpenUtau/Strings/Strings.pl-PL.axaml | 19 +++++++++++++++++++ OpenUtau/Strings/Strings.pt-BR.axaml | 19 +++++++++++++++++++ OpenUtau/Strings/Strings.ru-RU.axaml | 19 +++++++++++++++++++ OpenUtau/Strings/Strings.th-TH.axaml | 19 +++++++++++++++++++ OpenUtau/Strings/Strings.vi-VN.axaml | 19 +++++++++++++++++++ OpenUtau/Strings/Strings.zh-CN.axaml | 19 +++++++++++++++++++ OpenUtau/Strings/Strings.zh-TW.axaml | 19 +++++++++++++++++++ OpenUtau/ThemeManager.cs | 14 ++++++++++++++ OpenUtau/ViewModels/TrackHeaderViewModel.cs | 12 +++++++++++- 20 files changed, 363 insertions(+), 3 deletions(-) diff --git a/OpenUtau/Strings/Strings.axaml b/OpenUtau/Strings/Strings.axaml index 855a46717..9e60e9861 100644 --- a/OpenUtau/Strings/Strings.axaml +++ b/OpenUtau/Strings/Strings.axaml @@ -46,13 +46,13 @@ Yes No resampler No resampler! Put your favourite resampler exe or dll in the Resamplers folder and choose it in Preferences! - Unsupported file format - Unsupported file format: Time Signature Track Settings Location Renderer Set As Default + Unsupported file format + Unsupported file format: Voice color remapping Applies to all notes in this track: @@ -75,6 +75,20 @@ Numerical Options + German + English + Spanish + French + Italian + Japanese + Korean + Polish + Portuguese + Russian + Vietnamese + Chinese + Cantonese + Apply Cancel Edit Lyrics diff --git a/OpenUtau/Strings/Strings.de-DE.axaml b/OpenUtau/Strings/Strings.de-DE.axaml index 36f123aa8..97d290bd2 100644 --- a/OpenUtau/Strings/Strings.de-DE.axaml +++ b/OpenUtau/Strings/Strings.de-DE.axaml @@ -51,6 +51,8 @@ Position Als Standard festlegen + + @@ -73,6 +75,20 @@ Numerisch Optionen + Deutsch + Englisch + Spanisch + Französisch + Italienisch + Japanisch + Koreanisch + Polnisch + Portugiesisch + Russisch + Vietnamesisch + Chinesisch + Kantonesisch + Anwenden Abbrechen Lyrics bearbeiten @@ -139,6 +155,7 @@ Werkzeuge Cache leeren Debug Fenster + @@ -296,6 +313,7 @@ Warnung: Diese Option entfernt alle benutzerdefinierten Einstellungen.Solfège (do re mi fa sol la ti)--> Sprache Die Noten anderer Tonspuren im Piano-Modus anzeigen. + Portrait im Piano-Modus anzeigen Sänger Sortierreihenfolge Aussehen @@ -399,6 +417,7 @@ Warnung: moresampler wird nicht vollständig unterstützt. Es kann das Programm Setzen Ton Tonumfänge + Website aufrufen Dateikodierung archivieren diff --git a/OpenUtau/Strings/Strings.es-ES.axaml b/OpenUtau/Strings/Strings.es-ES.axaml index 7df6eb25b..548193d19 100644 --- a/OpenUtau/Strings/Strings.es-ES.axaml +++ b/OpenUtau/Strings/Strings.es-ES.axaml @@ -51,6 +51,8 @@ + + @@ -73,6 +75,20 @@ + alemán + inglés + español + francés + italiano + japonés + coreano + polaco + portugués + ruso + vietnamita + chino + cantonés + @@ -139,6 +155,7 @@ Herramientas + @@ -296,6 +313,7 @@ Warning: this option removes custom presets.--> + Tema @@ -399,6 +417,7 @@ Warning: this option removes custom presets.--> + diff --git a/OpenUtau/Strings/Strings.es-MX.axaml b/OpenUtau/Strings/Strings.es-MX.axaml index 8afd8349f..51a26fb8e 100644 --- a/OpenUtau/Strings/Strings.es-MX.axaml +++ b/OpenUtau/Strings/Strings.es-MX.axaml @@ -51,6 +51,8 @@ Ubicación Renderizador Usar como predeterminado + + @@ -73,6 +75,20 @@ Numérico Opciones + alemán + inglés + español + francés + italiano + japonés + coreano + polaco + portugués + ruso + vietnamita + chino + cantonés + Aplicar Cancelar Editar letra @@ -139,6 +155,7 @@ _Herramientas Limpiar caché Ventana de depuración + 1:1 Horizontal 1:2 Horizontal @@ -292,6 +309,7 @@ Advertencia: Esta opción eliminará las bases personalizadas. Lenguaje Mostrar notas de otras pistas en el piano + Mostrar foto en el piano Tema @@ -395,6 +413,7 @@ Advertencia: Moresampler no es totalmente compatible por ahora. Este puede ser l Carpeta Tono Rangos tonales + Visitar sitio web diff --git a/OpenUtau/Strings/Strings.fi-FI.axaml b/OpenUtau/Strings/Strings.fi-FI.axaml index e63cde0bb..6bdce25e1 100644 --- a/OpenUtau/Strings/Strings.fi-FI.axaml +++ b/OpenUtau/Strings/Strings.fi-FI.axaml @@ -51,6 +51,8 @@ + + @@ -73,6 +75,20 @@ Numeraalinen Kustomoi + saksa + englanti + espanja + ranska + italia + japani + korea + puola + portugali + venäjä + vietnam + kiina + kantoninkiina + @@ -139,6 +155,7 @@ Työkalut + Asettelu Vaakasuora 1:1 Vaakasuora 1:2 @@ -296,6 +313,7 @@ Warning: this option removes custom presets.--> Kieli + Teema @@ -399,6 +417,7 @@ Warning: this option removes custom presets.--> Ääniala + diff --git a/OpenUtau/Strings/Strings.fr-FR.axaml b/OpenUtau/Strings/Strings.fr-FR.axaml index f330507e2..7ba38b48c 100644 --- a/OpenUtau/Strings/Strings.fr-FR.axaml +++ b/OpenUtau/Strings/Strings.fr-FR.axaml @@ -51,6 +51,8 @@ Emplacement Moteur de rendu Réglage par défaut + + @@ -73,6 +75,20 @@ Numérique + allemand + anglais + espagnol + français + italien + japonais + coréen + polonais + portugais + russe + vietnamien + chinois + cantonais + Appliquer Annuler Modifier les paroles @@ -139,6 +155,7 @@ Outils Effacer le Cache Fenêtre de débogage + Disposition des fenêtres @@ -292,6 +309,7 @@ Attention: cela va effacer le préréglage. Langue Montrer les notes des autres pistes sur le piano roll + Montrer le portrait sur le piano roll Thème @@ -395,6 +413,7 @@ Avertissement : moresampler n'est pas entièrement pris en charge. Il peut être Définir Tonalité Registre + Visiter le site diff --git a/OpenUtau/Strings/Strings.id-ID.axaml b/OpenUtau/Strings/Strings.id-ID.axaml index 3777ad553..dc1cdd666 100644 --- a/OpenUtau/Strings/Strings.id-ID.axaml +++ b/OpenUtau/Strings/Strings.id-ID.axaml @@ -51,6 +51,8 @@ Lokasi Perender Tetapkan Sebagai Bawaan + + Pemetaan ulang warna suara Terapkan ke semua nada di trek ini: @@ -73,6 +75,20 @@ Numerik Opsi + Jerman + Inggris + Spanyol + Prancis + Italia + Jepang + Korea + Polski + Portugis + Rusia + Vietnam + Tionghoa + Kanton + Terapkan Batalkan Sunting Lirik @@ -139,6 +155,7 @@ Peralatan Hapus Cache Jendela Debug + Tata Letak Horisontal 1:1 Horisontal 1:2 @@ -298,6 +315,7 @@ Peringatan: opsi ini menghapus prasetel khusus. Solfège (do re mi fa sol la si) Bahasa Tampilkan not trek lain di piano roll + Tampilkan foto potret di piano roll Bahasa tampilan nama penyanyi Tema @@ -401,6 +419,7 @@ Peringatan: moresampler tidak sepenuhnya didukung. Ini mungkin melambat dan meny Setel Nada Rentang Nada + Visit Situs Web Pengkodean Berkas Arsip diff --git a/OpenUtau/Strings/Strings.it-IT.axaml b/OpenUtau/Strings/Strings.it-IT.axaml index cc7b78602..d49993b0f 100644 --- a/OpenUtau/Strings/Strings.it-IT.axaml +++ b/OpenUtau/Strings/Strings.it-IT.axaml @@ -51,6 +51,8 @@ Percorso Imposta default + + @@ -73,6 +75,20 @@ Numerico Opzioni + tedesco + inglese + spagnolo + francese + italiano + giapponese + coreano + polacco + portoghese + russo + vietnamita + cinese + cantonese + Applica Cancella Modifica Testo @@ -139,6 +155,7 @@ Strumenti Svuota Cache Finestra di Debug + Disposizione Orizzontale 1:1 Orizzontale 1:2 @@ -296,6 +313,7 @@ Tieni premuto Ctrl per selezionare Lingua Mostra note di altre tracce sul piano roll + Mostra immagine del cantante sul piano roll Ordine cantanti Tema @@ -399,6 +417,7 @@ Attenzione: moresampler non è completamente supportato. Potrebbe causare rallen Imposta Tono Range Tonale + Visita il sito web Codifica del File d'Archivio diff --git a/OpenUtau/Strings/Strings.ja-JP.axaml b/OpenUtau/Strings/Strings.ja-JP.axaml index ea446ebd4..6dc30046a 100644 --- a/OpenUtau/Strings/Strings.ja-JP.axaml +++ b/OpenUtau/Strings/Strings.ja-JP.axaml @@ -51,6 +51,8 @@ 場所 デフォルト設定として保存 + + Voice colorの再マッピング このトラック内のすべての音符に適用されます: @@ -73,6 +75,20 @@ 数値 カスタム + ドイツ語 + 英語 + スペイン語 + フランス語 + イタリア語 + 日本語 + 韓国語 + ポーランド語 + ポルトガル語 + ロシア語 + ベトナム語 + 中国語 + 広東語 + 適用 キャンセル 歌詞を編集 @@ -139,6 +155,7 @@ ツール キャッシュクリア デバッグウインドウ + レイアウト 横並び 1:1 横並び 1:2 @@ -296,6 +313,7 @@ Solfège (ドレミファソラシ) 言語 ピアノロール上に他トラックの音符を表示 + ピアノロール上に背景イラストを表示 シンガー名の表示言語 テーマ diff --git a/OpenUtau/Strings/Strings.ko-KR.axaml b/OpenUtau/Strings/Strings.ko-KR.axaml index f3712060a..04d2b196c 100644 --- a/OpenUtau/Strings/Strings.ko-KR.axaml +++ b/OpenUtau/Strings/Strings.ko-KR.axaml @@ -51,6 +51,8 @@ 위치 열기 렌더러 기본값으로 사용 + + 보이스 컬러 재맵핑 ▼ 재맵핑된 컬러가 이 트랙의 모든 노트에 적용되요 @@ -73,6 +75,20 @@ 숫자형 표현 선택지형 표현 + 독일어 + 영어 + 스페인어 + 프랑스어 + 이탈리아어 + 일본어 + 한국어 + 폴란드어 + 포르투갈어 + 러시아어 + 베트남어 + 중국어 + 광둥어 + 적용하기 취소 가사 편집하기 @@ -139,6 +155,7 @@ 도구 캐시 비우기 디버그 창 + 레이아웃 1:1 수평 배치 1:2 수평 배치 @@ -313,6 +330,7 @@ 계이름 도우미 (도 레 미 파 솔 라 시) 인터페이스 언어 피아노 롤에 다른 트랙의 노트 표시(유령 노트) + 피아노 롤에 가수의 스탠딩 표시 가수 이름 표시 언어 테마 설정 @@ -419,6 +437,7 @@ 설정 음계 음역대 + 가수 공식 사이트 방문 압축 파일의 인코딩 diff --git a/OpenUtau/Strings/Strings.nl-NL.axaml b/OpenUtau/Strings/Strings.nl-NL.axaml index 90a57aebc..36cda33f8 100644 --- a/OpenUtau/Strings/Strings.nl-NL.axaml +++ b/OpenUtau/Strings/Strings.nl-NL.axaml @@ -51,6 +51,8 @@ + + @@ -73,6 +75,20 @@ Numeriek Opties + Duits + Engels + Spaans + Frans + Italiaans + Japans + Koreaans + Pools + Portugees + Russisch + Vietnamees + Chinees + Kantonees + Toepassen Annuleer Bewerk Tekst @@ -139,6 +155,7 @@ _Tools Cache wissen Debug venster + Indeling Horizontaal 1:1 Horizontaal 1:2 @@ -292,6 +309,7 @@ Ctrl ingedrukt houden om te selecteren Taal + Toon portret op pianorol Thema @@ -395,6 +413,7 @@ Waarschuwing: moresampler wordt niet volledig ondersteund. Het kan traag zijn en Toon Toonbereiken + diff --git a/OpenUtau/Strings/Strings.pl-PL.axaml b/OpenUtau/Strings/Strings.pl-PL.axaml index 482cbffdb..4c95c083c 100644 --- a/OpenUtau/Strings/Strings.pl-PL.axaml +++ b/OpenUtau/Strings/Strings.pl-PL.axaml @@ -51,6 +51,8 @@ + + @@ -73,6 +75,20 @@ + niemiecki + angielski + hiszpański + francuski + włoski + japoński + koreański + polski + portugalski + rosyjski + wietnamski + chiński + kantoński + @@ -139,6 +155,7 @@ Narzędzia + @@ -296,6 +313,7 @@ Warning: this option removes custom presets.--> + Motyw @@ -399,6 +417,7 @@ Warning: this option removes custom presets.--> + diff --git a/OpenUtau/Strings/Strings.pt-BR.axaml b/OpenUtau/Strings/Strings.pt-BR.axaml index e7d011b51..cd6a568e4 100644 --- a/OpenUtau/Strings/Strings.pt-BR.axaml +++ b/OpenUtau/Strings/Strings.pt-BR.axaml @@ -51,6 +51,8 @@ Local Renderizador Definir como Padrão + + @@ -73,6 +75,20 @@ Numérico Opções + alemão + inglês + espanhol + francês + italiano + japonês + coreano + polonês + português + russo + vietnamita + chinês + cantonês + Aplicar Cancelar Editar Lírica @@ -139,6 +155,7 @@ Ferramentas Limpar Cache Janela de Debug + @@ -292,6 +309,7 @@ Segure Ctrl para selecionar Idioma Mostrar notas fantasma + Mostrar retrato no piano roll Tema @@ -395,6 +413,7 @@ Segure Ctrl para selecionar Aplicar Tom Alcance + Visite o Website diff --git a/OpenUtau/Strings/Strings.ru-RU.axaml b/OpenUtau/Strings/Strings.ru-RU.axaml index fe475b8f8..775a9acfe 100644 --- a/OpenUtau/Strings/Strings.ru-RU.axaml +++ b/OpenUtau/Strings/Strings.ru-RU.axaml @@ -51,6 +51,8 @@ Расположение Рендерер Установить по умолчанию + + Изменение цвета голоса Применится ко всем нотам в этом треке: @@ -73,6 +75,20 @@ Числовой Параметры + немецкий + английский + испанский + французский + итальянский + японский + корейский + польский + португальский + русский + вьетнамский + китайский + кантонский + Применить Отмена Редактировать текст @@ -139,6 +155,7 @@ Инструменты Очистить кэш Окно отладки + Расположение Горизонтально 1:1 Горизонтально 1:2 @@ -292,6 +309,7 @@ Сольфеджио (do re mi fa sol la ti) Язык Отображать ноты других треков на пианоролле + Отображать портрет на пианоролле Порядок сортировки вокалистов Тема @@ -395,6 +413,7 @@ Установить Тон Диапазон тональности + Посетить сайт Кодировка архива diff --git a/OpenUtau/Strings/Strings.th-TH.axaml b/OpenUtau/Strings/Strings.th-TH.axaml index bc77a5cd6..40a96c4c1 100644 --- a/OpenUtau/Strings/Strings.th-TH.axaml +++ b/OpenUtau/Strings/Strings.th-TH.axaml @@ -51,6 +51,8 @@ + + @@ -73,6 +75,20 @@ ตัวเลข ตัวเลือก + เยอรมัน + อังกฤษ + สเปน + ฝรั่งเศส + อิตาลี + ญี่ปุ่น + เกาหลี + โปแลนด์ + โปรตุเกส + รัสเซีย + เวียดนาม + จีน + กวางตุ้ง + ใช้งาน ยกเลิก แก้ไขเนื้อเพลง @@ -139,6 +155,7 @@ เครื่องมือ ล้างแคช + เลย์เอาท์ แนวนอน 1:1 แนวนอน 1:2 @@ -292,6 +309,7 @@ ภาษา + แสดงภาพเหมือนบน Piano roll ธีม @@ -395,6 +413,7 @@ ตั้งค่า + diff --git a/OpenUtau/Strings/Strings.vi-VN.axaml b/OpenUtau/Strings/Strings.vi-VN.axaml index 9372a4dd2..6fdd28c25 100644 --- a/OpenUtau/Strings/Strings.vi-VN.axaml +++ b/OpenUtau/Strings/Strings.vi-VN.axaml @@ -51,6 +51,8 @@ Thư mục Trình render Đặt thành mặc định + + @@ -73,6 +75,20 @@ Giá trị số Lựa chọn các giá trị + Tiếng Đức + Tiếng Anh + Tiếng Tây Ban Nha + Tiếng Pháp + Tiếng Italy + Tiếng Nhật + Tiếng Hàn + Tiếng Ba Lan + Tiếng Bồ Đào Nha + Tiếng Nga + Tiếng Việt + Tiếng Trung + Tiếng Quảng Đông + Áp dụng Huỷ bỏ Chỉnh sửa lời bài hát @@ -139,6 +155,7 @@ Công cụ Xoá bộ nhớ đệm Mở cửa sổ Debug + Bố cục Ngang 1:1 Ngang 1:2 @@ -292,6 +309,7 @@ Nhấn giữ Ctrl để chọn nhiều nốt Ngôn ngữ Hiện nốt của các track khác trong Piano Roll + Hiện avatar trong Piano Roll Chủ đề @@ -395,6 +413,7 @@ Nhấn giữ Ctrl để chọn nhiều nốt Áp dụng Cao độ Cao độ + Mở trang web diff --git a/OpenUtau/Strings/Strings.zh-CN.axaml b/OpenUtau/Strings/Strings.zh-CN.axaml index 0baaedbae..94ac8bd55 100644 --- a/OpenUtau/Strings/Strings.zh-CN.axaml +++ b/OpenUtau/Strings/Strings.zh-CN.axaml @@ -51,6 +51,8 @@ 位置 渲染器 设为默认 + + 音色重映射 以下设置将应用于音轨中的所有音符: @@ -73,6 +75,20 @@ 数值 选项 + 德语 + 英语 + 西班牙语 + 法语 + 意大利语 + 日语 + 韩语 + 波兰语 + 葡萄牙语 + 俄语 + 越南语 + 中文 + 粤语 + 应用 取消 编辑歌词 @@ -139,6 +155,7 @@ 工具 清空缓存 调试窗口 + 界面布局 水平分布 1:1 水平分布 1:2 @@ -292,6 +309,7 @@ 唱名(do re mi fa sol la ti) 语言 在钢琴窗上显示其他音轨的音符 + 在钢琴窗上显示歌手背景图 歌手名称显示语言 主题 @@ -395,6 +413,7 @@ 设定 音调 音调范围 + 访问歌手官网 压缩包编码 diff --git a/OpenUtau/Strings/Strings.zh-TW.axaml b/OpenUtau/Strings/Strings.zh-TW.axaml index 9571a82f4..4d2ac1146 100644 --- a/OpenUtau/Strings/Strings.zh-TW.axaml +++ b/OpenUtau/Strings/Strings.zh-TW.axaml @@ -51,6 +51,8 @@ + + @@ -73,6 +75,20 @@ 數值 選項 + 德文 + 英文 + 西班牙文 + 法文 + 義大利文 + 日文 + 韓文 + 波蘭文 + 葡萄牙文 + 俄文 + 越南文 + 中文 + 粵語 + 套用 取消 編輯歌詞 @@ -139,6 +155,7 @@ 工具 清除快取 除錯視窗 + 版面配置 橫向 1:1 橫向 1:2 @@ -292,6 +309,7 @@ 語言 + 在鋼琴卷軸上顯示角色背景圖 主題 @@ -395,6 +413,7 @@ 設定 音調 音調範圍 + diff --git a/OpenUtau/ThemeManager.cs b/OpenUtau/ThemeManager.cs index 51aae5e1f..0ed3fd590 100644 --- a/OpenUtau/ThemeManager.cs +++ b/OpenUtau/ThemeManager.cs @@ -261,6 +261,20 @@ public static string GetString(string key) { return key; } + public static bool TryGetString(string key, out string value) { + if (Application.Current == null) { + value = key; + return false; + } + IResourceDictionary resDict = Application.Current.Resources; + if (resDict.TryGetResource(key, ThemeVariant.Default, out var outVar) && outVar is string s) { + value = s; + return true; + } + value = key; + return false; + } + public static TrackColor GetTrackColor(string name) { if (TrackColors.Any(c => c.Name == name)) { return TrackColors.First(c => c.Name == name); diff --git a/OpenUtau/ViewModels/TrackHeaderViewModel.cs b/OpenUtau/ViewModels/TrackHeaderViewModel.cs index a3504d7c0..51fdb10f5 100644 --- a/OpenUtau/ViewModels/TrackHeaderViewModel.cs +++ b/OpenUtau/ViewModels/TrackHeaderViewModel.cs @@ -270,6 +270,16 @@ public void RefreshSingers() { this.RaisePropertyChanged(nameof(SingerMenuItems)); } + public string GetPhonemizerGroupHeader(string key){ + if(key is null){ + return "General"; + } + if(ThemeManager.TryGetString($"languages.{key.ToLowerInvariant()}", out var value)){ + return $"{key}: {value}"; + } + return key; + } + public void RefreshPhonemizers() { var items = new List(); //Recently used phonemizers @@ -288,7 +298,7 @@ public void RefreshPhonemizers() { Items = DocManager.Inst.PhonemizerFactories.GroupBy(factory => factory.language) .OrderBy(group => group.Key) .Select(group => new MenuItemViewModel() { - Header = (group.Key is null) ? "General" : group.Key, + Header = GetPhonemizerGroupHeader(group.Key), Items = group.Select(factory => new MenuItemViewModel() { Header = factory.ToString(), Command = SelectPhonemizerCommand, From 9615d9a701ec3486341dfc990c9bc9d7a9bc153c Mon Sep 17 00:00:00 2001 From: sdercolin Date: Wed, 10 Jan 2024 18:43:45 +0900 Subject: [PATCH 010/204] Add UnixCaseCheck in voice bank check --- .../Classic/VoicebankErrorChecker.cs | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/OpenUtau.Core/Classic/VoicebankErrorChecker.cs b/OpenUtau.Core/Classic/VoicebankErrorChecker.cs index 39d3d6b93..0884751b4 100644 --- a/OpenUtau.Core/Classic/VoicebankErrorChecker.cs +++ b/OpenUtau.Core/Classic/VoicebankErrorChecker.cs @@ -113,8 +113,12 @@ public void Check() { "character.yaml", "prefix.map", }); + } else { + //On MacOS and Linux, check if there are files that have the same name but different case. + foreach (var otoSet in voicebank.OtoSets) { + UnixCaseCheck(otoSet); + } } - //TODO: On MacOS and Linux, check if there are files that have the same name but different case. } bool TryGetFileDuration(string filePath, Oto oto, out double fileDuration) { @@ -290,5 +294,25 @@ bool WindowsCaseCheck(string folder, IEnumerable correctFileNames){ } return valid; } + + /// + /// Check if the file names are duplicated when converted to lower case. + /// + /// otoSet to be checked + /// + bool UnixCaseCheck(OtoSet otoSet) { + var wavNames = otoSet.Otos.Select(x => x.Wav).Distinct().ToList(); + var duplicatedGroups = wavNames.GroupBy(x => x.ToLower()) + .Where(group => group.Count() > 1) + .ToList(); + foreach (var group in duplicatedGroups) { + Infos.Add(new VoicebankError() { + message = $"Duplcated file names defined for case sensitive platforms in oto set \"{otoSet.Name}\":" + + string.Join(", ", group.Select(x => $"\"{x}\"")) + + "." + }); + } + return duplicatedGroups.Count == 0; + } } } From bf176d48d19c1466b469f6b6734a0ce5def02f47 Mon Sep 17 00:00:00 2001 From: sdercolin Date: Wed, 10 Jan 2024 20:44:46 +0900 Subject: [PATCH 011/204] Update method names and doc while removing conditions on current OS --- .../Classic/VoicebankErrorChecker.cs | 45 +++++++++---------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/OpenUtau.Core/Classic/VoicebankErrorChecker.cs b/OpenUtau.Core/Classic/VoicebankErrorChecker.cs index 0884751b4..4470eef1b 100644 --- a/OpenUtau.Core/Classic/VoicebankErrorChecker.cs +++ b/OpenUtau.Core/Classic/VoicebankErrorChecker.cs @@ -102,22 +102,20 @@ public void Check() { }); } //Cross platform check - //Windows path is case insensitive, while MacOS path and Linux path are case sensitive. - //On Windows, check if the wave filename in oto.ini is the same as the filename in the file system. - if(OS.IsWindows()){ - foreach(var otoSet in voicebank.OtoSets) { - WindowsCaseCheck(otoSet); - } - WindowsCaseCheck(voicebank.BasePath, new string[]{ - "chatacter.txt", - "character.yaml", - "prefix.map", - }); - } else { - //On MacOS and Linux, check if there are files that have the same name but different case. - foreach (var otoSet in voicebank.OtoSets) { - UnixCaseCheck(otoSet); - } + //On case-insensitive systems, check if the wave filename in oto.ini is the same as the filename in the file system. + //If not matched, the VB may not work when copied to case-sensitive systems. + foreach(var otoSet in voicebank.OtoSets) { + CaseCheckOnInsensitiveSystem(otoSet); + } + CaseCheckOnInsensitiveSystem(voicebank.BasePath, new string[]{ + "chatacter.txt", + "character.yaml", + "prefix.map", + }); + //On case-sensitive systems, check if there are files with names that only differ in cases. + //If such files exist, the VB may not work when copied to case-insensitive systems. + foreach (var otoSet in voicebank.OtoSets) { + CaseCheckOnSensitiveSystem(otoSet); } } @@ -264,8 +262,8 @@ bool FindDuplication(out List duplicates) { /// /// otoSet to be checked /// - bool WindowsCaseCheck(OtoSet otoSet) { - return WindowsCaseCheck( + bool CaseCheckOnInsensitiveSystem(OtoSet otoSet) { + return CaseCheckOnInsensitiveSystem( Directory.GetParent(otoSet.File).FullName, otoSet.Otos .Select(oto => oto.Wav) @@ -273,7 +271,7 @@ bool WindowsCaseCheck(OtoSet otoSet) { .ToHashSet()); } - bool WindowsCaseCheck(string folder, IEnumerable correctFileNames){ + bool CaseCheckOnInsensitiveSystem(string folder, IEnumerable correctFileNames){ bool valid = true; Dictionary fileNamesLowerToActual = Directory.GetFiles(folder) .Select(Path.GetFileName) @@ -288,7 +286,7 @@ bool WindowsCaseCheck(string folder, IEnumerable correctFileNames){ message = $"Wrong case in file name: \n" + $"expected: {Path.Join(folder,fileName)}\n" + $"Actual: {Path.Join(folder,fileNamesLowerToActual[fileName.ToLower()])}\n" - + $"voicebank may not work on another OS." + + $"The voicebank may not work on another OS." }); } } @@ -300,16 +298,17 @@ bool WindowsCaseCheck(string folder, IEnumerable correctFileNames){ /// /// otoSet to be checked /// - bool UnixCaseCheck(OtoSet otoSet) { + bool CaseCheckOnSensitiveSystem(OtoSet otoSet) { var wavNames = otoSet.Otos.Select(x => x.Wav).Distinct().ToList(); var duplicatedGroups = wavNames.GroupBy(x => x.ToLower()) .Where(group => group.Count() > 1) .ToList(); foreach (var group in duplicatedGroups) { Infos.Add(new VoicebankError() { - message = $"Duplcated file names defined for case sensitive platforms in oto set \"{otoSet.Name}\":" + message = $"Duplicated file names found when ignoreing case in oto set \"{otoSet.Name}\":" + string.Join(", ", group.Select(x => $"\"{x}\"")) - + "." + + ".\n" + + "The voicebank may not work on another OS with case-sensitivity." }); } return duplicatedGroups.Count == 0; From ffb9708d03f35d31848c278986814e442beec491 Mon Sep 17 00:00:00 2001 From: Maiko Date: Sat, 13 Jan 2024 21:24:49 +0900 Subject: [PATCH 012/204] Add singer favorite function --- OpenUtau.Core/Ustx/USinger.cs | 13 +++++++ OpenUtau.Core/Util/Preferences.cs | 1 + OpenUtau/Controls/TrackHeader.axaml | 24 +++++++++++++ OpenUtau/Controls/TrackHeader.axaml.cs | 4 +++ OpenUtau/ViewModels/MenuItemViewModel.cs | 40 +++++++++++++++++++++ OpenUtau/ViewModels/TrackHeaderViewModel.cs | 20 ++++++++--- OpenUtau/Views/PreferencesDialog.axaml | 4 ++- OpenUtau/Views/PreferencesDialog.axaml.cs | 16 ++++++++- 8 files changed, 116 insertions(+), 6 deletions(-) diff --git a/OpenUtau.Core/Ustx/USinger.cs b/OpenUtau.Core/Ustx/USinger.cs index 736875662..c6a771bd2 100644 --- a/OpenUtau.Core/Ustx/USinger.cs +++ b/OpenUtau.Core/Ustx/USinger.cs @@ -222,6 +222,19 @@ public bool OtoDirty { NotifyPropertyChanged(nameof(OtoDirty)); } } + public bool Favored { + get => Preferences.Default.FavoriteSingers.Contains(Id); + set { + if (value) { + if (!Preferences.Default.FavoriteSingers.Contains(Id)) { + Preferences.Default.FavoriteSingers.Add(Id); + } + } else { + Preferences.Default.FavoriteSingers.Remove(Id); + } + Preferences.Save(); + } + } public event PropertyChangedEventHandler PropertyChanged; diff --git a/OpenUtau.Core/Util/Preferences.cs b/OpenUtau.Core/Util/Preferences.cs index c5b5fc648..cadeb3202 100644 --- a/OpenUtau.Core/Util/Preferences.cs +++ b/OpenUtau.Core/Util/Preferences.cs @@ -152,6 +152,7 @@ public class SerializablePreferences { public bool PreferCommaSeparator = false; public bool ResamplerLogging = false; public List RecentSingers = new List(); + public List FavoriteSingers = new List(); public Dictionary SingerPhonemizers = new Dictionary(); public List RecentPhonemizers = new List(); public bool PreferPortAudio = false; diff --git a/OpenUtau/Controls/TrackHeader.axaml b/OpenUtau/Controls/TrackHeader.axaml index c09b7f1da..7a1f5d14c 100644 --- a/OpenUtau/Controls/TrackHeader.axaml +++ b/OpenUtau/Controls/TrackHeader.axaml @@ -61,6 +61,30 @@ + + + + + + + diff --git a/OpenUtau/Controls/TrackHeader.axaml.cs b/OpenUtau/Controls/TrackHeader.axaml.cs index 85130cbdd..e3d064cb7 100644 --- a/OpenUtau/Controls/TrackHeader.axaml.cs +++ b/OpenUtau/Controls/TrackHeader.axaml.cs @@ -6,8 +6,10 @@ using Avalonia.Input; using Avalonia.Interactivity; using OpenUtau.App.ViewModels; +using OpenUtau.App.Views; using OpenUtau.Core; using OpenUtau.Core.Ustx; +using Org.BouncyCastle.Cms; using ReactiveUI; namespace OpenUtau.App.Controls { @@ -86,6 +88,8 @@ void SingerButtonClicked(object sender, RoutedEventArgs args) { if (SingerManager.Inst.Singers.Count > 0) { ViewModel?.RefreshSingers(); SingersMenu.Open(); + } else { + DocManager.Inst.ExecuteCmd(new ErrorMessageNotification("There is no singer.")); } args.Handled = true; } diff --git a/OpenUtau/ViewModels/MenuItemViewModel.cs b/OpenUtau/ViewModels/MenuItemViewModel.cs index cf3c27948..5517be9d6 100644 --- a/OpenUtau/ViewModels/MenuItemViewModel.cs +++ b/OpenUtau/ViewModels/MenuItemViewModel.cs @@ -1,5 +1,8 @@ using System.Collections.Generic; using System.Windows.Input; +using Avalonia.Controls.Primitives; +using Avalonia.Data; +using OpenUtau.Core.Ustx; namespace OpenUtau.App.ViewModels { public class MenuItemViewModel { @@ -9,4 +12,41 @@ public class MenuItemViewModel { public IList? Items { get; set; } public double Height { get; set; } = 24; } + + public class SingerMenuItemViewModel : MenuItemViewModel { + public bool IsFav { + get { + if(CommandParameter is USinger singer) { + return singer.Favored; + } + return false; + } + set { + if (CommandParameter is USinger singer) { + singer.Favored = value; + } + } + } + private object? _icon; + public object? Icon { + get { + if(_icon == null) { + if (CommandParameter is USinger) { + _icon = new ToggleButton() { + [!ToggleButton.IsCheckedProperty] = new Binding("IsFav") + }; + } + } + return _icon; + } + } + public string? Location { + get { + if (CommandParameter is USinger singer) { + return singer.Location; + } + return null; + } + } + } } diff --git a/OpenUtau/ViewModels/TrackHeaderViewModel.cs b/OpenUtau/ViewModels/TrackHeaderViewModel.cs index a3504d7c0..80fdf5bf2 100644 --- a/OpenUtau/ViewModels/TrackHeaderViewModel.cs +++ b/OpenUtau/ViewModels/TrackHeaderViewModel.cs @@ -248,18 +248,30 @@ public void RefreshSingers() { items.AddRange(Preferences.Default.RecentSingers .Select(id => SingerManager.Inst.Singers.Values.FirstOrDefault(singer => singer.Id == id)) .OfType() - .LocalizedOrderBy(singer => singer.LocalizedName) - .Select(singer => new MenuItemViewModel() { + .Select(singer => new SingerMenuItemViewModel() { Header = singer.LocalizedName, Command = SelectSingerCommand, CommandParameter = singer, })); + items.Add(new SingerMenuItemViewModel() { + Header = "Favs ...", + Items = Preferences.Default.FavoriteSingers + .Select(id => SingerManager.Inst.Singers.Values.FirstOrDefault(singer => singer.Id == id)) + .OfType() + .LocalizedOrderBy(singer => singer.LocalizedName) + .Select(singer => new SingerMenuItemViewModel() { + Header = singer.LocalizedName, + Command = SelectSingerCommand, + CommandParameter = singer, + }).ToArray(), + }); + var keys = SingerManager.Inst.SingerGroups.Keys.OrderBy(k => k); foreach (var key in keys) { - items.Add(new MenuItemViewModel() { + items.Add(new SingerMenuItemViewModel() { Header = $"{key} ...", Items = SingerManager.Inst.SingerGroups[key] - .Select(singer => new MenuItemViewModel() { + .Select(singer => new SingerMenuItemViewModel() { Header = singer.LocalizedName, Command = SelectSingerCommand, CommandParameter = singer, diff --git a/OpenUtau/Views/PreferencesDialog.axaml b/OpenUtau/Views/PreferencesDialog.axaml index 0423cacda..8b61d5083 100644 --- a/OpenUtau/Views/PreferencesDialog.axaml +++ b/OpenUtau/Views/PreferencesDialog.axaml @@ -78,11 +78,13 @@ - +