set_tempo
Adjust the tempo in beats per minute (BPM) for music patterns in Strudel.cc, enabling precise control over timing during AI-powered music generation and live coding sessions.
Instructions
Set BPM
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bpm | Yes | Tempo in BPM |
Implementation Reference
- The executeTool switch case that implements the set_tempo tool: validates the bpm input, prepends a setcpm(bpm) line to the current pattern, writes the updated pattern to the editor, and returns a confirmation message.case 'set_tempo': InputValidator.validateBPM(args.bpm); const currentTempo = await this.getCurrentPatternSafe(); const withTempo = `setcpm(${args.bpm})\n${currentTempo}`; await this.writePatternSafe(withTempo); return `Set tempo to ${args.bpm} BPM`;
- The tool definition in getTools() including name, description, and input schema requiring a numeric bpm parameter. This is used for both listing tools and validation.{ name: 'set_tempo', description: 'Set BPM', inputSchema: { type: 'object', properties: { bpm: { type: 'number', description: 'Tempo in BPM' } }, required: ['bpm'] }
- Array in requiresInitialization() helper function that includes 'set_tempo' among tools requiring browser initialization before execution.const toolsRequiringInit = [ 'write', 'append', 'insert', 'replace', 'play', 'pause', 'stop', 'clear', 'get_pattern', 'analyze', 'analyze_spectrum', 'analyze_rhythm', 'transpose', 'reverse', 'stretch', 'humanize', 'generate_variation', 'add_effect', 'add_swing', 'set_tempo', 'save', 'undo', 'redo', 'validate_pattern_runtime' ];