@@ -29,7 +29,7 @@ def choices(root='C', fifths=0, end=8):
|
||||
|
||||
def plan(intent='active'):
|
||||
motif = generator.solo.planning.new_motif(tests.solo_fixtures.library(), fractions.Fraction(4))
|
||||
passage = generator.solo.types.Passage(fractions.Fraction(), fractions.Fraction(8), intent, fractions.Fraction(1) if intent == 'active' else fractions.Fraction(1, 8) if intent == 'sustained_arrival' else fractions.Fraction(), fractions.Fraction(3, 4) if intent == 'active' else fractions.Fraction(1) if intent == 'sustained_arrival' else fractions.Fraction())
|
||||
passage = generator.solo.types.ActivitySpan(fractions.Fraction(), fractions.Fraction(8), intent, fractions.Fraction(1) if intent == 'active' else fractions.Fraction(1, 8) if intent == 'sustained_arrival' else fractions.Fraction(), fractions.Fraction(3, 4) if intent == 'active' else fractions.Fraction(1) if intent == 'sustained_arrival' else fractions.Fraction())
|
||||
return generator.solo.types.PhrasePlan('fixture', passage.start, passage.end, motif, 'statement', 'thematic', None, (59, 75), passage.activity, fractions.Fraction(), (passage,))
|
||||
|
||||
def note(start, end, letter='g', alter=0, octave=4, **kwargs):
|
||||
@@ -76,7 +76,7 @@ class ScoringTests(unittest.TestCase):
|
||||
class DevelopmentTests(unittest.TestCase):
|
||||
def test_connected_motion_can_cross_a_bar_and_arrive_on_a_sustain(self):
|
||||
source = tests.test_solo.song(count=4, chords=('CM7',))
|
||||
passage = dataclasses.replace(plan(), end=fractions.Fraction(16), treatment='contour_reference', passages=(generator.solo.types.Passage(0, 8, 'active', fractions.Fraction(2), fractions.Fraction(1)), generator.solo.types.Passage(8, 16, 'sustained_arrival', fractions.Fraction(1, 8), fractions.Fraction(1))), target=generator.solo.types.TargetEvent(fractions.Fraction(8), fractions.Fraction(8), frozenset({4}), 'CM7', 'fixture arrival'))
|
||||
passage = dataclasses.replace(plan(), end=fractions.Fraction(16), treatment='contour_reference', passages=(generator.solo.types.ActivitySpan(0, 8, 'active', fractions.Fraction(2), fractions.Fraction(1)), generator.solo.types.ActivitySpan(8, 16, 'sustained_arrival', fractions.Fraction(1, 8), fractions.Fraction(1))), target=generator.solo.types.TargetEvent(fractions.Fraction(8), fractions.Fraction(8), frozenset({4}), 'CM7', 'fixture arrival'))
|
||||
phrase = generator.solo.realization.compose(passage, source['staves'][0]['measures'], choices(end=16), tests.solo_fixtures.library(), generator.rhythm.load_library(pathlib.Path('data/rhythms')), fractions.Fraction(120))
|
||||
notes = generator.solo.composer.phrase_notes(phrase)
|
||||
self.assertGreaterEqual(sum(n.start < 8 for n in notes), 12)
|
||||
@@ -148,7 +148,7 @@ class DevelopmentTests(unittest.TestCase):
|
||||
passage = plan()
|
||||
left = (note(0, 2, 'c'), note(2, 4, 'e'), note(4, 8, 'g'))
|
||||
right = (note(0, 1, 'a'), note(1, 4, 'c'), note(4, 8, 'g'))
|
||||
self.assertNotEqual(generator.solo.realization.state_identity((0, (), left[-1], 0, left), passage), generator.solo.realization.state_identity((0, (), right[-1], 0, right), passage))
|
||||
self.assertNotEqual(generator.solo.types.ContinuationState(passage.id, left, last=left[-1]), generator.solo.types.ContinuationState(passage.id, right, last=right[-1]))
|
||||
def test_lookahead_can_choose_a_lower_ranked_statement(self):
|
||||
first = dataclasses.replace(plan(), end=fractions.Fraction(4), ending='connected')
|
||||
second = dataclasses.replace(plan(), id='answer', start=fractions.Fraction(4), relationship='answer')
|
||||
|
||||
Reference in New Issue
Block a user