tempo
Analyze audio time series to estimate tempo (BPM) with precision using optional offset and duration parameters. Supports customizable hop length, BPM range, and accuracy settings.
Instructions
Estimates the tempo (in BPM) of the given audio time series using librosa. Offset and duration are optional, in seconds.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ac_size | No | ||
| hop_length | No | ||
| max_tempo | No | ||
| path_audio_time_series_y | Yes | ||
| start_bpm | No | ||
| std_bpm | No |
Implementation Reference
- src/mcp_music_analysis/server.py:71-93 (handler)The handler function for the 'tempo' MCP tool. It loads the audio time series from a CSV file and uses librosa.feature.tempo to estimate the tempo in BPM.@mcp.tool() def tempo( path_audio_time_series_y: str, hop_length: int = 512, start_bpm: float = 120, std_bpm: float = 1.0, ac_size: float = 8.0, max_tempo: float = 320.0, ) -> float: """ Estimates the tempo (in BPM) of the given audio time series using librosa. Offset and duration are optional, in seconds. """ y = np.loadtxt(path_audio_time_series_y, delimiter=";") tempo = librosa.feature.tempo( y=y, hop_length=hop_length, start_bpm=start_bpm, std_bpm=std_bpm, ac_size=ac_size, max_tempo=max_tempo, ) return tempo