public void GetNoteMotionFromNotes(int previousNote, int currentNote, NoteMotion expectedNoteMotion)
        {
            var context    = _factory.CreateCompositionContext();
            var noteMotion = context.GetNoteMotionFromNotes(previousNote, currentNote);

            Assert.AreEqual(expectedNoteMotion, noteMotion);
        }
Beispiel #2
0
 /// <summary>
 /// Determines whether the given NoteMotionSpan and NoteMotion values create a correct leap return.
 /// </summary>
 /// <param name="currentNoteMotionSpan">The current NoteMotionSpan</param>
 /// <param name="nextNoteMotionSpan">The next NoteMotionSpan</param>
 /// <param name="currentNoteMotion">The current NoteMotion</param>
 /// <param name="nexNoteMotion">The next NoteMotion</param>
 /// <returns>the given NoteMotionSpan and NoteMotion values create a correct leap return</returns>
 private static bool IsCorrectLeapReturn(
     NoteMotionSpan currentNoteMotionSpan,
     NoteMotionSpan nextNoteMotionSpan,
     NoteMotion currentNoteMotion,
     NoteMotion nexNoteMotion
     )
 {
     return(currentNoteMotionSpan == NoteMotionSpan.Leap &&
            nextNoteMotionSpan == NoteMotionSpan.Step &&
            currentNoteMotion != nexNoteMotion);
 }
Beispiel #3
0
 /// <summary>
 /// NoteChoice constructor.
 /// </summary>
 /// <param name="counterPointNoteMotion">The counterpoint note motion</param>
 /// <param name="cantusFirmusNoteMotion">The cantus firmus note motion</param>
 /// <param name="counterPointScaleDegreeChange">The number of scale degrees the counterpoint should change</param>
 /// <param name="cantusFirmusScaleDegreeChange">The number of scale degrees the cantus firmus should change</param>
 public NoteChoice(
     NoteMotion counterPointNoteMotion = NoteMotion.Oblique,
     NoteMotion cantusFirmusNoteMotion = NoteMotion.Oblique,
     int counterPointScaleDegreeChange = 0,
     int cantusFirmusScaleDegreeChange = 0
     )
 {
     CantusFirmusNoteMotion        = cantusFirmusNoteMotion;
     CounterPointNoteMotion        = counterPointNoteMotion;
     CantusFirmusScaleDegreeChange = cantusFirmusScaleDegreeChange;
     CounterPointScaleDegreeChange = counterPointScaleDegreeChange;
 }
Beispiel #4
0
        /// <summary>
        /// Determines whether the NoteMotion and NoteMotionSpan values create multiple leaps in the same direction.
        /// </summary>
        /// <param name="currentNoteArrivedFromNoteMotion">The current arrived from NoteMotion</param>
        /// <param name="nextNoteArrivedFromNoteMotion">The next arrived from NoteMotion</param>
        /// <param name="currentNoteArrivedFromNoteMotionSpan">The current arrived from NoteMotionSpan</param>
        /// <param name="nextNoteArrivedFromNoteMotionSpan">The next arrived from NoteMotionSpan</param>
        /// <returns></returns>
        private static bool IsMultipleLeap(
            NoteMotion currentNoteArrivedFromNoteMotion,
            NoteMotion nextNoteArrivedFromNoteMotion,
            NoteMotionSpan currentNoteArrivedFromNoteMotionSpan,
            NoteMotionSpan nextNoteArrivedFromNoteMotionSpan
            )
        {
            if (currentNoteArrivedFromNoteMotionSpan != NoteMotionSpan.Leap)
            {
                return(false);
            }

            return(currentNoteArrivedFromNoteMotionSpan == nextNoteArrivedFromNoteMotionSpan &&
                   currentNoteArrivedFromNoteMotion == nextNoteArrivedFromNoteMotion);
        }
Beispiel #5
0
 /// <summary>
 /// CompositionContext constructor: initialize class properties with explicit values.
 /// </summary>
 /// <param name="counterPointNoteMotion">The counterpoint note motion</param>
 /// <param name="counterPointNoteMotionSpan">The counterpoint note motion span</param>
 /// <param name="counterPointNoteScaleDegree">The counterpoint note scale degree</param>
 /// <param name="cantusFirmusNoteMotion">The cantus firmus note motion</param>
 /// <param name="cantusFirmusNoteMotionSpan">The cantus firmus note motion span</param>
 /// <param name="cantusFirmusNoteScaleDegree">The cantus firmus scale degree</param>
 public CompositionContext(
     NoteMotion counterPointNoteMotion,
     NoteMotionSpan counterPointNoteMotionSpan,
     ScaleDegree counterPointNoteScaleDegree,
     NoteMotion cantusFirmusNoteMotion,
     NoteMotionSpan cantusFirmusNoteMotionSpan,
     ScaleDegree cantusFirmusNoteScaleDegree
     )
 {
     CounterPointNoteMotion      = counterPointNoteMotion;
     CounterPointNoteMotionSpan  = counterPointNoteMotionSpan;
     CounterPointNoteScaleDegree = counterPointNoteScaleDegree;
     CantusFirmusNoteMotion      = cantusFirmusNoteMotion;
     CantusFirmusNoteMotionSpan  = cantusFirmusNoteMotionSpan;
     CantusFirmusNoteScaleDegree = cantusFirmusNoteScaleDegree;
 }
Beispiel #6
0
 /// <summary>
 /// Override for creating a CompositionContext with specified values.
 /// </summary>
 /// <param name="counterPointNoteMotion">The counterpoint NoteMotion to use</param>
 /// <param name="counterPointNoteMotionSpan">The counterpoint NoteMotionSpan to use</param>
 /// <param name="counterPointNoteScaleDegree">The counterpoint ScaleDegree to use</param>
 /// <param name="cantusFirmusNoteMotion">The cantus firmus NoteMotion to use</param>
 /// <param name="cantusFirmusNoteMotionSpan">The cantus firmus NoteMotionSpan to use</param>
 /// <param name="cantusFirmusNoteScaleDegree">The cantus firmus ScaleDegree to use</param>
 /// <returns></returns>
 public CompositionContext CreateCompositionContext(
     NoteMotion counterPointNoteMotion,
     NoteMotionSpan counterPointNoteMotionSpan,
     ScaleDegree counterPointNoteScaleDegree,
     NoteMotion cantusFirmusNoteMotion,
     NoteMotionSpan cantusFirmusNoteMotionSpan,
     ScaleDegree cantusFirmusNoteScaleDegree
     )
 {
     return(new CompositionContext(
                counterPointNoteMotion,
                counterPointNoteMotionSpan,
                counterPointNoteScaleDegree,
                cantusFirmusNoteMotion,
                cantusFirmusNoteMotionSpan,
                cantusFirmusNoteScaleDegree
                ));
 }
 /// <summary>
 /// Determines whether or not the given notes correctly resolve according to the ascending seventh rule.
 /// </summary>
 /// <param name="currentNote">The current note</param>
 /// <param name="nextNote">The next note</param>
 /// <param name="currentNoteArrivedFromNoteMotion">The note motion which the current note arrived from</param>
 /// <returns>Whether the given notes correctly resolve</returns>
 private bool IncorrectlyResolves(int currentNote, int nextNote, NoteMotion currentNoteArrivedFromNoteMotion)
 {
     return(_scaleDegreeEvaluator.GetScaleDegreeFromNote(currentNote) == ScaleDegree.Seventh &&
            currentNoteArrivedFromNoteMotion == NoteMotion.Ascending &&
            _scaleDegreeEvaluator.GetScaleDegreeFromNote(nextNote) != ScaleDegree.Root);
 }