Пример #1
0
        ///
        ///<summary>Convert one format to another with SoX.</summary>
        ///<param name="inf">The input file.</param>
        ///<param name="outf">The output file. This file will be overwritten if it exists.</param>
        ///
        public static void soxConvert(string inf, string outf)
        {
            //Console.WriteLine("Converting format with SoX...");
            Process p = new SoXProcess();

            p.StartInfo.Arguments += inf.quote() + " " + outf.quote();
            p.Start();
            p.WaitForExit();

            if (p.ExitCode != 0)
            {
                throw new MusicFileException("Creating the file " + outf + " was unsuccessful. It's possible that SoX doesn't support this format.");
            }
        }
Пример #2
0
        ///
        ///<summary>Convert one format to another with SoX, trimming to a certain point.</summary>
        ///<param name="inf">The input file.</param>
        ///<param name="outf">The output file. This file will be overwritten if it exists.</param>
        ///<param name="length">The length to trim to, in samples.</param>
        ///
        public static void soxConvert(string inf, string outf, int length)
        {
            //Console.WriteLine("Converting format with SoX...");
            Process p = new SoXProcess();

            p.StartInfo.Arguments += inf.quote() + " " + outf.quote() + " trim 0 " + length + "s";
            p.Start();
            p.WaitForExit();

            if (p.ExitCode != 0)
            {
                throw new MusicFileException("SoX conversion was unsuccessful");
            }
        }