Ejemplo n.º 1
0
        public void BuildMinorScaleTest()
        {
            var scale = new MinorScale(Step.A, false);
            var steps = scale.BuildScale(1, 8);

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

            scale = new MinorScale(Step.E, false);
            steps = scale.BuildScale(1, 8);
            MusicalAssertions.StepsMatch(steps, Step.E, Step.FSharp, Step.G, Step.A, Step.B, Step.C, Step.D, Step.E).Assert();
        }
Ejemplo n.º 2
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.º 3
0
        public void ChordsTest()
        {
            var chord = TertianHarmony.CreateChord(Pitch.C4, 0, MajorScale.C);

            MusicalAssertions.StepsMatch(chord.Pitches, Step.C, Step.E, Step.G).Assert();
            Assert.AreEqual(Step.C, chord.Name);
            chord = TertianHarmony.CreateChord(Pitch.G4, 0, MajorScale.C);
            Assert.AreEqual(Step.G, chord.Name);
            MusicalAssertions.StepsMatch(chord.Pitches, Step.G, Step.B, Step.D).Assert();
            chord = TertianHarmony.Create7thChord(Pitch.C4, 0, MajorScale.C);
            Assert.AreEqual(Step.C, chord.Name);
            MusicalAssertions.StepsMatch(chord.Pitches, Step.C, Step.E, Step.G, Step.Bb).Assert();
            chord = TertianHarmony.Create7thChord(Pitch.C4, 1, MajorScale.C);
            Assert.AreEqual(Step.C, chord.Name);
            MusicalAssertions.StepsMatch(chord.Pitches, Step.E, Step.G, Step.Bb, Step.C).Assert();
            chord = TertianHarmony.Create7thChord(Pitch.C4, 2, MajorScale.C);
            Assert.AreEqual(Step.C, chord.Name);
            MusicalAssertions.StepsMatch(chord.Pitches, Step.G, Step.Bb, Step.C, Step.E).Assert();
            chord = TertianHarmony.Create7thChord(Pitch.C4, 3, MajorScale.C);
            Assert.AreEqual(Step.C, chord.Name);
            MusicalAssertions.StepsMatch(chord.Pitches, Step.Bb, Step.C, Step.E, Step.G).Assert();
            MusicalAssertions.Throws <ArgumentException>(() => TertianHarmony.Create7thChord(Pitch.C4, 4, MajorScale.C)).Assert();
        }