generate_variation
Create variations of music patterns for TidalCycles/Strudel, supporting subtle, moderate, extreme, glitch, and evolving transformation types.
Instructions
Create pattern variations
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | No | Variation type (subtle/moderate/extreme/glitch/evolving) |
Implementation Reference
- MCP tool handler in executeTool switch statement: retrieves current pattern, generates variation using PatternGenerator service, writes the varied pattern to the editor, and returns success message.case 'generate_variation': const toVary = await this.getCurrentPatternSafe(); const varied = this.generator.generateVariation(toVary, args.type || 'subtle'); await this.writePatternSafe(varied); return `Added ${args.type || 'subtle'} variation`;
- src/server/EnhancedMCPServerFixed.ts:203-212 (registration)Tool registration in getTools(): defines name, description, and input schema for the generate_variation tool.{ name: 'generate_variation', description: 'Create pattern variations', inputSchema: { type: 'object', properties: { type: { type: 'string', description: 'Variation type (subtle/moderate/extreme/glitch/evolving)' } } } },
- Input schema definition specifying optional 'type' parameter for variation styles.inputSchema: { type: 'object', properties: { type: { type: 'string', description: 'Variation type (subtle/moderate/extreme/glitch/evolving)' } } }
- Core implementation in PatternGenerator service: appends Strudel-specific variation modifiers (e.g., fast, rev, jux) to the input pattern based on the specified type.generateVariation(pattern: string, variationType: string = 'subtle'): string { const variations: Record<string, string> = { subtle: '.sometimes(x => x.fast(2))', moderate: '.every(4, x => x.rev).sometimes(x => x.fast(2))', extreme: '.every(2, x => x.jux(rev)).sometimes(x => x.iter(4))', glitch: '.sometimes(x => x.chop(8).rev).rarely(x => x.speed(-1))', evolving: '.slow(4).every(8, x => x.fast(2)).every(16, x => x.palindrome)' }; return pattern + (variations[variationType] || variations.subtle); }