Schemas / Audio

rig.audio.analysis

v0.31.0 · draft 5 fields 2 required

Fields

FieldTypeMeaning
source enuminput · asset required input (live capture) or asset
asset entity optional Required when source is asset; an entity carrying rig.media.asset_ref
bandCount int required Number of frequency bands to produce
smoothing number0 – 1 optional Optional. 0-1; 0 = no smoothing between frames
onsetThreshold float optional Optional. Absent disables onset detection

Request for spectral analysis of an audio stream. Format when present.

This describes the analysis to perform, not its results. Band magnitudes and onset flags change every frame and are host state - writing them into a document would make every save differ.

Band layout is deliberately unspecified beyond the count. Linear and logarithmic spacing both occur in the wild and neither is right for every use, so two hosts will agree on the request and may disagree on the bands. Do not build a document that depends on an exact band centre frequency.

To drive a property from a band, use rig.mod.binding.

JSON Schema

Resolves at https://rig.works/schemas/rig.audio.analysis.schema.jsonraw file.

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://rig.works/schemas/rig.audio.analysis.schema.json",
  "title": "rig.audio.analysis",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "source": {
      "type": "string",
      "enum": [
        "input",
        "asset"
      ]
    },
    "asset": {
      "$ref": "./_defs.schema.json#/$defs/entity"
    },
    "bandCount": {
      "$ref": "./_defs.schema.json#/$defs/int"
    },
    "smoothing": {
      "type": "number",
      "minimum": 0,
      "maximum": 1
    },
    "onsetThreshold": {
      "$ref": "./_defs.schema.json#/$defs/float"
    }
  },
  "required": [
    "source",
    "bandCount"
  ]
}