@libraz/libsonare 1.7.2 → 1.8.0

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 (303) hide show
  1. package/NOTICE +178 -0
  2. package/README.md +26 -203
  3. package/dist/_chain_config.d.ts +14 -0
  4. package/dist/_chain_config.d.ts.map +1 -0
  5. package/dist/_effects_common.d.ts +6 -0
  6. package/dist/_effects_common.d.ts.map +1 -0
  7. package/dist/_feature_validation.d.ts +8 -0
  8. package/dist/_feature_validation.d.ts.map +1 -0
  9. package/dist/_fft_options.d.ts +24 -0
  10. package/dist/_fft_options.d.ts.map +1 -0
  11. package/dist/align_take.d.ts +50 -0
  12. package/dist/align_take.d.ts.map +1 -0
  13. package/dist/analysis.d.ts +29 -5840
  14. package/dist/analysis.d.ts.map +1 -0
  15. package/dist/analysis.js +873 -722
  16. package/dist/analysis.js.map +1 -1
  17. package/dist/analysis_helpers.d.ts +9 -0
  18. package/dist/analysis_helpers.d.ts.map +1 -0
  19. package/dist/audio.d.ts +163 -0
  20. package/dist/audio.d.ts.map +1 -0
  21. package/dist/clip_page_streamer.d.ts +133 -0
  22. package/dist/clip_page_streamer.d.ts.map +1 -0
  23. package/dist/codes.d.ts +44 -0
  24. package/dist/codes.d.ts.map +1 -0
  25. package/dist/effects_mastering.d.ts +23 -0
  26. package/dist/effects_mastering.d.ts.map +1 -0
  27. package/dist/effects_note_ops.d.ts +477 -0
  28. package/dist/effects_note_ops.d.ts.map +1 -0
  29. package/dist/effects_percussive.d.ts +185 -0
  30. package/dist/effects_percussive.d.ts.map +1 -0
  31. package/dist/effects_separation.d.ts +65 -0
  32. package/dist/effects_separation.d.ts.map +1 -0
  33. package/dist/effects_spectral.d.ts +28 -0
  34. package/dist/effects_spectral.d.ts.map +1 -0
  35. package/dist/effects_timepitch.d.ts +129 -0
  36. package/dist/effects_timepitch.d.ts.map +1 -0
  37. package/dist/effects_voice_change.d.ts +53 -0
  38. package/dist/effects_voice_change.d.ts.map +1 -0
  39. package/dist/errors.d.ts +51 -0
  40. package/dist/errors.d.ts.map +1 -0
  41. package/dist/feature_core.d.ts +341 -0
  42. package/dist/feature_core.d.ts.map +1 -0
  43. package/dist/feature_decompose.d.ts +278 -0
  44. package/dist/feature_decompose.d.ts.map +1 -0
  45. package/dist/feature_inverse.d.ts +128 -0
  46. package/dist/feature_inverse.d.ts.map +1 -0
  47. package/dist/feature_loudness.d.ts +66 -0
  48. package/dist/feature_loudness.d.ts.map +1 -0
  49. package/dist/feature_music.d.ts +307 -0
  50. package/dist/feature_music.d.ts.map +1 -0
  51. package/dist/feature_pitch.d.ts +108 -0
  52. package/dist/feature_pitch.d.ts.map +1 -0
  53. package/dist/feature_resample.d.ts +16 -0
  54. package/dist/feature_resample.d.ts.map +1 -0
  55. package/dist/feature_spectral.d.ts +137 -0
  56. package/dist/feature_spectral.d.ts.map +1 -0
  57. package/dist/feature_spectrogram.d.ts +198 -0
  58. package/dist/feature_spectrogram.d.ts.map +1 -0
  59. package/dist/features.d.ts +10 -0
  60. package/dist/features.d.ts.map +1 -0
  61. package/dist/hrtf/default.shrf +0 -0
  62. package/dist/index.d.ts +74 -7431
  63. package/dist/index.d.ts.map +1 -0
  64. package/dist/index.js +3758 -1362
  65. package/dist/index.js.map +1 -1
  66. package/dist/instrument_types.d.ts +517 -0
  67. package/dist/instrument_types.d.ts.map +1 -0
  68. package/dist/live_audio.d.ts +35 -0
  69. package/dist/live_audio.d.ts.map +1 -0
  70. package/dist/mastering_chain.d.ts +213 -0
  71. package/dist/mastering_chain.d.ts.map +1 -0
  72. package/dist/mastering_core.d.ts +457 -0
  73. package/dist/mastering_core.d.ts.map +1 -0
  74. package/dist/mastering_dynamics.d.ts +80 -0
  75. package/dist/mastering_dynamics.d.ts.map +1 -0
  76. package/dist/metering.d.ts +287 -0
  77. package/dist/metering.d.ts.map +1 -0
  78. package/dist/mixer.d.ts +464 -0
  79. package/dist/mixer.d.ts.map +1 -0
  80. package/dist/mixing_assistant.d.ts +62 -0
  81. package/dist/mixing_assistant.d.ts.map +1 -0
  82. package/dist/mixing_oneshot.d.ts +40 -0
  83. package/dist/mixing_oneshot.d.ts.map +1 -0
  84. package/dist/module_state.d.ts +15 -0
  85. package/dist/module_state.d.ts.map +1 -0
  86. package/dist/opfs_clip_pages.d.ts +28 -0
  87. package/dist/opfs_clip_pages.d.ts.map +1 -0
  88. package/dist/playback_renderer.d.ts +128 -0
  89. package/dist/playback_renderer.d.ts.map +1 -0
  90. package/dist/polyphony.d.ts +202 -0
  91. package/dist/polyphony.d.ts.map +1 -0
  92. package/dist/project.d.ts +8 -0
  93. package/dist/project.d.ts.map +1 -0
  94. package/dist/project_class.d.ts +562 -0
  95. package/dist/project_class.d.ts.map +1 -0
  96. package/dist/project_internal.d.ts +194 -0
  97. package/dist/project_internal.d.ts.map +1 -0
  98. package/dist/project_synth.d.ts +74 -0
  99. package/dist/project_synth.d.ts.map +1 -0
  100. package/dist/project_types.d.ts +652 -0
  101. package/dist/project_types.d.ts.map +1 -0
  102. package/dist/public_types.d.ts +185 -0
  103. package/dist/public_types.d.ts.map +1 -0
  104. package/dist/public_types_acoustic.d.ts +215 -0
  105. package/dist/public_types_acoustic.d.ts.map +1 -0
  106. package/dist/public_types_mastering.d.ts +510 -0
  107. package/dist/public_types_mastering.d.ts.map +1 -0
  108. package/dist/public_types_mixing.d.ts +436 -0
  109. package/dist/public_types_mixing.d.ts.map +1 -0
  110. package/dist/public_types_music.d.ts +619 -0
  111. package/dist/public_types_music.d.ts.map +1 -0
  112. package/dist/public_types_playback.d.ts +164 -0
  113. package/dist/public_types_playback.d.ts.map +1 -0
  114. package/dist/public_types_realtime.d.ts +174 -0
  115. package/dist/public_types_realtime.d.ts.map +1 -0
  116. package/dist/public_types_repair.d.ts +424 -0
  117. package/dist/public_types_repair.d.ts.map +1 -0
  118. package/dist/public_types_spectral.d.ts +697 -0
  119. package/dist/public_types_spectral.d.ts.map +1 -0
  120. package/dist/quick_analysis.d.ts +445 -0
  121. package/dist/quick_analysis.d.ts.map +1 -0
  122. package/dist/realtime_engine.d.ts +850 -0
  123. package/dist/realtime_engine.d.ts.map +1 -0
  124. package/dist/realtime_voice_changer.d.ts +158 -0
  125. package/dist/realtime_voice_changer.d.ts.map +1 -0
  126. package/dist/repair_dereverb.d.ts +187 -0
  127. package/dist/repair_dereverb.d.ts.map +1 -0
  128. package/dist/repair_impulsive.d.ts +186 -0
  129. package/dist/repair_impulsive.d.ts.map +1 -0
  130. package/dist/repair_noise.d.ts +239 -0
  131. package/dist/repair_noise.d.ts.map +1 -0
  132. package/dist/repair_trim.d.ts +123 -0
  133. package/dist/repair_trim.d.ts.map +1 -0
  134. package/dist/sample_bank.d.ts +84 -0
  135. package/dist/sample_bank.d.ts.map +1 -0
  136. package/dist/scale.d.ts +10 -0
  137. package/dist/scale.d.ts.map +1 -0
  138. package/dist/schemas/mixer-scene.schema.json +393 -0
  139. package/dist/schemas/playback-renderer-config.schema.json +392 -0
  140. package/dist/sonare-analysis.d.ts +8 -0
  141. package/dist/sonare-analysis.js +2 -2
  142. package/dist/sonare-analysis.wasm +0 -0
  143. package/dist/sonare.d.ts +3909 -0
  144. package/dist/sonare.js +2 -2
  145. package/dist/sonare.wasm +0 -0
  146. package/dist/stream_analyzer.d.ts +163 -0
  147. package/dist/stream_analyzer.d.ts.map +1 -0
  148. package/dist/stream_types.d.ts +214 -0
  149. package/dist/stream_types.d.ts.map +1 -0
  150. package/dist/streaming_mixing.d.ts +6 -0
  151. package/dist/streaming_mixing.d.ts.map +1 -0
  152. package/dist/streaming_processors.d.ts +335 -0
  153. package/dist/streaming_processors.d.ts.map +1 -0
  154. package/dist/transcribe.d.ts +77 -0
  155. package/dist/transcribe.d.ts.map +1 -0
  156. package/dist/validation.d.ts +140 -0
  157. package/dist/validation.d.ts.map +1 -0
  158. package/dist/web_midi.d.ts +77 -0
  159. package/dist/web_midi.d.ts.map +1 -0
  160. package/dist/worker.d.ts +5 -48
  161. package/dist/worker.d.ts.map +1 -0
  162. package/dist/worker.js +94 -41
  163. package/dist/worker.js.map +1 -1
  164. package/dist/worker_client.d.ts +96 -0
  165. package/dist/worker_client.d.ts.map +1 -0
  166. package/dist/worker_protocol.d.ts +43 -0
  167. package/dist/worker_protocol.d.ts.map +1 -0
  168. package/dist/worklet/audio_types.d.ts +21 -0
  169. package/dist/worklet/audio_types.d.ts.map +1 -0
  170. package/dist/worklet/engine-automation.d.ts +29 -0
  171. package/dist/worklet/engine-automation.d.ts.map +1 -0
  172. package/dist/worklet/engine-capture-facade.d.ts +35 -0
  173. package/dist/worklet/engine-capture-facade.d.ts.map +1 -0
  174. package/dist/worklet/engine-clips.d.ts +23 -0
  175. package/dist/worklet/engine-clips.d.ts.map +1 -0
  176. package/dist/worklet/engine-markers.d.ts +40 -0
  177. package/dist/worklet/engine-markers.d.ts.map +1 -0
  178. package/dist/worklet/engine-mixer-facade.d.ts +128 -0
  179. package/dist/worklet/engine-mixer-facade.d.ts.map +1 -0
  180. package/dist/worklet/engine-node.d.ts +81 -0
  181. package/dist/worklet/engine-node.d.ts.map +1 -0
  182. package/dist/worklet/engine-offline.d.ts +81 -0
  183. package/dist/worklet/engine-offline.d.ts.map +1 -0
  184. package/dist/worklet/engine-options.d.ts +12 -0
  185. package/dist/worklet/engine-options.d.ts.map +1 -0
  186. package/dist/worklet/engine-parameter-facade.d.ts +106 -0
  187. package/dist/worklet/engine-parameter-facade.d.ts.map +1 -0
  188. package/dist/worklet/engine-processor.d.ts +68 -0
  189. package/dist/worklet/engine-processor.d.ts.map +1 -0
  190. package/dist/worklet/engine-register.d.ts +2 -0
  191. package/dist/worklet/engine-register.d.ts.map +1 -0
  192. package/dist/worklet/engine-strips.d.ts +73 -0
  193. package/dist/worklet/engine-strips.d.ts.map +1 -0
  194. package/dist/worklet/engine-sync.d.ts +37 -0
  195. package/dist/worklet/engine-sync.d.ts.map +1 -0
  196. package/dist/worklet/engine-tempo-facade.d.ts +48 -0
  197. package/dist/worklet/engine-tempo-facade.d.ts.map +1 -0
  198. package/dist/worklet/engine.d.ts +397 -0
  199. package/dist/worklet/engine.d.ts.map +1 -0
  200. package/dist/worklet/guards.d.ts +47 -0
  201. package/dist/worklet/guards.d.ts.map +1 -0
  202. package/dist/worklet/messages.d.ts +710 -0
  203. package/dist/worklet/messages.d.ts.map +1 -0
  204. package/dist/worklet/mixer-processor.d.ts +46 -0
  205. package/dist/worklet/mixer-processor.d.ts.map +1 -0
  206. package/dist/worklet/playback-processor.d.ts +62 -0
  207. package/dist/worklet/playback-processor.d.ts.map +1 -0
  208. package/dist/worklet/protocol.d.ts +323 -0
  209. package/dist/worklet/protocol.d.ts.map +1 -0
  210. package/dist/worklet/voice-changer-processor.d.ts +41 -0
  211. package/dist/worklet/voice-changer-processor.d.ts.map +1 -0
  212. package/dist/worklet.d.ts +16 -2515
  213. package/dist/worklet.d.ts.map +1 -0
  214. package/dist/worklet.js +2763 -501
  215. package/dist/worklet.js.map +1 -1
  216. package/package.json +23 -12
  217. package/src/_effects_common.ts +17 -0
  218. package/src/_feature_validation.ts +34 -0
  219. package/src/_fft_options.ts +39 -0
  220. package/src/align_take.ts +64 -0
  221. package/src/analysis.ts +56 -3
  222. package/src/analysis_helpers.ts +7 -0
  223. package/src/audio.ts +106 -3
  224. package/src/codes.ts +39 -2
  225. package/src/effects_mastering.ts +97 -22
  226. package/src/effects_note_ops.ts +635 -0
  227. package/src/effects_percussive.ts +217 -0
  228. package/src/effects_separation.ts +150 -0
  229. package/src/effects_spectral.ts +60 -0
  230. package/src/effects_timepitch.ts +377 -0
  231. package/src/errors.ts +23 -1
  232. package/src/feature_core.ts +127 -2
  233. package/src/feature_decompose.ts +633 -0
  234. package/src/feature_inverse.ts +454 -0
  235. package/src/feature_loudness.ts +125 -0
  236. package/src/feature_music.ts +107 -14
  237. package/src/feature_pitch.ts +96 -1
  238. package/src/feature_spectral.ts +16 -611
  239. package/src/feature_spectrogram.ts +63 -450
  240. package/src/features.ts +36 -22
  241. package/src/index.ts +282 -30
  242. package/src/instrument_types.ts +645 -0
  243. package/src/live_audio.ts +27 -1
  244. package/src/mastering_chain.ts +184 -0
  245. package/src/mastering_core.ts +346 -32
  246. package/src/mastering_dynamics.ts +22 -11
  247. package/src/metering.ts +67 -24
  248. package/src/mixer.ts +212 -3
  249. package/src/mixing_assistant.ts +138 -0
  250. package/src/mixing_oneshot.ts +10 -5
  251. package/src/module_state.ts +24 -2
  252. package/src/playback_renderer.ts +252 -0
  253. package/src/polyphony.ts +279 -0
  254. package/src/project.ts +61 -24
  255. package/src/project_class.ts +450 -27
  256. package/src/project_internal.ts +149 -42
  257. package/src/project_synth.ts +67 -1
  258. package/src/project_types.ts +268 -270
  259. package/src/public_types.ts +122 -3
  260. package/src/public_types_acoustic.ts +112 -3
  261. package/src/public_types_mastering.ts +254 -73
  262. package/src/public_types_mixing.ts +363 -1
  263. package/src/public_types_music.ts +312 -2
  264. package/src/public_types_playback.ts +195 -0
  265. package/src/public_types_realtime.ts +39 -7
  266. package/src/public_types_repair.ts +446 -0
  267. package/src/public_types_spectral.ts +487 -1
  268. package/src/quick_analysis.ts +203 -26
  269. package/src/realtime_engine.ts +711 -28
  270. package/src/realtime_voice_changer.ts +55 -1
  271. package/src/repair_dereverb.ts +299 -0
  272. package/src/repair_impulsive.ts +395 -0
  273. package/src/repair_noise.ts +425 -0
  274. package/src/repair_trim.ts +226 -0
  275. package/src/sample_bank.ts +113 -0
  276. package/src/sonare.js.d.ts +1122 -30
  277. package/src/stream_analyzer.ts +36 -4
  278. package/src/stream_types.ts +37 -0
  279. package/src/streaming_mixing.ts +1 -1
  280. package/src/streaming_processors.ts +194 -10
  281. package/src/transcribe.ts +89 -0
  282. package/src/validation.ts +285 -11
  283. package/src/web_midi.ts +1 -6
  284. package/src/worker.ts +18 -2
  285. package/src/worklet/audio_types.ts +37 -0
  286. package/src/worklet/engine-mixer-facade.ts +444 -10
  287. package/src/worklet/engine-node.ts +78 -26
  288. package/src/worklet/engine-offline.ts +14 -8
  289. package/src/worklet/engine-parameter-facade.ts +21 -0
  290. package/src/worklet/engine-processor.ts +272 -83
  291. package/src/worklet/engine-register.ts +32 -18
  292. package/src/worklet/engine-strips.ts +280 -9
  293. package/src/worklet/engine-sync.ts +14 -6
  294. package/src/worklet/engine.ts +365 -31
  295. package/src/worklet/guards.ts +140 -44
  296. package/src/worklet/messages.ts +227 -2
  297. package/src/worklet/mixer-processor.ts +109 -47
  298. package/src/worklet/playback-processor.ts +300 -0
  299. package/src/worklet/protocol.ts +53 -3
  300. package/src/worklet/voice-changer-processor.ts +17 -11
  301. package/src/worklet.ts +17 -0
  302. package/src/effects_transform.ts +0 -718
  303. package/src/mastering_repair.ts +0 -273
