Skip to main content
Glama
williamzujkowski

Strudel MCP Server

generate_bassline

Create bassline patterns in specified musical keys and styles for TidalCycles/Strudel music generation.

Instructions

Generate bassline

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesMusical key
styleYesBass style

Implementation Reference

  • Core handler function that generates Strudel bassline pattern code based on musical key and style, using predefined patterns with synth parameters.
    generateBassline(key: string, style: string): string {
      const patterns: Record<string, string> = {
        techno: `note("${key}2 ${key}2 ${key}2 ${key}2").s("sawtooth").cutoff(800)`,
        house: `note("${key}2 ~ ${key}2 ~").s("sine").gain(0.8)`,
        dnb: `note("${key}1 ~ ~ ${key}2 ~ ${key}1 ~ ~").s("square").cutoff(400)`,
        acid: `note("${key}2 ${key}3 ${key}2 ${this.theory.getNote(key, 3)}2").s("sawtooth").cutoff(sine.range(200, 2000).slow(4))`,
        dub: `note("${key}1 ~ ~ ~ ${key}1 ~ ${this.theory.getNote(key, 5)}1 ~").s("sine:2").room(0.5)`,
        funk: `note("${key}2 ${key}2 ~ ${this.theory.getNote(key, 5)}2 ~ ${key}2 ${this.theory.getNote(key, 7)}2 ~").s("square").cutoff(1200)`,
        jazz: `note("${key}2 ~ ${this.theory.getNote(key, 4)}2 ~ ${this.theory.getNote(key, 7)}2 ~").s("sine").gain(0.7)`,
        ambient: `note("${key}1").s("sine").attack(2).release(4).gain(0.6)`
      };
    
      return patterns[style] || patterns.techno;
    }
  • Tool registration in getTools(): defines name, description, and input schema for generate_bassline tool.
    {
      name: 'generate_bassline',
      description: 'Generate bassline',
      inputSchema: {
        type: 'object',
        properties: {
          key: { type: 'string', description: 'Musical key' },
          style: { type: 'string', description: 'Bass style' }
        },
        required: ['key', 'style']
      }
    },
  • Server-side tool handler: validates args, delegates to PatternGenerator, appends bassline to current pattern, writes it.
    case 'generate_bassline':
      InputValidator.validateRootNote(args.key);
      InputValidator.validateStringLength(args.style, 'style', 100, false);
      const bass = this.generator.generateBassline(args.key, args.style);
      const currentBass = await this.getCurrentPatternSafe();
      const newBassPattern = currentBass ? currentBass + '\n' + bass : bass;
      await this.writePatternSafe(newBassPattern);
      return `Generated ${args.style} bassline in ${args.key}`;
  • Input schema definition: requires 'key' (string) and 'style' (string) parameters.
    inputSchema: {
      type: 'object',
      properties: {
        key: { type: 'string', description: 'Musical key' },
        style: { type: 'string', description: 'Bass style' }
      },
      required: ['key', 'style']
    }

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