Skip to main content
Glama

beat_track

Analyze audio rhythmic content by computing beat tracks for music analysis. Uses librosa to detect tempo and beat positions from audio time series.

Instructions

Computes the beat track of the given audio time series using librosa. The beat track is a representation of the audio signal in terms of its rhythmic content, which is useful for music analysis. The beat track is computed using the following parameters: - hop_length: The number of samples between frames. - start_bpm: The initial estimate of the tempo (in BPM). - tightness: The tightness of the beat tracking (default is 100). - units: The units of the beat track (default is "frames"). It can be frames, samples, time.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
path_audio_time_series_yYes
hop_lengthNo
start_bpmNo
tightnessNo
unitsNoframes

Implementation Reference

  • The beat_track tool handler function. Decorated with @mcp.tool() for registration. Loads audio time series, computes tempo and beat frames using librosa.beat.beat_track, and returns a dictionary with tempo (BPM) and beats.
    @mcp.tool() def beat_track( path_audio_time_series_y: str, hop_length: int = 512, start_bpm: float = 120, tightness: int = 100, units: str = "frames", ) -> str: """ Computes the beat track of the given audio time series using librosa. The beat track is a representation of the audio signal in terms of its rhythmic content, which is useful for music analysis. The beat track is computed using the following parameters: - hop_length: The number of samples between frames. - start_bpm: The initial estimate of the tempo (in BPM). - tightness: The tightness of the beat tracking (default is 100). - units: The units of the beat track (default is "frames"). It can be frames, samples, time. """ y = np.loadtxt(path_audio_time_series_y, delimiter=";") tempo, beats = librosa.beat.beat_track( y=y, hop_length=hop_length, start_bpm=start_bpm, tightness=tightness, units=units, ) return { "tempo": tempo, "beats": beats, }
  • Tool schema definition in the analyze_audio prompt, listing parameters and return type.
    "- beat_track(path_audio_time_series_y: str, hop_length: int = 512, start_bpm: float = 120, " "tightness: int = 100, units: str = 'frames') -> dict\n"
  • Core librosa.beat.beat_track call that performs the beat tracking computation.
    tempo, beats = librosa.beat.beat_track( y=y, hop_length=hop_length, start_bpm=start_bpm, tightness=tightness, units=units, )

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hugohow/mcp-music-analysis'

If you have feedback or need assistance with the MCP directory API, please join our Discord server