{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/lotsofsounds-com/json-schema/lotsofsounds-com-sound-schema.json",
  "title": "Sound",
  "x-generated": "2026-10-31",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/lotsofsounds-com-openapi.json#/components/schemas/Sound",
  "allOf": [
    {
      "$ref": "#/$defs/SoundSummary"
    },
    {
      "type": "object",
      "properties": {
        "category": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "SFX",
            "MUSIC",
            "LOFI",
            "AMBIENT"
          ],
          "description": "Sound category"
        },
        "license": {
          "type": [
            "string",
            "null"
          ]
        },
        "timing": {
          "type": [
            "object",
            "null"
          ],
          "description": "Where the sound happens in the file, in milliseconds from the start. Use onset_ms and tail_ms as trim points. Null until the sound is analysed.",
          "required": [
            "onset_ms",
            "peak_ms",
            "tail_ms"
          ],
          "properties": {
            "onset_ms": {
              "type": "integer",
              "description": "First audible moment (within 30 dB of the loudest point)"
            },
            "peak_ms": {
              "type": "integer",
              "description": "Loudest moment. Put this on the visual hit."
            },
            "tail_ms": {
              "type": "integer",
              "description": "Last audible moment (within 45 dB of the loudest point)"
            }
          }
        },
        "loudness": {
          "type": [
            "object",
            "null"
          ],
          "description": "EBU R128 loudness. Use it to balance sounds against each other. Null until the sound is analysed.",
          "required": [
            "integrated_lufs",
            "true_peak_db"
          ],
          "properties": {
            "integrated_lufs": {
              "type": "number",
              "description": "Integrated loudness in LUFS"
            },
            "true_peak_db": {
              "type": [
                "number",
                "null"
              ],
              "description": "True peak in dBTP"
            }
          }
        }
      }
    }
  ],
  "$defs": {
    "SoundSummary": {
      "type": "object",
      "required": [
        "id",
        "name",
        "tags",
        "duration",
        "stream_url"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "tags": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "duration": {
          "type": "number",
          "description": "Duration in seconds"
        },
        "stream_url": {
          "type": "string",
          "format": "uri",
          "description": "URL to stream this sound"
        },
        "download_url": {
          "type": "string",
          "format": "uri",
          "description": "URL to download this sound (only present on authenticated endpoints)"
        }
      }
    }
  }
}