alpha2 0.4.6 → 0.5.1

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.
Files changed (123) hide show
  1. package/README.md +5 -4
  2. package/THIRD_PARTY_NOTICES.md +4 -0
  3. package/dist/abort.d.ts +12 -0
  4. package/dist/abort.js +48 -0
  5. package/dist/active-clock.d.ts +35 -0
  6. package/dist/active-clock.js +99 -0
  7. package/dist/assets.d.ts +51 -22
  8. package/dist/assets.js +8 -12
  9. package/dist/audio-layout.d.ts +52 -74
  10. package/dist/audio-layout.js +114 -148
  11. package/dist/audio-timeline.d.ts +89 -117
  12. package/dist/audio-timeline.js +102 -118
  13. package/dist/audio-worker.d.ts +12 -21
  14. package/dist/audio-worker.js +8 -13
  15. package/dist/audio-worklet-processor.js +45 -58
  16. package/dist/audio-worklet.d.ts +45 -76
  17. package/dist/audio-worklet.js +44 -79
  18. package/dist/audio.d.ts +15 -23
  19. package/dist/audio.js +9 -13
  20. package/dist/builder.d.ts +45 -63
  21. package/dist/builder.js +49 -45
  22. package/dist/capabilities.d.ts +99 -16
  23. package/dist/capabilities.js +2 -2
  24. package/dist/captions.d.ts +45 -22
  25. package/dist/captions.js +60 -15
  26. package/dist/chroma-siting.d.ts +24 -41
  27. package/dist/chroma-siting.js +38 -71
  28. package/dist/containers.d.ts +41 -30
  29. package/dist/containers.js +59 -27
  30. package/dist/decoder-fallback.d.ts +13 -0
  31. package/dist/decoder-fallback.js +38 -0
  32. package/dist/decoder-order.d.ts +24 -39
  33. package/dist/decoder-order.js +28 -42
  34. package/dist/edit.d.ts +77 -154
  35. package/dist/edit.js +98 -180
  36. package/dist/effects.d.ts +125 -176
  37. package/dist/effects.js +7 -9
  38. package/dist/export-destination.d.ts +25 -41
  39. package/dist/export-destination.js +20 -32
  40. package/dist/export-failure.d.ts +34 -59
  41. package/dist/export-failure.js +54 -48
  42. package/dist/export-metrics.d.ts +116 -0
  43. package/dist/export-metrics.js +74 -0
  44. package/dist/export-retry.d.ts +46 -29
  45. package/dist/export-retry.js +86 -51
  46. package/dist/exporter.d.ts +67 -116
  47. package/dist/exporter.js +133 -133
  48. package/dist/extensions.d.ts +69 -115
  49. package/dist/extensions.js +55 -82
  50. package/dist/frame-intake.d.ts +92 -0
  51. package/dist/frame-intake.js +114 -0
  52. package/dist/frame-supply.d.ts +96 -162
  53. package/dist/frame-supply.js +181 -171
  54. package/dist/frames.d.ts +23 -0
  55. package/dist/frames.js +34 -0
  56. package/dist/generated/project-schema.d.ts +712 -485
  57. package/dist/generated/project-schema.js +55 -2
  58. package/dist/generated/project-shape.js +276 -16
  59. package/dist/geometry.d.ts +28 -34
  60. package/dist/geometry.js +18 -23
  61. package/dist/gpu-recovery.d.ts +92 -0
  62. package/dist/gpu-recovery.js +135 -0
  63. package/dist/hdr-frames.d.ts +82 -67
  64. package/dist/hdr-frames.js +112 -49
  65. package/dist/index.d.ts +6 -0
  66. package/dist/index.js +6 -0
  67. package/dist/json-text.d.ts +13 -23
  68. package/dist/json-text.js +10 -20
  69. package/dist/layout-values.d.ts +14 -22
  70. package/dist/layout-values.js +18 -21
  71. package/dist/layout.d.ts +48 -63
  72. package/dist/layout.js +37 -37
  73. package/dist/loudness.d.ts +27 -32
  74. package/dist/loudness.js +19 -23
  75. package/dist/media.d.ts +85 -237
  76. package/dist/media.js +133 -287
  77. package/dist/mediabunny.d.ts +178 -246
  78. package/dist/mediabunny.js +781 -583
  79. package/dist/paint.d.ts +23 -0
  80. package/dist/paint.js +37 -0
  81. package/dist/physical-frames.d.ts +5 -17
  82. package/dist/physical-frames.js +4 -11
  83. package/dist/player.d.ts +56 -47
  84. package/dist/player.js +155 -40
  85. package/dist/presented-frames.d.ts +2 -7
  86. package/dist/presented-frames.js +3 -8
  87. package/dist/project.d.ts +74 -118
  88. package/dist/project.js +384 -445
  89. package/dist/rate-control.d.ts +9 -23
  90. package/dist/rate-control.js +7 -18
  91. package/dist/renderer-choice.d.ts +41 -0
  92. package/dist/renderer-choice.js +82 -0
  93. package/dist/repacked-bytes.d.ts +0 -2
  94. package/dist/repacked-bytes.js +2 -5
  95. package/dist/robustness.d.ts +25 -37
  96. package/dist/robustness.js +71 -54
  97. package/dist/sha256.d.ts +5 -13
  98. package/dist/sha256.js +9 -24
  99. package/dist/text.d.ts +97 -71
  100. package/dist/text.js +33 -70
  101. package/dist/video-frames.d.ts +7 -25
  102. package/dist/video-frames.js +12 -29
  103. package/dist/waveform.d.ts +5 -11
  104. package/dist/waveform.js +4 -9
  105. package/dist/worker-error.d.ts +5 -20
  106. package/dist/worker-error.js +8 -25
  107. package/dist/worker.d.ts +82 -95
  108. package/dist/worker.js +235 -143
  109. package/package.json +26 -2
  110. package/wasm/alpha2_audio_worklet.wasm +0 -0
  111. package/wasm/alpha2_extensions.d.ts +26 -47
  112. package/wasm/alpha2_extensions.js +26 -47
  113. package/wasm/alpha2_extensions_bg.wasm +0 -0
  114. package/wasm/alpha2_wasm.d.ts +501 -587
  115. package/wasm/alpha2_wasm.js +661 -616
  116. package/wasm/alpha2_wasm_bg.wasm +0 -0
  117. package/wasm/alpha2_wasm_bg.wasm.d.ts +22 -12
  118. package/wasm/rust-crate-licenses.md +2 -2
  119. package/wasm/snippets/{alpha2-wasm-c62e60c964e88a52 → alpha2-wasm-070d94113471ef0a}/inline1.js +1 -0
  120. package/wasm/snippets/alpha2-wasm-070d94113471ef0a/inline2.js +82 -0
  121. package/wasm/snippets/alpha2-wasm-c62e60c964e88a52/inline2.js +0 -52
  122. /package/wasm/snippets/{alpha2-wasm-c62e60c964e88a52 → alpha2-wasm-070d94113471ef0a}/inline0.js +0 -0
  123. /package/wasm/snippets/{alpha2-wasm-c62e60c964e88a52 → alpha2-wasm-070d94113471ef0a}/inline3.js +0 -0
