From 74aa937ec2ff9080fb54516534d9ee19793d72e7 Mon Sep 17 00:00:00 2001 From: Michael Winter Date: Thu, 26 Mar 2026 15:41:41 +0100 Subject: [PATCH] Add --target-register-power option to curve target register progression --- src/io.py | 7 +++++++ src/path.py | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/io.py b/src/io.py index 5b29a9c..3cf6dee 100644 --- a/src/io.py +++ b/src/io.py @@ -362,6 +362,12 @@ def main(): default=0, help="Target register in octaves (default: disabled, 2 = two octaves)", ) + parser.add_argument( + "--target-register-power", + type=float, + default=1.0, + help="Power to curve target register progress (1=linear, 2=quadratic, etc.)", + ) parser.add_argument( "--allow-voice-crossing", action="store_true", @@ -604,6 +610,7 @@ def main(): weights_config["target_register"] = True weights_config["target_register_octaves"] = args.target_register weights_config["weight_target_register"] = args.weight_target_register + weights_config["target_register_power"] = args.target_register_power else: weights_config["weight_target_register"] = 0 # disabled diff --git a/src/path.py b/src/path.py index eb4f2dd..cd730da 100644 --- a/src/path.py +++ b/src/path.py @@ -371,12 +371,14 @@ class Path: target_octaves = config.get("target_register_octaves", 2.0) max_path = config.get("max_path", 50) target_cents = target_octaves * 1200 + power = config.get("target_register_power", 1.0) start_avg_cents = sum(p.to_cents() for p in path_chords[0].pitches) / len( path_chords[0].pitches ) progress = len(path_chords) / max_path - current_target = start_avg_cents + (progress * target_cents) + progress_curve = progress**power + current_target = start_avg_cents + (progress_curve * target_cents) current_chord = path_chords[-1] current_avg_cents = sum(p.to_cents() for p in current_chord.pitches) / len(