Fit a melody to a music box
fit_melody_to_boxAdjusts a melody so it can be played on a music box and lists every change. Strategies: "transpose" (shift the whole melody to the key that fits best), "nearest_note" (move each unplayable note to the closest playable one), "transpose_then_nearest" (default: both). Optionally snaps notes to a grid. Returns the new melody and its validation.
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": {
"box": "<box>",
"bpm": "<bpm>",
"notes": "<notes>"
},
"name": "fit_melody_to_box"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| box | Yes | Music box type: "15", "20", "30" (notes) or "freestyle" (digital only). See list_music_boxes. | |
| bpm | Yes | Tempo in beats per minute (30-300). | |
| notes | Yes | Notes in any order, at most 2000. Only onsets matter: music boxes have no note durations. | |
| strategy | No | ||
| target_box | No | Box to fit into. Defaults to the melody's box. | |
| quantize_beats | No | Snap every note to this grid in beats (e.g. 0.5 = eighth notes). | |
| illegal_threshold_ticks | No | Minimum gap between two identical notes, in ticks (default 384 = 2 beats). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| melody | Yes | ||
| changes | Yes | ||
| summary | Yes | ||
| semitones | Yes | ||
| validation | Yes | ||
| composer_link | No | Opens the composer with the fitted melody loaded, without saving. |