Beispiel #1
0
 def test_rule_leadingtone_unresolved(self):
     pitches1 = ("G3", "D4", "F4", "B4")
     pitches2 = ("G3", "C4", "E4", "E5")
     key = "C"
     costGT = applyRule(Rule.LEADINGTONE_UNRESOLVED) + applyRule(
         Rule.MELODIC_INTERVAL_BEYONDTHIRD
     )
     cost = progressionCost(key, pitches1, pitches2)
     self.assertEqual(cost, costGT)
Beispiel #2
0
 def test_rule_unison_by_leap2(self):
     pitches1 = ("D3", "F4", "A4", "D5")
     pitches2 = ("D3", "F4", "B4", "B4")
     key = "C"
     costGT = applyRule(Rule.UNISON_BY_LEAP) + applyRule(
         Rule.MELODIC_INTERVAL_BEYONDSECOND
     )
     cost = progressionCost(key, pitches1, pitches2)
     self.assertEqual(cost, costGT)
Beispiel #3
0
 def test_rule_voice_crossing(self):
     pitches1 = ("E3", "G3", "C4", "E4")
     pitches2 = ("A3", "G3", "C4", "E4")
     key = "C"
     costGT = applyRule(Rule.VOICE_CROSSING) + applyRule(
         Rule.MELODIC_INTERVAL_BEYONDTHIRD
     )
     cost = progressionCost(key, pitches1, pitches2)
     self.assertEqual(cost, costGT)
Beispiel #4
0
 def test_rule_seventh_unresolved(self):
     pitches1 = ("C3", "E3", "C4", "B-4")
     pitches2 = ("C3", "E3", "C4", "G4")
     key = "C"
     costGT = applyRule(Rule.SEVENTH_UNRESOLVED) + applyRule(
         Rule.MELODIC_INTERVAL_BEYONDSECOND
     )
     cost = progressionCost(key, pitches1, pitches2)
     self.assertEqual(cost, costGT)
Beispiel #5
0
 def test_rule_hidden_octave(self):
     pitches1 = ("C3", "G4", "C5", "E5")
     pitches2 = ("F3", "A4", "C5", "F5")
     key = "C"
     costGT = applyRule(Rule.HIDDEN_OCTAVE) + applyRule(
         Rule.MELODIC_INTERVAL_BEYONDTHIRD
     )
     cost = progressionCost(key, pitches1, pitches2)
     self.assertEqual(cost, costGT)
Beispiel #6
0
 def test_rule_hidden_fifth(self):
     pitches1 = ("G3", "C4", "E4", "E4")
     pitches2 = ("B3", "D4", "D4", "F4")
     key = "C"
     costGT = applyRule(Rule.HIDDEN_FIFTH) + applyRule(
         Rule.MELODIC_INTERVAL_BEYONDSECOND
     )
     cost = progressionCost(key, pitches1, pitches2)
     self.assertEqual(cost, costGT)
Beispiel #7
0
 def test_rule_melodicinterval_beyondsecond(self):
     pitches1 = ("C4", "G4", "C5", "E5")
     pitches2 = ("E4", "G4", "C5", "E5")
     key = "C"
     costGT = applyRule(Rule.MELODIC_INTERVAL_BEYONDSECOND)
     cost = progressionCost(key, pitches1, pitches2)
     self.assertEqual(cost, costGT)
Beispiel #8
0
 def test_rule_melodicinterval_forbidden(self):
     pitches1 = ("B3", "D4", "F4", "B4")
     pitches2 = ("B3", "D4", "F4", "A-4")
     key = "c"
     costGT = applyRule(Rule.MELODIC_INTERVAL_FORBIDDEN)
     cost = progressionCost(key, pitches1, pitches2)
     self.assertEqual(cost, costGT)
Beispiel #9
0
 def test_rule_allvoices_same_direction(self):
     pitches1 = ("E3", "G4", "A4", "C5")
     pitches2 = ("D3", "F4", "G4", "B4")
     key = "C"
     costGT = applyRule(Rule.ALLVOICES_SAME_DIRECTION)
     cost = progressionCost(key, pitches1, pitches2)
     self.assertEqual(cost, costGT)
Beispiel #10
0
 def test_rule_identical_voicing(self):
     pitches1 = ("C3", "C4", "E4", "G4")
     pitches2 = ("C3", "C4", "E4", "G4")
     key = "C"
     costGT = applyRule(Rule.IDENTICAL_VOICING)
     cost = progressionCost(key, pitches1, pitches2)
     self.assertEqual(cost, costGT)
Beispiel #11
0
 def test_rule_parallel_octave(self):
     pitches1 = ("C4", "G4", "C5", "E5")
     pitches2 = ("B3", "G4", "B4", "E5")
     key = "C"
     costGT = applyRule(Rule.PARALLEL_OCTAVE)
     cost = progressionCost(key, pitches1, pitches2)
     self.assertEqual(cost, costGT)
Beispiel #12
0
 def test_rule_parallel_fifth(self):
     pitches1 = ("D3", "B3", "D4", "F4")
     pitches2 = ("C3", "C4", "E4", "G4")
     key = "C"
     costGT = applyRule(Rule.PARALLEL_FIFTH)
     cost = progressionCost(key, pitches1, pitches2)
     self.assertEqual(cost, costGT)
Beispiel #13
0
 def test_progression_cost(self):
     pitches1 = ("C3", "C4", "E4", "G4")
     pitches2 = ("G2", "B3", "D4", "G4")
     key = "C"
     costGT = applyRule(Rule.MELODIC_INTERVAL_BEYONDTHIRD)
     cost = progressionCost(key, pitches1, pitches2)
     self.assertEqual(cost, costGT)
Beispiel #14
0
 def test_rule_vertical_seventh_missingnote(self):
     pitches = ("G3", "B3", "F4", "G4")
     costGT = applyRule(Rule.VERTICAL_SEVENTH_MISSINGNOTE)
     cost = chordCost(pitches)
     self.assertEqual(cost, costGT)
Beispiel #15
0
 def test_rule_vertical_not_doublingroot(self):
     pitches = ("E3", "G3", "C4", "E4")
     costGT = applyRule(Rule.VERTICAL_NOT_DOUBLINGROOT)
     cost = chordCost(pitches)
     self.assertEqual(cost, costGT)