write_score
Render a structured score spec into Dorico via caret entry or MusicXML import. Choose caret to add to the current flow, or MusicXML to include key and time signatures as a new flow.
Instructions
Render a ScoreSpec into Dorico by caret entry or MusicXML import.
The main way to write music here, and the one to reach for whenever there is
more than a single beat to enter: add_notes and add_rest do not chain, because
each re-enters note input at the caret and stacks on the same beat.
Returns:
Result dictionary with the execution report, the preflight warnings, and the
caveats attached to what was dispatched.
Note:
Choose the method by what the score needs. 'caret' adds to the current flow
and leaves the rest of the project alone, but it cannot set a key or time
signature, because those go in through a popover no API can type into.
'musicxml' carries them, at the price of arriving as a new flow rather than
joining the current one.
Call score_schema first for the exact shape: unknown keys are refused rather
than ignored. Dorico must be in write mode, so use switch_mode if unsure.
Nothing is verified by the return, since kOK means accepted rather than
effective (docs/protocol.md), so check the result in the score.
The caret path repositions between staves by jumping to the start of the
flow, so it needs to know nothing about the flow's meter or length.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| score | Yes | The score to work on, as a ScoreSpec object: metadata, parts, and the events inside them. Call score_schema first for the exact shape, which refuses unknown keys rather than ignoring them. | |
| method | No | How to get the music in. 'caret' types it into the flow already open, adding to what is there. 'musicxml' writes the whole score to a file and imports it as a new flow, which is the only path that carries key and time signatures. | caret |
| preflight | No | True runs the offline range and voice-leading checks first and reports what they found before anything is sent to Dorico. It warns rather than blocks. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||