Esempio n. 1
0
        public NoteSequence BuildDropTuning(int strings, NoteSharp topNote)
        {
            var notes = new List <NoteSharp>();

            NoteSharp currentNote = topNote;

            notes.Add(currentNote);

            for (int i = 1; i < strings; i++)
            {
                int step = NormalStep;

                if (i == (strings - 2))
                {
                    step -= 1;
                }
                else if (i == 1)
                {
                    step += 2;
                }

                currentNote = GetNextNoteByInterval(currentNote, (Interval)step);

                notes.Add(currentNote);
            }

            return(new NoteSequence(notes));
        }
Esempio n. 2
0
        public void NoteManipulation_GetInterval_MinorSecond()
        {
            NoteSharp starting = NoteSharp.GSharp, expected = NoteSharp.A;

            NoteSharp ending = _service.GetNextNoteByInterval(starting, Interval.Minor2);

            Assert.AreEqual(expected, ending);
        }
Esempio n. 3
0
        public void NoteManipulation_GetInterval_DiminishedFifth()
        {
            NoteSharp starting = NoteSharp.DSharp, expected = NoteSharp.A;

            NoteSharp ending = _service.GetNextNoteByInterval(starting, Interval.Diminished5);

            Assert.AreEqual(expected, ending);
        }
Esempio n. 4
0
        public void NoteManipulation_GetInterval_PerfectFourth()
        {
            NoteSharp starting = NoteSharp.G, expected = NoteSharp.CSharp;

            NoteSharp ending = _service.GetNextNoteByInterval(starting, Interval.Perfect4);

            Assert.AreEqual(expected, ending);
        }
Esempio n. 5
0
        public Scale BuildHarmonicScale(NoteSharp firstNote)
        {
            var scale = BuildMinorScale(firstNote);

            scale.ScaleNotes.Notes[6] = GetNextNoteByInterval(scale.ScaleNotes.Notes[6], Interval.Minor2);

            return(scale);
        }
Esempio n. 6
0
        public void NoteManipulation_RelativeMajor_C()
        {
            NoteSharp starting = NoteSharp.C, expected = NoteSharp.DSharp;

            NoteSharp ending = _service.FindRelativeMajor(starting);

            Assert.AreEqual(expected, ending);
        }
Esempio n. 7
0
        public NoteSharp GetNextNoteByInterval(NoteSharp note, Interval interval)
        {
            if ((int)note + (int)interval == TotalNotes)
            {
                return((NoteSharp)TotalNotes);
            }

            var ending = ((int)note + (int)interval) % TotalNotes;

            return((NoteSharp)ending);
        }
Esempio n. 8
0
        public void Scale_MinorScale_B()
        {
            NoteSharp starting = NoteSharp.B;

            NoteSharp[] scale = { NoteSharp.B, NoteSharp.CSharp, NoteSharp.D, NoteSharp.E, NoteSharp.FSharp, NoteSharp.G, NoteSharp.A, NoteSharp.B },
            result = _service.BuildMinorScale(starting).ScaleNotes.Notes;

            Assert.AreEqual(scale.Length, result.Length, "Result scale is the wrong length.");

            for (var i = 0; i < scale.Length; i++)
            {
                Assert.AreEqual(scale[i], result[i], "Mismatch at index {0}", i);
            }
        }
Esempio n. 9
0
        public void Scale_Melodic_F()
        {
            NoteSharp starting = NoteSharp.F;

            NoteSequence scale  = new NoteSequence(new NoteSharp[] { NoteSharp.F, NoteSharp.G, NoteSharp.GSharp, NoteSharp.ASharp, NoteSharp.C, NoteSharp.D, NoteSharp.E, NoteSharp.F, NoteSharp.DSharp, NoteSharp.CSharp, NoteSharp.C, NoteSharp.ASharp, NoteSharp.GSharp, NoteSharp.G, NoteSharp.F }),
                         result = new NoteSequence(_service.BuildMelodicScale(starting).ScaleNotes);

            Assert.AreEqual(scale.Length, result.Length, "Result scale is the wrong length.");

            for (var i = 0; i < scale.Length; i++)
            {
                Assert.AreEqual(scale.Notes[i], result.Notes[i], "Mismatch at index {0}", i);
            }
        }
Esempio n. 10
0
        public void Scale_Harmonic_C()
        {
            NoteSharp starting = NoteSharp.C;

            NoteSharp[] scale = { NoteSharp.C, NoteSharp.D, NoteSharp.DSharp, NoteSharp.F, NoteSharp.G, NoteSharp.GSharp, NoteSharp.B, NoteSharp.C },
            result = _service.BuildHarmonicScale(starting).ScaleNotes.Notes;

            Assert.AreEqual(scale.Length, result.Length, "Result scale is the wrong length.");

            for (var i = 0; i < scale.Length; i++)
            {
                Assert.AreEqual(scale[i], result[i], "Mismatch at index {0}", i);
            }
        }
