Exemple #1
0
        public static void Save(string newName, WaveScanner ws, int overhead, bool createLogs)
        {
            List <splitter> chains  = ARSplitter.GetChains(ws.NumFiles, overhead);
            int             chain_n = 1;

            foreach (splitter chain in chains)
            {
                WavCollection samples = ws.GetSamples(chain);
                Wav           total   = samples.GetChain();

                for (int k = 0; k < chain.fillers; k++)
                {
                    total.CatSilence(samples.MaxDuration());
                }

                int    tot = chain.chainLen + chain.fillers;
                string wavName, logName;
                mkNames(newName, tot, chain_n, out wavName, out logName);

                total.Save(wavName);
                if (createLogs)
                {
                    saveLog(logName, chain.fillers, samples);
                }
                chain_n++;
            }
        }
Exemple #2
0
        static int Main(string[] args)
        {
            Options opt = new Options();

            if (!Parser.Default.ParseArguments(args, opt) || (string.IsNullOrWhiteSpace(opt.InputFile) && string.IsNullOrWhiteSpace(opt.InputFolder)))
            {
                // Values are available here
                Console.WriteLine(opt.GetUsage());
                return(1);
            }

            if (!opt.CreateAR && !opt.CreateOT)
            {
                Console.WriteLine(opt.GetUsage());
                Console.WriteLine("Nothing to do: no output chain specified.");
                return(1);
            }

            WaveScanner ws        = new WaveScanner();
            string      errorcode = string.IsNullOrWhiteSpace(opt.InputFolder) ? ws.Load(opt.InputFile) : ws.LoadDir(opt.InputFolder);

            if (!string.IsNullOrEmpty(errorcode))
            {
                Console.WriteLine(errorcode);
                return(1);
            }

            string out_fn;

            if (string.IsNullOrWhiteSpace(opt.OutputFile))
            {
                string fn  = string.IsNullOrWhiteSpace(opt.InputFolder) ? opt.InputFile : opt.InputFolder;
                string dir = Path.GetDirectoryName(fn);
                string nm  = Path.GetFileNameWithoutExtension(fn) + ".wav";
                out_fn = Path.Combine(dir, nm);
            }
            else
            {
                out_fn = opt.OutputFile;
            }

            Console.WriteLine("Creating chains, please wait...");
            ws.Save(out_fn, opt.CreateAR, opt.CreateOT, opt.MaxOverhead, opt.CreateLogs);

            return(0);
        }