Generation
This commit is contained in:
@@ -39,7 +39,7 @@ class GuitarPartTests(unittest.TestCase):
|
||||
self.assertNotIn(0, generator.guitar.chord_requirements(chord, 'electric')[0])
|
||||
candidates = generator.guitar.chord_positions(*generator.guitar.chord_requirements(chord, 'electric'), profile='electric')
|
||||
self.assertTrue(any(all(p.midi % 12 != 0 for p in c) for c in candidates))
|
||||
def test_acoustic_combines_independent_rhythms_and_alternating_bass(self):
|
||||
def test_acoustic_combines_independent_rhythms_with_a_fixed_grip(self):
|
||||
result = self.practice(tests.test_parts.xml_harmony() + tests.test_musicxml.xml_note(), 'acoustic')
|
||||
measure = result['staves'][0]['measures'][0]
|
||||
self.assertEqual(len(measure['voices']), 1)
|
||||
@@ -47,7 +47,10 @@ class GuitarPartTests(unittest.TestCase):
|
||||
bass = [(n['onset'], p) for n in notes for p in n['pitches'] if p['tablature']['string'] >= 5 and 'tie_from' not in p]
|
||||
upper = {generator.model.fraction(n['onset']) for n in notes for p in n['pitches'] if p['tablature']['string'] <= 4 and 'tie_from' not in p}
|
||||
self.assertNotEqual({generator.model.fraction(onset) for onset, _ in bass}, upper)
|
||||
self.assertEqual([generator.model.pitch_number(p) % 12 for _, p in bass], [0, 7])
|
||||
self.assertEqual([generator.model.pitch_number(p) % 12 for _, p in bass], [0, 0])
|
||||
self.assertEqual(bass[0][1]['tablature'], bass[1][1]['tablature'])
|
||||
upper_shapes = {tuple((p['tablature']['string'], p['tablature']['fret']) for p in n['pitches'] if p['tablature']['string'] <= 4) for n in notes}
|
||||
self.assertEqual(len(upper_shapes - {()}), 1)
|
||||
self.assertEqual(sum(generator.model.fraction(n['duration']) for n in notes), 4)
|
||||
for note in notes:
|
||||
self.assertNotIn('stem', note)
|
||||
@@ -62,7 +65,7 @@ class GuitarPartTests(unittest.TestCase):
|
||||
positions = [generator.guitar.TabPosition(by_id[e['id']]['tablature']['string'], by_id[e['id']]['tablature']['fret'], int(generator.model.fraction(e['pitch']))) for e in simultaneous]
|
||||
self.assertEqual(len(positions), len({p.string_number for p in positions}))
|
||||
self.assertTrue(generator.guitar.within_fret_span(positions))
|
||||
def test_explicit_bass_and_fifth_fallback(self):
|
||||
def test_explicit_bass_and_default_root(self):
|
||||
for symbol, expected in (('CM/E', 4), ('C7b9', 0)):
|
||||
source = tests.test_musicxml.parse(tests.test_musicxml.xml_score(tests.test_musicxml.xml_note()))
|
||||
chord = generator.harmony.parse_symbol(symbol)
|
||||
|
||||
Reference in New Issue
Block a user