Skip to main content
Glama

generate_drums

Create drum patterns for music production by specifying style and complexity parameters. This tool helps musicians generate rhythmic sequences for use in TidalCycles/Strudel live coding environments.

Instructions

Generate drum pattern

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
styleYesDrum style
complexityNoComplexity (0-1)

Implementation Reference

  • Main tool handler: validates inputs, generates drum pattern using PatternGenerator, appends to current pattern if any, writes to editor, returns confirmation.
    case 'generate_drums': InputValidator.validateStringLength(args.style, 'style', 100, false); if (args.complexity !== undefined) { InputValidator.validateNormalizedValue(args.complexity, 'complexity'); } const drums = this.generator.generateDrumPattern(args.style, args.complexity || 0.5); const currentDrum = await this.getCurrentPatternSafe(); const newDrumPattern = currentDrum ? currentDrum + '\n' + drums : drums; await this.writePatternSafe(newDrumPattern); return `Generated ${args.style} drums`;
  • Tool schema definition including input schema for style (required) and optional complexity.
    { name: 'generate_drums', description: 'Generate drum pattern', inputSchema: { type: 'object', properties: { style: { type: 'string', description: 'Drum style' }, complexity: { type: 'number', description: 'Complexity (0-1)' } }, required: ['style'] }
  • Core helper function that returns a predefined Strudel drum pattern string based on the specified style and complexity level, selecting from arrays of patterns per style.
    generateDrumPattern(style: string, complexity: number = 1): string { const patterns: Record<string, string[]> = { techno: [ 's("bd*4")', 's("bd*4, ~ cp ~ cp")', 's("bd*4, ~ cp ~ cp, hh*8")', 's("bd*4, ~ cp ~ cp, [~ hh]*4, oh ~ ~ ~").swing(0.05)' ], house: [ 's("bd*4, hh*8")', 's("bd*4, hh*8, ~ cp ~ cp")', 's("bd*4, [~ hh]*4, ~ cp ~ cp, oh ~ oh ~")', 's("bd*4, [~ hh]*4, ~ cp ~ cp").every(4, x => x.fast(2))' ], dnb: [ 's("bd ~ ~ bd ~ ~ bd ~, ~ ~ cp ~ ~ cp ~ ~")', 's("bd ~ ~ [bd bd] ~ ~ bd ~, ~ ~ cp ~ ~ cp ~ ~, hh*16")', 's("bd ~ ~ [bd bd] ~ ~ bd ~, ~ ~ cp ~ [~ cp] ~ cp ~ ~, hh*16").fast(2)' ], breakbeat: [ 's("bd ~ ~ bd ~ ~ ~ bd, ~ cp ~ ~ cp ~")', 's("bd ~ ~ bd ~ [~ bd] ~ bd, ~ cp ~ ~ cp ~, hh*8")', 's("bd ~ [~ bd] bd ~ [~ bd] ~ bd, ~ cp ~ ~ cp [~ cp], hh*8").swing(0.1)' ], trap: [ 's("bd*2, ~ cp ~ cp")', 's("bd*2, ~ cp ~ cp, hh*8").every(2, x => x.fast(2))', 's("bd [bd bd] ~ bd, ~ cp ~ cp, hh*16").swing(0.2)' ], jungle: [ 's("bd ~ [~ bd] bd ~ ~ bd ~, ~ cp ~ ~ cp ~").fast(2)', 's("bd ~ [~ bd] bd ~ [bd bd] bd ~, ~ cp ~ [~ cp] cp ~, hh*32").fast(2)' ], ambient: [ 's("bd ~ ~ ~")', 's("bd ~ ~ ~, ~ ~ ~ hh:8").room(0.9)', 's("bd ~ ~ ~, ~ ~ ~ hh:8, ~ ~ oh:5 ~").room(0.9).gain(0.5)' ], experimental: [ 's("bd").euclid(5, 8)', 's("bd cp").euclid(7, 16)', 's("bd cp hh").euclid(choose([3, 5, 7]), 16)' ] }; const stylePatterns = patterns[style] || patterns.techno; const index = Math.min(Math.floor(complexity * stylePatterns.length), stylePatterns.length - 1); return stylePatterns[index]; }

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/williamzujkowski/strudel-mcp-server'

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