{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/lotsofsounds-com/json-schema/lotsofsounds-com-popular-sound-schema.json",
  "title": "PopularSound",
  "x-generated": "2026-10-31",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/lotsofsounds-com-openapi.json#/components/schemas/PopularSound",
  "allOf": [
    {
      "$ref": "#/$defs/Sound"
    },
    {
      "type": "object",
      "required": [
        "numDownloads"
      ],
      "properties": {
        "numDownloads": {
          "type": "integer",
          "minimum": 0,
          "description": "All-time downloads used to rank popular sounds"
        }
      }
    }
  ],
  "$defs": {
    "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"
                }
              }
            }
          }
        }
      ]
    },
    "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)"
        }
      }
    }
  }
}