{
  "openapi": "3.1.1",
  "info": {
    "title": "Tuning Reference (String Frequencies \u0026 Temperaments) API",
    "version": "1.0.0",
    "summary": "String frequencies for guitar, bass, violin and more at any A4, in equal or historical temperaments.",
    "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://tonegridtuningreference.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "String frequencies for guitar, bass, violin and more at any A4, in equal or historical temperaments.",
        "description": "Look up the exact frequency of every string of an instrument tuning and of a whole octave of notes for a reference pitch between A4 = 415 and 466 Hz, in equal temperament, 5-limit just intonation, Pythagorean tuning, quarter-comma meantone, Werckmeister III or Vallotti on any tonic — with the deviation of each note from equal temperament in cents. The same tables as the tuner and drone in the Tonegrid app.\n\nMethodology:\n- Equal temperament: f = A4 × 2^((n − 69) / 12) for MIDI note n. Other temperaments shift each pitch class by its deviation from equal temperament, with A held at 0 so that A4 always sounds at the reference pitch, as on tuners with temperament settings.\n- Just intonation (5-limit, asymmetric 12-note scale) uses the ratios 1, 16/15, 9/8, 6/5, 5/4, 4/3, 45/32, 3/2, 8/5, 5/3, 9/5, 15/8 above the tonic. Pythagorean, meantone, Werckmeister III and Vallotti are built from the chain of fifths E♭–G♯: pure fifths (3/2), fifths narrowed by ¼ syntonic comma (meantone), ¼ Pythagorean comma on C–G, G–D, D–A and B–F♯ (Werckmeister III), or ⅙ Pythagorean comma on F–C–G–D–A–E–B (Vallotti).\n- Cents = 1200 × log2(f1 / f2). Frequencies are rounded to 0.001 Hz and cents to 0.01.\n\nReference values. Real instruments also need inharmonicity and string stretch taken into account (pianos are tuned with stretched octaves).",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "tonegrid_tuning_reference",
        "x-owner-app": "tonegrid",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TonegridTuningReferenceInput"
              },
              "examples": {
                "example1": {
                  "summary": "Guitar in standard tuning at A4 = 440 Hz",
                  "value": {
                    "instrument": "guitar/standard",
                    "a4": 440,
                    "temperament": "equal",
                    "tonic": "C",
                    "octave": 4
                  }
                },
                "example2": {
                  "summary": "Violin at baroque pitch A4 = 415 Hz, Werckmeister III",
                  "value": {
                    "instrument": "violin/standard",
                    "a4": 415,
                    "temperament": "werckmeister3",
                    "tonic": "C",
                    "octave": 4
                  }
                },
                "example3": {
                  "summary": "Just intonation in D for a D drone, A4 = 442 Hz",
                  "value": {
                    "instrument": "none",
                    "a4": 442,
                    "temperament": "just",
                    "tonic": "D",
                    "octave": 3
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TonegridTuningReferenceResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "TonegridTuningReferenceInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "instrument": {
            "title": "Instrument tuning",
            "type": "string",
            "enum": [
              "none",
              "guitar/standard",
              "guitar/dropD",
              "guitar/halfDown",
              "guitar/dadgad",
              "guitar/openG",
              "guitar/openD",
              "guitar7/standard",
              "bass4/standard",
              "bass4/dropD",
              "bass5/standard",
              "ukulele/standard",
              "ukulele/lowG",
              "ukulele/baritone",
              "violin/standard",
              "viola/standard",
              "cello/standard",
              "doublebass/standard",
              "mandolin/standard",
              "banjo/openG"
            ],
            "default": "guitar/standard"
          },
          "a4": {
            "title": "Reference pitch A4 (Hz)",
            "type": "number",
            "minimum": 415,
            "maximum": 466,
            "default": 440
          },
          "temperament": {
            "title": "Temperament",
            "type": "string",
            "enum": [
              "equal",
              "just",
              "pythagorean",
              "meantone",
              "werckmeister3",
              "vallotti"
            ],
            "default": "equal"
          },
          "tonic": {
            "title": "Tonic (key the temperament is built on)",
            "type": "string",
            "enum": [
              "C",
              "C♯",
              "D",
              "E♭",
              "E",
              "F",
              "F♯",
              "G",
              "A♭",
              "A",
              "B♭",
              "B"
            ],
            "default": "C"
          },
          "octave": {
            "title": "Octave of the note table",
            "type": "integer",
            "minimum": 0,
            "maximum": 8,
            "default": 4
          }
        },
        "required": []
      },
      "TonegridTuningReferenceResult": {
        "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": [
              "a4",
              "temperament",
              "tonic",
              "strings",
              "notes"
            ],
            "properties": {
              "a4": {
                "type": "number"
              },
              "temperament": {
                "type": "string"
              },
              "tonic": {
                "type": "string"
              },
              "strings": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "string",
                    "note",
                    "midi",
                    "hz",
                    "centsFromEqual"
                  ],
                  "properties": {
                    "string": {
                      "type": "integer",
                      "description": "1 = lowest-sounding string as listed (string order of the tuning)."
                    },
                    "note": {
                      "type": "string"
                    },
                    "midi": {
                      "type": "integer"
                    },
                    "hz": {
                      "type": "number"
                    },
                    "centsFromEqual": {
                      "type": "number"
                    }
                  }
                }
              },
              "notes": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "note",
                    "midi",
                    "hz",
                    "centsFromEqual",
                    "centsFromTonic"
                  ],
                  "properties": {
                    "note": {
                      "type": "string"
                    },
                    "midi": {
                      "type": "integer"
                    },
                    "hz": {
                      "type": "number"
                    },
                    "centsFromEqual": {
                      "type": "number"
                    },
                    "centsFromTonic": {
                      "type": "number",
                      "description": "Cents above the tonic within the octave (temperament step)."
                    }
                  }
                }
              }
            }
          },
          "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"
              }
            }
          }
        }
      }
    }
  }
}