Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions OpenUtau.Core/Format/SVP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private static UProject ConvertToUstx(SynthVProject svpProject, string filePath)

project.tempos = svpProject.time?.tempo?.Select(t =>
new UTempo(
(int)Math.Round(t.position / 1_042_230.0), // convert to ms
(int)Math.Round(t.position / 1470000.0), // convert to OU.Ticks
t.bpm)
).ToList() ?? new List<UTempo>();

Expand All @@ -68,16 +68,17 @@ private static UProject ConvertToUstx(SynthVProject svpProject, string filePath)
};

foreach (var svpNote in svpTrack.mainGroup.notes) {
if (svpNote.musicalType != "singing") {
// skips over rap notes
if (svpNote.musicalType == "rapping") {
continue;
}
// nanoseconds to milliseconds
double onsetMs = svpNote.onset / 1_468_750.0;
double durationMs = svpNote.duration / 1_468_750.0;
// SV.Quarter to OU.Ticks
double onsetMs = svpNote.onset / 1470000.0;
double durationMs = svpNote.duration / 1470000.0;
Log.Error($"Note onset: {svpNote.onset} ticks ({onsetMs:F3} ms)");

int tickOn = timeAxis.MsPosToTickPos(Math.Round(onsetMs));
int tickOff = timeAxis.MsPosToTickPos(Math.Round(onsetMs + durationMs));
int tickOn = (int)(Math.Round(onsetMs));
int tickOff = (int)(Math.Round(onsetMs + durationMs));
int duration = Math.Max(tickOff - tickOn, 1);
Log.Error($"Note tick: {tickOn}");

Expand All @@ -86,7 +87,7 @@ private static UProject ConvertToUstx(SynthVProject svpProject, string filePath)
tickOn,
duration);

note.lyric = string.IsNullOrEmpty(svpNote.lyrics) ? "a" : svpNote.lyrics;
note.lyric = string.IsNullOrEmpty(svpNote.lyrics) ? $"{Util.NotePresets.Default.DefaultLyric}" : svpNote.lyrics;
if (note.lyric == "-") {
note.lyric = "+~";
}
Expand Down