1
0
mirror of synced 2024-12-18 04:45:55 +01:00

add padding silence before sound

This commit is contained in:
NotImplementedLife 2023-07-17 17:47:56 +03:00
parent b53891cb7a
commit 2f2e1b447f
2 changed files with 38 additions and 7 deletions

View File

@ -221,15 +221,35 @@ namespace TaikoSoundEditor
File.WriteAllText("tja.txt", tja.ToString());
var seconds = Math.Ceiling(tja.Headers.Offset + 3);
var seconds = (int)Math.Ceiling(tja.Headers.Offset + 3);
if (seconds < 0) seconds = 0;
FeedbackBox.AppendText("Converting to wav\r\n");
WAV.ConvertToWav(audioFilePath, $@".-tmp\{songName}.wav");
WAV.ConvertToWav(audioFilePath, $@".-tmp\{songName}.wav", seconds);
tja.Headers.Offset -= seconds;
tja.Headers.DemoStart += seconds;
var text = File.ReadAllLines(tjaPath);
text = text.Select(l =>
{
if (l.StartsWith("OFFSET:"))
return $"OFFSET:{tja.Headers.Offset:n3}";
if (l.StartsWith("DEMOSTART:"))
return $"DEMOSTART:{tja.Headers.DemoStart:n3}";
return l;
}).ToArray();
var newTja = @$".-tmp\{Path.GetFileName(tjaPath)}";
File.WriteAllLines(newTja, text);
FeedbackBox.AppendText("Running tja2fumen\r\n");
var tja_binaries = TJA.RunTja2Fumen(tjaPath);
var tja_binaries = TJA.RunTja2Fumen(newTja);
FeedbackBox.AppendText("Creating sound data\r\n");
NewSongData ns = new NewSongData();
@ -315,6 +335,17 @@ namespace TaikoSoundEditor
mi.SongFileName = $"sound/song_{songName}";
mi.RendaTimeEasy = 0;
mi.RendaTimeHard = 0;
mi.RendaTimeMania = 0;
mi.RendaTimeNormal = 0;
mi.RendaTimeUra = 0;
mi.FuusenTotalEasy = 0;
mi.FuusenTotalHard = 0;
mi.FuusenTotalMania = 0;
mi.FuusenTotalNormal = 0;
mi.FuusenTotalUra = 0;
Dictionary<string, int> genres = new Dictionary<string, int>
{
{ "POP", 0 },

6
WAV.cs
View File

@ -10,7 +10,7 @@ namespace TaikoSoundEditor
internal static class WAV
{
public static void ConvertToWav(string sourcePath, string destPath, int seconds_before = 0)
public static void ConvertToWav(string sourcePath, string destPath, int seconds_before)
{
sourcePath = Path.GetFullPath(sourcePath);
destPath = Path.GetFullPath(destPath);
@ -19,9 +19,9 @@ namespace TaikoSoundEditor
p.StartInfo.FileName = Path.GetFullPath(@"Tools\sox\sox.exe");
p.StartInfo.ArgumentList.Add(sourcePath);
p.StartInfo.ArgumentList.Add(destPath);
/*p.StartInfo.ArgumentList.Add("pad");
p.StartInfo.ArgumentList.Add("pad");
p.StartInfo.ArgumentList.Add(seconds_before.ToString());
p.StartInfo.ArgumentList.Add("0");*/
p.StartInfo.ArgumentList.Add("0");
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.RedirectStandardOutput = true;