Skip to main content
Glama

load

Load audio files for analysis by extracting time series data with optional offset and duration parameters.

Instructions

Loads an audio file and returns the path to the audio time series Offset and duration are optional, in seconds. Be careful, you will never know the name of the song.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes
offsetNo
durationNo

Implementation Reference

  • The main handler for the 'load' MCP tool. Decorated with @mcp.tool(), it loads an audio file using librosa.load, saves the time series y to a CSV file in temp dir, computes STFT and HPSS but only returns the path to y CSV.
    @mcp.tool() def load( file_path: str, offset: float = 0.0, duration: float = None, ) -> dict: """ Loads an audio file and returns the path to the audio time series Offset and duration are optional, in seconds. Be careful, you will never know the name of the song. """ y, sr = librosa.load(path=file_path, offset=offset, duration=duration) # stock y inside a csv file name = file_path.split("/")[-1].split(".")[0] + "_y" y_path = os.path.join(tempfile.gettempdir(), name + ".csv") np.savetxt(y_path, y, delimiter=";") D = librosa.stft(y) harmonics, percussion = librosa.decompose.hpss(D) # Save the harmonic and percussive components to separate files # name_harmonic = file_path.split("/")[-1].split(".")[0] + "_harmonic" # name_percussive = file_path.split("/")[-1].split(".")[0] + "_percussive" # harmonic_path = os.path.join(tempfile.gettempdir(), name_harmonic + ".csv") # percussive_path = os.path.join(tempfile.gettempdir(), name_percussive + ".csv") # np.savetxt(harmonic_path, harmonics, delimiter=";") # np.savetxt(percussive_path, percussion, delimiter=";") return { "y_path": y_path, # "y_harmonic_path": harmonic_path, # "y_percussive_path": percussive_path, }

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