Add --target-register-power option to curve target register progression
This commit is contained in:
parent
8ea5c4fe0c
commit
74aa937ec2
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Reference in a new issue