humanize
Add natural timing variations to music patterns by adjusting humanization amount from 0 to 1, creating more organic-sounding rhythms in Strudel music generation.
Instructions
Add human timing variation
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| amount | No | Humanization amount (0-1) |
Implementation Reference
- Handler for 'humanize' tool: gets current pattern, appends .nudge() with random timing variation based on amount (0-1), writes back the modified pattern.
case 'humanize': if (args.amount !== undefined) { InputValidator.validateNormalizedValue(args.amount, 'amount'); } const toHumanize = await this.getCurrentPatternSafe(); const humanized = toHumanize + `.nudge(rand.range(-${args.amount || 0.01}, ${args.amount || 0.01}))`; await this.writePatternSafe(humanized); return 'Added human timing'; - src/server/EnhancedMCPServerFixed.ts:193-202 (registration)Registration of 'humanize' tool in getTools() array, including name, description, and input schema.
{ name: 'humanize', description: 'Add human timing variation', inputSchema: { type: 'object', properties: { amount: { type: 'number', description: 'Humanization amount (0-1)' } } } }, - Input schema definition for 'humanize' tool: optional 'amount' number between 0-1.
inputSchema: { type: 'object', properties: { amount: { type: 'number', description: 'Humanization amount (0-1)' } } } - src/utils/InputValidator.ts:278-290 (helper)Helper function validateNormalizedValue used to validate the 'amount' parameter for humanize (and similar normalized params).
static validateNormalizedValue(value: number, fieldName: string): void { if (typeof value !== 'number') { throw new Error(`${fieldName} must be a number`); } if (isNaN(value) || !isFinite(value)) { throw new Error(`${fieldName} must be a valid number`); } if (value < 0 || value > 1.0) { throw new Error(`${fieldName} must be between 0 and 1.0, got ${value}`); } }