Ejemplo n.º 1
0
        public void ChromaticIntervalTranslationsTest()
        {
            var scale   = new MajorScale(Step.G, false);
            var pitches = scale.BuildScale(1, 8);

            var secondStep      = pitches.ElementAt(1);
            var translatedPitch = scale.TranslatePitch(secondStep, Interval.MajorThird);

            Assert.AreEqual(translatedPitch, Step.CSharp);
        }
        public void TertianTuningTest()
        {
            var tuning = new TertianTuning(Pitch.C4);
            var comma  = tuning.CommaBetweenLastIntervalAndPerfectOctave;

            var scale = new MajorScale(Step.G, false);

            foreach (var pitch in scale.BuildScale(1, 9))
            {
                var tp = pitch.Tune(new TunedPitch(Pitch.A4, 440), tuning);
                Debug.WriteLine(tp.ToString());
            }
        }
Ejemplo n.º 3
0
        public void BuildMajorScaleTest()
        {
            var scale = new MajorScale(Step.G, false);
            var steps = scale.BuildScale(1, 8);

            MusicalAssertions.StepsMatch(steps, Step.G, Step.A, Step.B, Step.C, Step.D, Step.E, Step.FSharp, Step.G).Assert();

            scale = new MajorScale(Step.B, false);
            steps = scale.BuildScale(1, 8);
            MusicalAssertions.StepsMatch(steps, Step.B, Step.CSharp, Step.DSharp, Step.E, Step.FSharp, Step.GSharp, Step.ASharp, Step.B).Assert();

            scale = new MajorScale(Step.Bb, true);
            steps = scale.BuildScale(1, 8);
            MusicalAssertions.StepsMatch(steps, Step.Bb, Step.C, Step.D, Step.Eb, Step.F, Step.G, Step.A, Step.Bb).Assert();

            MusicalAssertions.ThrowsMalformedScaleException(() => scale = new MajorScale(Step.B, true)).Assert();
        }
Ejemplo n.º 4
0
        public void DiatonicIntervalTranslationsTest()
        {
            var scale   = new MajorScale(Step.G, false);
            var pitches = scale.BuildScale(1, 8);

            var secondStep      = pitches.ElementAt(1);
            var translatedPitch = scale.TranslatePitch(secondStep, DiatonicInterval.Unison);

            Assert.AreEqual(translatedPitch, Step.A);
            translatedPitch = scale.TranslatePitch(secondStep, DiatonicInterval.Second);
            Assert.AreEqual(translatedPitch, Step.B);
            translatedPitch = scale.TranslatePitch(secondStep, DiatonicInterval.Third);
            Assert.AreEqual(translatedPitch, Step.C);
            translatedPitch = scale.TranslatePitch(secondStep, DiatonicInterval.Fourth);
            Assert.AreEqual(translatedPitch, Step.D);
            translatedPitch = scale.TranslatePitch(secondStep, DiatonicInterval.Fifth);
            Assert.AreEqual(translatedPitch, Step.E);
            translatedPitch = scale.TranslatePitch(secondStep, DiatonicInterval.Sixth);
            Assert.AreEqual(translatedPitch, Step.FSharp);
            translatedPitch = scale.TranslatePitch(secondStep, DiatonicInterval.Seventh);
            Assert.AreEqual(translatedPitch, Step.G);
            translatedPitch = scale.TranslatePitch(secondStep, DiatonicInterval.Octave);
            Assert.AreEqual(translatedPitch, Step.A);
        }