Beispiel #1
0
        public void Fingering_In_Single_Area_Is_One_Hand_Position()
        {
            var f = new Fingering();

            f.Add(new FingerPosition(1, 1));
            f.Add(new FingerPosition(2, 1));
            f.Add(new FingerPosition(3, 1));

            Assert.Single(f.HandPositions());
        }
Beispiel #2
0
        public void Fingering_Of_Octave_Is_Three_Hand_Positions()
        {
            var f = new Fingering();

            foreach (int fret in Enumerable.Range(1, 12))
            {
                f.Add(new FingerPosition(fret, 1));
            }

            Assert.Equal(3, f.HandPositions().Count);
        }
        public void Fingering_Along_Single_String_Scores_Lower_Than_Across_Three_Strings()
        {
            var oneString = new Fingering();

            // do they all fit under one hand position.
            // one fret per finger
            oneString.Add(new FingerPosition(0, 1));
            oneString.Add(new FingerPosition(1, 1));
            oneString.Add(new FingerPosition(2, 1));
            oneString.Add(new FingerPosition(3, 1));
            oneString.Add(new FingerPosition(4, 1));
            oneString.Add(new FingerPosition(5, 1));

            var spread = new Fingering();

            spread.Add(new FingerPosition(10, 3));
            spread.Add(new FingerPosition(11, 3));
            spread.Add(new FingerPosition(12, 3));
            spread.Add(new FingerPosition(8, 2));
            spread.Add(new FingerPosition(9, 2));
            spread.Add(new FingerPosition(10, 2));

            var scorer = new FingeringScorer();

            Assert.True(scorer.Score(oneString) < scorer.Score(spread));
        }
Beispiel #4
0
        public void Fingering_Repeated_Notes_Are_Included_In_Hand_Positions()
        {
            var f = new Fingering();

            foreach (int fret in Enumerable.Range(1, 12))
            {
                foreach (int @string in Enumerable.Range(1, 6))
                {
                    f.Add(new FingerPosition(fret, @string));
                }
            }

            Assert.Equal(3, f.HandPositions().Count);
        }
Beispiel #5
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();
        }
        public static Fingering CreateFingeringFor(this FingerboardInstrument instrument, Melody piece, ISelectValue randomness)
        {
            var notes = piece.Notes;

            var fingering = new Fingering();

            foreach (Note p in notes)
            {
                var possibleAlternatives = instrument.PositionsFor(p);

                int            randomIndex = randomness.BetweenZeroAnd(possibleAlternatives.Count - 1);
                FingerPosition selected    = possibleAlternatives[randomIndex];

                fingering.Add(new FingerPosition(selected.Fret, selected.String));
            }

            return(fingering);
        }
Beispiel #7
0
        public void Fingering_In_High_Then_Low_Area_Is_Two_Hand_Positions()
        {
            var f = new Fingering();

            f.Add(new FingerPosition(10, 1));
            f.Add(new FingerPosition(11, 1));
            f.Add(new FingerPosition(12, 1));

            f.Add(new FingerPosition(1, 1));
            f.Add(new FingerPosition(2, 1));
            f.Add(new FingerPosition(3, 1));

            Assert.Equal(2, f.HandPositions().Count);
        }