audio-metrics
Audio Metrics capability — sliding-window aggregates over the pipeline audio inference results.
Audio Metrics capability — sliding-window aggregates over the pipeline audio inference results. Hosted by addon-pipeline-analytics (same addon that owns zone-analytics); the runtime-state slice gives operators a live read on dB level + dominant classes without a custom event subscription.
At a glance
| Capability | audio-metrics |
| Provided by | One addon provides it for every device and answers by device id. |
| Active providers per device | one |
| Device types | camera |
| Source | packages/types/src/capabilities/audio-metrics.cap.ts |
Methods
Every method takes the device id (deviceId) to address the device; the input tables below list the other fields.
| Method | Kind | Required of a provider | Access |
|---|---|---|---|
getCurrentSnapshot | query | yes | default |
getHistory | query | yes | default |
getCurrentSnapshot
query
Latest snapshot for this device. Null until the analytics pipeline has processed at least one audio window.
Input
No fields besides deviceId.
Output
| Field | Type | Required | Description |
|---|---|---|---|
ts | number | yes | |
windowSec | number | yes | |
level | { rms: number; dbfs: number } | yes | |
peakDbfs | number | yes | |
avgDbfs | number | yes | |
current | { className: string; score: number; timestamp: number } | null | yes | |
byClass | ({ className: string; hits: number; avgScore: number; peakScore: number })[] | yes |
getHistory
query
Time-series view of recent audio-metrics samples. The provider keeps an in-memory ring of ~1Hz samples (matching the slice- write rate) capped at MAX_HISTORY_POINTS_KEPT (provider-side). windowSec selects how far back to read; sampleEveryMs downsamples by bucketed averaging when finer than the kept granularity. Empty points array on freshly-booted providers with no audio yet — same convention as getCurrentSnapshot.
Input
| Field | Type | Required | Description |
|---|---|---|---|
windowSec | number | no | History window in seconds. Default 300 (5 minutes). Provider clamps to its retention cap if larger. |
sampleEveryMs | number | no | Target sample interval in ms. Default 1000 (1 sample/second). Provider clamps to natural sample rate if smaller, and bucket-averages when bigger than the requested window would produce more than maxPoints samples. |
Output
Audio-metrics history payload — a series of AudioMetricsHistoryPoint samples capped at maxPoints (default 1024). When the requested windowSec / sampleEveryMs would exceed the cap, the provider subsamples by bucketed averaging and reports the effective sample spacing on effectiveSampleEveryMs so the UI can label the x-axis.
| Field | Type | Required | Description |
|---|---|---|---|
points | ({ ts: number; dbfs: number | null; peakDbfs: number; avgDbfs: number; topClass: string | null; topScore: number | null })[] | yes | |
effectiveSampleEveryMs | number | yes | Actual ms between adjacent samples after any subsampling. |
windowMsActual | number | yes | Wall-clock window covered by points (points[N-1].ts - points[0].ts), or 0 when there's fewer than 2 samples. |
Runtime state
The state Dominevo keeps for each device with this capability, readable without calling the provider.
Reactive runtime-state mirror — live device.state.audioMetrics.value.
| Field | Type | Required | Description |
|---|---|---|---|
ts | number | yes | Wall-clock timestamp (ms) of the most recent audio window. |
windowSec | number | yes | Sliding-window length (seconds) used for aggregation. |
level | { rms: number; dbfs: number } | yes | Latest level reading from the most recent window. |
peakDbfs | number | yes | Peak dBFS observed across the rolling window. |
avgDbfs | number | yes | Mean dBFS across the rolling window. |
current | { className: string; score: number; timestamp: number } | null | yes | Most recent above-threshold classification, or null on silence. |
byClass | ({ className: string; hits: number; avgScore: number; peakScore: number })[] | yes | Per-class summary across the rolling window — keys are macroClass strings (e.g. dog_bark, speech, glass_break). |