audio_to_midi
Convert audio files to MIDI format for music production and analysis. Process audio URLs to generate MIDI data for editing and composition.
Instructions
Convert audio to MIDI format
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| audio_url | Yes | URL of the audio file to convert to MIDI | |
| webhook_url | No | URL for callback upon completion |
Implementation Reference
- src/index.ts:1250-1268 (handler)The handler function that implements the core logic for the 'audio_to_midi' tool. It validates input, makes an HTTP POST request to the external '/audio_to_midi' API endpoint with audio_url and optional webhook_url, and returns a response message with task details.private async handleAudioToMidi(args: any) { if (!args.audio_url) { throw new McpError(ErrorCode.InvalidParams, "audio_url is required"); } const response = await this.axiosInstance.post("/audio_to_midi", { audio_url: args.audio_url, webhook_url: args.webhook_url, }); return { content: [ { type: "text", text: `Audio to MIDI conversion started!\n\n${JSON.stringify(response.data, null, 2)}\n\nUse get_conversion_by_id with the task_id to check the status.`, }, ], }; }
- src/index.ts:562-578 (schema)The input schema definition for the 'audio_to_midi' tool in the TOOLS array, specifying required 'audio_url' and optional 'webhook_url' parameters.name: "audio_to_midi", description: "Convert audio to MIDI format", inputSchema: { type: "object" as const, properties: { audio_url: { type: "string", description: "URL of the audio file to convert to MIDI", }, webhook_url: { type: "string", description: "URL for callback upon completion", }, }, required: ["audio_url"], }, },
- src/index.ts:715-720 (registration)The switch case in the tool execution handler that registers and dispatches calls to 'audio_to_midi' by invoking handleAudioToMidi.case "extract_key_bpm": return await this.handleExtractKeyBpm(args); case "audio_to_midi": return await this.handleAudioToMidi(args); case "generate_lyrics": return await this.handleGenerateLyrics(args);
- src/index.ts:645-649 (registration)Registration of all tools (including 'audio_to_midi') for the ListTools request handler, which returns the TOOLS array containing the tool definition.this.server.setRequestHandler( ListToolsRequestSchema, async () => ({ tools: TOOLS, })