Esempio n. 11
0
        public NoteSequence ReverseSequence(Scale scale)
        {
            NoteSequence seq = scale.ScaleNotes;

            NoteSharp[] reversed = new NoteSharp[seq.Length];
            for (int i = 0; i < seq.Length / 2; i++)
            {
                int swapping = (seq.Length - 1) - i;

                reversed[i] = seq.Notes[swapping];

                reversed[swapping] = seq.Notes[i];
            }

            return(new NoteSequence(reversed));
        }
        public void BuildDropGSevenString()
        {
            NoteSharp topString = NoteSharp.G;

            Guitar g = new Guitar(7, TuningStyle.Drop, topString, "dropG7");

            g.Strings = _service.BuildDropTuning(g.NumberOfStrings, topString);

            Assert.IsTrue(g.Strings.Length == g.NumberOfStrings, "Incorrect Number of Strings, Expected {0} got {1}", g.NumberOfStrings, g.Strings.Length);

            NoteSharp[] realNote = { NoteSharp.G, NoteSharp.D, NoteSharp.G, NoteSharp.C, NoteSharp.F, NoteSharp.A, NoteSharp.D };

            for (int i = 0; i < g.NumberOfStrings; i++)
            {
                Assert.AreEqual(realNote[i], g.Strings.Notes[i], "Incorrect Note on string {0}", i + 1);
            }
        }
        public void Tuning_DropTuning_BSix()
        {
            NoteSharp topString = NoteSharp.B;

            Guitar g = new Guitar(6, TuningStyle.Drop, topString, "dropB6");

            g.Strings = _service.BuildDropTuning(g.NumberOfStrings, topString);

            Assert.IsTrue(g.Strings.Length == g.NumberOfStrings, "Incorrect Number of Strings, Expected {0} got {1}", g.NumberOfStrings, g.Strings.Length);

            NoteSharp[] realNote = { NoteSharp.B, NoteSharp.FSharp, NoteSharp.B, NoteSharp.E, NoteSharp.GSharp, NoteSharp.CSharp };

            for (int i = 0; i < g.NumberOfStrings; i++)
            {
                Assert.AreEqual(realNote[i], g.Strings.Notes[i], "Incorrect Note on string {0}", i + 1);
            }
        }
        public void Tuning_Standard_Seven()
        {
            NoteSharp topString = NoteSharp.B;

            Guitar g = new Guitar(7, TuningStyle.Standard, topString, "standard7");

            g.Strings = _service.BuildStandardTuning(g.NumberOfStrings, topString);

            Assert.IsTrue(g.Strings.Length == g.NumberOfStrings, "Incorrect Number of Strings, Expected {0} got {1}", g.NumberOfStrings, g.Strings.Length);

            NoteSharp[] realNote = { NoteSharp.B, NoteSharp.E, NoteSharp.A, NoteSharp.D, NoteSharp.G, NoteSharp.B, NoteSharp.E };

            for (int i = 0; i < g.NumberOfStrings; i++)
            {
                Assert.AreEqual(realNote[i], g.Strings.Notes[i], "Incorrect Note on string {0}", (1 + i));
            }
        }
Esempio n. 15
0
        public NoteSequence BuildScaleWithTwoHalfSteps(NoteSharp firstNote, int one, int two)
        {
            var scale = new List <NoteSharp>();

            scale.Add(firstNote);

            NoteSharp currentNote = firstNote;

            for (var i = 1; i < ScaleLength; i++)
            {
                int step = 2;
                if (i == one || i == two)
                {
                    step = 1;
                }

                currentNote = GetNextNoteByInterval(currentNote, (Interval)step);
                scale.Add(currentNote);
            }

            return(new NoteSequence(scale));
        }
Esempio n. 16
0
        public Scale BuildMelodicScale(NoteSharp firstNote)
        {
            Scale scaleObject = new Scale(firstNote, ScaleStyle.Melodic, null);
            var   scale       = BuildMinorScale(firstNote);
            var   secondHalf  = ReverseSequence(BuildMinorScale(firstNote));
            var   fullScale   = new NoteSharp[(ScaleLength * 2) - 1];

            scale.ScaleNotes.Notes[5] = GetNextNoteByInterval(scale.ScaleNotes.Notes[5], Interval.Minor2);
            scale.ScaleNotes.Notes[6] = GetNextNoteByInterval(scale.ScaleNotes.Notes[6], Interval.Minor2);

            for (int i = 0; i < ScaleLength; i++)
            {
                fullScale[i] = scale.ScaleNotes.Notes[i];
            }

            for (int i = 0; i < ScaleLength - 1; i++)
            {
                fullScale[ScaleLength + i] = secondHalf.Notes[1 + (i % ScaleLength)];
            }

            scaleObject.ScaleNotes = new NoteSequence(fullScale);
            return(scaleObject);
        }
Esempio n. 17
0
 public Scale(NoteSharp firstNote, ScaleStyle scaleStyle, NoteSequence scaleNotes)
 {
     FirstNote  = firstNote;
     ScaleStyle = scaleStyle;
     ScaleNotes = scaleNotes;
 }
Esempio n. 18
0
 public NoteSharp FindRelativeMinor(NoteSharp major)
 {
     return(GetNextNoteByInterval(major, Interval.Major6));
 }
Esempio n. 19
0
 public Scale BuildMinorScale(NoteSharp firstNote)
 {
     return(new Scale(firstNote, ScaleStyle.Minor, BuildScaleWithTwoHalfSteps(firstNote, 2, 5)));
 }
Esempio n. 20
0
 public Guitar(int strings, TuningStyle tuningStyle, NoteSharp topNote, string name)
 {
     NumberOfStrings = strings;
     TuningStyle     = tuningStyle;
     GuitarName      = name;
 }