tempo
Analyze audio files to detect tempo in beats per minute (BPM) using time series data, with configurable parameters for precise measurement.
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 |
|---|---|---|---|
| path_audio_time_series_y | Yes | ||
| hop_length | No | ||
| start_bpm | No | ||
| std_bpm | No | ||
| ac_size | No | ||
| max_tempo | No |
Implementation Reference
- src/mcp_music_analysis/server.py:71-93 (handler)The main handler function for the 'tempo' tool. It loads the audio time series from a CSV file and estimates the tempo in BPM using librosa.feature.tempo.@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
- The input schema for the 'tempo' tool as listed in the MCP prompt, defining parameters and return type."- 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\n"
- src/mcp_music_analysis/server.py:71-71 (registration)The @mcp.tool() decorator registers the tempo function as an MCP tool.@mcp.tool()