{ "$schema":                  "https://json-schema.org/draft/2020-12/schema",
  "$id":                      "https://schemas.mpai.community/CAE3/V1.0/data/AcousticProfile.json",
  "title":                    "Acoustic Profile V1.0",
  "description":              "The acoustics of an Object or of a Scene. An Object's: its frequency range, spectrogram, loudness and directional patterns (#/$defs/Object). A Scene's: its reflectivity, reverberation, diffusion, absorption and Doppler effect (#/$defs/Scene). A Data Type refers to the one it has.",
  "anyOf":                    [ { "$ref": "#/$defs/Object" }, { "$ref": "#/$defs/Scene" } ],

  "$defs":                    {

    "Object":                 { "type": "object", "required": ["Header", "AcousticProfileID", "FrequencyRange", "Loudness"], "additionalProperties": false,
                                "description": "The acoustics of an Object: what it sounds like, and how it radiates.", "properties": {

      "Header":               { "type": "string", "const": "CAE-ACP-V1.0" },
      "MInstanceID":          { "type": "string" },
      "UEnvironmentID":       { "type": "string" },
      "AcousticProfileID":    { "type": "string", "description": "Unique identifier for this AcousticProfile" },
      "AcousticProfileTime":  { "$ref": "https://schemas.mpai.community/OSD/V1.5/data/SimpleTime.json" },

      "FrequencyRange":       { "type": "object", "required": ["MinFrequencyHz", "MaxFrequencyHz"], "additionalProperties": false, "description": "Nominal frequency bounds of the audio object in Hz", "properties": {
        "MinFrequencyHz":     { "type": "number", "minimum": 0 },
        "MaxFrequencyHz":     { "type": "number", "minimum": 0 } } },

      "Spectrogram":          { "$ref": "https://schemas.mpai.community/OSD/V1.5/data/Plot.json" },

      "Loudness":             { "type": "number", "description": "Perceptual loudness (e.g., LUFS in dB)" },

      "DirectionalPatterns":  { "$ref": "https://schemas.mpai.community/OSD/V1.5/data/Plot.json", "description": "How the Object radiates by direction, relative to the orientation of its Space-Time: gain in dB by azimuth and elevation (a 2D Plot), or by azimuth, elevation and frequency band (a 3D Plot). As DirectionalPatterns of the Audio Source. Absent, the Object radiates alike in every direction." },

      "DataXMData":           { "$ref": "https://schemas.mpai.community/PTF/V1.0/data/DataExchangeMetadata.json" },
      "DescrMetadata":        { "type": "string", "maxLength": 2048 } } },

    "Scene":                  { "type": "object", "required": ["Header", "AcousticProfileID"], "additionalProperties": false,
                                "description": "The acoustics of a Scene: what happens to the sound of its Objects on the way to the listener.", "properties": {

      "Header":               { "type": "string", "const": "CAE-ACP-V1.0" },
      "MInstanceID":          { "type": "string" },
      "UEnvironmentID":       { "type": "string" },
      "AcousticProfileID":    { "type": "string", "description": "Unique identifier for this AcousticProfile" },
      "AcousticProfileTime":  { "$ref": "https://schemas.mpai.community/OSD/V1.5/data/SimpleTime.json" },

      "Reflectivity":         { "type": "array", "items": { "type": "object", "required": ["EarlyReflectionTime", "LateReflectionTime"], "additionalProperties": false, "properties": {
        "EarlyReflectionTime":{ "type": "number", "minimum": 0 },
        "LateReflectionTime": { "type": "number", "minimum": 0 } } } },

      "Reverberation":        { "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": {
        "RT60":               { "$ref": "https://schemas.mpai.community/OSD/V1.5/data/Plot.json" },
        "RT30":               { "$ref": "https://schemas.mpai.community/OSD/V1.5/data/Plot.json" },
        "RT20":               { "$ref": "https://schemas.mpai.community/OSD/V1.5/data/Plot.json" },
        "EDT":                { "type": "number", "minimum": 0 } } } },

      "Diffusion":            { "type": "number", "minimum": 0 },

      "Absorption":           { "type": "number", "minimum": 0 },

      "Doppler":              { "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": {
        "DirectSoundFactor":  { "type": "number", "minimum": 0, "maximum": 1 },
        "IndirectSound":      { "type": "number", "minimum": 0 } } } },

      "DataXMData":           { "$ref": "https://schemas.mpai.community/PTF/V1.0/data/DataExchangeMetadata.json" },
      "DescrMetadata":        { "type": "string", "maxLength": 2048 } } } } }
