@camstack/types 1.2.177 → 1.2.179
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/addon.js +12 -6
- package/dist/addon.mjs +12 -6
- package/dist/audio/audio-chunk-format.d.ts +73 -0
- package/dist/audio/audio-scale-epoch.d.ts +117 -0
- package/dist/capabilities/audio-analyzer.cap.d.ts +62 -1
- package/dist/capabilities/index.d.ts +2 -2
- package/dist/capabilities/notification-rules.cap.d.ts +6 -0
- package/dist/capabilities/schemas/streaming-shared.d.ts +15 -0
- package/dist/capabilities/stream-broker.cap.d.ts +21 -11
- package/dist/encode-profile.d.ts +4 -4
- package/dist/generated/addon-api.d.ts +14 -0
- package/dist/generated/cap-input-defaults.d.ts +1 -1
- package/dist/generated/device-proxy.d.ts +2 -0
- package/dist/generated/method-access-map.d.ts +1 -1
- package/dist/generated/method-device-selectors.d.ts +2 -2
- package/dist/generated/system-proxy.d.ts +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +290 -8
- package/dist/index.mjs +277 -9
- package/dist/interfaces/audio-analyzer.d.ts +28 -0
- package/dist/interfaces/event-bus.d.ts +7 -3
- package/dist/interfaces/recording-config.d.ts +24 -0
- package/dist/interfaces/stream-broker.d.ts +13 -0
- package/dist/notification/audio-condition.d.ts +49 -35
- package/dist/{sleep-CTHjJilA.js → sleep-B1ZwxAhh.js} +169 -2
- package/dist/{sleep-ox21Ig4I.mjs → sleep-BnujYGPe.mjs} +140 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from './audio/audio-chunk-format.js';
|
|
1
2
|
export type { CapabilitiesAccess } from './addon/base-addon.js';
|
|
2
3
|
export { BaseAddon, normalizeAddonInitResult } from './addon/base-addon.js';
|
|
3
4
|
export type { AddonRouteInvokeRequest, AddonRouteReplyEnvelope, } from './addon/build-addon-route-provider.js';
|
|
@@ -28,7 +29,7 @@ export type * from './interfaces/analysis.js';
|
|
|
28
29
|
export * from './interfaces/analysis-persistence.js';
|
|
29
30
|
export type * from './interfaces/api-responses.js';
|
|
30
31
|
export type * from './interfaces/api-shared.js';
|
|
31
|
-
export type { AudioClassificationResult, IAudioAnalyzer } from './interfaces/audio-analyzer.js';
|
|
32
|
+
export type { AudioAttachDeviceInput, AudioAttachDeviceResult, AudioClassificationResult, AudioDetachDeviceResult, IAudioAnalyzer, } from './interfaces/audio-analyzer.js';
|
|
32
33
|
export type * from './interfaces/audio-inference-engine.js';
|
|
33
34
|
export type * from './interfaces/auth.js';
|
|
34
35
|
export type * from './interfaces/camera-pipeline.js';
|
|
@@ -209,6 +210,7 @@ export type { AudioCodecInfo, AudioDecodeSessionConfig, AudioEncodedChunk, Audio
|
|
|
209
210
|
export type { StreamQuality } from './interfaces/device-capabilities/camera.js';
|
|
210
211
|
export { STREAM_QUALITY_LABELS, streamQualityLabel, } from './interfaces/device-capabilities/camera.js';
|
|
211
212
|
export * from './lifecycle/index.js';
|
|
213
|
+
export { AUDIO_SCALE_EPOCH_ISO, AUDIO_SCALE_EPOCH_MS, type AudioScaleEra, audioScaleEraOf, G711_SCALE_CORRECTION_DB, type G711Law, ituDbfsFromPreEpoch, } from './audio/audio-scale-epoch.js';
|
|
212
214
|
export { audioIsFailClosed, audioKindId, audioLabelChoices, audioModeOf, audioOrDefaults, isAudioLabelSelected, NC_AUDIO_CONFIRM_HITS_DEFAULT, NC_AUDIO_CONFIRM_HITS_MAX, NC_AUDIO_CONFIRM_HITS_MIN, NC_AUDIO_CONFIRM_WINDOW_MAX_SEC, NC_AUDIO_CONFIRM_WINDOW_MIN_SEC, NC_AUDIO_CONFIRM_WINDOW_SEC_DEFAULT, NC_AUDIO_DB_MAX, NC_AUDIO_DB_MIN, NC_AUDIO_DB_OFFERED, NC_AUDIO_DB_STEP, NC_AUDIO_DEFAULTS, NC_AUDIO_HIT_PERCENT_MAX, NC_AUDIO_HIT_PERCENT_MIN, NC_AUDIO_SAMPLING_MAX_SEC, NC_AUDIO_SAMPLING_MIN_SEC, type NcAudioLabelChoice, type NcAudioMode, type NcAudioPatch, normalizeAudioLabel, patchAudio, toggleAudioLabel, } from './notification/audio-condition.js';
|
|
213
215
|
export { isBaseConditionKey, knownValues, NC_BASE_CONDITION_KEYS, type NcBaseConditionKey, pickerForCondition, type TaxonomyGroup, type TaxonomyOption, type TaxonomyPicker, } from './notification/condition-taxonomy.js';
|
|
214
216
|
export { type PreparedAction, type PreparedAttachment, type PreparedNotification, prepareNotification, type ResolvedLevel, } from './notification/degrade-engine.js';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_sleep = require("./sleep-B1ZwxAhh.js");
|
|
2
3
|
const require_event_category = require("./event-category-BNJ9EE5B.js");
|
|
3
|
-
const require_sleep = require("./sleep-CTHjJilA.js");
|
|
4
4
|
const require_canonical_hash = require("./canonical-hash-DNV8S5ET.js");
|
|
5
5
|
const require_enums = require("./enums.js");
|
|
6
6
|
const require_err_msg = require("./err-msg-COpsHMw2.js");
|
|
@@ -1954,6 +1954,30 @@ var noDuplicates = (values) => new Set(values).size === values.length;
|
|
|
1954
1954
|
* sensori su UNA camera è già oltre qualunque installazione osservata.
|
|
1955
1955
|
*/
|
|
1956
1956
|
var MAX_SENSOR_TRIGGER_DEVICES = 16;
|
|
1957
|
+
/**
|
|
1958
|
+
* What the bands editor OFFERS when an operator first ticks "audio above
|
|
1959
|
+
* threshold" on a band. Not a schema default: an absent `audioThresholdDbfs`
|
|
1960
|
+
* means the audio source is not listened to at all, and it stays absent until
|
|
1961
|
+
* asked for.
|
|
1962
|
+
*
|
|
1963
|
+
* It lived as a bare `-30` inline in `RecordingBandsEditor.tsx`, which is how
|
|
1964
|
+
* a calibration hides: unnamed, unexplained, and invisible to any guard. D460
|
|
1965
|
+
* gave it a name so the claim below can be read and disagreed with.
|
|
1966
|
+
*
|
|
1967
|
+
* **Not shifted at the D459 epoch.** `-30 dBFS is loud enough to be worth
|
|
1968
|
+
* recording` is a statement about the scale, not a number anybody read off the
|
|
1969
|
+
* pre-epoch decoder — there is no recorded measurement behind it, and absent
|
|
1970
|
+
* evidence of measurement the provenance test says a scale statement stays put
|
|
1971
|
+
* (the reasoning is D460's, and the same answer `SILENCE_FLOOR_DBFS` gets).
|
|
1972
|
+
*
|
|
1973
|
+
* As with `audioMarkerMinDbfs`, the epoch makes this seed START working rather
|
|
1974
|
+
* than become too permissive: on the old scale a PCMU camera had to reach a
|
|
1975
|
+
* true -18 dBFS to read -30, so the trigger was nearly dead on 19 of 25
|
|
1976
|
+
* cameras. A band seeded with it now fires roughly as the editor implies.
|
|
1977
|
+
*
|
|
1978
|
+
* @dbfs-era itu
|
|
1979
|
+
*/
|
|
1980
|
+
var RECORDING_AUDIO_TRIGGER_OFFERED_DBFS = -30;
|
|
1957
1981
|
/** Which detectors trigger an `events`-mode band. */
|
|
1958
1982
|
var RecordingTriggersSchema = zod.z.object({
|
|
1959
1983
|
motion: zod.z.boolean().optional(),
|
|
@@ -6993,6 +7017,51 @@ var AudioAnalysisSettingsSchema = zod.z.object({
|
|
|
6993
7017
|
minConfidence: zod.z.number().min(0).max(1).default(.3),
|
|
6994
7018
|
allowedClasses: zod.z.array(zod.z.string()).default([])
|
|
6995
7019
|
});
|
|
7020
|
+
/**
|
|
7021
|
+
* `attachDevice` — the analyzer PULLS a camera's audio from the broker (D461).
|
|
7022
|
+
*
|
|
7023
|
+
* Until D461 the orchestrator drained the broker's chunk plane, accumulated
|
|
7024
|
+
* ~1 s windows and pushed them back out as `analyseChunk`. It neither produced
|
|
7025
|
+
* nor consumed the audio: the PCM crossed hub-main twice for a process that
|
|
7026
|
+
* only buffered it. `attachDevice` inverts the direction — the analyzer opens
|
|
7027
|
+
* its own `subscribeAudioChunks` against the broker and the subscriber IS the
|
|
7028
|
+
* decoder, so the coded G.711 bytes D455 put on the plane stay coded all the
|
|
7029
|
+
* way to the one expansion that feeds the model.
|
|
7030
|
+
*
|
|
7031
|
+
* The orchestrator still owns the POLICY (the `audioMode` gate, the on-motion
|
|
7032
|
+
* window, the per-device node assignment, the settings read) and therefore
|
|
7033
|
+
* still owns the attach/detach pair. It no longer owns the bytes.
|
|
7034
|
+
*/
|
|
7035
|
+
var AudioAttachDeviceInputSchema = zod.z.object({
|
|
7036
|
+
deviceId: zod.z.number(),
|
|
7037
|
+
/** Broker id (`<deviceId>/<camStreamId>`) carrying this camera's audio. */
|
|
7038
|
+
brokerId: zod.z.string(),
|
|
7039
|
+
/**
|
|
7040
|
+
* `clusterRoles.ingestNode` — the node whose broker owns the source dial.
|
|
7041
|
+
* Every `streamBroker` call the attachment makes is pinned to it, exactly as
|
|
7042
|
+
* the orchestrator's poller pinned them before the move.
|
|
7043
|
+
*/
|
|
7044
|
+
ingestNodeId: zod.z.string(),
|
|
7045
|
+
/**
|
|
7046
|
+
* Resolved once by the orchestrator at attach time, exactly as it was read
|
|
7047
|
+
* once per subscription before D461. The analyzer does NOT re-resolve per
|
|
7048
|
+
* window: a settings change re-attaches, which is what always happened.
|
|
7049
|
+
*/
|
|
7050
|
+
settings: AudioAnalysisSettingsSchema
|
|
7051
|
+
});
|
|
7052
|
+
var AudioAttachDeviceResultSchema = zod.z.object({
|
|
7053
|
+
/** False only when the analyzer is shutting down and refused to attach. */
|
|
7054
|
+
attached: zod.z.boolean(),
|
|
7055
|
+
/**
|
|
7056
|
+
* True when the attachment replaced a live one for the same device. An
|
|
7057
|
+
* attach is idempotent by REPLACEMENT — two pollers on one camera would
|
|
7058
|
+
* double the broker's fanout and neither would know about the other.
|
|
7059
|
+
*/
|
|
7060
|
+
replaced: zod.z.boolean()
|
|
7061
|
+
});
|
|
7062
|
+
var AudioDetachDeviceResultSchema = zod.z.object({
|
|
7063
|
+
/** False when no attachment existed — detach is idempotent. */
|
|
7064
|
+
detached: zod.z.boolean() });
|
|
6996
7065
|
var AudioClassificationResultSchema = zod.z.object({
|
|
6997
7066
|
labels: zod.z.array(AudioClassificationLabelSchema).readonly(),
|
|
6998
7067
|
rawLabels: zod.z.array(AudioClassificationLabelSchema).readonly().optional(),
|
|
@@ -7041,6 +7110,21 @@ var audioAnalyzerCapability = {
|
|
|
7041
7110
|
settings: AudioAnalysisSettingsSchema
|
|
7042
7111
|
}), AudioAnalysisResultSchema.nullable(), { kind: "mutation" }),
|
|
7043
7112
|
classify: require_sleep.method(AudioChunkInputSchema, AudioClassificationResultSchema, { timeoutMs: 3e4 }),
|
|
7113
|
+
/**
|
|
7114
|
+
* Start pulling this camera's audio from the broker, in THIS process.
|
|
7115
|
+
* Returns as soon as the attachment exists — the first
|
|
7116
|
+
* `subscribeAudioChunks` retries with backoff behind it, because the
|
|
7117
|
+
* broker for a camStream may not be registered yet (that tolerance moved
|
|
7118
|
+
* with the poller, D461). Replaces any live attachment for the device.
|
|
7119
|
+
*/
|
|
7120
|
+
attachDevice: require_sleep.method(AudioAttachDeviceInputSchema, AudioAttachDeviceResultSchema, { kind: "mutation" }),
|
|
7121
|
+
/**
|
|
7122
|
+
* Stop pulling this camera's audio and release the broker subscription.
|
|
7123
|
+
* Idempotent. A detach that never arrives is the one failure mode this
|
|
7124
|
+
* split adds, which is why `AudioChunkPlane` reaps a subscription nobody
|
|
7125
|
+
* drains rather than trusting it (D461).
|
|
7126
|
+
*/
|
|
7127
|
+
detachDevice: require_sleep.method(zod.z.object({ deviceId: zod.z.number() }), AudioDetachDeviceResultSchema, { kind: "mutation" }),
|
|
7044
7128
|
isReady: require_sleep.method(zod.z.void(), zod.z.boolean()),
|
|
7045
7129
|
dispose: require_sleep.method(zod.z.void(), zod.z.void(), { kind: "mutation" }),
|
|
7046
7130
|
/**
|
|
@@ -15751,6 +15835,12 @@ var NcOccupancyConditionSchema = zod.z.object({
|
|
|
15751
15835
|
* number. An operator (or a UI) that writes `60` meaning "60 decibels, quite
|
|
15752
15836
|
* loud" would author a threshold NO sample can ever reach, and the rule would
|
|
15753
15837
|
* look broken rather than mis-configured. The schema range rejects it instead.
|
|
15838
|
+
*
|
|
15839
|
+
* Untouched by the D459 scale correction, and structurally so: -96 dBFS is
|
|
15840
|
+
* where 16-bit digital silence sits on ANY decoder, right or wrong. It
|
|
15841
|
+
* describes the container, not a calibration made through one.
|
|
15842
|
+
*
|
|
15843
|
+
* @dbfs-era scale-bound
|
|
15754
15844
|
*/
|
|
15755
15845
|
var NC_AUDIO_DBFS_FLOOR = -96;
|
|
15756
15846
|
/**
|
|
@@ -28480,8 +28570,8 @@ includeCrops: zod.z.boolean().optional() }).optional(), zod.z.array(IdentitySche
|
|
|
28480
28570
|
*
|
|
28481
28571
|
* An **empty array reads NOTHING** — `[]` is an empty page, never
|
|
28482
28572
|
* "every camera". A request for no devices is a request, not an
|
|
28483
|
-
* omission; same contract as `deviceManager.
|
|
28484
|
-
* `pipelineAnalytics.listRecentTracks`.
|
|
28573
|
+
* omission; same contract as `deviceManager.listAll`'s `deviceIds`
|
|
28574
|
+
* and `pipelineAnalytics.listRecentTracks`.
|
|
28485
28575
|
*
|
|
28486
28576
|
* Absent (`undefined`) is the omission, and keeps the cluster-wide view.
|
|
28487
28577
|
*/
|
|
@@ -42285,12 +42375,24 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
42285
42375
|
addonId: null,
|
|
42286
42376
|
access: "create"
|
|
42287
42377
|
},
|
|
42378
|
+
"audioAnalyzer.attachDevice": {
|
|
42379
|
+
capName: "audio-analyzer",
|
|
42380
|
+
capScope: "system",
|
|
42381
|
+
addonId: null,
|
|
42382
|
+
access: "create"
|
|
42383
|
+
},
|
|
42288
42384
|
"audioAnalyzer.classify": {
|
|
42289
42385
|
capName: "audio-analyzer",
|
|
42290
42386
|
capScope: "system",
|
|
42291
42387
|
addonId: null,
|
|
42292
42388
|
access: "view"
|
|
42293
42389
|
},
|
|
42390
|
+
"audioAnalyzer.detachDevice": {
|
|
42391
|
+
capName: "audio-analyzer",
|
|
42392
|
+
capScope: "system",
|
|
42393
|
+
addonId: null,
|
|
42394
|
+
access: "create"
|
|
42395
|
+
},
|
|
42294
42396
|
"audioAnalyzer.dispose": {
|
|
42295
42397
|
capName: "audio-analyzer",
|
|
42296
42398
|
capScope: "system",
|
|
@@ -48403,11 +48505,21 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
|
|
|
48403
48505
|
form: "single",
|
|
48404
48506
|
optional: false
|
|
48405
48507
|
}],
|
|
48508
|
+
"audioAnalyzer.attachDevice": [{
|
|
48509
|
+
name: "deviceId",
|
|
48510
|
+
form: "single",
|
|
48511
|
+
optional: false
|
|
48512
|
+
}],
|
|
48406
48513
|
"audioAnalyzer.classify": [{
|
|
48407
48514
|
name: "deviceId",
|
|
48408
48515
|
form: "single",
|
|
48409
48516
|
optional: true
|
|
48410
48517
|
}],
|
|
48518
|
+
"audioAnalyzer.detachDevice": [{
|
|
48519
|
+
name: "deviceId",
|
|
48520
|
+
form: "single",
|
|
48521
|
+
optional: false
|
|
48522
|
+
}],
|
|
48411
48523
|
"audioMetrics.getCurrentSnapshot": [{
|
|
48412
48524
|
name: "deviceId",
|
|
48413
48525
|
form: "single",
|
|
@@ -50255,7 +50367,9 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
|
|
|
50255
50367
|
var SYSTEM_SCOPE_DEVICE_METHODS = [
|
|
50256
50368
|
"addonSettings.getDeviceSettings",
|
|
50257
50369
|
"addonSettings.updateDeviceSettings",
|
|
50370
|
+
"audioAnalyzer.attachDevice",
|
|
50258
50371
|
"audioAnalyzer.classify",
|
|
50372
|
+
"audioAnalyzer.detachDevice",
|
|
50259
50373
|
"decoder.createSession",
|
|
50260
50374
|
"deviceAdoption.release",
|
|
50261
50375
|
"deviceAdoption.resync",
|
|
@@ -50917,6 +51031,7 @@ function createSystemProxy(api) {
|
|
|
50917
51031
|
audioAnalyzer: {
|
|
50918
51032
|
analyseChunk: (input) => dispatch("audioAnalyzer", "analyseChunk", "mutation", input),
|
|
50919
51033
|
classify: (input) => dispatch("audioAnalyzer", "classify", "query", input),
|
|
51034
|
+
attachDevice: (input) => dispatch("audioAnalyzer", "attachDevice", "mutation", input),
|
|
50920
51035
|
isReady: (input) => dispatch("audioAnalyzer", "isReady", "query", input),
|
|
50921
51036
|
dispose: (input) => dispatch("audioAnalyzer", "dispose", "mutation", input),
|
|
50922
51037
|
reprobeAudioEngine: (input) => dispatch("audioAnalyzer", "reprobeAudioEngine", "mutation", input)
|
|
@@ -51490,6 +51605,112 @@ function createSystemProxy(api) {
|
|
|
51490
51605
|
};
|
|
51491
51606
|
}
|
|
51492
51607
|
//#endregion
|
|
51608
|
+
//#region src/audio/audio-scale-epoch.ts
|
|
51609
|
+
/**
|
|
51610
|
+
* The instant the audio amplitude scale changed, and by how much (D459).
|
|
51611
|
+
*
|
|
51612
|
+
* ## What happened
|
|
51613
|
+
*
|
|
51614
|
+
* Until this epoch the native RTP G.711 decoder that feeds the audio chunk
|
|
51615
|
+
* plane — `stream-broker/rtsp/audio-rtp-decoder.ts`, the PCM the audio
|
|
51616
|
+
* CLASSIFIER and the dBFS level meter read — decoded μ-law at exactly 1/4 of
|
|
51617
|
+
* its ITU-T G.711 value and A-law at exactly −1/8 (magnitude *and* sign). The
|
|
51618
|
+
* WebRTC/Opus egress decoded the same bytes correctly in `g711-mulaw.ts`, so
|
|
51619
|
+
* **the audio an operator HEARD was right and the audio the detector MEASURED
|
|
51620
|
+
* was 4–8× quieter**, which is why it survived so long.
|
|
51621
|
+
*
|
|
51622
|
+
* Non-G.711 sources — AAC and Opus, decoded through the `audio-codec` cap —
|
|
51623
|
+
* were always on the ITU-T scale and are NOT affected. Nothing here should
|
|
51624
|
+
* ever be applied to them.
|
|
51625
|
+
*
|
|
51626
|
+
* ## What this module is for, and what it is NOT for
|
|
51627
|
+
*
|
|
51628
|
+
* It is the ONE place the two numbers live, so no caller re-derives them and
|
|
51629
|
+
* no second constant can disagree. It exists for two readers:
|
|
51630
|
+
*
|
|
51631
|
+
* - **A person re-calibrating a threshold.** Every absolute-dBFS gate
|
|
51632
|
+
* authored before the epoch against a native G.711 camera is now that many
|
|
51633
|
+
* dB too permissive: `NcAudioCondition.dbThreshold`,
|
|
51634
|
+
* `RecordingTriggers.audioThresholdDbfs`, `audioMarkerMinDbfs`, and the
|
|
51635
|
+
* viewer's per-grid `audioDb`.
|
|
51636
|
+
* - **Anything drawing a level across the epoch.** A graph that spans it
|
|
51637
|
+
* shows a step of 12.04 dB (PCMU) or 18.06 dB (PCMA) on the affected
|
|
51638
|
+
* cameras. `audioScaleEraOf` is how a reader says which side a sample is
|
|
51639
|
+
* on instead of leaving the step unexplained.
|
|
51640
|
+
*
|
|
51641
|
+
* **It is NOT a gain to apply to a sample.** Stored history is NOT rewritten
|
|
51642
|
+
* and live audio is NOT re-scaled: the decoder is correct now, and a second
|
|
51643
|
+
* authority that "fixes up" a number the decoder already got right is the
|
|
51644
|
+
* defect again with an extra place to argue with. Nor can history be
|
|
51645
|
+
* retro-corrected honestly — `DecodedAudioChunk` never carried the codec, so
|
|
51646
|
+
* a stored `AudioEvent.dbfs` does not say which of the two factors (or
|
|
51647
|
+
* neither) applied to it. Guessing per row is exactly the move that wrote the
|
|
51648
|
+
* original defect.
|
|
51649
|
+
*/
|
|
51650
|
+
/** Spelling of the epoch, so the millisecond constant is readable. */
|
|
51651
|
+
var AUDIO_SCALE_EPOCH_ISO = "2026-09-11T00:00:00.000Z";
|
|
51652
|
+
/**
|
|
51653
|
+
* The instant, in epoch milliseconds. A reading at or after it is on the
|
|
51654
|
+
* ITU-T scale; a reading before it, from a native G.711 camera, is 12–18 dB
|
|
51655
|
+
* low.
|
|
51656
|
+
*
|
|
51657
|
+
* It is the DAY, not the deploy minute, and deliberately so: the correction
|
|
51658
|
+
* reaches each node when that node's `addon-pipeline` is redeployed, which is
|
|
51659
|
+
* neither simultaneous across the fleet nor knowable from here. A reader that
|
|
51660
|
+
* treats the boundary as fuzzy by a few hours is reading it correctly; one
|
|
51661
|
+
* that treats a sample 200 ms after it as authoritative is not.
|
|
51662
|
+
*/
|
|
51663
|
+
var AUDIO_SCALE_EPOCH_MS = Date.parse(AUDIO_SCALE_EPOCH_ISO);
|
|
51664
|
+
var G711_SCALE_CORRECTION_DB = {
|
|
51665
|
+
PCMU: 20 * Math.log10(4),
|
|
51666
|
+
PCMA: 20 * Math.log10(8)
|
|
51667
|
+
};
|
|
51668
|
+
/**
|
|
51669
|
+
* Restate a dBFS number that was MEASURED through the pre-epoch decoder as the
|
|
51670
|
+
* same intent on the ITU-T scale (D460).
|
|
51671
|
+
*
|
|
51672
|
+
* ## When this applies, and when it is the wrong thing to reach for
|
|
51673
|
+
*
|
|
51674
|
+
* An absolute-dBFS number in this repo is one of two things, and only one of
|
|
51675
|
+
* them converts:
|
|
51676
|
+
*
|
|
51677
|
+
* - **A statement about the scale** — "-55 dBFS is near silence", "-25 dBFS
|
|
51678
|
+
* is loud". It was true on the ITU-T scale before the epoch and it is true
|
|
51679
|
+
* after. The defect was never in the number; it was that 19 of this hub's
|
|
51680
|
+
* 25 cameras did not obey it. Converting such a number takes something
|
|
51681
|
+
* correct and makes it wrong, in order to preserve a bug.
|
|
51682
|
+
* - **A measurement taken through the old decoder** — a value someone read
|
|
51683
|
+
* off a meter that under-reported by exactly 4× (PCMU) or 8× (PCMA). It
|
|
51684
|
+
* describes a sound that was really {@link G711_SCALE_CORRECTION_DB} dB
|
|
51685
|
+
* louder. That is what this function is for.
|
|
51686
|
+
*
|
|
51687
|
+
* Telling the two apart is a question about PROVENANCE, not about arithmetic,
|
|
51688
|
+
* and it cannot be answered from the number. It is answered by the comment the
|
|
51689
|
+
* author left — which is why `scripts/check-dbfs-era.mts` makes leaving one
|
|
51690
|
+
* mandatory.
|
|
51691
|
+
*
|
|
51692
|
+
* ## Why a function and not a typed-in number
|
|
51693
|
+
*
|
|
51694
|
+
* `-55 + 12.04` written into a source file is, six months later, completely
|
|
51695
|
+
* indistinguishable from a threshold somebody simply preferred. Calling this
|
|
51696
|
+
* keeps the derivation, the law, and the original measurement all visible at
|
|
51697
|
+
* the call site, so a future reader can disagree with the *premise* instead of
|
|
51698
|
+
* having to reverse-engineer the sum.
|
|
51699
|
+
*
|
|
51700
|
+
* **This is not a runtime gain.** It converts an authored CONSTANT once, where
|
|
51701
|
+
* it is declared. It must never be applied to a live sample or a stored
|
|
51702
|
+
* `AudioEvent.dbfs`: the decoder is correct now, and a second authority
|
|
51703
|
+
* adjusting numbers the decoder already got right is the original defect with
|
|
51704
|
+
* an extra place to argue with (D459).
|
|
51705
|
+
*/
|
|
51706
|
+
function ituDbfsFromPreEpoch(law, authoredDbfs) {
|
|
51707
|
+
return authoredDbfs + G711_SCALE_CORRECTION_DB[law];
|
|
51708
|
+
}
|
|
51709
|
+
function audioScaleEraOf(timestampMs) {
|
|
51710
|
+
if (!Number.isFinite(timestampMs) || timestampMs <= 0) return "unknown";
|
|
51711
|
+
return timestampMs >= AUDIO_SCALE_EPOCH_MS ? "itu" : "pre-itu";
|
|
51712
|
+
}
|
|
51713
|
+
//#endregion
|
|
51493
51714
|
//#region src/notification/audio-condition.ts
|
|
51494
51715
|
/**
|
|
51495
51716
|
* audio-condition — the authoring logic behind the sustained-sound condition
|
|
@@ -51547,8 +51768,21 @@ function audioKindId(macroId) {
|
|
|
51547
51768
|
}
|
|
51548
51769
|
/** Level bounds, in dBFS. Negative-going: the ceiling is full scale. */
|
|
51549
51770
|
var NC_AUDIO_DB_MIN = -96;
|
|
51771
|
+
/**
|
|
51772
|
+
* Full scale. The ceiling of dBFS itself on any decoder, not a calibration —
|
|
51773
|
+
* untouched by D459 and untouchable by anything like it.
|
|
51774
|
+
*
|
|
51775
|
+
* @dbfs-era scale-bound
|
|
51776
|
+
*/
|
|
51550
51777
|
var NC_AUDIO_DB_MAX = 0;
|
|
51551
|
-
/**
|
|
51778
|
+
/**
|
|
51779
|
+
* Step of the level control — 3 dB is one perceptual notch, not one unit.
|
|
51780
|
+
*
|
|
51781
|
+
* A step between two levels, so it survives any uniform scale change: 3 dB is
|
|
51782
|
+
* the same interval before and after the D459 epoch.
|
|
51783
|
+
*
|
|
51784
|
+
* @dbfs-era relative
|
|
51785
|
+
*/
|
|
51552
51786
|
var NC_AUDIO_DB_STEP = 3;
|
|
51553
51787
|
/**
|
|
51554
51788
|
* Offered when the operator turns the level filter ON. NOT a schema default:
|
|
@@ -51563,8 +51797,42 @@ var NC_AUDIO_DB_STEP = 3;
|
|
|
51563
51797
|
* operator turned the filter on for, and the rule looks broken rather than
|
|
51564
51798
|
* mis-seeded. The offered floor is the QUIET end of that measured band; the
|
|
51565
51799
|
* editor says which way the number runs rather than leaving it to be inferred.
|
|
51566
|
-
|
|
51567
|
-
|
|
51800
|
+
*
|
|
51801
|
+
* ⚠ **That measurement was taken on the pre-D459 scale, and D460 moved this
|
|
51802
|
+
* constant because of it.** Until {@link AUDIO_SCALE_EPOCH_MS} the native RTP
|
|
51803
|
+
* G.711 decoder reported levels 12.04 dB low (PCMU) or 18.06 dB low (PCMA).
|
|
51804
|
+
*
|
|
51805
|
+
* This is the ONE absolute-dBFS number in the repo that is a MEASUREMENT
|
|
51806
|
+
* rather than a statement about the scale, and it is the only one with a
|
|
51807
|
+
* recorded provenance — which is exactly why it is also the only shared
|
|
51808
|
+
* constant that converts. Three things agree that the camera it was measured
|
|
51809
|
+
* on spoke PCMU:
|
|
51810
|
+
*
|
|
51811
|
+
* - 19 of this hub's 25 cameras with audio are PCMU, 5 AAC, 1 L16, 0 PCMA
|
|
51812
|
+
* (codec census over 10 h of `audio: track detected`, 2026-09-11);
|
|
51813
|
+
* - **-55..-26 dBFS is not a close cry on a true scale.** -26 is a quiet
|
|
51814
|
+
* room. Read as a PCMU measurement the band is -43..-14, which is exactly
|
|
51815
|
+
* where a cry a metre from the microphone sits;
|
|
51816
|
+
* - there is no PCMA camera on this installation, so the only candidate
|
|
51817
|
+
* correction is mu-law's.
|
|
51818
|
+
*
|
|
51819
|
+
* So the band is restated, not re-guessed: the offered floor stays "the QUIET
|
|
51820
|
+
* end of the measured band", and the band moves to where it was always really
|
|
51821
|
+
* sitting. {@link ituDbfsFromPreEpoch} does the arithmetic so the derivation
|
|
51822
|
+
* survives in the source instead of becoming a number somebody preferred.
|
|
51823
|
+
*
|
|
51824
|
+
* `Math.round` is the control's own granularity, not a fudge: the editor's
|
|
51825
|
+
* level field is an integer stepper and `patchAudio` clamps through
|
|
51826
|
+
* `clampInt`, so a fractional seed could never reach storage anyway.
|
|
51827
|
+
*
|
|
51828
|
+
* **This changes no existing rule.** It is what an editor OFFERS when the
|
|
51829
|
+
* level filter is switched on with nothing stored; every `dbThreshold` an
|
|
51830
|
+
* operator already authored is untouched, and those are a separate question
|
|
51831
|
+
* — see D460 on why they are declared rather than migrated.
|
|
51832
|
+
*
|
|
51833
|
+
* @dbfs-era pre-itu-pcmu
|
|
51834
|
+
*/
|
|
51835
|
+
var NC_AUDIO_DB_OFFERED = Math.round(ituDbfsFromPreEpoch("PCMU", -55));
|
|
51568
51836
|
var NC_AUDIO_HIT_PERCENT_MIN = 1;
|
|
51569
51837
|
var NC_AUDIO_HIT_PERCENT_MAX = 100;
|
|
51570
51838
|
var NC_AUDIO_SAMPLING_MIN_SEC = 1;
|
|
@@ -51656,7 +51924,7 @@ function patchAudio(current, patch) {
|
|
|
51656
51924
|
const hasLabels = wantedLabels !== void 0 && wantedLabels.length > 0;
|
|
51657
51925
|
const mode = patch.mode ?? (has(patch, "labels") && hasLabels ? "label" : has(patch, "dbThreshold") && wantedDb !== void 0 ? "level" : hasLabels ? "label" : wantedDb !== void 0 ? "level" : null);
|
|
51658
51926
|
const labels = mode === "label" && hasLabels ? wantedLabels : void 0;
|
|
51659
|
-
const dbThreshold = mode !== "level" ? void 0 : wantedDb ?? (patch.mode === "level" ?
|
|
51927
|
+
const dbThreshold = mode !== "level" ? void 0 : wantedDb ?? (patch.mode === "level" ? NC_AUDIO_DB_OFFERED : void 0);
|
|
51660
51928
|
return {
|
|
51661
51929
|
...labels !== void 0 ? { labels: [...labels] } : {},
|
|
51662
51930
|
...dbThreshold !== void 0 ? { dbThreshold: clampInt(dbThreshold, NC_AUDIO_DB_MIN, 0) } : {},
|
|
@@ -52342,7 +52610,7 @@ var NC_OCCUPANCY_DEFAULTS = {
|
|
|
52342
52610
|
var NC_AUDIO_SEED = {
|
|
52343
52611
|
hitPercent: NC_AUDIO_DEFAULTS.hitPercent,
|
|
52344
52612
|
samplingSeconds: NC_AUDIO_DEFAULTS.samplingSeconds,
|
|
52345
|
-
dbThreshold:
|
|
52613
|
+
dbThreshold: NC_AUDIO_DB_OFFERED
|
|
52346
52614
|
};
|
|
52347
52615
|
function ruleSeedForSection(section) {
|
|
52348
52616
|
switch (section) {
|
|
@@ -55440,8 +55708,11 @@ exports.APPLE_SA_TO_MACRO = APPLE_SA_TO_MACRO;
|
|
|
55440
55708
|
exports.ARCHIVED_DEBUG_NOTES_DEFAULT_LIMIT = ARCHIVED_DEBUG_NOTES_DEFAULT_LIMIT;
|
|
55441
55709
|
exports.AUDIO_ANALYSIS_CAP_NAME = AUDIO_ANALYSIS_CAP_NAME;
|
|
55442
55710
|
exports.AUDIO_BACKEND_CHOICES = AUDIO_BACKEND_CHOICES;
|
|
55711
|
+
exports.AUDIO_CHUNK_FORMATS = require_sleep.AUDIO_CHUNK_FORMATS;
|
|
55443
55712
|
exports.AUDIO_MACRO_LABELS = AUDIO_MACRO_LABELS;
|
|
55444
55713
|
exports.AUDIO_PRESETS = require_canonical_hash.AUDIO_PRESETS;
|
|
55714
|
+
exports.AUDIO_SCALE_EPOCH_ISO = AUDIO_SCALE_EPOCH_ISO;
|
|
55715
|
+
exports.AUDIO_SCALE_EPOCH_MS = AUDIO_SCALE_EPOCH_MS;
|
|
55445
55716
|
exports.AccessoriesStatusSchema = AccessoriesStatusSchema;
|
|
55446
55717
|
exports.AccessoryKind = AccessoryKind;
|
|
55447
55718
|
exports.AddBrokerInputSchema = AddBrokerInputSchema;
|
|
@@ -55481,12 +55752,16 @@ exports.AttachmentMediaTypeSchema = AttachmentMediaTypeSchema;
|
|
|
55481
55752
|
exports.AttachmentSchema = AttachmentSchema;
|
|
55482
55753
|
exports.AudioAnalysisResultSchema = AudioAnalysisResultSchema;
|
|
55483
55754
|
exports.AudioAnalysisSettingsSchema = AudioAnalysisSettingsSchema;
|
|
55755
|
+
exports.AudioAttachDeviceInputSchema = AudioAttachDeviceInputSchema;
|
|
55756
|
+
exports.AudioAttachDeviceResultSchema = AudioAttachDeviceResultSchema;
|
|
55757
|
+
exports.AudioChunkFormatSchema = require_sleep.AudioChunkFormatSchema;
|
|
55484
55758
|
exports.AudioChunkInputSchema = AudioChunkInputSchema;
|
|
55485
55759
|
exports.AudioClassSummarySchema = AudioClassSummarySchema;
|
|
55486
55760
|
exports.AudioClassificationLabelSchema = AudioClassificationLabelSchema;
|
|
55487
55761
|
exports.AudioClassificationResultSchema = AudioClassificationResultSchema;
|
|
55488
55762
|
exports.AudioCodecInfoSchema = AudioCodecInfoSchema;
|
|
55489
55763
|
exports.AudioDecodeSessionConfigSchema = AudioDecodeSessionConfigSchema;
|
|
55764
|
+
exports.AudioDetachDeviceResultSchema = AudioDetachDeviceResultSchema;
|
|
55490
55765
|
exports.AudioEncodeSchema = AudioEncodeSchema;
|
|
55491
55766
|
exports.AudioEncodeSessionConfigSchema = AudioEncodeSessionConfigSchema;
|
|
55492
55767
|
exports.AudioEncodedChunkSchema = AudioEncodedChunkSchema;
|
|
@@ -55800,6 +56075,7 @@ exports.FrameHandleSchema = require_sleep.FrameHandleSchema;
|
|
|
55800
56075
|
exports.FrameInputSchema = FrameInputSchema;
|
|
55801
56076
|
exports.FrameLazyCountersSchema = FrameLazyCountersSchema;
|
|
55802
56077
|
exports.FrameLazyMetricsSchema = FrameLazyMetricsSchema;
|
|
56078
|
+
exports.G711_SCALE_CORRECTION_DB = G711_SCALE_CORRECTION_DB;
|
|
55803
56079
|
exports.GasStatusSchema = GasStatusSchema;
|
|
55804
56080
|
exports.GetLoggingSettingsInputSchema = GetLoggingSettingsInputSchema;
|
|
55805
56081
|
exports.GetStreamWithCodecInputSchema = GetStreamWithCodecInputSchema;
|
|
@@ -56188,6 +56464,7 @@ exports.REACHABILITY_FAILURES_TO_OFFLINE = REACHABILITY_FAILURES_TO_OFFLINE;
|
|
|
56188
56464
|
exports.REACHABILITY_POLL_INTERVAL_MS = REACHABILITY_POLL_INTERVAL_MS;
|
|
56189
56465
|
exports.REACHABILITY_PROBE_TIMEOUT_MS = REACHABILITY_PROBE_TIMEOUT_MS;
|
|
56190
56466
|
exports.RECOGNITION_TYPES = RECOGNITION_TYPES;
|
|
56467
|
+
exports.RECORDING_AUDIO_TRIGGER_OFFERED_DBFS = RECORDING_AUDIO_TRIGGER_OFFERED_DBFS;
|
|
56191
56468
|
exports.RECORDING_EXPORT_MAX_READ_BYTES = RECORDING_EXPORT_MAX_READ_BYTES;
|
|
56192
56469
|
exports.RECORDING_TIMELINE_BATCH_MAX = RECORDING_TIMELINE_BATCH_MAX;
|
|
56193
56470
|
exports.REDACTED_SECRET = REDACTED_SECRET;
|
|
@@ -56539,6 +56816,7 @@ exports.asString = require_sleep.asString;
|
|
|
56539
56816
|
exports.assertTimelapseCadences = assertTimelapseCadences;
|
|
56540
56817
|
exports.audioAnalysisCapability = audioAnalysisCapability;
|
|
56541
56818
|
exports.audioAnalyzerCapability = audioAnalyzerCapability;
|
|
56819
|
+
exports.audioChunkBytesPerSample = require_sleep.audioChunkBytesPerSample;
|
|
56542
56820
|
exports.audioCodecCapability = audioCodecCapability;
|
|
56543
56821
|
exports.audioIsFailClosed = audioIsFailClosed;
|
|
56544
56822
|
exports.audioKindId = audioKindId;
|
|
@@ -56547,6 +56825,7 @@ exports.audioMetricsCapability = audioMetricsCapability;
|
|
|
56547
56825
|
exports.audioModeOf = audioModeOf;
|
|
56548
56826
|
exports.audioOrDefaults = audioOrDefaults;
|
|
56549
56827
|
exports.audioPlanFromEncodeProfile = require_canonical_hash.audioPlanFromEncodeProfile;
|
|
56828
|
+
exports.audioScaleEraOf = audioScaleEraOf;
|
|
56550
56829
|
exports.authProviderCapability = authProviderCapability;
|
|
56551
56830
|
exports.autoAssignProfiles = autoAssignProfiles;
|
|
56552
56831
|
exports.automationControlCapability = automationControlCapability;
|
|
@@ -56674,6 +56953,7 @@ exports.eventEmitterCapability = eventEmitterCapability;
|
|
|
56674
56953
|
exports.eventsCapability = eventsCapability;
|
|
56675
56954
|
exports.evictionPolicyForMode = evictionPolicyForMode;
|
|
56676
56955
|
exports.evictionPolicyOfLocation = evictionPolicyOfLocation;
|
|
56956
|
+
exports.expandAudioChunkToF32le = require_sleep.expandAudioChunkToF32le;
|
|
56677
56957
|
exports.expandCapMethods = require_sleep.expandCapMethods;
|
|
56678
56958
|
exports.extractNestedAddonId = extractNestedAddonId;
|
|
56679
56959
|
exports.extractSourceInfoFromMetadata = extractSourceInfoFromMetadata;
|
|
@@ -56711,6 +56991,7 @@ exports.intercomCapability = intercomCapability;
|
|
|
56711
56991
|
exports.invocationFromEncodeProfile = require_canonical_hash.invocationFromEncodeProfile;
|
|
56712
56992
|
exports.isAgentOnlyPlacement = isAgentOnlyPlacement;
|
|
56713
56993
|
exports.isArrayOutputSchema = isArrayOutputSchema;
|
|
56994
|
+
exports.isAudioChunkFormat = require_sleep.isAudioChunkFormat;
|
|
56714
56995
|
exports.isAudioLabelSelected = isAudioLabelSelected;
|
|
56715
56996
|
exports.isAudioRule = isAudioRule;
|
|
56716
56997
|
exports.isBaseConditionKey = isBaseConditionKey;
|
|
@@ -56737,6 +57018,7 @@ exports.isSourceCap = isSourceCap;
|
|
|
56737
57018
|
exports.isStorageLocationMode = isStorageLocationMode;
|
|
56738
57019
|
exports.isSystemDelivery = isSystemDelivery;
|
|
56739
57020
|
exports.isVoidInput = isVoidInput;
|
|
57021
|
+
exports.ituDbfsFromPreEpoch = ituDbfsFromPreEpoch;
|
|
56740
57022
|
exports.jobKindSchema = jobKindSchema;
|
|
56741
57023
|
exports.kebabToCamel = kebabToCamel;
|
|
56742
57024
|
exports.knownValues = knownValues;
|