Fit music to a video's length
fit_musicFits a music track to a video by cutting or looping bars to exact length, landing the drop on a chosen hit, ending on a beat, ducking under voice, and setting loudness without changing tempo or pitch.
Instructions
Use it when the user wants a music track made as long as a video, its drop on a moment, or music ducked under a voice. Fits a music track to a video cut: makes it exactly the given length by cutting or looping whole bars, lands its drop on the hit, ends it on a beat, ducks it under a voice and sets its loudness, without changing its tempo or pitch. Writes fitted.wav, mix.wav with a voice (the voice over the ducked music), cues.json (every beat, bar, seam and the hit, in seconds and in frames at fps), seams.png (the picture to show the user) and FIT.md (what was done and where to listen). Given the video, it also writes video.mp4, the video's picture as it was with the track under it and its own sound as video_sound says. A launch film to carry the track is planned with plan_launch_film and music false, so its sound is its effects, and give out_dir a folder inside the film's, like its music/, so the film's folder holds its track. Give cues.json to check_video to check the cuts land on the beat. To read a track's tempo, drop and ending without fitting it, use analyze_music instead. The music playbook (makersmcp_playbook) has the whole job. (musicfit 0.2.2, on this machine.)
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": {
"track": "<track>",
"length": "<length>"
},
"name": "fit_music"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bpm | No | The tempo, when the one found is half or double the real one; FIT.md warns when it could be (default: found). | |
| end | No | How it ends: auto takes the track's own ending, its last hit ringing out, when it has one and there is room for it, and a fade otherwise; natural asks for that ending, fade for a fade (default auto). | |
| fps | No | The video's frame rate, like 25 or 29.97: the frames in cues.json and FIT.md count at it, and length, hit and drop given in frames are read at it. 25 for a launch film, the fps in a demo's steps.json (default: the video's with video, else 30). | |
| hit | No | Where the drop lands in the result, as text in seconds like "24" or frames like "600f", inside length and at least 0.5 s before its end. A launch film's logo close is the start of its logo clip in film.timeline.json, a demo's click its pressedAt in steps.json. Without it the track starts as it starts. | |
| drop | No | Where the drop is in the track, as text in seconds like "41.3" or frames, when the one found is not the one wanted (default: found). analyze_music lists the other candidates. | |
| duck | No | How far the music dips under the voice, in dB (default 10), and the most it dips under the video's own sound with video_sound keep. | |
| fade | No | Length of the closing fade in seconds, rounded to whole beats and at least one, a bar by default, ending on the last beat before the end; for a track with no steady beat, as given, 2 by default. It is used only when the result ends with a fade. | |
| lufs | No | Loudness of the result in LUFS (default -14). A limiter keeps the true peaks at -1 dBTP or lower, so a peaky track can come out a little quieter; FIT.md says. | |
| meter | No | Beats to a bar, "3" or "4", when FIT.md warns the bars may have the other (default: found). | |
| track | Yes | The music file, or a video whose sound to use; anything ffmpeg reads. An instrumental a little longer than the video fits best. | |
| video | No | The video to lay the result under, length long to a frame: the run also writes video.mp4, its picture copied as it was with the track under it at lufs. Its frames count at its own frame rate unless fps is given. | |
| voice | No | A voice track on the video's timeline, from its first frame. The music dips under it, and the run adds mix.wav, the voice over the ducked music at lufs; fitted.wav is then the ducked music alone. | |
| length | Yes | The video's exact length, as text: seconds like "29.333" or "32s", frames at fps like "733f", or "1:05"; from 1 to 3600 seconds. A launch film's is seconds in its film.timeline.json, a demo's video.duration in its steps.json. | |
| out_dir | No | Folder to save into, absolute or relative to /app. Default: musicfit-<track-name>, where <track-name> is the name of track without its extension. A run replaces the files an earlier run of this kit left there, so give each version its own out_dir. | |
| video_sound | No | What becomes of the video's own sound, needed when it has more than a faint room tone: keep, for sound effects, each set a little over the music, which dips under one by duck at most where it must; voice, for speech, set to lufs with the music ducked under it; drop, for music of its own, left out. Ask the user when it is not known. | |
| wait_seconds | No | How long to wait for the result, counted from the start of the call, before returning a job_id to wait on. Some clients end a call after 60 or 240 seconds; 45 is safe in all of them. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kit | Yes | ||
| docs | No | The notes the text shows, and where each one is. | |
| next | No | What to do next, as the Next line says. | |
| tool | Yes | ||
| files | No | ||
| folder | No | Where the kit saved its files. | |
| job_id | Yes | ||
| passed | No | For checks: whether the check passed. | |
| status | Yes | ||
| continued | No | True when this call continued the job of an identical call whose answer did not reach the client, instead of starting another. | |
| exit_code | No | ||
| last_line | No | What the kit was doing last. | |
| expires_at | No | When the download links stop working. | |
| next_action | No | ||
| elapsed_seconds | Yes |