Skip to main content
Glama

mfcc

Extract Mel-frequency cepstral coefficients (MFCC) from audio files to analyze spectral content for music analysis applications.

Instructions

Computes the MFCC of the given audio time series using librosa. The MFCC is a representation of the audio signal in terms of its spectral content, which is useful for music analysis. The MFCC is computed using the following parameters: - path_audio_time_series_y: The path to the audio time series (CSV file). It's sometimes better to take harmonics only

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
path_audio_time_series_yYes

Implementation Reference

  • The handler function for the 'mfcc' tool. It loads the audio time series from a CSV file, computes the MFCC features using librosa.feature.mfcc, saves the result to a new CSV file in temp dir, and returns the path to that file. The @mcp.tool() decorator registers it as an MCP tool.
    @mcp.tool() def mfcc( path_audio_time_series_y: str, ) -> str: """ Computes the MFCC of the given audio time series using librosa. The MFCC is a representation of the audio signal in terms of its spectral content, which is useful for music analysis. The MFCC is computed using the following parameters: - path_audio_time_series_y: The path to the audio time series (CSV file). It's sometimes better to take harmonics only """ y = np.loadtxt(path_audio_time_series_y, delimiter=";") mfcc = librosa.feature.mfcc(y=y) # Save the mfcc to a CSV file name = path_audio_time_series_y.split("/")[-1].split(".")[0] + "_mfcc" mfcc_path = os.path.join(tempfile.gettempdir(), name + ".csv") np.savetxt(mfcc_path, mfcc, delimiter=";") # Return the path to the CSV file return mfcc_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