generate_score
Run a music21 Python script to produce a MusicXML score file, returning the output file paths and execution results.
Instructions
Run a music21 Python script to generate a score file (MusicXML).
Write a COMPLETE, self-contained music21 script that builds the whole
score and ends by exporting it, e.g.
score.write("musicxml", fp="My Piece.musicxml"). Use a plain file
name (no directory) so the file lands in the working directory and is
reported back in output_files. Read the score_generation_guide
tool first: it holds the music21 conventions this project relies on
(flats are written B- not Bb, metadata, repeats, volta brackets,
transposing instruments, and a full template).
The script runs on the user's machine with the user's privileges, in the same Python interpreter as this server (so music21 is importable). Only send code the user would be comfortable running themselves.
Args: script: Complete Python source of the generation script. output_dir: Working directory for the run. Defaults to a fresh directory under the user's Desktop (or home directory when there is no Desktop). Created if it does not exist. timeout: Seconds to wait before killing the script (default: 120).
Returns:
JSON. On success: {"success": true, "output_files": [absolute paths of files created in the working directory], "stdout": ...}. On
failure: {"error": ..., "stderr": last lines, "returncode": n}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| script | Yes | ||
| timeout | No | ||
| output_dir | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |