예제 #1
0
        public void MoveToFirstAnchor_Unkeyed_NoAnchors()
        {
            var pattern = new PatternBuilder()
                          .MoveToTime(new MetricTime(0, 0, 10))
                          .StepForward(new MetricLength(0, 0, 11))
                          .MoveToTime(new MetricTime(0, 0, 30))
                          .StepBack(new MetricLength(0, 0, 5))
                          .MoveToFirstAnchor()

                          .Note(OctaveDefinition.Get(0).A)

                          .Build();
        }
예제 #2
0
        public void StepBack_Musical_BeyondZero()
        {
            var pattern = new PatternBuilder()
                          .MoveToTime(new MetricTime(0, 0, 10))
                          .StepForward(new MetricLength(0, 0, 30))
                          .StepBack(new MusicalLength(1000 * MusicalFraction.Quarter))

                          .Note(OctaveDefinition.Get(0).A)

                          .Build();

            TestNotes(pattern, new[]
            {
                new NoteInfo(NoteName.A, 0, new MetricTime(0, 0, 0), (MusicalLength)MusicalFraction.Quarter)
            });
        }
예제 #3
0
        public void StepBack_Musical()
        {
            var pattern = new PatternBuilder()
                          .MoveToTime(new MusicalTime(MusicalFraction.Eighth))
                          .StepForward(new MusicalLength(MusicalFraction.Whole))
                          .StepBack(new MusicalLength(MusicalFraction.Half))

                          .Note(OctaveDefinition.Get(0).A)

                          .Build();

            TestNotes(pattern, new[]
            {
                new NoteInfo(NoteName.A, 0, new MusicalTime(new Fraction(5, 8)), (MusicalLength)MusicalFraction.Quarter)
            });
        }
예제 #4
0
        public void StepBack_Metric_BeyondZero()
        {
            var pattern = new PatternBuilder()
                          .MoveToTime(new MetricTimeSpan(0, 0, 10))
                          .StepForward(new MetricTimeSpan(0, 0, 30))
                          .StepBack(new MetricTimeSpan(0, 1, 37))

                          .Note(OctaveDefinition.Get(0).A)

                          .Build();

            TestNotes(pattern, new[]
            {
                new NoteInfo(NoteName.A, 0, new MetricTimeSpan(0, 0, 0), MusicalTimeSpan.Quarter)
            });
        }
예제 #5
0
        public void MoveToFirstAnchor_Keyed_OneUnkeyedAndOneKeyed()
        {
            var anchorTime = new MetricTime(0, 0, 30);

            var pattern = new PatternBuilder()
                          .MoveToTime(new MetricTime(0, 0, 10))
                          .StepForward(new MetricLength(0, 0, 11))
                          .Anchor()
                          .MoveToTime(anchorTime)
                          .Anchor("Test")
                          .StepBack(new MetricLength(0, 0, 5))
                          .MoveToFirstAnchor("Test")

                          .Note(OctaveDefinition.Get(0).A)

                          .Build();

            TestNotes(pattern, new[]
            {
                new NoteInfo(NoteName.A, 0, anchorTime, (MusicalLength)MusicalFraction.Quarter)
            });
        }
예제 #6
0
        public void Note_MixedLengthAndVelocity()
        {
            var defaultNoteLength = (MusicalLength)MusicalFraction.Quarter;
            var defaultVelocity   = (SevenBitNumber)90;

            var specifiedLength   = new MetricLength(0, 0, 10);
            var specifiedVelocity = (SevenBitNumber)95;

            var pattern = new PatternBuilder()
                          .SetNoteLength(defaultNoteLength)
                          .SetVelocity(defaultVelocity)

                          .Note(OctaveDefinition.Get(0).A)
                          .Note(OctaveDefinition.Get(1).C, specifiedLength, specifiedVelocity)

                          .Build();

            TestNotes(pattern, new[]
            {
                new NoteInfo(NoteName.A, 0, null, defaultNoteLength, defaultVelocity),
                new NoteInfo(NoteName.C, 1, (MusicalTime)MusicalFraction.Quarter, specifiedLength, specifiedVelocity)
            });
        }
예제 #7
0
        public void MoveToFirstAnchor_Unkeyed_OneUnkeyed()
        {
            var moveTime   = new MetricTimeSpan(0, 0, 10);
            var step       = new MetricTimeSpan(0, 0, 11);
            var anchorTime = moveTime + step;

            var pattern = new PatternBuilder()
                          .MoveToTime(moveTime)
                          .StepForward(step)
                          .Anchor()
                          .MoveToTime(new MetricTimeSpan(0, 0, 30))
                          .StepBack(new MetricTimeSpan(0, 0, 5))
                          .MoveToFirstAnchor()

                          .Note(OctaveDefinition.Get(0).A)

                          .Build();

            TestNotes(pattern, new[]
            {
                new NoteInfo(NoteName.A, 0, anchorTime, MusicalTimeSpan.Quarter)
            });
        }
예제 #8
0
        public void Chord_Interval()
        {
            var defaultNoteLength = (MusicalLength)MusicalFraction.Quarter;
            var defaultVelocity   = (SevenBitNumber)90;

            var pattern = new PatternBuilder()
                          .SetNoteLength(defaultNoteLength)
                          .SetVelocity(defaultVelocity)
                          .SetRootNote(NoteDefinition.Get(NoteName.CSharp, 5))

                          .Chord(new[] { IntervalDefinition.Two, IntervalDefinition.Five }, OctaveDefinition.Get(2).A)
                          .Chord(new[] { IntervalDefinition.Two, -IntervalDefinition.Ten }, OctaveDefinition.Get(2).B)

                          .Build();

            TestNotes(pattern, new[]
            {
                new NoteInfo(NoteName.A, 2, null, defaultNoteLength, defaultVelocity),
                new NoteInfo(NoteName.B, 2, null, defaultNoteLength, defaultVelocity),
                new NoteInfo(NoteName.D, 3, null, defaultNoteLength, defaultVelocity),

                new NoteInfo(NoteName.B, 2, new MathTime(new MusicalTime(), defaultNoteLength), defaultNoteLength, defaultVelocity),
                new NoteInfo(NoteName.CSharp, 3, new MathTime(new MusicalTime(), defaultNoteLength), defaultNoteLength, defaultVelocity),
                new NoteInfo(NoteName.CSharp, 2, new MathTime(new MusicalTime(), defaultNoteLength), defaultNoteLength, defaultVelocity),
            });
        }