Exemplo n.º 1
0
        public L1C5Controller()
        {
            Pitch pitch = new Pitches().Random();

            ViewBag.Pitch  = pitch;
            ViewBag.ShowDo = true;
        }
Exemplo n.º 2
0
        private static string ToMarkupValue(Pitches pitch)
        {
            switch (pitch)
            {
            case Pitches.Default:
                return("default");

            case Pitches.XLow:
                return("x-low");

            case Pitches.Low:
                return("low");

            case Pitches.Medium:
                return("medium");

            case Pitches.High:
                return("high");

            case Pitches.XHigh:
                return("x-high");

            default:
                throw new ArgumentOutOfRangeException(nameof(pitch), pitch, null);
            }
        }
Exemplo n.º 3
0
 public double this[Pitches pitch, Scales scale]
 {
     get
     {
         return(GetFrequence(pitch, scale));
     }
 }
Exemplo n.º 4
0
        public L1C1Controller()
        {
            Pitch pitch = new Pitches().Random();

            //pitch = new Pitches().PitchesList.Single(s => s.PitchName == "E4");
            ViewBag.Pitch  = pitch;
            ViewBag.ShowDo = true;
        }
Exemplo n.º 5
0
        public ActionResult GetNewDO()
        {
            Pitch pitch = new Pitches().Random();
            //Pitch pitch = new Pitches().PitchesList.Single(s => s.PitchName == "F#3/Gb3");
            JsonResult jsonResult = Json(pitch, JsonRequestBehavior.AllowGet);

            return(jsonResult);
        }
Exemplo n.º 6
0
        public NoteGroup(TokenGroup tokenGroup, Pitches[] scale, double songDuration)
        {
            _tokenGroup = tokenGroup;
            Scale = scale;
            SongDuration = songDuration;

            InitChordsFromTokenGroup();
        }
Exemplo n.º 7
0
        // GET: DO
        public ActionResult Index()
        {
            Pitch pitch = new Pitches().Random();

            ViewBag.Pitch  = pitch;
            ViewBag.ShowDo = true;

            return(View());
        }
Exemplo n.º 8
0
        public L2C5Controller()
        {
            Pitch pitch = new Pitches().Random();

            ViewBag.Pitch = pitch;

            ViewBag.ShowPlayDoTriad = true;
            ViewBag.ShowDo          = true;
        }
Exemplo n.º 9
0
        public ActionResult MelodicMin3rdMaj6thNoDO(string @do)
        {
            if (!string.IsNullOrWhiteSpace(@do))
            {
                Pitch pitch = new Pitches().PitchesList.Single(s => s.PitchName.ToUpper().Split('/').Contains(@do.ToUpper()));
                ViewBag.Pitch = pitch;
            }

            return(View());
        }
Exemplo n.º 10
0
        public ActionResult HarmonicIntervals(string @do)
        {
            if (!string.IsNullOrWhiteSpace(@do))
            {
                Pitch pitch = new Pitches().PitchesList.Single(s => s.PitchName.ToUpper().Split('/').Contains(@do.ToUpper()));
                ViewBag.Pitch = pitch;
            }

            return(View());
        }
Exemplo n.º 11
0
 public static string ToXML(
     this Pitches p)
     => new[]
     {
         "default",
         "x-low",
         "low",
         "medium",
         "high",
         "x-high",
     }[(int)p];
Exemplo n.º 12
0
        public ActionResult DiatonicTriadProgressions(string @do)
        {
            if (!string.IsNullOrWhiteSpace(@do))
            {
                Pitch pitch = new Pitches().PitchesList.Single(s => s.PitchName.ToUpper().Split('/').Contains(@do.ToUpper()));
                ViewBag.Pitch = pitch;
            }

            ViewBag.ShowPlayDoTriad = true;
            return(View());
        }
Exemplo n.º 13
0
        public void GuessOS()
        {
            Pitches p = OppPitch();
            int     n = random.Next(100);

            if (p == Pitches.PitchOut)
            {
                if (n < 80)
                {
                    Strike();
                }
                else
                {
                    int hit = random.Next(25);
                    Hit(hit);
                }
            }
            else if (p == Pitches.Fastball)
            {
                if (n < 75)
                {
                    Strike();
                }
                else
                {
                    int hit = random.Next(25);
                    Hit(hit);
                }
            }
            else if (p == Pitches.BreakingBall)
            {
                if (n < 75)
                {
                    Strike();
                }
                else
                {
                    int hit = random.Next(25);
                    Hit(hit);
                }
            }
            else if (p == Pitches.OffSpeed)
            {
                if (n < 35)
                {
                    Strike();
                }
                else
                {
                    int hit = random.Next(25);
                    Hit(hit);
                }
            }
        }
