{
  "openapi": "3.1.1",
  "info": {
    "title": "Tickwork API",
    "version": "1.0.0",
    "summary": "Deterministic tools for people and AI agents.",
    "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://tickwork.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/tools": {
      "get": {
        "operationId": "listTools",
        "summary": "Catalog of all tools",
        "responses": {
          "200": {
            "description": "Tool list.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tools/{id}": {
      "get": {
        "operationId": "getTool",
        "summary": "Definition of one tool",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "tickwork-midi-inspector",
                "tickwork-euclidean-rhythm",
                "tickwork-midi-quantizer"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "404": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tools/tickwork-midi-inspector/calculate": {
      "post": {
        "operationId": "calculateTickworkMidiInspector",
        "summary": "See what is inside a MIDI file: tracks, instruments, tempo map, notes, length and an estimated key.",
        "description": "Reads a Standard MIDI File (.mid, format 0, 1 or 2) and lists its tracks with channels, General MIDI instruments, note counts and ranges, the tempo map, time and key signatures, note lengths, the most notes sounding at once, drum hits and an estimated key from the pitch content. Includes a piano-roll overview. The same reader Tickwork uses to import MIDI files.\n\nMethodology:\n- The file is parsed byte by byte following the Standard MIDI File 1.0 specification: header chunk, track chunks, variable-length delta times, running status, meta and SysEx events. Unknown chunks are skipped; RIFF-wrapped files (.rmi) are unwrapped.\n- Notes are paired from note-on to the next note-off of the same key and channel (a note-on with velocity 0 counts as a note-off). Times in seconds use the tempo map (120 BPM until the first tempo event); SMPTE files use frames per second instead.\n- The key estimate correlates the duration-weighted pitch-class histogram of all pitched notes (channel 10 excluded) with the Krumhansl–Kessler major and minor key profiles in all 24 keys and reports the best and second-best match.\n- Polyphony is the largest number of notes sounding at the same moment across all tracks; note lengths are given in beats (quarter notes).\n\nThe key is a statistical estimate from the notes, not an analysis of harmony; modal or atonal music often gets a nearby major or minor key.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "tickwork_midi_inspector",
        "x-owner-app": "tickwork",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TickworkMidiInspectorInput"
              },
              "examples": {
                "example1": {
                  "summary": "Inspect the lo-fi song sample",
                  "value": {
                    "sample": "lofi-song"
                  }
                },
                "example2": {
                  "summary": "Inspect the acid line sample",
                  "value": {
                    "sample": "acid-locks"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TickworkMidiInspectorResult"
                }
              }
            }
          },
          "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/tools/tickwork-euclidean-rhythm/calculate": {
      "post": {
        "operationId": "calculateTickworkEuclideanRhythm",
        "summary": "Spread k beats evenly over n steps for several drums at once and download the groove as a MIDI file.",
        "description": "Builds Euclidean rhythms with Bjorklund’s algorithm — E(3,8), E(5,16), E(7,12) and any other pulses/steps pair — with rotation, for up to eight drum voices. Voices of different lengths run against each other as a polymeter. You get the patterns as text, their beat intervals, a Standard MIDI File on the General MIDI drum channel and a Tickwork project to keep editing.\n\nMethodology:\n- Bjorklund’s algorithm distributes k onsets over n steps as evenly as possible by repeatedly pairing the groups of onsets with the remainder groups, like Euclid’s algorithm for the greatest common divisor (Toussaint 2005). The first step is always a hit; rotation r shifts the pattern r steps later.\n- Each voice is one step lane of its own length on a sixteenth-note grid, so voices of 8, 12 and 16 steps drift against each other and line up again after their least common multiple.\n- The MIDI file (format 1, 480 ticks per quarter note) puts every voice on channel 10 with its General MIDI percussion key; swing delays every off-beat sixteenth to the given share of an eighth note (50 % = straight). Notes last half a sixteenth.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "tickwork_euclidean_rhythm",
        "x-owner-app": "tickwork",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TickworkEuclideanRhythmInput"
              },
              "examples": {
                "example1": {
                  "summary": "Kick, snare and hats in three lengths",
                  "value": {
                    "voices": "4, 16, 0, kick\n3, 8, 2, snare\n7, 12, 0, closed-hat",
                    "tempo": 110,
                    "swing": 50,
                    "bars": 4
                  }
                },
                "example2": {
                  "summary": "Tresillo E(3,8) on a clap",
                  "value": {
                    "voices": "3, 8, 0, clap",
                    "tempo": 96,
                    "swing": 50,
                    "bars": 2
                  }
                },
                "example3": {
                  "summary": "Five against seven with swing",
                  "value": {
                    "voices": "5, 16, 0, rim\n7, 16, 3, closed-hat\n2, 8, 4, kick",
                    "tempo": 124,
                    "swing": 58,
                    "bars": 8
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TickworkEuclideanRhythmResult"
                }
              }
            }
          },
          "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/tools/tickwork-midi-quantizer/calculate": {
      "post": {
        "operationId": "calculateTickworkMidiQuantizer",
        "summary": "Tighten the timing of a MIDI file to a grid, with strength, swing and a window that keeps the feel.",
        "description": "Moves the notes of a Standard MIDI File toward a 1/4 to 1/32 or triplet grid. Strength below 100 % keeps part of the human feel, swing shifts every off-beat grid line, the window leaves notes far from the grid alone, and note ends can be quantized too. Controllers, pitch bends, programs and every other event are kept. You get the new MIDI file and a before/after timing report.\n\nMethodology:\n- Every note-on is paired with its note-off (same key and channel). Its grid target is the nearest grid line; with swing, every odd grid line sits at the swing share of a grid pair (MPC-style: 50 % = straight, 66 % ≈ triplet).\n- A note is moved only when its distance to the target is within the window (a share of half a grid step); it then moves by strength × distance, rounded to whole ticks. Without “ends”, the length is kept; with it, the end moves toward its own grid line the same way (at least one tick long).\n- All other events — controllers, pitch bends, program changes, SysEx, tempo and text — keep their exact times. The file keeps its resolution and is written with explicit status bytes.\n\nQuantizing changes the feel of a performance; keep the original file.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "tickwork_midi_quantizer",
        "x-owner-app": "tickwork",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TickworkMidiQuantizerInput"
              },
              "examples": {
                "example1": {
                  "summary": "Tighten a loose groove to sixteenths",
                  "value": {
                    "sample": "humanized-groove",
                    "grid": "1/16",
                    "strength": 100,
                    "swing": 50,
                    "window": 100,
                    "ends": false
                  }
                },
                "example2": {
                  "summary": "Half-strength with swing 58 %",
                  "value": {
                    "sample": "humanized-groove",
                    "grid": "1/16",
                    "strength": 50,
                    "swing": 58,
                    "window": 100,
                    "ends": false
                  }
                },
                "example3": {
                  "summary": "Eighth-note triplets, ends included",
                  "value": {
                    "sample": "lofi-song",
                    "grid": "1/8T",
                    "strength": 100,
                    "swing": 50,
                    "window": 100,
                    "ends": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TickworkMidiQuantizerResult"
                }
              }
            }
          },
          "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/workflows": {
      "get": {
        "operationId": "listWorkflows",
        "summary": "Multi-tool workflows",
        "responses": {
          "200": {
            "description": "Workflow list.",
            "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"
                }
              }
            }
          }
        }
      },
      "TickworkMidiInspectorInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "file": {
            "title": "MIDI file (.mid)",
            "description": "Up to 4 MB. Leave empty to inspect a built-in sample. Nothing is stored; the file is read once for this report. Upload as {filename, contentType?, contentBase64}. Max 4096 KiB. Accepts .mid,.midi,.rmi,.smf,audio/midi,audio/x-midi,application/octet-stream.",
            "type": "object",
            "additionalProperties": false,
            "required": [
              "filename",
              "contentBase64"
            ],
            "properties": {
              "filename": {
                "type": "string"
              },
              "contentType": {
                "type": "string"
              },
              "contentBase64": {
                "type": "string"
              }
            }
          },
          "sample": {
            "title": "Sample when no file is uploaded",
            "type": "string",
            "enum": [
              "lofi-song",
              "acid-locks",
              "humanized-groove"
            ],
            "default": "lofi-song"
          }
        },
        "required": []
      },
      "TickworkMidiInspectorResult": {
        "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": [
              "file",
              "sample",
              "format",
              "ppq",
              "smpte",
              "tracks",
              "notes",
              "durationSeconds",
              "durationBeats",
              "bars",
              "tempos",
              "timeSignatures",
              "keySignatures",
              "key",
              "noteLengths",
              "maxPolyphony",
              "pitchClasses",
              "drumHits",
              "trackReports"
            ],
            "properties": {
              "file": {
                "type": "string"
              },
              "sample": {
                "type": "boolean"
              },
              "format": {
                "type": "integer"
              },
              "ppq": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "smpte": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "tracks": {
                "type": "integer"
              },
              "notes": {
                "type": "integer"
              },
              "durationSeconds": {
                "type": "number"
              },
              "durationBeats": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "bars": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "tempos": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "tick",
                    "seconds",
                    "bpm"
                  ],
                  "properties": {
                    "tick": {
                      "type": "integer"
                    },
                    "seconds": {
                      "type": "number"
                    },
                    "bpm": {
                      "type": "number"
                    }
                  }
                }
              },
              "timeSignatures": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "tick",
                    "signature"
                  ],
                  "properties": {
                    "tick": {
                      "type": "integer"
                    },
                    "signature": {
                      "type": "string"
                    }
                  }
                }
              },
              "keySignatures": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "tick",
                    "key"
                  ],
                  "properties": {
                    "tick": {
                      "type": "integer"
                    },
                    "key": {
                      "type": "string"
                    }
                  }
                }
              },
              "key": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": false,
                "required": [
                  "tonic",
                  "mode",
                  "name",
                  "correlation",
                  "runnerUp",
                  "runnerUpCorrelation"
                ],
                "properties": {
                  "tonic": {
                    "type": "integer"
                  },
                  "mode": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "correlation": {
                    "type": "number"
                  },
                  "runnerUp": {
                    "type": "string"
                  },
                  "runnerUpCorrelation": {
                    "type": "number"
                  }
                }
              },
              "noteLengths": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": false,
                "required": [
                  "shortestBeats",
                  "medianBeats",
                  "longestBeats"
                ],
                "properties": {
                  "shortestBeats": {
                    "type": "number"
                  },
                  "medianBeats": {
                    "type": "number"
                  },
                  "longestBeats": {
                    "type": "number"
                  }
                }
              },
              "maxPolyphony": {
                "type": "integer"
              },
              "pitchClasses": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "pitch",
                    "share"
                  ],
                  "properties": {
                    "pitch": {
                      "type": "string"
                    },
                    "share": {
                      "type": "number"
                    }
                  }
                }
              },
              "drumHits": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "key",
                    "name",
                    "hits"
                  ],
                  "properties": {
                    "key": {
                      "type": "integer"
                    },
                    "name": {
                      "type": "string"
                    },
                    "hits": {
                      "type": "integer"
                    }
                  }
                }
              },
              "trackReports": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "track",
                    "name",
                    "instrument",
                    "channels",
                    "programs",
                    "notes",
                    "lowest",
                    "highest",
                    "meanVelocity",
                    "firstSeconds",
                    "lastSeconds",
                    "controllers",
                    "pitchBends",
                    "drums"
                  ],
                  "properties": {
                    "track": {
                      "type": "integer"
                    },
                    "name": {
                      "type": "string"
                    },
                    "instrument": {
                      "type": "string"
                    },
                    "channels": {
                      "type": "array",
                      "items": {
                        "type": "integer"
                      }
                    },
                    "programs": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "notes": {
                      "type": "integer"
                    },
                    "lowest": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "highest": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "meanVelocity": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "firstSeconds": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "lastSeconds": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "controllers": {
                      "type": "integer"
                    },
                    "pitchBends": {
                      "type": "integer"
                    },
                    "drums": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "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"
              }
            }
          }
        }
      },
      "TickworkEuclideanRhythmInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "voices": {
            "title": "Rhythm voices",
            "description": "One voice per line: pulses, steps, rotation (optional), sound (optional: kick, snare, clap, closed-hat, open-hat, low-tom, high-tom, rim or a MIDI key 0–127), velocity (optional). Example: 3, 8, 0, kick",
            "type": "string",
            "maxLength": 600,
            "default": "4, 16, 0, kick\n3, 8, 2, snare\n7, 12, 0, closed-hat"
          },
          "tempo": {
            "title": "Tempo",
            "type": "number",
            "minimum": 20,
            "maximum": 300,
            "default": 110,
            "x-unit": "BPM"
          },
          "swing": {
            "title": "Swing",
            "description": "50 = straight; 54–62 = light to strong shuffle on the off-beat sixteenths.",
            "type": "number",
            "minimum": 50,
            "maximum": 75,
            "default": 50,
            "x-unit": "%"
          },
          "bars": {
            "title": "Bars in the MIDI file",
            "type": "integer",
            "minimum": 1,
            "maximum": 16,
            "default": 4
          }
        },
        "required": []
      },
      "TickworkEuclideanRhythmResult": {
        "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": [
              "voices",
              "tempo",
              "swing",
              "bars",
              "cycleSteps",
              "notes",
              "seconds",
              "midiFile",
              "projectFile"
            ],
            "properties": {
              "voices": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "pulses",
                    "steps",
                    "rotation",
                    "key",
                    "velocity",
                    "pattern",
                    "intervals",
                    "density"
                  ],
                  "properties": {
                    "pulses": {
                      "type": "integer"
                    },
                    "steps": {
                      "type": "integer"
                    },
                    "rotation": {
                      "type": "integer"
                    },
                    "key": {
                      "type": "integer"
                    },
                    "velocity": {
                      "type": "integer"
                    },
                    "pattern": {
                      "type": "string",
                      "description": "x = hit, . = rest (one character per sixteenth)."
                    },
                    "intervals": {
                      "type": "array",
                      "items": {
                        "type": "integer"
                      }
                    },
                    "density": {
                      "type": "number"
                    }
                  }
                }
              },
              "tempo": {
                "type": "number"
              },
              "swing": {
                "type": "number"
              },
              "bars": {
                "type": "integer"
              },
              "cycleSteps": {
                "type": "integer",
                "description": "Sixteenths until every voice starts together again (least common multiple of the lengths)."
              },
              "notes": {
                "type": "integer"
              },
              "seconds": {
                "type": "number"
              },
              "midiFile": {
                "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)."
                  }
                }
              },
              "projectFile": {
                "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"
              }
            }
          }
        }
      },
      "TickworkMidiQuantizerInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "file": {
            "title": "MIDI file (.mid)",
            "description": "Up to 4 MB. Leave empty to quantize a built-in, loosely played sample. Upload as {filename, contentType?, contentBase64}. Max 4096 KiB. Accepts .mid,.midi,.rmi,.smf,audio/midi,audio/x-midi,application/octet-stream.",
            "type": "object",
            "additionalProperties": false,
            "required": [
              "filename",
              "contentBase64"
            ],
            "properties": {
              "filename": {
                "type": "string"
              },
              "contentType": {
                "type": "string"
              },
              "contentBase64": {
                "type": "string"
              }
            }
          },
          "sample": {
            "title": "Sample when no file is uploaded",
            "type": "string",
            "enum": [
              "lofi-song",
              "acid-locks",
              "humanized-groove"
            ],
            "default": "humanized-groove"
          },
          "grid": {
            "title": "Grid",
            "type": "string",
            "enum": [
              "1/4",
              "1/8",
              "1/8T",
              "1/16",
              "1/16T",
              "1/32"
            ],
            "default": "1/16"
          },
          "strength": {
            "title": "Strength",
            "description": "100 % puts notes exactly on the grid; 50 % moves them half way.",
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "default": 100,
            "x-unit": "%"
          },
          "swing": {
            "title": "Swing",
            "description": "Position of every second grid line inside a pair (50 = straight, 66 ≈ triplet feel). Ignored for triplet grids.",
            "type": "number",
            "minimum": 50,
            "maximum": 75,
            "default": 50,
            "x-unit": "%"
          },
          "window": {
            "title": "Window",
            "description": "Only notes within this share of half a grid step are moved; 100 % moves all notes.",
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "default": 100,
            "x-unit": "%"
          },
          "ends": {
            "title": "Quantize note ends too",
            "type": "boolean",
            "default": false
          }
        },
        "required": []
      },
      "TickworkMidiQuantizerResult": {
        "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": [
              "file",
              "sample",
              "grid",
              "strength",
              "swing",
              "window",
              "ends",
              "ppq",
              "gridTicks",
              "notes",
              "moved",
              "meanShiftTicks",
              "maxShiftTicks",
              "deviationBefore",
              "deviationAfter",
              "perTrack",
              "midiFile"
            ],
            "properties": {
              "file": {
                "type": "string"
              },
              "sample": {
                "type": "boolean"
              },
              "grid": {
                "type": "string"
              },
              "strength": {
                "type": "number"
              },
              "swing": {
                "type": "number"
              },
              "window": {
                "type": "number"
              },
              "ends": {
                "type": "boolean"
              },
              "ppq": {
                "type": "integer"
              },
              "gridTicks": {
                "type": "number"
              },
              "notes": {
                "type": "integer"
              },
              "moved": {
                "type": "integer"
              },
              "meanShiftTicks": {
                "type": "number"
              },
              "maxShiftTicks": {
                "type": "number"
              },
              "deviationBefore": {
                "type": "number",
                "description": "Mean distance of note starts from the grid before, in ticks."
              },
              "deviationAfter": {
                "type": "number"
              },
              "perTrack": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "track",
                    "name",
                    "notes",
                    "moved"
                  ],
                  "properties": {
                    "track": {
                      "type": "integer"
                    },
                    "name": {
                      "type": "string"
                    },
                    "notes": {
                      "type": "integer"
                    },
                    "moved": {
                      "type": "integer"
                    }
                  }
                }
              },
              "midiFile": {
                "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"
              }
            }
          }
        }
      }
    }
  }
}