Skip to main content
Glama

play_note

Generate musical notes in Sonic Pi by specifying MIDI note numbers, synth types, duration, and filter parameters to create custom sounds.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
noteYesMIDI note number (0-127)
synthNoSynth to use (e.g. :saw, :beep, :prophet)
sustainNoNote duration in seconds
cutoffNoFilter cutoff frequency

Implementation Reference

  • Handler function that implements the core logic of the 'play_note' tool by generating Sonic Pi code and sending it via OSC.
    async ({ note, synth = ":beep", sustain = 1, cutoff = 100 }: PlayNoteParams) => { try { const code = ` use_synth ${synth} play ${note}, sustain: ${sustain}, cutoff: ${cutoff} `; this.oscClient.send('/run-code', code); return { content: [{ type: "text", text: `Playing note ${note} with synth ${synth} (sustain: ${sustain}s, cutoff: ${cutoff})` }] }; } catch (error) { console.error('Error in play_note:', error); throw new Error('Failed to play note'); } }
  • Zod schema for input validation of the 'play_note' tool parameters.
    { note: z.number().min(0).max(127).describe("MIDI note number (0-127)"), synth: z.string().optional().describe("Synth to use (e.g. :saw, :beep, :prophet)"), sustain: z.number().optional().describe("Note duration in seconds"), cutoff: z.number().optional().describe("Filter cutoff frequency") },
  • src/server.ts:44-44 (registration)
    The string identifier used to register the 'play_note' tool in the MCP server.
    "play_note",
  • TypeScript interface providing type safety for the 'play_note' handler parameters.
    interface PlayNoteParams { note: number; synth?: string; sustain?: number; cutoff?: number; }
Install Server

Other Tools

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/abhishekjairath/sonic-pi-mcp'

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