{
  "openapi": "3.1.1",
  "info": {
    "title": "Drum Synthesizer (WAV one-shots) API",
    "version": "1.0.0",
    "summary": "Design a kick, snare, hi-hat, clap or tom from scratch and download it as a WAV one-shot.",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://tonegriddrumsynth.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Design a kick, snare, hi-hat, clap or tom from scratch and download it as a WAV one-shot.",
        "description": "Synthesizes a drum sound without samples: a pitch-swept tone, filtered noise, metallic square-wave clusters, clap bursts, a click and saturation, each with its own decay. Start from one of eleven presets, change any setting with a small JSON object, and get a 16-bit mono WAV one-shot plus its waveform, spectrum and level. The same synthesizer as the Drum Lab in the Tonegrid app.\n\nMethodology:\n- Tone: a sine or triangle oscillator whose frequency falls exponentially from the start to the end pitch within the pitch-decay time and then stays (the phase is the exact integral of the sweep, so there are no clicks).\n- Noise: seeded white noise (same seed, same sound) through a low-, band- or high-pass biquad filter (RBJ cookbook). Metal: six square waves at fixed inharmonic ratios (1 : 1.34 : 1.68 : 2.21 : 2.66 : 3.15) above the metal frequency, through the same filter, for cymbal-like hats. Clap: the noise envelope restarts for every burst; early bursts die within two spacings, the last one uses the noise decay.\n- Each part has an exponential decay that reaches −60 dB at its decay time, plus a 0.5 ms attack ramp; an optional click is a 3.2 kHz sine burst of under 1 ms. Drive applies tanh saturation. The sound ends with a 2 ms fade to silence and is normalised: the WAV file peaks at −1 dBFS (16-bit mono, 44.1 kHz).\n\nThese are simple synthesized drums, not recordings of real instruments or of any drum machine. You may use the sounds you make freely.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "tonegrid_drum_synth",
        "x-owner-app": "tonegrid",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TonegridDrumSynthInput"
              },
              "examples": {
                "example1": {
                  "summary": "Hand clap preset",
                  "value": {
                    "preset": "hand-clap",
                    "settings": ""
                  }
                },
                "example2": {
                  "summary": "Long, distorted deep kick",
                  "value": {
                    "preset": "deep-kick",
                    "settings": "{\"name\": \"Boom kick\", \"toneEnd\": 38, \"toneDecay\": 0.9, \"drive\": 0.35}"
                  }
                },
                "example3": {
                  "summary": "Open hi-hat with a darker filter",
                  "value": {
                    "preset": "open-hat",
                    "settings": "{\"noiseHz\": 5200, \"noiseDecay\": 0.6}"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TonegridDrumSynthResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tool": {
      "get": {
        "operationId": "getToolDefinition",
        "summary": "Inputs, output schema and examples for this tool",
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "TonegridDrumSynthInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "preset": {
            "title": "Start from preset",
            "type": "string",
            "enum": [
              "deep-kick",
              "punchy-kick",
              "tight-snare",
              "fat-snare",
              "closed-hat",
              "open-hat",
              "hand-clap",
              "low-tom",
              "high-tom",
              "rimshot",
              "laser-zap"
            ],
            "default": "deep-kick"
          },
          "settings": {
            "title": "Change settings (JSON, optional)",
            "description": "Any of: toneStart, toneEnd (Hz), pitchDecay, toneDecay (s), wave (sine/triangle), toneLevel, noiseLevel, noiseDecay, noiseFilter (lowpass/bandpass/highpass), noiseHz, noiseQ, metalLevel, metalHz, bursts, burstSpacing, click, drive, level, seed, name, kind. Empty = the preset as it is. Tonegrid’s “Copy settings” gives a complete object.",
            "type": "string",
            "maxLength": 4000,
            "default": ""
          }
        },
        "required": []
      },
      "TonegridDrumSynthResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "name",
              "kind",
              "sampleRate",
              "channels",
              "seconds",
              "peakDb",
              "rmsDb",
              "centroidHz",
              "peaks",
              "patch",
              "wavFile"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "kind": {
                "type": "string"
              },
              "sampleRate": {
                "type": "integer"
              },
              "channels": {
                "type": "integer"
              },
              "seconds": {
                "type": "number",
                "description": "Length of the one-shot (longest decay + 5 ms, at most 2 s)."
              },
              "peakDb": {
                "type": "number",
                "description": "Sample peak of the file (normalised to −1 dBFS)."
              },
              "rmsDb": {
                "type": "number"
              },
              "centroidHz": {
                "type": "number",
                "description": "Spectral centroid (brightness)."
              },
              "peaks": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "frequencyHz",
                    "levelDb"
                  ],
                  "properties": {
                    "frequencyHz": {
                      "type": "number"
                    },
                    "levelDb": {
                      "type": "number"
                    }
                  }
                }
              },
              "patch": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "name",
                  "kind",
                  "wave",
                  "noiseFilter",
                  "toneStart",
                  "toneEnd",
                  "pitchDecay",
                  "toneDecay",
                  "toneLevel",
                  "noiseLevel",
                  "noiseDecay",
                  "noiseHz",
                  "noiseQ",
                  "metalLevel",
                  "metalHz",
                  "bursts",
                  "burstSpacing",
                  "click",
                  "drive",
                  "level",
                  "seed"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "kick",
                      "snare",
                      "hat",
                      "clap",
                      "tom",
                      "perc"
                    ]
                  },
                  "wave": {
                    "type": "string",
                    "enum": [
                      "sine",
                      "triangle"
                    ]
                  },
                  "noiseFilter": {
                    "type": "string",
                    "enum": [
                      "lowpass",
                      "bandpass",
                      "highpass"
                    ]
                  },
                  "toneStart": {
                    "type": "number",
                    "minimum": 20,
                    "maximum": 4000
                  },
                  "toneEnd": {
                    "type": "number",
                    "minimum": 20,
                    "maximum": 4000
                  },
                  "pitchDecay": {
                    "type": "number",
                    "minimum": 0.001,
                    "maximum": 1
                  },
                  "toneDecay": {
                    "type": "number",
                    "minimum": 0.01,
                    "maximum": 2
                  },
                  "toneLevel": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  },
                  "noiseLevel": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  },
                  "noiseDecay": {
                    "type": "number",
                    "minimum": 0.005,
                    "maximum": 2
                  },
                  "noiseHz": {
                    "type": "number",
                    "minimum": 100,
                    "maximum": 16000
                  },
                  "noiseQ": {
                    "type": "number",
                    "minimum": 0.3,
                    "maximum": 12
                  },
                  "metalLevel": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  },
                  "metalHz": {
                    "type": "number",
                    "minimum": 100,
                    "maximum": 2000
                  },
                  "bursts": {
                    "type": "number",
                    "minimum": 1,
                    "maximum": 5
                  },
                  "burstSpacing": {
                    "type": "number",
                    "minimum": 0.003,
                    "maximum": 0.03
                  },
                  "click": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  },
                  "drive": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  },
                  "level": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  },
                  "seed": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 4294967295
                  }
                }
              },
              "wavFile": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "artifactId",
                  "filename",
                  "mime",
                  "bytes",
                  "sha256",
                  "path"
                ],
                "properties": {
                  "artifactId": {
                    "type": "string"
                  },
                  "filename": {
                    "type": "string"
                  },
                  "mime": {
                    "type": "string"
                  },
                  "bytes": {
                    "type": "integer"
                  },
                  "sha256": {
                    "type": "string"
                  },
                  "path": {
                    "type": "string",
                    "description": "Download path on the same site (valid for about 2 hours)."
                  }
                }
              }
            }
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}