{
  "openapi": "3.1.1",
  "info": {
    "title": "Tempo \u0026 Delay Time Calculator (BPM to ms) API",
    "version": "1.0.0",
    "summary": "Delay and reverb times in ms, Hz and samples for every note value at your tempo — or BPM from ms.",
    "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://tracklayertempodelay.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Delay and reverb times in ms, Hz and samples for every note value at your tempo — or BPM from ms.",
        "description": "Turns a tempo into delay times for whole to sixty-fourth notes, straight, dotted and triplet, in milliseconds, LFO rate in hertz and samples at your sample rate, plus pre-delay and decay suggestions for reverbs that breathe with the song. The reverse mode finds the tempo at which a delay time equals a note value. The same tempo maths sets the synced delays in the Tracklayer app.\n\nMethodology:\n- A quarter note lasts 60 000 ÷ BPM milliseconds. Other note values scale with their length in quarter notes (whole = 4, eighth = ½); dotted notes are 1.5 × and triplets ⅔ × as long. Hz = 1000 ÷ ms (one LFO or tremolo cycle per note); samples = ms × sample rate ÷ 1000, rounded.\n- The bar length is the number of beats × 4 ÷ the beat unit quarter notes (6/8 = 3 quarter notes).\n- Reverb suggestions follow a common mixing rule of thumb: a short pre-delay on the grid (1/64 to 1/8) keeps the dry attack clear, and pre-delay + decay together fill a musical length (a quarter note up to two bars), so the tail fades before the next phrase. They are starting points to adjust by ear, not a standard.\n- Reverse mode: BPM = length in quarter notes × 60 000 ÷ ms.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "tracklayer_tempo_delay",
        "x-owner-app": "tracklayer",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TracklayerTempoDelayInput"
              },
              "examples": {
                "example1": {
                  "summary": "Delay times at 120 BPM",
                  "value": {
                    "mode": "bpm",
                    "bpm": 120,
                    "ms": 375,
                    "noteValue": "1/8d",
                    "timeSignature": "4/4",
                    "sampleRate": "48000"
                  }
                },
                "example2": {
                  "summary": "Slow 6/8 ballad at 72 BPM, 44.1 kHz",
                  "value": {
                    "mode": "bpm",
                    "bpm": 72,
                    "ms": 375,
                    "noteValue": "1/8d",
                    "timeSignature": "6/8",
                    "sampleRate": "44100"
                  }
                },
                "example3": {
                  "summary": "Which tempo makes 375 ms a dotted eighth?",
                  "value": {
                    "mode": "ms",
                    "bpm": 120,
                    "ms": 375,
                    "noteValue": "1/8d",
                    "timeSignature": "4/4",
                    "sampleRate": "48000"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TracklayerTempoDelayResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "TracklayerTempoDelayInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "mode": {
            "title": "Calculate",
            "type": "string",
            "enum": [
              "bpm",
              "ms"
            ],
            "default": "bpm"
          },
          "bpm": {
            "title": "Tempo",
            "description": "Quarter notes per minute.",
            "type": "number",
            "minimum": 20,
            "maximum": 300,
            "default": 120,
            "x-unit": "BPM"
          },
          "ms": {
            "title": "Delay time (reverse mode)",
            "type": "number",
            "minimum": 1,
            "maximum": 60000,
            "default": 375,
            "x-unit": "ms"
          },
          "noteValue": {
            "title": "Note value of that delay (reverse mode)",
            "type": "string",
            "enum": [
              "2/1",
              "2/1d",
              "2/1t",
              "1/1",
              "1/1d",
              "1/1t",
              "1/2",
              "1/2d",
              "1/2t",
              "1/4",
              "1/4d",
              "1/4t",
              "1/8",
              "1/8d",
              "1/8t",
              "1/16",
              "1/16d",
              "1/16t",
              "1/32",
              "1/32d",
              "1/32t",
              "1/64",
              "1/64d",
              "1/64t"
            ],
            "default": "1/8d"
          },
          "timeSignature": {
            "title": "Time signature",
            "description": "For the bar length and the long reverb suggestion.",
            "type": "string",
            "maxLength": 5,
            "default": "4/4"
          },
          "sampleRate": {
            "title": "Sample rate",
            "type": "string",
            "enum": [
              "44100",
              "48000",
              "88200",
              "96000"
            ],
            "default": "48000"
          }
        },
        "required": []
      },
      "TracklayerTempoDelayResult": {
        "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": [
              "bpm",
              "timeSignature",
              "sampleRate",
              "beatMs",
              "barMs",
              "rows",
              "reverb"
            ],
            "properties": {
              "bpm": {
                "type": "number"
              },
              "timeSignature": {
                "type": "string"
              },
              "sampleRate": {
                "type": "integer"
              },
              "beatMs": {
                "type": "number",
                "description": "One quarter note."
              },
              "barMs": {
                "type": "number"
              },
              "rows": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "sync",
                    "label",
                    "feel",
                    "beats",
                    "ms",
                    "hz",
                    "samples"
                  ],
                  "properties": {
                    "sync": {
                      "type": "string",
                      "description": "Note value id: 1/8 straight, 1/8d dotted, 1/8t triplet."
                    },
                    "label": {
                      "type": "string"
                    },
                    "feel": {
                      "type": "string",
                      "enum": [
                        "straight",
                        "dotted",
                        "triplet"
                      ]
                    },
                    "beats": {
                      "type": "number",
                      "description": "Length in quarter notes."
                    },
                    "ms": {
                      "type": "number"
                    },
                    "hz": {
                      "type": "number",
                      "description": "Rate when this note value is one LFO cycle."
                    },
                    "samples": {
                      "type": "integer"
                    }
                  }
                }
              },
              "reverb": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "style",
                    "preDelayMs",
                    "decayMs",
                    "note"
                  ],
                  "properties": {
                    "style": {
                      "type": "string"
                    },
                    "preDelayMs": {
                      "type": "number"
                    },
                    "decayMs": {
                      "type": "number"
                    },
                    "note": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "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"
              }
            }
          }
        }
      }
    }
  }
}