且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在C#中分割音频文件?

更新时间:2023-01-30 22:18:57

我用这段代码修剪音频信号



I use this code for trim audio signal

private void button1_Click(object sender, EventArgs e)
        {
            string ifile = @"E:\Temp\a1.wav";
            string ofile = @"E:\Temp\a3.wav";

            Process p = new Process();
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.RedirectStandardOutput = true;
            p.StartInfo.RedirectStandardError = true;
            p.StartInfo.FileName = "C:\\Program Files (x86)\\sox-14-4-1\\sox.exe ";
            //p.StartInfo.Arguments = ifile + " " + ofile + " silence 1 0.1 1% 0.1 1%";
            p.StartInfo.Arguments = ifile + " " + ofile + " silence 1 0.1 1% -1 0.1 1%";

            //sox in.wav out4.wav silence 1 0.1 1% -1 0.1 1%
            //p.OutputDataReceived += process_OutputDataReceived;
            //p.ErrorDataReceived += process_ErrorDataReceived;

            p.Start();
            p.BeginErrorReadLine();
            p.BeginOutputReadLine();
        }