169 lines
7.8 KiB
JSON
169 lines
7.8 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 }
|
|
}
|
|
},
|
|
"acoustics": { "$ref": "#/$defs/acoustics" },
|
|
"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" }
|
|
}
|
|
},
|
|
"wallLevels": {
|
|
"type": "object", "additionalProperties": false,
|
|
"properties": {
|
|
"xMin": { "type": "number", "minimum": -60, "maximum": 0 },
|
|
"xMax": { "type": "number", "minimum": -60, "maximum": 0 },
|
|
"yMin": { "type": "number", "minimum": -60, "maximum": 0 },
|
|
"yMax": { "type": "number", "minimum": -60, "maximum": 0 },
|
|
"zMin": { "type": "number", "minimum": -60, "maximum": 0 },
|
|
"zMax": { "type": "number", "minimum": -60, "maximum": 0 }
|
|
}
|
|
},
|
|
"room": {
|
|
"type": "object", "additionalProperties": false, "required": ["min", "max"],
|
|
"properties": {
|
|
"min": { "$ref": "#/$defs/position" },
|
|
"max": { "$ref": "#/$defs/position" }
|
|
}
|
|
},
|
|
"reflections": {
|
|
"type": "object", "additionalProperties": false,
|
|
"required": ["order", "wallGainDb", "scattering"],
|
|
"properties": {
|
|
"order": { "enum": [0, 1] },
|
|
"wallGainDb": { "type": "number", "minimum": -60, "maximum": 0 },
|
|
"perWallDb": { "$ref": "#/$defs/wallLevels" },
|
|
"scattering": { "type": "number", "minimum": 0, "maximum": 1 }
|
|
}
|
|
},
|
|
"diffuseReverb": {
|
|
"type": "object", "additionalProperties": false,
|
|
"required": ["enabled", "rt60Seconds", "gainDb", "tapCount"],
|
|
"properties": {
|
|
"enabled": { "type": "boolean" },
|
|
"rt60Seconds": { "type": "number", "minimum": 0.05, "maximum": 5 },
|
|
"gainDb": { "type": "number", "minimum": -60, "maximum": 0 },
|
|
"tapCount": { "type": "integer", "minimum": 1, "maximum": 32 }
|
|
}
|
|
},
|
|
"occluder": {
|
|
"type": "object", "additionalProperties": false,
|
|
"required": ["id", "min", "max", "transmissionDb", "diffractionGainDb"],
|
|
"properties": {
|
|
"id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9._-]*$" },
|
|
"min": { "$ref": "#/$defs/position" },
|
|
"max": { "$ref": "#/$defs/position" },
|
|
"transmissionDb": { "type": "number", "minimum": -120, "maximum": 0 },
|
|
"diffractionGainDb": { "type": "number", "minimum": -120, "maximum": 0 }
|
|
}
|
|
},
|
|
"acoustics": {
|
|
"type": "object", "additionalProperties": false, "required": ["model"],
|
|
"properties": {
|
|
"model": { "enum": ["free-field", "shoebox"] },
|
|
"room": { "$ref": "#/$defs/room" },
|
|
"reflections": { "$ref": "#/$defs/reflections" },
|
|
"diffuseReverb": { "$ref": "#/$defs/diffuseReverb" },
|
|
"occluders": {
|
|
"type": "array", "maxItems": 8, "items": { "$ref": "#/$defs/occluder" }
|
|
}
|
|
}
|
|
},
|
|
"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" }
|
|
}
|
|
}
|
|
}
|
|
}
|