Files
micarrsim/schemas/scene.schema.json
T
2026-08-28 15:48:16 +09:00

107 lines
5.2 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://micarrsim.local/schemas/scene.schema.json",
"title": "micarrsim acoustic scene",
"type": "object",
"additionalProperties": false,
"required": ["schemaVersion", "kind", "id", "name", "units", "sampleRate", "duration", "speedOfSound", "seed", "mix", "sources"],
"properties": {
"schemaVersion": { "const": "1.0.0" }, "kind": { "const": "micarrsim.scene" },
"id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9._-]*$" },
"name": { "type": "string", "minLength": 1, "maxLength": 120 },
"description": { "type": "string", "maxLength": 1000 }, "units": { "const": "m" },
"sampleRate": { "type": "integer", "minimum": 8000, "maximum": 192000 },
"duration": { "type": "number", "exclusiveMinimum": 0, "maximum": 300 },
"speedOfSound": { "type": "number", "minimum": 250, "maximum": 400 },
"seed": { "type": "integer", "minimum": 0, "maximum": 4294967295 },
"mix": {
"type": "object", "additionalProperties": false, "required": ["normalization", "targetPeak"],
"properties": {
"normalization": { "enum": ["none", "peak"] },
"targetPeak": { "type": "number", "exclusiveMinimum": 0, "maximum": 1 }
}
},
"image": { "$ref": "#/$defs/image" },
"assets": { "type": "array", "maxItems": 128, "items": { "$ref": "#/$defs/asset" } },
"sources": { "type": "array", "minItems": 1, "maxItems": 32, "items": { "$ref": "#/$defs/source" } },
"ambient": { "type": "array", "maxItems": 8, "items": { "$ref": "#/$defs/ambient" } }
},
"$defs": {
"position": {
"type": "array", "prefixItems": [{ "type": "number" }, { "type": "number" }, { "type": "number" }],
"items": false, "minItems": 3, "maxItems": 3
},
"trajectoryKeyframe": {
"type": "object", "additionalProperties": false, "required": ["time", "position"],
"properties": {
"time": { "type": "number", "minimum": 0 },
"position": { "$ref": "#/$defs/position" }
}
},
"image": {
"type": "object", "additionalProperties": false,
"required": ["assetId", "widthPixels", "heightPixels", "plane"],
"properties": {
"assetId": { "type": "string", "minLength": 1 },
"widthPixels": { "type": "integer", "minimum": 1, "maximum": 32768 },
"heightPixels": { "type": "integer", "minimum": 1, "maximum": 32768 },
"plane": {
"type": "object", "additionalProperties": false,
"required": ["z", "xMin", "xMax", "yMin", "yMax"],
"properties": {
"z": { "type": "number", "exclusiveMinimum": 0 },
"xMin": { "type": "number" }, "xMax": { "type": "number" },
"yMin": { "type": "number" }, "yMax": { "type": "number" }
}
}
}
},
"asset": {
"type": "object", "additionalProperties": false, "required": ["id", "kind", "fileName", "mimeType"],
"properties": {
"id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9._-]*$" },
"kind": { "enum": ["audio", "image"] }, "fileName": { "type": "string", "minLength": 1, "maxLength": 255 },
"mimeType": { "type": "string", "minLength": 3, "maxLength": 100 },
"sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
}
},
"signal": {
"oneOf": [
{ "type": "object", "additionalProperties": false, "required": ["type", "frequency"], "properties": {
"type": { "const": "tone" }, "frequency": { "type": "number", "exclusiveMinimum": 0 },
"phaseDeg": { "type": "number", "minimum": -360, "maximum": 360 }
}},
{ "type": "object", "additionalProperties": false, "required": ["type", "color"], "properties": {
"type": { "const": "noise" }, "color": { "enum": ["white", "pink"] },
"seedOffset": { "type": "integer", "minimum": 0, "maximum": 4294967295 }
}},
{ "type": "object", "additionalProperties": false, "required": ["type", "assetId"], "properties": {
"type": { "const": "asset" }, "assetId": { "type": "string", "minLength": 1 },
"channel": { "type": "integer", "minimum": 0, "maximum": 255 }, "loop": { "type": "boolean" }
}}
]
},
"source": {
"type": "object", "additionalProperties": false,
"required": ["id", "name", "position", "gainDb", "startTime", "duration", "signal"],
"properties": {
"id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9._-]*$" },
"name": { "type": "string", "minLength": 1, "maxLength": 120 }, "position": { "$ref": "#/$defs/position" },
"trajectory": {
"type": "array", "minItems": 2, "maxItems": 4096,
"items": { "$ref": "#/$defs/trajectoryKeyframe" }
},
"gainDb": { "type": "number", "minimum": -120, "maximum": 24 }, "startTime": { "type": "number", "minimum": 0 },
"duration": { "type": "number", "exclusiveMinimum": 0 }, "signal": { "$ref": "#/$defs/signal" }
}
},
"ambient": {
"type": "object", "additionalProperties": false, "required": ["id", "gainDb", "signal"],
"properties": {
"id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9._-]*$" },
"gainDb": { "type": "number", "minimum": -120, "maximum": 24 }, "signal": { "$ref": "#/$defs/signal" }
}
}
}
}