Detect beats in a file
detect_beats_in_fileDetect rhythmic onsets and estimate tempo in an audio file to return beat times, beat count, and tempo confidence for placing markers or cuts to music.
Instructions
Find rhythmic onsets (beats, hits, transients) in a file's audio by decoding it and picking energy peaks, and estimate the tempo. Returns beat_times in file time (seconds from the start of the file), beat_count, median_beat_interval, tempo_bpm and tempo_confidence (0-1). Use it to cut to music: place markers (add_markers) or cuts (razor_at_times) at the returned times (for a clip at 100 % speed: sequence time = clip start + file time - clip in point). tempo_bpm is null when no steady pulse is found. Works best on music with clear percussion; for speech use detect_silence_in_file instead. Works on the file on disk with ffmpeg, not on the timeline; Premiere Pro is not needed. ffmpeg and ffprobe must be installed (see check_ffmpeg), else FFMPEG_NOT_FOUND.
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": {
"path": "<path>"
},
"name": "detect_beats_in_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end | No | Analyse up to this file time, in seconds; clamped to the file's length. Must be greater than start. Default: the end of the file. | |
| path | Yes | Absolute path of the media file on this computer. | |
| start | No | Analyse from this file time (seconds from the start of the file). Default 0. | |
| max_bpm | No | Highest tempo considered for the tempo estimate, in beats per minute; must be above min_bpm. Default 200. | |
| min_bpm | No | Lowest tempo considered for the tempo estimate, in beats per minute. Default 60. | |
| max_results | No | Maximum beats to return. When there are more, the result has truncated=true and the total count. Default 2000. | |
| min_spacing | No | Smallest time between two reported beats, in seconds; of two closer onsets the stronger wins. Default 0.25 (at most 4 per second). Use 0.4-0.5 to get only main beats. | |
| sensitivity | No | 0-1. Higher reports weaker onsets too, lower only the strongest hits. Default 0.5. | |
| audio_stream | No | Which audio stream to use, 0-based among the file's audio streams (see probe_media_file). Default 0. | |
| timeout_seconds | No | Stop ffmpeg and fail with TIMEOUT after this many seconds. Default 600. | |
| include_strengths | No | Also return beat_strengths: the relative strength (0-1) of each beat, in the same order as beat_times. Default false. |