Exemplo n.º 14
0
        public static float ValueForPitch(Pitches name)
        {
            switch (name)
            {
                case Pitches.B6: return 1975.53F;
                case Pitches.A6: return 1760.00F;

                case Pitches.GsAf6: return 1661.22F;
                case Pitches.G6:     return 1567.98F;
                case Pitches.FsGf6: return 1479.98F;
                case Pitches.F6: return 1396.91F;
                case Pitches.E6: return 1318.51F;
                case Pitches.DsEf6: return 1244.51F;
                case Pitches.D6: return 1174.66F;
                case Pitches.CsDf6: return 1108.73F;
                case Pitches.C6: return 1046.50F;
                case Pitches.B5: return 987.767F;
                case Pitches.AsBf5: return 932.328F;
                case Pitches.A5: return 880.000F;

                case Pitches.GsAf5: return 830.609F;
                case Pitches.G5: return 783.991F;
                case Pitches.FsGf5: return 739.989F;
                case Pitches.F5: return 698.456F;
                case Pitches.E5: return 659.255F;
                case Pitches.DsEf5: return 622.254F;
                case Pitches.D5: return 587.330F;
                case Pitches.CsDf5: return 554.365F;
                case Pitches.C5: return 523.251F;
                case Pitches.B4: return 493.883F;
                case Pitches.AsBf4: return 466.164F;
                case Pitches.A4: return 440F;

                case Pitches.GsAf4: return 415.305F;
                case Pitches.G4: return 391.995F;
                case Pitches.FsGf4: return 369.994F;
                case Pitches.F4: return 349.228F;
                case Pitches.E4: return 329.628F;
                case Pitches.DsEf4: return 311.127F;
                case Pitches.D4: return 293.665F;
                case Pitches.CsDf4: return 277.183F;
                case Pitches.C4: return 261.626F;
                case Pitches.B3: return 246.942F;
                case Pitches.AsBf3: return 233.082F;
                case Pitches.A3: return 220.000F;

                case Pitches.G3: return 195.998F;
                case Pitches.E3: return 164.814F;
                case Pitches.D3: return 146.832F;
                case Pitches.C3: return 130.813F;

                default:                return 0; // Derp
            }
        }
