Chord Families

This commit is contained in:
khodowany
2026-10-06 03:18:02 -05:00
parent e71385dad1
commit 8423f3d788
14 changed files with 196 additions and 57 deletions
+4 -4
View File
@@ -23,14 +23,14 @@ def ranked(symbol, melody=(), profile='electric', prune=False):
return sorted(candidates, key=lambda shape: (generator.guitar.voicing_cost(shape, profile, requirements.allowed, melody), shape))
class VoicingTests(unittest.TestCase):
def test_electric_chords_use_the_shared_three_fret_limit(self):
def test_electric_chords_use_the_shared_four_fret_limit(self):
for prune in (False, True):
candidates = ranked('CM7', prune=prune)
self.assertTrue(candidates)
self.assertTrue(all(generator.guitar.compactness(c) + 1 <= 3 for c in candidates))
self.assertTrue(all(generator.guitar.compactness(c) + 1 <= 4 for c in candidates))
candidates = ranked('CM7')
self.assertIn(grip((5, 4, 5, 3)), candidates)
self.assertNotIn(grip((2, 4, 1, 3)), candidates)
self.assertIn(grip((2, 4, 1, 3)), candidates)
self.assertNotIn(grip((5, 9, 8, 7)), candidates)
def test_requested_shapes_win_without_a_shape_dictionary(self):
for symbol, melody, expected in (('FM7', 69, (3, 5, 5, 5)), ('Gm7', 67, (3, 3, 3, 3))):
@@ -55,7 +55,7 @@ class VoicingTests(unittest.TestCase):
def test_wider_low_chord_cannot_displace_a_playable_melody_grip(self):
candidates = ranked('CM7', (67,))
self.assertEqual(candidates[0], grip((5, 4, 5, 3)))
self.assertNotIn(grip((2, 4, 1, 3)), candidates)
self.assertIn(grip((2, 4, 1, 3)), candidates)
self.assertEqual(max(p.midi for p in candidates[0]), 67)
def test_essential_extensions_are_never_relaxed_to_add_the_root(self):
for symbol in ('C7b9', 'FM7#11', 'C13', 'Cdim7'):