Exemplo n.º 1
0
        private Tuple <double, double> GetRandomParameterSet()
        {
            var harmonyMemoryConsiderationRatio = _random.NextValue(0.9, 1);
            var pitchAdjustmentRatio            = _random.NextDouble();

            return(new Tuple <double, double>(harmonyMemoryConsiderationRatio, pitchAdjustmentRatio));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Improvises the harmony.
        /// </summary>
        /// <param name="harmonyMemoryConsiderationRatio">The harmony memory consideration ratio.</param>
        /// <param name="pitchAdjustmentRatio">The pitch adjustment ratio.</param>
        /// <returns></returns>
        public Harmony <T> ImproviseHarmony(double harmonyMemoryConsiderationRatio, double pitchAdjustmentRatio)
        {
            var randomValue    = Random.NextDouble();
            var generationRule = EstablishHarmonyGenerationRule(randomValue, harmonyMemoryConsiderationRatio, pitchAdjustmentRatio);

            switch (generationRule)
            {
            case HarmonyGenerationRules.MemoryConsideration:
                return(UseMemoryConsideration());

            case HarmonyGenerationRules.PitchAdjustment:
                return(UsePitchAdjustment());

            case HarmonyGenerationRules.RandomChoosing:
                return(UseRandomChoosing());

            default:
                return(new Harmony <T>(double.PositiveInfinity));
            }
        }