Exemplo n.º 15
0
        public void GetFrequence_Success()
        {
            Pitches[] pitchArray = new Pitches[] {
                Pitches.C,
                Pitches.Csharp,
                Pitches.D,
                Pitches.Dsharp,
                Pitches.E,
                Pitches.F,
                Pitches.Fsharp,
                Pitches.G,
                Pitches.Gsharp,
                Pitches.A,
                Pitches.Asharp,
                Pitches.B
            };

            Scales[] scaleArray = new Scales[] {
                Scales.Four,
                Scales.Five,
                Scales.Six,
                Scales.Seven
            };

            List <double> frequences        = new List <double>();
            double?       previousFrequence = null;

            foreach (var scale in scaleArray)
            {
                foreach (var pitch in pitchArray)
                {
                    var frequence = frequenceRepository[pitch, scale];
                    Assert.IsNotNull(frequence);

                    if (previousFrequence.HasValue)
                    {
                        Assert.IsTrue(previousFrequence < frequence);
                    }

                    previousFrequence = frequence;

                    Assert.IsFalse(frequences.Contains(frequence));

                    frequences.Add(frequence);
                }
            }

            Assert.AreEqual(scaleArray.Length * pitchArray.Length, frequences.Count);
        }
        public async System.Threading.Tasks.Task OnGetAsync(int eventid)
        {
            PEvent  = _context.PitchEvents.FirstOrDefault(e => e.PitchEventId == eventid);
            Pitches = _context.Pitch.Where(p => p.PitchDate == PEvent.PitchDate).Include(p => p.Application);
            await _util.SendEmailAsync(log, "MF Pitch Event Results", "PEP");

            var pitchIds = Pitches.Select(p => p.PitchId).ToList();
            var userIds  = Pitches.Select(p => p.Application.ApplicantId).ToList();

            Scores     = _context.ScoreCard.Where(s => pitchIds.Contains(s.PitchId)).Include(s => s.Judge).Include(s => s.ScoreCardField);
            Presenters = _context.ApplicationUsers.Where(u => userIds.Contains(u.Id));
            var judgeIds = Scores.Select(s => s.JudgeId).ToList();

            Judges                = _context.ApplicationUsers.Where(j => judgeIds.Contains(j.Id));
            ScoringCategories     = Scores.Select(s => s.ScoreCardField.ScoreCardFieldDescription).Distinct().ToArray();
            AverageCategoryScores = new List <float>();



            foreach (var c in ScoringCategories)
            {
                var   sum = Scores.Where(x => x.ScoreCardField.ScoreCardFieldDescription == c).AsEnumerable().ToList().Sum(s => s.Score);
                float avg = (float)sum / (float)Scores.Where(x => x.ScoreCardField.ScoreCardFieldDescription == c).AsEnumerable().ToList().Count;
                AverageCategoryScores.Add(avg);
            }
            AveragePitchScores = new List <float>();
            var numJudges = Judges.AsEnumerable().ToList().Count;

            foreach (var p in Presenters.AsEnumerable().ToList())
            {
                float totalScore = 0;
                foreach (var c in ScoringCategories)
                {
                    totalScore += Scores.FirstOrDefault(s => (s.Pitch.Application.ApplicantId == p.Id) && (s.ScoreCardField.ScoreCardFieldDescription == c)).Score;
                }
                totalScore = (float)totalScore / (float)numJudges;
                AveragePitchScores.Add(totalScore);
            }
            CompanyNames = new List <string>();
            foreach (var p in Pitches.AsEnumerable().ToList())
            {
                CompanyNames.Add(p.Application.CompanyName);
            }
        }
Exemplo n.º 17
0
        public void Take()
        {
            Pitches p = OppPitch();
            int     n = random.Next(100);

            if (p == Pitches.PitchOut)
            {
                Ball();
            }
            else if (p == Pitches.Fastball)
            {
                if (n < 75)
                {
                    Strike();
                }
                else
                {
                    Ball();
                }
            }
            else if (p == Pitches.BreakingBall)
            {
                if (n < 65)
                {
                    Strike();
                }
                else
                {
                    Ball();
                }
            }
            else if (p == Pitches.OffSpeed)
            {
                if (n < 85)
                {
                    Strike();
                }
                else
                {
                    Ball();
                }
            }
        }
Exemplo n.º 18
0
        public L2Controller()
        {
            Pitch pitch = new Pitches().Random();

            ViewBag.Pitch = pitch;
        }
Exemplo n.º 19
0
            // All the major keys.



            public bool Contains(Pitch pitch)
            {
                return(Pitches.Contains(pitch));
            }
Exemplo n.º 20
0
 public Note(Pitches pitch, Scales scale, Durations duration)
     : base(duration)
 {
     Pitch = pitch;
     Scale = scale;
 }
Exemplo n.º 21
0
 private Pitches IncreasePitch(Pitches p)
 {
     return((Pitches)((int)p + 1 % 12));
 }
Exemplo n.º 22
0
 public Note(Pitches pitch, float duration, double startBeat)
 {
     _pitch = pitch;
     _duration = duration;
     StartBeat = startBeat;
 }
 public override string ToString()
 {
     return(string.Join(separatorString, Pitches.Select(PitchConverter.PitchToString)));
 }
Exemplo n.º 24
0
 public NoteFrequence(Pitches pitch, Scales scale, double frequence)
 {
     Pitch     = pitch;
     Scale     = scale;
     Frequence = frequence;
 }
Exemplo n.º 25
0
 private Pitches DecreasePitch(Pitches p)
 {
     return((Pitches)((int)p - 1 % 12));
 }
Exemplo n.º 26
0
 private double GetFrequence(Pitches pitch, Scales scale)
 {
     return(noteFrequenceArray.Where(w => w.Pitch.Equals(pitch) && w.Scale.Equals(scale))
            .Select(s => s.Frequence)
            .FirstOrDefault());
 }