add padding silence before sound
This commit is contained in:
parent
b53891cb7a
commit
2f2e1b447f
39
MainForm.cs
39
MainForm.cs
@ -221,15 +221,35 @@ namespace TaikoSoundEditor
|
|||||||
File.WriteAllText("tja.txt", tja.ToString());
|
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;
|
if (seconds < 0) seconds = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FeedbackBox.AppendText("Converting to wav\r\n");
|
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");
|
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");
|
FeedbackBox.AppendText("Creating sound data\r\n");
|
||||||
NewSongData ns = new NewSongData();
|
NewSongData ns = new NewSongData();
|
||||||
@ -315,6 +335,17 @@ namespace TaikoSoundEditor
|
|||||||
|
|
||||||
mi.SongFileName = $"sound/song_{songName}";
|
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>
|
Dictionary<string, int> genres = new Dictionary<string, int>
|
||||||
{
|
{
|
||||||
{ "POP", 0 },
|
{ "POP", 0 },
|
||||||
|
6
WAV.cs
6
WAV.cs
@ -10,7 +10,7 @@ namespace TaikoSoundEditor
|
|||||||
internal static class WAV
|
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);
|
sourcePath = Path.GetFullPath(sourcePath);
|
||||||
destPath = Path.GetFullPath(destPath);
|
destPath = Path.GetFullPath(destPath);
|
||||||
@ -19,9 +19,9 @@ namespace TaikoSoundEditor
|
|||||||
p.StartInfo.FileName = Path.GetFullPath(@"Tools\sox\sox.exe");
|
p.StartInfo.FileName = Path.GetFullPath(@"Tools\sox\sox.exe");
|
||||||
p.StartInfo.ArgumentList.Add(sourcePath);
|
p.StartInfo.ArgumentList.Add(sourcePath);
|
||||||
p.StartInfo.ArgumentList.Add(destPath);
|
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(seconds_before.ToString());
|
||||||
p.StartInfo.ArgumentList.Add("0");*/
|
p.StartInfo.ArgumentList.Add("0");
|
||||||
p.StartInfo.UseShellExecute = false;
|
p.StartInfo.UseShellExecute = false;
|
||||||
p.StartInfo.RedirectStandardError = true;
|
p.StartInfo.RedirectStandardError = true;
|
||||||
p.StartInfo.RedirectStandardOutput = true;
|
p.StartInfo.RedirectStandardOutput = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user