@@ -0,0 +1,446 @@
1
+ /**
2
+ * Defect detection and repair report types: declick, declip, decrackle,
3
+ * denoise, dehum, dereverb and silence trim.
4
+ */
5
+
6
+ /**
7
+ * What a declick analysis found in one channel of a
8
+ * {@link MasteringRepairDeclickStereoResult}. Runs, not samples.
9
+ */
10
+ export interface ClickDetection {
11
+ /** Runs meeting the repair criteria. */
12
+ count: number;
13
+ /**
14
+ * Outlier runs the criteria excluded. A large value says `maxClickSamples`
15
+ * or `neighborRatio` is too tight for this material, not that the material
16
+ * is clean.
17
+ */
18
+ rejected: number;
19
+ /** Over the counted runs. */
20
+ longestRunSamples: number;
21
+ /** `count` divided by the input duration. */
22
+ perSecond: number;
23
+ }
24
+
25
+ /**
26
+ * What a declick pass found in one channel of a
27
+ * {@link MasteringRepairDeclickStereoResult} and what it did to it.
28
+ */
29
+ export interface DeclickReport {
30
+ /** This channel's own analysis of the input. */
31
+ detected: ClickDetection;
32
+ /**
33
+ * Runs interpolated. Larger than `detected.count` only under linked stereo
34
+ * detection.
35
+ */
36
+ repairedRuns: number;
37
+ /** Samples overwritten by interpolation. */
38
+ repairedSamples: number;
39
+ /**
40
+ * Of `repairedRuns`, those whose extent this channel's own detection did
41
+ * not produce. Always 0 from the mono `masteringRepairDeclick`.
42
+ */
43
+ linkedRuns: number;
44
+ /**
45
+ * False when the input was too short for `lpcOrder`: every fill then
46
+ * reduces to linear interpolation.
47
+ */
48
+ lpcModelUsed: boolean;
49
+ }
50
+
51
+ /**
52
+ * A declicked stereo pair and what each channel's pass found and did.
53
+ *
54
+ * A run either channel's detector selects is repaired in BOTH channels — a
55
+ * common-mode click repaired on one side only would move the stereo image.
56
+ * Only the selection is shared: each channel's fill is computed from its own
57
+ * samples and its own AR model, which is why `leftReport` and `rightReport`
58
+ * genuinely differ. `linkedRuns` is the part of `repairedRuns` this channel's
59
+ * own detection did not produce, so it is normally non-zero here. Merged runs
60
+ * can exceed `maxClickSamples`: that cap governs what may be selected, not
61
+ * how far a selection reaches once both channels agree a click is there.
62
+ */
63
+ export interface MasteringRepairDeclickStereoResult {
64
+ left: Float32Array;
65
+ right: Float32Array;
66
+ leftReport: DeclickReport;
67
+ rightReport: DeclickReport;
68
+ }
69
+
70
+ /**
71
+ * What a declip analysis found in one channel of a
72
+ * {@link MasteringRepairDeclipStereoResult}.
73
+ */
74
+ export interface ClipDetection {
75
+ /** Samples at or past `clipThreshold`. */
76
+ sampleCount: number;
77
+ /** `sampleCount` divided by the input length. */
78
+ sampleFraction: number;
79
+ /** Runs of consecutive clipped samples. */
80
+ runCount: number;
81
+ /** A run past the 512-sample cap takes the interpolation fallback instead of the solver. */
82
+ longestRunSamples: number;
83
+ /**
84
+ * Runs of at least 3 bit-identical samples sitting within 1 dB of the signal's peak. Reads
85
+ * clipping that survived a later gain change and so no longer reaches `clipThreshold` — the
86
+ * fields above see none of it. A genuinely flat-topped waveform (a square or pulse train, a
87
+ * fully limited master) counts here too and cannot be told apart from clipping in the time
88
+ * domain.
89
+ */
90
+ flatRunCount: number;
91
+ /** Over the counted flat-top runs. */
92
+ longestFlatRunSamples: number;
93
+ /** Samples belonging to a counted flat-top run. */
94
+ flatSampleCount: number;
95
+ /** The magnitude the counted runs sit at; 0 when there are none. */
96
+ flatLevel: number;
97
+ }
98
+
99
+ /**
100
+ * What a declip pass found in one channel of a
101
+ * {@link MasteringRepairDeclipStereoResult} and what it did to it.
102
+ */
103
+ export interface DeclipReport {
104
+ /** This channel's own analysis of the input. */
105
+ detected: ClipDetection;
106
+ /** Runs the Janssen solver filled. */
107
+ lpcReconstructedRuns: number;
108
+ /**
109
+ * Runs past the LPC gap cap, filled by interpolation instead: for these,
110
+ * `lpcOrder`, `iterations` and `lpcBlend` had no effect.
111
+ */
112
+ interpolatedRuns: number;
113
+ /** Samples overwritten by either fill. */
114
+ repairedSamples: number;
115
+ /**
116
+ * Of the repaired runs, those reaching past this channel's own clipped
117
+ * samples because the other channel's run was wider. Always 0 from the
118
+ * mono `masteringRepairDeclip`.
119
+ */
120
+ linkedRuns: number;
121
+ }
122
+
123
+ /**
124
+ * A declipped stereo pair and what each channel's pass found and did.
125
+ *
126
+ * Declip takes the union of both channels' clipped runs. Each channel
127
+ * reconstructs the whole of every union run it has at least one clipped
128
+ * sample in; a channel with none is left untouched there. `linkedRuns` is
129
+ * therefore 0 for a plateau clipped in only one channel, and non-zero only
130
+ * where both channels are clipped in the same region with different
131
+ * extents — the narrower channel is what reaches past its own clipped
132
+ * samples.
133
+ */
134
+ export interface MasteringRepairDeclipStereoResult {
135
+ left: Float32Array;
136
+ right: Float32Array;
137
+ leftReport: DeclipReport;
138
+ rightReport: DeclipReport;
139
+ }
140
+
141
+ /**
142
+ * What a decrackle analysis found in one channel of a
143
+ * {@link MasteringRepairDecrackleStereoResult}.
144
+ *
145
+ * Crackle is measured by the median criterion regardless of the configured `DecrackleMode` --
146
+ * wavelet shrinkage is a removal method, not a detection method, so this is the module's only
147
+ * definition of the defect.
148
+ */
149
+ export interface CrackleDetection {
150
+ /** Samples deviating from the local median by more than `threshold`. */
151
+ sampleCount: number;
152
+ /** `sampleCount` divided by the input length. */
153
+ sampleFraction: number;
154
+ /** `sampleCount` divided by the input duration. */
155
+ perSecond: number;
156
+ }
157
+
158
+ /**
159
+ * What a decrackle pass found in one channel of a
160
+ * {@link MasteringRepairDecrackleStereoResult} and what it did to it.
161
+ *
162
+ * The two modes remove crackle by different means and report through different fields. A field
163
+ * belonging to the other mode reads zero because that mode did not run -- the caller knows this
164
+ * from the config it passed, so it is not an unfilled value.
165
+ */
166
+ export interface DecrackleReport {
167
+ /** This channel's own analysis of the input. */
168
+ detected: CrackleDetection;
169
+ /** Median mode: samples the filter overwrote. Equal to `detected.sampleCount`. */
170
+ replacedSamples: number;
171
+ /** Wavelet mode: detail coefficients examined by the unshifted pass, not by every pass the mode averages. */
172
+ detailCoefficients: number;
173
+ /** Wavelet mode: of those, driven to zero. */
174
+ shrunkCoefficients: number;
175
+ /** Wavelet mode: the MAD noise estimate that set every level's threshold. The configured
176
+ * `threshold` is only a cap on it. */
177
+ noiseSigma: number;
178
+ }
179
+
180
+ /**
181
+ * A decrackled stereo pair and what each channel's pass found and did.
182
+ *
183
+ * Crackle is surface damage: the two channels carry different scratches at different instants,
184
+ * so there is no common event for a shared decision to agree about. Both modes are memoryless
185
+ * across channels, so the pair is processed independently and there is no `linkedRuns` field,
186
+ * unlike {@link MasteringRepairDeclickStereoResult} and {@link MasteringRepairDeclipStereoResult}.
187
+ */
188
+ export interface MasteringRepairDecrackleStereoResult {
189
+ left: Float32Array;
190
+ right: Float32Array;
191
+ leftReport: DecrackleReport;
192
+ rightReport: DecrackleReport;
193
+ }
194
+
195
+ /**
196
+ * What a dehum analysis found in one channel of a
197
+ * {@link MasteringRepairDehumStereoResult}.
198
+ *
199
+ * Always measured through the estimation path, whatever `DehumOptions.adaptive` says: the
200
+ * fixed path notches the configured frequency without ever looking for hum, so a detector
201
+ * following the flag would hand back its own input.
202
+ */
203
+ export interface HumDetection {
204
+ /** Tracked fundamental; the configured value when adaptive tracking is off. */
205
+ fundamentalHz: number;
206
+ /** Winning candidate's projected energy over the median candidate; 1.0 means no peak
207
+ * was found at all. Not a lock flag. */
208
+ fundamentalProminence: number;
209
+ /** Harmonics found above the floor, not necessarily a contiguous run from the first. */
210
+ harmonics: number;
211
+ /** Input level at each k*f0, k ascending, length 16. Measured for every k the sample
212
+ * rate carries, not only the notched ones; a k*f0 at or past Nyquist reads the dB floor
213
+ * because nothing is there to measure. */
214
+ harmonicDbfs: Float32Array;
215
+ }
216
+
217
+ /**
218
+ * What a dehum pass found in one channel of a
219
+ * {@link MasteringRepairDehumStereoResult} and what it did to it.
220
+ */
221
+ export interface DehumReport {
222
+ /** This channel's own analysis, before filtering. */
223
+ detected: HumDetection;
224
+ /** Harmonics the cascade reached; fewer than the configured `harmonics` once k*f0
225
+ * hits Nyquist. */
226
+ notchedHarmonics: number;
227
+ /** Frequency the last notch refresh used. */
228
+ appliedFundamentalHz: number;
229
+ /** Largest excursion of the tracked frequency from the configured one. Zero without
230
+ * adaptive tracking, which is the measurement rather than an unset field. */
231
+ fundamentalDriftHz: number;
232
+ }
233
+
234
+ /**
235
+ * A dehummed stereo pair and what each channel's pass found and did.
236
+ *
237
+ * Mains hum is one physical source, so with `DehumOptions.adaptive` set the tracker reads
238
+ * the channel mean and both cascades follow the one frequency it finds: `appliedFundamentalHz`
239
+ * and `fundamentalDriftHz` are therefore identical in both reports by construction, while each
240
+ * report's `detected` still measures that channel's own input and each channel keeps its own
241
+ * filter state. With `adaptive` clear, which is the default, nothing is shared and the two
242
+ * channels are filtered independently at the configured frequency.
243
+ */
244
+ export interface MasteringRepairDehumStereoResult {
245
+ left: Float32Array;
246
+ right: Float32Array;
247
+ leftReport: DehumReport;
248
+ rightReport: DehumReport;
249
+ }
250
+
251
+ /**
252
+ * What a denoise analysis found in a
253
+ * {@link MasteringRepairDenoiseClassicalStereoResult}.
254
+ *
255
+ * A pair-level measurement, and the only absolute one in that result: the estimator runs on
256
+ * the channel-summed power, so two identical channels read `10*log10(2)` -- about
257
+ * 3.01 dB -- above the same material through `masteringRepairDenoiseClassical`. Compare a stereo
258
+ * floor only against another stereo floor.
259
+ */
260
+ export interface NoiseDetection {
261
+ /** Broadband estimated noise floor, in dBFS. */
262
+ floorDbfs: number;
263
+ /** The floor's shape, low band to high, length 32. A geometric grid from 20 Hz to Nyquist --
264
+ * the same axis the mastering report's `bandEnergyDeltaDb` uses, so a noise floor and a
265
+ * tonal-balance change can be read together. */
266
+ bandFloorDbfs: Float32Array;
267
+ }
268
+
269
+ /**
270
+ * What a denoise pass found in a
271
+ * {@link MasteringRepairDenoiseClassicalStereoResult} and what it removed.
272
+ */
273
+ export interface DenoiseReport {
274
+ /** The pair's analysis, before the mask. */
275
+ detected: NoiseDetection;
276
+ /** Mean attenuation the gain mask applied. Zero reads the same whether the mask was
277
+ * transparent or no mask ran at all. */
278
+ meanReductionDb: number;
279
+ /** Deepest attenuation any cell applied; at `reductionDb` the floor set the depth rather
280
+ * than the estimate. */
281
+ maxReductionDb: number;
282
+ /** Fraction of cells sitting on that floor. Always 0 in `spectralSubtraction` mode, which
283
+ * floors on `spectralFloor` instead, so 0 from that mode is the mode and not a
284
+ * measurement. */
285
+ floorLimitedFraction: number;
286
+ }
287
+
288
+ /**
289
+ * A denoised stereo pair and the one mask that produced it.
290
+ *
291
+ * One `report` rather than a per-channel pair: the gain mask is built from the channel-summed
292
+ * power and applied unchanged to both channels, so the pass cannot move an interchannel level
293
+ * or phase difference, and a pair would be two copies of one measurement.
294
+ *
295
+ * Needs at least `nFft` samples and REJECTS a shorter input, the opposite of
296
+ * {@link MasteringRepairDereverbClassicalStereoResult}'s entry point, which pads one.
297
+ */
298
+ export interface MasteringRepairDenoiseClassicalStereoResult {
299
+ left: Float32Array;
300
+ right: Float32Array;
301
+ report: DenoiseReport;
302
+ }
303
+
304
+ /**
305
+ * A denoised channel set and the one mask that produced it.
306
+ *
307
+ * The N-channel form of {@link MasteringRepairDenoiseClassicalStereoResult}: one mask over the
308
+ * channel-summed power, applied unchanged to every channel, so no interchannel level or phase
309
+ * difference moves however many channels there are. One channel reproduces
310
+ * `masteringRepairDenoiseClassical` bit for bit; two reproduce the stereo entry plane for plane.
311
+ *
312
+ * `report.detected` is the SET's and absolute: N identical channels read `10*log10(N)` above one
313
+ * of them — about 3.01 dB for a pair and 4.77 dB for three. Every other field of the report is a
314
+ * fraction and does not move with the channel count.
315
+ */
316
+ export interface MasteringRepairDenoiseClassicalLinkedResult {
317
+ /** One output per input channel, in input order. */
318
+ channels: Float32Array[];
319
+ report: DenoiseReport;
320
+ }
321
+
322
+ /**
323
+ * What a dereverb analysis found in a
324
+ * {@link MasteringRepairDereverbClassicalStereoResult}.
325
+ *
326
+ * NOT an ISO 3382 reverberation time: no Schroeder integration, no noise-floor truncation,
327
+ * STFT bins rather than octave bands, and music is not a free decay. Use `estimateRoom` for a
328
+ * graded RT60; this reports what the module itself measured while deciding how much to
329
+ * subtract.
330
+ */
331
+ export interface ReverbDetection {
332
+ /** Decay across the module's own late lag, in dB. Less negative means the material sustains
333
+ * across that lag, which a late tail does and a dry offset does not -- so a reverberant
334
+ * input reads HIGHER here than the same material dry. */
335
+ lateDecayRatioDb: number;
336
+ /** Mean WPE predictor norm, before the clamp. Exactly 0 whenever the WPE stage did not run,
337
+ * which is the case unless `wpeEnabled` is set -- and it is clear by default, so a
338
+ * default-config pass reports 0 here as its measurement. */
339
+ latePredictability: number;
340
+ }
341
+
342
+ /**
343
+ * What a dereverb pass found in a
344
+ * {@link MasteringRepairDereverbClassicalStereoResult} and what it removed.
345
+ */
346
+ export interface DereverbReport {
347
+ /** The pair's analysis. */
348
+ detected: ReverbDetection;
349
+ /** Mean attenuation the subtraction applied. */
350
+ meanReductionDb: number;
351
+ /** Fraction of cells the `threshold` gate admitted as late reverberation. The only
352
+ * observation of that knob: 0 alongside a nonzero `meanReductionDb` says the gate admitted
353
+ * nothing. */
354
+ suppressedFraction: number;
355
+ /** Mean predictor norm actually applied, after the clamp. Below
356
+ * `detected.latePredictability` says the clamp acted, an otherwise silent branch. Zero when
357
+ * the WPE stage did not run, so 0 by default. */
358
+ wpePredictorNorm: number;
359
+ }
360
+
361
+ /**
362
+ * A dereverberated stereo pair and the one mask that produced it.
363
+ *
364
+ * One `report` rather than a per-channel pair: the mask is built from the channel-summed power
365
+ * and the WPE stage accumulates over both channels and applies one predictor set to each, so
366
+ * neither stage can move an interchannel level or phase difference.
367
+ *
368
+ * Every field of that report is a ratio or a fraction, so unlike {@link NoiseDetection}
369
+ * nothing here shifts with the channel count and a stereo figure is comparable against a mono
370
+ * one. An input shorter than `nFft` is PADDED for analysis rather than rejected, which is the
371
+ * opposite of {@link MasteringRepairDenoiseClassicalStereoResult}'s entry point.
372
+ */
373
+ export interface MasteringRepairDereverbClassicalStereoResult {
374
+ left: Float32Array;
375
+ right: Float32Array;
376
+ report: DereverbReport;
377
+ }
378
+
379
+ /**
380
+ * A dereverberated channel set and the one mask that produced it.
381
+ *
382
+ * The N-channel form of {@link MasteringRepairDereverbClassicalStereoResult}: one mask over the
383
+ * channel-summed power, and one WPE predictor set fitted over every channel's statistics, so
384
+ * neither stage can move an interchannel level or phase difference. One channel reproduces
385
+ * `masteringRepairDereverbClassical` bit for bit; two reproduce the stereo entry plane for plane.
386
+ *
387
+ * Every field of the report is a ratio or a fraction, so unlike
388
+ * {@link MasteringRepairDenoiseClassicalLinkedResult} nothing here shifts with the channel count.
389
+ * An input shorter than `nFft` is PADDED for analysis rather than rejected, again the opposite of
390
+ * that entry.
391
+ */
392
+ export interface MasteringRepairDereverbClassicalLinkedResult {
393
+ /** One output per input channel, in input order. */
394
+ channels: Float32Array[];
395
+ report: DereverbReport;
396
+ }
397
+
398
+ /** One half-open sample range, in INPUT-buffer coordinates. */
399
+ export interface TrimRange {
400
+ /** First kept sample. */
401
+ first: number;
402
+ /** One past the last kept sample. An empty range has `first >= lastExclusive`. */
403
+ lastExclusive: number;
404
+ }
405
+
406
+ /**
407
+ * What a trim pass kept and what it dropped.
408
+ *
409
+ * A pass that kept nothing reports `range` as `(inputLength, inputLength)`, which counts the
410
+ * whole buffer as removed head and leaves `removedTailSamples` at 0. The two still sum to the
411
+ * input length, so a caller reporting how much went reads the right total; only the split
412
+ * between the ends is arbitrary there.
413
+ */
414
+ export interface TrimReport {
415
+ /** The kept range, padding included. */
416
+ range: TrimRange;
417
+ /** Samples dropped before `range.first`. */
418
+ removedHeadSamples: number;
419
+ /** Samples dropped after `range.lastExclusive`. */
420
+ removedTailSamples: number;
421
+ }
422
+
423
+ /**
424
+ * A trimmed stereo pair, the range both channels were cut to, and the two per-channel scans
425
+ * that range is the union of.
426
+ *
427
+ * The only repair stereo result whose arrays are SHORTER than the input, so `left.length` is
428
+ * the output length and the input's says nothing about it. Both channels come back the same
429
+ * length, because one range cuts both.
430
+ *
431
+ * A pair in which NEITHER channel carries signal comes back as two empty arrays and a success,
432
+ * not an error.
433
+ *
434
+ * One `report` plus two ranges, which is neither of the earlier repair stereo shapes:
435
+ * `report.range` is the union that was applied to both channels, while `leftRange` and
436
+ * `rightRange` are the per-channel scans it was formed from, so a caller can see which channel
437
+ * decided each edge. A channel carrying nothing reports an empty range and contributes nothing
438
+ * to the union.
439
+ */
440
+ export interface MasteringRepairTrimSilenceStereoResult {
441
+ left: Float32Array;
442
+ right: Float32Array;
443
+ report: TrimReport;
444
+ leftRange: TrimRange;
445
+ rightRange: TrimRange;
446
+ }