Collapse To Repeat
collapse_to_repeatCollapse a run of repeated bars or phrases into one kept section with start/end repeat barlines and a play count, deleting duplicate copies while preserving the first phrase.
Instructions
Collapse a run of repeated bars or phrases into one played N times: keeps the first phrase_bars bars from start, deletes the rest of the run, and puts start/end repeat barlines with a play count around the kept bars (shown as e.g. '7x'). With phrase_bars=2, bars start..end must be a 2-bar phrase repeated (e.g. 28-35 becomes 28-29 x4). This changes every staff, so use it in a score that contains only the part being charted (make_part_score). It refuses when any staff's copies differ in anything but ghost notes and crashes on beat 1, unless force=True. Later measures are renumbered: collapse from the end of the score backwards. Needs MuseScore 4.6+.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"start": "<start>",
"end": "<end>"
},
"name": "collapse_to_repeat"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end | Yes | Last bar of the run (1-based, inclusive) | |
| force | No | Collapse even if copies differ in more than ghost notes and crashes on beat 1 (those differences are lost) | |
| start | Yes | First bar of the run (1-based); the phrase starting here is kept | |
| phrase_bars | No | Length of the repeated phrase in bars (1, 2, 4...); the run must be a whole number of phrases |