Files
guitar-tabs/guitar-tab.schema.json
2026-07-10 12:44:14 +05:30

346 lines
10 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Guitar Tab Interchange Format",
"description": "A portable, renderer-friendly format for guitar tablature, chord/lyric sheets, repeats, annotations, and beat-level playback anchors.",
"type": "object",
"additionalProperties": false,
"required": ["format", "id", "metadata", "instrument", "arrangements"],
"properties": {
"$schema": { "type": "string" },
"format": { "const": "guitar-tab/v1" },
"id": { "$ref": "#/$defs/id" },
"metadata": { "$ref": "#/$defs/metadata" },
"instrument": { "$ref": "#/$defs/instrument" },
"timing": { "$ref": "#/$defs/timing" },
"legend": {
"type": "array",
"items": { "$ref": "#/$defs/legendItem" },
"default": []
},
"arrangements": {
"type": "array",
"minItems": 1,
"items": { "$ref": "#/$defs/arrangement" }
},
"extensions": { "$ref": "#/$defs/extensions" }
},
"$defs": {
"id": {
"type": "string",
"pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
},
"extensions": {
"type": "object",
"description": "Namespaced vendor data. Keys should use reverse-domain notation.",
"additionalProperties": true,
"default": {}
},
"metadata": {
"type": "object",
"additionalProperties": false,
"required": ["title", "artists"],
"properties": {
"title": { "type": "string", "minLength": 1 },
"artists": {
"type": "array",
"minItems": 1,
"items": { "type": "string", "minLength": 1 }
},
"arranger": { "type": "string" },
"album": { "type": "string" },
"source": {
"type": "object",
"additionalProperties": false,
"properties": {
"label": { "type": "string" },
"file": { "type": "string" },
"url": { "type": "string", "format": "uri" },
"pages": {
"type": "array",
"items": { "type": "integer", "minimum": 1 },
"uniqueItems": true
}
}
},
"links": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": ["label", "url"],
"properties": {
"label": { "type": "string", "minLength": 1 },
"url": { "type": "string", "format": "uri" }
}
}
}
}
},
"instrument": {
"type": "object",
"additionalProperties": false,
"required": ["type", "strings", "tuning", "capo"],
"properties": {
"type": { "const": "guitar" },
"strings": { "type": "integer", "minimum": 1, "maximum": 18 },
"capo": { "type": "integer", "minimum": 0, "maximum": 24 },
"tuningName": { "type": "string" },
"tuning": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"additionalProperties": false,
"required": ["string", "label", "pitch"],
"properties": {
"string": { "type": "integer", "minimum": 1 },
"label": { "type": "string", "minLength": 1, "maxLength": 3 },
"pitch": { "type": "string", "pattern": "^[A-G](?:#|b)?-?[0-9]+$" }
}
}
}
}
},
"timing": {
"type": "object",
"additionalProperties": false,
"properties": {
"tempoBpm": { "type": "number", "exclusiveMinimum": 0, "maximum": 240 },
"timeSignature": {
"type": "object",
"additionalProperties": false,
"required": ["beats", "beatValue"],
"properties": {
"beats": { "type": "integer", "minimum": 1, "maximum": 32 },
"beatValue": { "type": "integer", "enum": [1, 2, 4, 8, 16, 32] }
}
}
}
},
"legendItem": {
"type": "object",
"additionalProperties": false,
"required": ["token", "label"],
"properties": {
"token": { "type": "string", "minLength": 1 },
"label": { "type": "string", "minLength": 1 },
"kind": {
"type": "string",
"enum": ["technique", "stroke", "rhythm", "other"]
}
}
},
"arrangement": {
"type": "object",
"additionalProperties": false,
"required": ["id", "title", "sections"],
"properties": {
"id": { "$ref": "#/$defs/id" },
"title": { "type": "string", "minLength": 1 },
"description": { "type": "string" },
"difficulty": { "type": "string" },
"sections": {
"type": "array",
"minItems": 1,
"items": { "$ref": "#/$defs/section" }
},
"extensions": { "$ref": "#/$defs/extensions" }
}
},
"section": {
"type": "object",
"additionalProperties": false,
"required": ["id", "title", "blocks"],
"properties": {
"id": { "$ref": "#/$defs/id" },
"title": { "type": "string", "minLength": 1 },
"repeat": { "$ref": "#/$defs/repeat" },
"blocks": {
"type": "array",
"minItems": 1,
"items": {
"oneOf": [
{ "$ref": "#/$defs/tabBlock" },
{ "$ref": "#/$defs/chordLyricsBlock" }
]
}
},
"extensions": { "$ref": "#/$defs/extensions" }
}
},
"repeat": {
"type": "object",
"additionalProperties": false,
"required": ["times"],
"properties": {
"times": { "type": "integer", "minimum": 2 }
}
},
"tabBlock": {
"type": "object",
"additionalProperties": false,
"required": ["id", "type", "bars"],
"properties": {
"id": { "$ref": "#/$defs/id" },
"type": { "const": "tab" },
"label": { "type": "string" },
"bars": {
"type": "array",
"minItems": 1,
"items": { "$ref": "#/$defs/bar" }
},
"repeat": { "$ref": "#/$defs/repeat" },
"extensions": { "$ref": "#/$defs/extensions" }
}
},
"bar": {
"type": "object",
"additionalProperties": false,
"required": ["id", "columnCount", "rows"],
"properties": {
"id": { "$ref": "#/$defs/id" },
"columnCount": { "type": "integer", "minimum": 1, "maximum": 4096 },
"beats": { "type": "number", "exclusiveMinimum": 0, "maximum": 32 },
"barline": {
"type": "object",
"additionalProperties": false,
"properties": {
"left": { "$ref": "#/$defs/barline" },
"right": { "$ref": "#/$defs/barline" }
}
},
"rows": {
"type": "array",
"minItems": 1,
"items": { "$ref": "#/$defs/tabRow" }
},
"lyrics": {
"type": "array",
"items": { "$ref": "#/$defs/positionedText" }
},
"chords": {
"type": "array",
"items": { "$ref": "#/$defs/positionedText" }
},
"markers": {
"type": "array",
"items": { "$ref": "#/$defs/marker" }
},
"events": {
"type": "array",
"items": { "$ref": "#/$defs/event" }
},
"notes": { "type": "string" },
"extensions": { "$ref": "#/$defs/extensions" }
}
},
"barline": {
"type": "string",
"enum": ["none", "single", "double", "repeatStart", "repeatEnd", "final"]
},
"tabRow": {
"type": "object",
"additionalProperties": false,
"required": ["string", "text"],
"properties": {
"string": { "type": "integer", "minimum": 1 },
"text": { "type": "string", "minLength": 1 }
}
},
"positionedText": {
"type": "object",
"additionalProperties": false,
"required": ["text"],
"properties": {
"text": { "type": "string", "minLength": 1 },
"atColumn": { "type": "integer", "minimum": 0 }
}
},
"marker": {
"type": "object",
"additionalProperties": false,
"required": ["atColumn", "token"],
"properties": {
"atColumn": { "type": "integer", "minimum": 0 },
"token": { "type": "string", "minLength": 1 },
"label": { "type": "string" }
}
},
"event": {
"type": "object",
"additionalProperties": false,
"required": ["id", "atBeat", "durationBeats", "notes"],
"properties": {
"id": { "$ref": "#/$defs/id" },
"atBeat": { "type": "number", "minimum": 0 },
"durationBeats": { "type": "number", "exclusiveMinimum": 0 },
"notes": {
"type": "array",
"minItems": 1,
"items": { "$ref": "#/$defs/note" }
},
"label": { "type": "string" }
}
},
"note": {
"type": "object",
"additionalProperties": false,
"required": ["string", "from", "to"],
"properties": {
"string": { "type": "integer", "minimum": 1 },
"fret": { "type": "integer", "minimum": 0 },
"muted": { "type": "boolean" },
"from": { "type": "integer", "minimum": 0 },
"to": { "type": "integer", "minimum": 1 },
"techniques": {
"type": "array",
"items": { "type": "string", "minLength": 1 },
"uniqueItems": true
}
},
"anyOf": [
{ "required": ["fret"] },
{ "properties": { "muted": { "const": true } }, "required": ["muted"] }
]
},
"chordLyricsBlock": {
"type": "object",
"additionalProperties": false,
"required": ["id", "type", "lines"],
"properties": {
"id": { "$ref": "#/$defs/id" },
"type": { "const": "chordLyrics" },
"label": { "type": "string" },
"lines": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"additionalProperties": false,
"required": ["id", "spans"],
"properties": {
"id": { "$ref": "#/$defs/id" },
"spans": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"additionalProperties": false,
"required": ["id", "text"],
"properties": {
"id": { "$ref": "#/$defs/id" },
"text": { "type": "string" },
"chord": { "type": "string" }
}
}
}
}
}
},
"repeat": { "$ref": "#/$defs/repeat" },
"extensions": { "$ref": "#/$defs/extensions" }
}
}
}
}