Exemple #1
0
        public static string[] GetResamplerArg(ResamplerArgs Args)
        {
            if (Args.InputWavfile.IndexOf("shi_shi_shi.wav") > 0)
            {
                double dr = 0;
                dr = 1;
            }


            //子音伸缩率
            int vel = Args.ConsonantVelocity; //Vel子音速度

            if (vel > 1000)
            {
                vel = 1000;
            }
            if (vel < 0)
            {
                vel = 0;
            }
            double velj = Math.Pow(2, (1 - ((int)vel / 100)));
            double FixedConsonantLengthMs = Args.FixedConsonantLengthMs * velj;
            double SoundStartMs           = Args.SoundStartMs * velj;


            double TickDebetMs             = UtauToolUtils.Global_GenerateGlobalPlusTimeMs(Args.ThisPreutterOverlapsArgs, Args.NextPreutterOverlapsArgs);
            double FixedMillisecLengthBase = MidiMathUtils.Tick2Time((long)(Args.TickLength), Args.Tempo) * 1000 + Args.ThisPreutterOverlapsArgs.PreUtterance - Args.NextRealPreutterOverlapsArgs.PreUtterance + Args.NextRealPreutterOverlapsArgs.OverlapMs;
            //   double FixedMillisecLength = UtauToolUtils.Resampler_SortNear50((int)FixedMillisecLengthBase);//Fixed.Resampler_SortNear50((int)(MidiMathUtils.Tick2Time((long)(Args.TickLength), Args.Tempo) * 1000 + (TickDebetMs < 0 ? 0 : TickDebetMs)));
            double FixedMillisecLength2 = UtauToolUtils.Resampler_SortNear50((int)(FixedMillisecLengthBase + SoundStartMs));

            string[] resampler_arg_suffix = new string[] {
                "\"" + Args.InputWavfile + "\"",
                "\"" + Args.OutputFile + "\"",
                "" + Args.Note + "",
                vel.ToString(),                                 //<==VEL
                "\"" + Args.Flags + "\"",
                (SoundStartMs).ToString("0.0###") + "",         //Args.SoundStartMs
                FixedMillisecLength2.ToString() + "",           //FixedMillisecLength
                FixedConsonantLengthMs.ToString("0.0###") + "", //Args.FixedConsonantLengthMs
                Args.FixedReleasingLengthMs.ToString("0.0###") + "",
                Args.Intensity.ToString() + "",
                Args.Moduration.ToString() + "",
                "!" + Args.Tempo.ToString() + "",
                Args.PitchString
            };
            return(resampler_arg_suffix);
        }