{ "$schema":                      "https://json-schema.org/draft/2020-12/schema",
  "$id":                          "https://schemas.mpai.community/TFA/V1.5/data/AudioQualifier.json",
  "title":                        "Audio Qualifier V1.5",
                                  "description": "Specifies audio Sub-Type, encoding Formats, Attributes, plus Trace and DescrMetadata.",
                                  "type": "object", "additionalProperties": false, 
                                  "required": ["Header", "AudioQualifierID", "SubType", "Format"], "properties": {

    "Header":                     { "type": "string", "pattern": "^TFA-AUQ-V[0-9]{1,2}[.][0-9]{1,2}$" },

    "AudioQualifierID":           { "type": "string" },

    "SubType":                    { "type": "string", "enum": ["Speech", "Music", "SoundEffects", "Noise", "Mixed"] },

    "Format":                    { "type": "object", "additionalProperties": false, "properties": {

      "ContentFormat":            { "type": "object", "additionalProperties": false, "properties": {

        "RawData":                { "type": "object", "additionalProperties": false, "properties": {
          "SampleSpace":          { "$ref": "https://schemas.mpai.community/TFA/V1.5/formats/PCM.json" },

          "TransformSpace":       { "type": "object", "additionalProperties": false, "properties": {
            "Sequence":           { "type": "string", "enum": ["Sequential", "Interleaved"] },
            "Precision":          { "type": "string", "enum": ["float32", "float64"] } } },

          "SphericalHarmonicDecomposition": { "type": "object", "additionalProperties": false, "properties": {
            "SHDOrder":           { "type": "string", 
                                    "enum": ["1stOrder","2ndOrder","3rdOrder","4thOrder","5thOrder","6thOrder","7thOrder"] },
            "Precision":          { "type": "string", "enum": ["float32", "float64"] } } },

          "Ambisonics":           { "type": "object", "additionalProperties": false, "properties": {
            "Normalisation":      { "type": "string", "enum": ["maxN","SN3D","N3D","N2D","SN2D"] },
            "ChannelOrder":       { "type": "string", "enum": ["FuMa","SID","ACN"] },
            "Order":              { "type": "string", 
                                    "enum": ["1stOrder","2ndOrder","3rdOrder","4thOrder","5thOrder","6thOrder","7thOrder"] },
            "Precision":          { "type": "string", "enum": ["float32","float64"] } } } } },

      "OtherContentFormats":      { "$ref": "https://schemas.mpai.community/TFA/V1.5/formats/AudioContentFormats.json" } } },

      
      "TransportFormat":          { "type": "object", "additionalProperties": false, "properties": {
        "FileFormats":            { "$ref": "https://schemas.mpai.community/TFA/V1.5/formats/AudioFileFormats.json" },
        "StreamFormats":          { "$ref": "https://schemas.mpai.community/TFA/V1.5/formats/AudioStreamFormats.json" } } } } },

    "Attributes":                 { "type": "object", "additionalProperties": false, "properties": {

      "Source":                   { "type": "object", "additionalProperties": false, "oneOf": [ 
                                    { "required": ["Vocal"], "properties": { "Vocal": { "type": "string", "enum": ["Real", "Synthetic"] } } },
                                    { "required": ["Music"], "properties": { "Music": { "type": "string", "enum": ["Real", "Synthetic"] } } },
                                    { "required": ["SoundEffects"], "properties": { "SoundEffects": { "type": "string", "enum": ["Real", "Synthetic"] } } },
                                    { "required": ["Noise"], "properties": { "Noise": { "type": "string", "enum": ["Real", "Synthetic"] } } } ] },

      "Metadata":                 { "type": "object", "additionalProperties": false, "properties": {

        "MetadataFormat":         { "$ref": "https://schemas.mpai.community/TFA/V1.5/formats/AudioMetadataFormats.json" },
        "ObjectID":               { "$ref": "https://schemas.mpai.community/OSD/V1.5/data/InstanceIdentifier.json" } } },

      "SpatialAttributes":        { "type": "object", "additionalProperties": false, "properties": {

        "BinauralCues":           { "type": "object", "additionalProperties": false, "properties": {

          "InterauralLevelDifference":{ "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": {
            "Frequency":          { "type": "number" },
            "LevelDifference":    { "type": "number" } } } },

          "InterauralTimeDelay":  { "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": {
            "Frequency":          { "type": "number" },
            "TimeDelay":          { "type": "number" } } } },

          "InterauralPhaseDifference":{ "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": {
            "Frequency":          { "type": "number" },
            "PhaseDifference":    { "type": "number" } } } } } },

        "SpectralCues":           { "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": {
            "Frequency":          { "type": "number" },
            "RSLeftEar":          { "type": "number" },
            "ISLeftEar":          { "type": "number" },
            "RSRightEar":         { "type": "number" },
            "ISRightEar":         { "type": "number" } } } },

        "InterchannelDifferences":{ "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": {
          "ChannelID":            { "type": "string" },
          "InterchannelLevelDifference":  { "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": {
            "Frequency":                  { "type": "number" },
            "InterChannelTimeDifference": { "type": "number" } } } } } } } } },

      "Device":                   { "type": "object", "additionalProperties": false, "properties": {
        "DeviceID":               { "type": "string" },
        "MicrophoneArrayGeometry":{ "$ref": "https://schemas.mpai.community/CAE1/V2.4/data/MicrophoneArrayGeometry.json" },
        "DeviceGeometry":         { "$ref": "https://schemas.mpai.community/OSD/V1.5/data/DeviceSceneGeometry.json" },
        "MicrophoneDirectivityFormat":{ "$ref": "https://schemas.mpai.community/TFA/V1.5/formats/MicrophoneDirectivityFormats.json" } } } 
                                    } },

    "DataExchangeMetadata":       {"$ref": "https://schemas.mpai.community/AIF/V3.0/data/DataExchangeMetadata.json" },
    "Trace":                     { "$ref": "https://schemas.mpai.community/AIF/V3.0/data/Trace.json" },
    "DescrMetadata":             { "type": "string", "maxLength": 2048 } } }