@@ -1,18 +1,15 @@
1
1
  /**
2
- * Loudness measurement and normalization (ITU-R BS.1770-4, EBU R128),
3
- * computed by the engine with the same code a native host uses.
2
+ * Loudness measurement and normalization (ITU-R BS.1770-4, EBU R128), computed by the engine.
4
3
  *
5
- * Measure decoded audio with {@link measureLoudness}. To export at a target
6
- * loudness, measure the export's mix before the master limiter first: turn
7
- * `setLoudnessMetering(true)` on the engine, render the export's audio once
8
- * with `renderAudio`, parse its report with `JSON.parse(engine.loudnessReport())`,
9
- * plan the gain with {@link planLoudnessNormalization}, and render the export with
10
- * `setNormalizationGainDb(plan.gainDb)`. The engine's report states the master
11
- * limiter's threshold, and the plan keeps the mix under it, so the limiter
12
- * leaves the export at the planned loudness. Turning metering on removes the
13
- * gain, so the cycle can run again; set zero for audio that is not normalized.
4
+ * To export at a target loudness:
5
+ * 1. call `setLoudnessMetering(true)` on the engine and render the audio once with `renderAudio`;
6
+ * 2. pass `JSON.parse(engine.loudnessReport())` to {@link planLoudnessNormalization};
7
+ * 3. render the export with `setNormalizationGainDb(plan.gainDb)`.
8
+ *
9
+ * The plan keeps the mix under the master limiter's threshold, so the limiter does not change the
10
+ * planned loudness. Enabling metering resets the gain to zero.
14
11
  */
