Add --transcribe option to CLI for generating LilyPond transcriptions
This commit is contained in:
parent
9dbde6a63d
commit
306de8b5c2
34
src/io.py
34
src/io.py
|
|
@ -410,6 +410,13 @@ def main():
|
|||
default=None,
|
||||
help="Enable OSC playback (optionally specify chord file, default: output/output_chords.json)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--transcribe",
|
||||
nargs="*",
|
||||
metavar=("INPUT", "OUTPUT"),
|
||||
default=None,
|
||||
help="Generate LilyPond transcription (optionally: input_file output_name)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--osc-ip",
|
||||
type=str,
|
||||
|
|
@ -430,6 +437,33 @@ def main():
|
|||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
# Handle transcription mode (separate from generation)
|
||||
if args.transcribe is not None:
|
||||
import json
|
||||
from .transcriber import transcribe
|
||||
|
||||
input_file = (
|
||||
args.transcribe[0]
|
||||
if len(args.transcribe) > 0
|
||||
else "output/output_chords.json"
|
||||
)
|
||||
output_name = (
|
||||
args.transcribe[1]
|
||||
if len(args.transcribe) > 1
|
||||
else "compact_sets_transcription"
|
||||
)
|
||||
|
||||
with open(input_file) as f:
|
||||
chords = json.load(f)
|
||||
|
||||
print(f"Transcribing {len(chords)} chords from {input_file}")
|
||||
transcribe(
|
||||
chords,
|
||||
output_name,
|
||||
fundamental=args.fundamental,
|
||||
)
|
||||
return # Exit after transcribing
|
||||
|
||||
# Handle OSC playback mode (separate from generation)
|
||||
if args.osc_play:
|
||||
from .osc_sender import OSCSender
|
||||
|
|
|
|||
Loading…
Reference in a new issue