fix: support '.' and 'NC' in --prefix argument

_encode_prefix now handles hold ('.') and no-chord ('NC') tokens
alongside chord symbols, and returns (ids, n_positions) so that
pos_in_bar is tracked correctly regardless of token type.

Fixes ChordParseError when dots were passed in --prefix.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-21 20:25:41 +03:00
parent 2e6e934564
commit f6ce2a41d3
3 changed files with 85 additions and 18 deletions
+2 -1
View File
@@ -79,7 +79,8 @@ def main() -> None:
help="Optional output MIDI file path.")
ap.add_argument("--prefix", default=None,
help='Space-separated chord symbols in the requested key, '
'e.g. "Cmaj7 Am7". Used as generation context.')
'e.g. "Cmaj7 . Am7 .". Use "." for held positions '
'and "NC" for no-chord positions.')
ap.add_argument("--no-tonic-anchor", action="store_true", dest="no_tonic_anchor",
help="Do not prepend the tonic chord when --prefix is not given.")
ap.add_argument("--temperature", type=float, default=1.0,