示例#1
0
        public void Common_Note_Is_Found_In_Many_Other_Fuzzy_Matches()
        {
            var gtr = new SixStringGuitarInstrument();

            // two notes on each string, 12 frets apart. Ignore original first position.
            Assert.Equal((gtr.Strings.Count * 2) - 1, gtr.OtherFuzzyPositionsFor(new FingerPosition(0, 1)).Count);
        }
示例#2
0
        public void Common_Note_Is_Found_In_Many_Other_Exact_Matches()
        {
            var gtr = new SixStringGuitarInstrument();

            // ignore first string, too far up sixth string so only 4 other candidates.
            Assert.Equal(gtr.Strings.Count - 2, gtr.OtherExactPositionsFor(new FingerPosition(0, 1)).Count);
        }
示例#3
0
        public void Tuning_Increases_Low_To_High_Across_Strings()
        {
            var gtr = new SixStringGuitarInstrument();

            for (int s = 6; s > 5; s--)
            {
                Assert.True(gtr.NoteAt(new FingerPosition(0, s)) < gtr.NoteAt(new FingerPosition(0, s - 1)));
            }
        }
示例#4
0
        public void Adjacent_High_Strings_Are_Tuned_Differently()
        {
            var gtr = new SixStringGuitarInstrument();

            var twoOpen = gtr.NoteAt(new FingerPosition(0, 2));
            var oneOpen = gtr.NoteAt(new FingerPosition(0, 1));

            Assert.True(twoOpen < oneOpen);
        }
示例#5
0
        public void Adjacent_Mid_Strings_Are_Tuned_Differently()
        {
            var gtr = new SixStringGuitarInstrument();

            var fourOpen  = gtr.NoteAt(new FingerPosition(0, 4));
            var threeOpen = gtr.NoteAt(new FingerPosition(0, 3));

            Assert.True(fourOpen < threeOpen);
        }
示例#6
0
        public void Adjacent_Low_Strings_Are_Tuned_Differently()
        {
            var gtr = new SixStringGuitarInstrument();

            var sixOpen  = gtr.NoteAt(new FingerPosition(0, 6));
            var fiveOpen = gtr.NoteAt(new FingerPosition(0, 5));

            Assert.True(sixOpen < fiveOpen);
        }
示例#7
0
        public void Tuning_Is_Self_Consistent()
        {
            var gtr = new SixStringGuitarInstrument();

            Assert.Equal(gtr.NoteAt(new FingerPosition(5, 6)), gtr.NoteAt(new FingerPosition(0, 5)));
            Assert.Equal(gtr.NoteAt(new FingerPosition(5, 5)), gtr.NoteAt(new FingerPosition(0, 4)));
            Assert.Equal(gtr.NoteAt(new FingerPosition(5, 4)), gtr.NoteAt(new FingerPosition(0, 3)));
            Assert.Equal(gtr.NoteAt(new FingerPosition(4, 3)), gtr.NoteAt(new FingerPosition(0, 2)));
            Assert.Equal(gtr.NoteAt(new FingerPosition(5, 2)), gtr.NoteAt(new FingerPosition(0, 1)));
        }
示例#8
0
        public void String_Are_Numbered_High_To_Low()
        {
            var gtr = new SixStringGuitarInstrument();

            Assert.Equal(new Note(SixStringGuitarInstrument.HighEString), gtr.Strings.FirstOrDefault(s => s.Number == 1).Open);
            Assert.Equal(new Note(SixStringGuitarInstrument.BString), gtr.Strings.FirstOrDefault(s => s.Number == 2).Open);
            Assert.Equal(new Note(SixStringGuitarInstrument.GString), gtr.Strings.FirstOrDefault(s => s.Number == 3).Open);
            Assert.Equal(new Note(SixStringGuitarInstrument.DString), gtr.Strings.FirstOrDefault(s => s.Number == 4).Open);
            Assert.Equal(new Note(SixStringGuitarInstrument.AString), gtr.Strings.FirstOrDefault(s => s.Number == 5).Open);
            Assert.Equal(new Note(SixStringGuitarInstrument.LowEString), gtr.Strings.FirstOrDefault(s => s.Number == 6).Open);
        }
示例#9
0
        static void Main(string[] args)
        {
            var instrument = new SixStringGuitarInstrument();

            // create a simple melody.
            var walkingBassFingering = new Fingering();

            walkingBassFingering.Add(new FingerPosition(0, 1));
            walkingBassFingering.Add(new FingerPosition(1, 1));
            walkingBassFingering.Add(new FingerPosition(2, 1));
            walkingBassFingering.Add(new FingerPosition(3, 1));

            Console.WriteLine(FingeringPrinter.Print(walkingBassFingering, instrument));

            // build the list of notes
            var melody = walkingBassFingering.ToMelody(instrument);

            // can we build the simples reconstruction ?
            var roundTripFingering = FingeringCreator.CreateFingeringFor(instrument, melody, new FixedValueSelector());

            Console.WriteLine(FingeringPrinter.Print(roundTripFingering, instrument));

            Console.ReadKey();
        }
示例#10
0
        public void Low_String_Is_Tuned_Correctly()
        {
            var gtr = new SixStringGuitarInstrument();

            Assert.Equal(new Note(40), gtr.NoteAt(new FingerPosition(0, 6)));
        }
示例#11
0
        public void Highest_Note_Is_Only_Found_In_One_Exact_Match()
        {
            var gtr = new SixStringGuitarInstrument();

            Assert.Equal(0, gtr.OtherExactPositionsFor(new FingerPosition(22, 1)).Count);
        }
示例#12
0
        public void Lowest_Note_Is_Only_Found_In_One_Exact_Match()
        {
            var gtr = new SixStringGuitarInstrument();

            Assert.Equal(1, gtr.PositionsFor(new Note(40)).Count);
        }