15
- /** What a loudness measurement found. `null` where nothing was measurable. */
12
+ /** Loudness measurement. A field is `null` when nothing was measurable. */
16
13
  export interface LoudnessReport {
17
14
  /** Gated integrated loudness, LUFS; `null` for audio below -70 LUFS. */
18
15
  readonly integratedLufs: number | null;
@@ -29,13 +26,12 @@ export interface LoudnessReport {
29
26
  /** Samples measured per channel. */
30
27
  readonly frames: number;
31
28
  /**
32
- * The linear threshold of the master limiter the mix was measured in front of: `null` for a mix
33
- * without one, absent from a {@link measureLoudness} measurement. The engine's
34
- * `loudnessReport()` states it, and a plan keeps the mix's sample peak under it.
29
+ * Linear threshold of the master limiter after the metering point; `null` without a limiter and
30
+ * absent from {@link measureLoudness} results.
35
31
  */
36
32
  readonly limiterThreshold?: number | null;
37
33
  }
38
- /** A static gain that brings a mix to a loudness target. */
34
+ /** Static gain that brings a mix to a loudness target. */
39
35
  export interface LoudnessNormalization {
40
36
  /** Gain to apply before the master limiter, dB. */
41
37
  readonly gainDb: number;
@@ -44,17 +40,17 @@ export interface LoudnessNormalization {
44
40
  /** True peak after the gain, dBTP. */
45
41
  readonly truePeakDbtp: number;
46
42
  /**
47
- * Whether a peak bound set the gain, leaving the result quieter than the target: the true-peak
48
- * ceiling, or the master limiter (`limiterLimited`).
43
+ * Whether the true-peak ceiling or the master limiter capped the gain, leaving the result quieter
44
+ * than the target.
49
45
  */
50
46
  readonly peakLimited: boolean;
51
47
  /**
52
- * Whether the master limiter's threshold set the gain, below what the ceiling allows: the mix's
53
- * sample peak is kept 0.01 dB under it, so the limiter does not act.
48
+ * Whether the limiter threshold capped the gain; the sample peak is kept 0.01 dB under it so the
49
+ * limiter does not act.
54
50
  */
55
51
  readonly limiterLimited: boolean;
56
52
  }
57
- /** The parts of `alpha2/wasm` loudness uses. */
53
+ /** The `alpha2/wasm` items loudness uses. */
58
54
  export interface LoudnessBinding {
59
55
  readonly LoudnessMeter: new (sampleRate: number, channels: number) => {
60
56
  push(planar: Float32Array): void;
@@ -64,21 +60,20 @@ export interface LoudnessBinding {
64
60
  planLoudnessNormalization(reportJson: string, targetLufs: number, ceilingDbtp: number): string;
65
61
  }
66
62
  /**
67
- * Measures planar audio: one `Float32Array` per channel, all one length. A NaN
68
- * or infinite sample measures as silence. `blockFrames` is how many frames are
69
- * copied into wasm per call.
63
+ * Measures planar audio, one equal-length `Float32Array` per channel. Non-finite samples count as
64
+ * silence. `blockFrames` is the number of frames copied into wasm per call.
70
65
  *
71
- * @throws RangeError When there are no planes, their lengths differ, or
72
- * `blockFrames` is not a positive integer.
73
- * @throws When the engine refuses the sample rate (outside 8 to 96 kHz).
66
+ * @throws RangeError When there are no planes, their lengths differ, or `blockFrames` is not a
67
+ * positive integer.
68
+ * @throws When the sample rate is outside 8 to 96 kHz.
74
69
  */
75
70
  export declare function measureLoudness(binding: LoudnessBinding, planes: readonly Float32Array[], sampleRate: number, blockFrames?: number): LoudnessReport;
76
71
  /**
77
- * The gain that brings `report` to `targetLufs` without its true peak passing `ceilingDbtp`
78
- * (default -1 dBTP), or its sample peak reaching the master limiter `report.limiterThreshold`
79
- * states; `null` for audio silent below the absolute gate.
72
+ * Plans the gain that brings `report` to `targetLufs` without the true peak exceeding
73
+ * `ceilingDbtp` or the sample peak reaching `report.limiterThreshold`. Returns `null` for audio
74
+ * below the absolute gate.
80
75
  *
81
- * @throws TypeError When `report` is not an object: the engine's `loudnessReport()` returns JSON
82
- * text, which is parsed first, and `null` while metering is off, which measured nothing.
76
+ * @throws TypeError When `report` is not an object (for example the unparsed JSON string from
77
+ * `loudnessReport()`, or its `null` while metering is off).
83
78
  */
84
79
  export declare function planLoudnessNormalization(binding: LoudnessBinding, report: LoudnessReport, targetLufs: number, ceilingDbtp?: number): LoudnessNormalization | null;
package/dist/loudness.js CHANGED
@@ -1,25 +1,21 @@
1
1
  /**
2
- * Loudness measurement and normalization (ITU-R BS.1770-4, EBU R128),
3
- * computed by the engine with the same code a native host uses.
2
+ * Loudness measurement and normalization (ITU-R BS.1770-4, EBU R128), computed by the engine.
4
3
  *
5
- * Measure decoded audio with {@link measureLoudness}. To export at a target
6
- * loudness, measure the export's mix before the master limiter first: turn
7
- * `setLoudnessMetering(true)` on the engine, render the export's audio once
8
- * with `renderAudio`, parse its report with `JSON.parse(engine.loudnessReport())`,
9
- * plan the gain with {@link planLoudnessNormalization}, and render the export with
10
- * `setNormalizationGainDb(plan.gainDb)`. The engine's report states the master
11
- * limiter's threshold, and the plan keeps the mix under it, so the limiter
12
- * leaves the export at the planned loudness. Turning metering on removes the
13
- * gain, so the cycle can run again; set zero for audio that is not normalized.
4
+ * To export at a target loudness:
5
+ * 1. call `setLoudnessMetering(true)` on the engine and render the audio once with `renderAudio`;
6
+ * 2. pass `JSON.parse(engine.loudnessReport())` to {@link planLoudnessNormalization};
7
+ * 3. render the export with `setNormalizationGainDb(plan.gainDb)`.
8
+ *
9
+ * The plan keeps the mix under the master limiter's threshold, so the limiter does not change the
10
+ * planned loudness. Enabling metering resets the gain to zero.
14
11
  */
15
12
  /**
16
- * Measures planar audio: one `Float32Array` per channel, all one length. A NaN
17
- * or infinite sample measures as silence. `blockFrames` is how many frames are
18
- * copied into wasm per call.
13
+ * Measures planar audio, one equal-length `Float32Array` per channel. Non-finite samples count as
14
+ * silence. `blockFrames` is the number of frames copied into wasm per call.
19
15
  *
20
- * @throws RangeError When there are no planes, their lengths differ, or
21
- * `blockFrames` is not a positive integer.
22
- * @throws When the engine refuses the sample rate (outside 8 to 96 kHz).
16
+ * @throws RangeError When there are no planes, their lengths differ, or `blockFrames` is not a
17
+ * positive integer.
18
+ * @throws When the sample rate is outside 8 to 96 kHz.
23
19
  */
24
20
  export function measureLoudness(binding, planes, sampleRate, blockFrames = 65_536) {
25
21
  const channels = planes.length;
@@ -45,15 +41,15 @@ export function measureLoudness(binding, planes, sampleRate, blockFrames = 65_53
45
41
  }
46
42
  }
47
43
  /**
48
- * The gain that brings `report` to `targetLufs` without its true peak passing `ceilingDbtp`
49
- * (default -1 dBTP), or its sample peak reaching the master limiter `report.limiterThreshold`
50
- * states; `null` for audio silent below the absolute gate.
44
+ * Plans the gain that brings `report` to `targetLufs` without the true peak exceeding
45
+ * `ceilingDbtp` or the sample peak reaching `report.limiterThreshold`. Returns `null` for audio
46
+ * below the absolute gate.
51
47
  *
52
- * @throws TypeError When `report` is not an object: the engine's `loudnessReport()` returns JSON
53
- * text, which is parsed first, and `null` while metering is off, which measured nothing.
48
+ * @throws TypeError When `report` is not an object (for example the unparsed JSON string from
49
+ * `loudnessReport()`, or its `null` while metering is off).
54
50
  */
55
51
  export function planLoudnessNormalization(binding, report, targetLufs, ceilingDbtp = -1) {
56
- // An unchecked string or null would plan as silence, the same answer as quiet audio.
52
+ // Without this check a string or null would silently plan as silence.
57
53
  if (typeof report !== "object" || report === null)
58
54
  throw new TypeError("planLoudnessNormalization takes a report object: parse loudnessReport() with JSON.parse, " +
59
55
  "and measure with metering on");