Skip to main content
Glama

sc_play_synth_advanced

Generate audio synthesis by playing specific synth types with customizable parameters including frequency, amplitude, duration, pan, and filter controls.

Instructions

Play a specific synth with explicit parameters. Available synths: sine, pluck, bell, bass, pad, kick, snare, hihat, atmosphere, sweep

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
synthNameYesName of the synth to play
freqNoFrequency in Hz (default: 440)
ampNoAmplitude 0-1 (default: 0.3)
durationNoDuration in seconds (default: 1)
panNoPan position -1 (left) to 1 (right) (default: 0)
decayNoDecay time for pluck synth (default: 2)
cutoffNoFilter cutoff frequency for bass/pad (default: varies)
startFreqNoStart frequency for sweep (default: 100)
endFreqNoEnd frequency for sweep (default: 2000)

Implementation Reference

  • Handler function for 'sc_play_synth_advanced': parses Zod schema, checks server booted and synthDefs loaded, builds SuperCollider Synth command string with provided parameters, executes it via scServer.executeCode, returns status message.
    case 'sc_play_synth_advanced': { const schema = z.object({ synthName: z.string(), freq: z.number().optional(), amp: z.number().optional(), duration: z.number().optional(), pan: z.number().optional(), decay: z.number().optional(), cutoff: z.number().optional(), startFreq: z.number().optional(), endFreq: z.number().optional(), }); const params = schema.parse(args); if (!scServer.getBooted() || !synthDefsLoaded) { return { content: [{ type: 'text', text: 'Error: SuperCollider server is not running. Call sc_boot first.' }], isError: true, }; } const { synthName, ...synthParams } = params; const paramStr = Object.entries(synthParams) .filter(([_, value]) => value !== undefined) .map(([key, value]) => `\\${key}, ${value}`) .join(', '); const code = `Synth(\\${synthName}, [${paramStr}]);`; await scServer.executeCode(code); return { content: [ { type: 'text', text: `Playing ${synthName} synth with parameters: ${JSON.stringify(synthParams)}`, }, ], }; }
  • src/index.ts:96-142 (registration)
    Tool registration in the tools array, defining name, description, and input schema (JSON Schema) for parameter validation with synthName required and enum of available synths, optional params for freq, amp, etc.
    { name: 'sc_play_synth_advanced', description: 'Play a specific synth with explicit parameters. Available synths: sine, pluck, bell, bass, pad, kick, snare, hihat, atmosphere, sweep', inputSchema: { type: 'object', properties: { synthName: { type: 'string', description: 'Name of the synth to play', enum: ['sine', 'pluck', 'bell', 'bass', 'pad', 'kick', 'snare', 'hihat', 'atmosphere', 'sweep'], }, freq: { type: 'number', description: 'Frequency in Hz (default: 440)', }, amp: { type: 'number', description: 'Amplitude 0-1 (default: 0.3)', }, duration: { type: 'number', description: 'Duration in seconds (default: 1)', }, pan: { type: 'number', description: 'Pan position -1 (left) to 1 (right) (default: 0)', }, decay: { type: 'number', description: 'Decay time for pluck synth (default: 2)', }, cutoff: { type: 'number', description: 'Filter cutoff frequency for bass/pad (default: varies)', }, startFreq: { type: 'number', description: 'Start frequency for sweep (default: 100)', }, endFreq: { type: 'number', description: 'End frequency for sweep (default: 2000)', }, }, required: ['synthName'], }, },
  • Zod schema used in handler for runtime validation of input arguments.
    const schema = z.object({ synthName: z.string(), freq: z.number().optional(), amp: z.number().optional(), duration: z.number().optional(), pan: z.number().optional(), decay: z.number().optional(), cutoff: z.number().optional(), startFreq: z.number().optional(), endFreq: z.number().optional(), });

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/BradA1878/mcp-wave'

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