@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,128 @@
1
+ import type { PlaybackDiagnostics, PlaybackRendererConfig, PlaybackRendererOptions, RenderPlaybackRequest, RenderPlaybackResult } from './public_types_playback';
2
+ /**
3
+ * An HRTF set (SHRF v1): the direct-sound impulse responses and inter-aural
4
+ * time delays a headphones-target {@link PlaybackRenderer} convolves each
5
+ * virtual speaker's signal with.
6
+ *
7
+ * This build embeds no HRTF data. The package ships the default set as the
8
+ * asset `@libraz/libsonare/hrtf/default.shrf`; fetch or read it and pass the
9
+ * bytes to {@link HrtfSet.fromBytes}. A renderer built from a set keeps its
10
+ * own copy, so deleting the set right after construction is safe.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const bytes = new Uint8Array(await (await fetch(hrtfUrl)).arrayBuffer());
15
+ * const hrtf = HrtfSet.fromBytes(bytes);
16
+ * const renderer = new PlaybackRenderer({ config: {}, hrtf, sampleRate: 48000 });
17
+ * hrtf.delete();
18
+ * ```
19
+ */
20
+ export declare class HrtfSet {
21
+ private native;
22
+ private released;
23
+ private constructor();
24
+ /** Builds an HRTF set from SHRF v1 bytes; malformed data throws. */
25
+ static fromBytes(bytes: Uint8Array): HrtfSet;
26
+ /** Releases the native handle. Idempotent, as the Node facade is. */
27
+ delete(): void;
28
+ /** Alias for {@link delete}, provided for cross-binding (Node) compatibility. */
29
+ destroy(): void;
30
+ }
31
+ /**
32
+ * Renders decoded movie audio (mono / stereo / 5.1 / 7.1 PCM) to headphones
33
+ * (binaural, head tracking, room model) or to stereo / 5.1 / 7.1 speakers
34
+ * (upmix, loudness alignment, night-mode DRC, dialogue level, speaker
35
+ * calibration, bass management).
36
+ *
37
+ * `config` follows `schemas/playback-renderer-config.schema.json`; see
38
+ * {@link PlaybackRendererConfig}. A headphones target requires `hrtf`.
39
+ *
40
+ * `processPlanar` copies every plane through the embind boundary, so it suits
41
+ * the main thread; like `processInterleaved`, a non-finite sample is replaced
42
+ * with 0 and counted rather than refused. The AudioWorklet path is
43
+ * `SonarePlaybackWorkletProcessor` in the worklet bundle.
44
+ */
45
+ export declare class PlaybackRenderer {
46
+ private native;
47
+ private released;
48
+ constructor(options: PlaybackRendererOptions);
49
+ /**
50
+ * Renders one planar block; every plane must carry the same frame count, at
51
+ * most `maxBlockSize` (0 is a no-op). With a fixed input layout the plane
52
+ * count must equal {@link inputChannels}; with `input.layout: "auto"` it
53
+ * must be 1, 2, 6 or 8, and a change switches the input layout without
54
+ * changing the latency. Non-finite input samples are replaced with 0 and
55
+ * counted ({@link nonFiniteDiscardCount}).
56
+ */
57
+ processPlanar(planes: Float32Array[]): Float32Array[];
58
+ /** Interleaved variant of {@link processPlanar}. Non-finite input samples are replaced with 0 and counted. */
59
+ processInterleaved(samples: Float32Array, inChannels: number): Float32Array;
60
+ /** Applies a complete configuration document; a changed prepare key throws. */
61
+ setConfig(config: PlaybackRendererConfig | string): void;
62
+ /** The current complete configuration document. */
63
+ config(): PlaybackRendererConfig;
64
+ /**
65
+ * Publishes the listener head orientation in degrees: right-handed,
66
+ * positive yaw turns the head right, positive pitch looks up, positive roll
67
+ * lowers the right ear. Ignored by a speakers target; a non-finite angle is
68
+ * ignored.
69
+ */
70
+ setHeadOrientation(yawDeg: number, pitchDeg?: number, rollDeg?: number): void;
71
+ /**
72
+ * Clears DSP state (filters, FIFOs, dynamics, convolution history, pending
73
+ * input-layout drains). Configuration and head pose are kept. Call it after
74
+ * a seek, from the thread that processes.
75
+ */
76
+ reset(): void;
77
+ /**
78
+ * Renderer latency in samples (headphones: near ear). Depends only on the
79
+ * target, the sample rate and distance compensation, never on realtime keys
80
+ * or the input layout.
81
+ */
82
+ latencySamples(): number;
83
+ /**
84
+ * Channel count of the active input layout. With `input.layout: "auto"`
85
+ * this follows the channel count of the most recent non-empty process call
86
+ * (2 before the first call).
87
+ */
88
+ inputChannels(): number;
89
+ /** Channel count of the output target. */
90
+ outputChannels(): number;
91
+ /**
92
+ * Inactive stages, per-stage latency, clamps, the active input layout, and
93
+ * the layout-switch / truncated-drain counters, as a plain object.
94
+ */
95
+ diagnostics(): PlaybackDiagnostics;
96
+ /** Non-finite input samples replaced with 0 since construction. */
97
+ nonFiniteDiscardCount(): number;
98
+ /** Releases the native handle. Idempotent, as the Node facade is. */
99
+ delete(): void;
100
+ /** Alias for {@link delete}, provided for cross-binding (Node) compatibility. */
101
+ destroy(): void;
102
+ }
103
+ /**
104
+ * Integrated-loudness meter for multichannel program material (BS.1770
105
+ * channel weights by channel count: 1, 2, 6 or 8), for measuring
106
+ * `loudness.program_lufs` ahead of a {@link PlaybackRenderer}.
107
+ */
108
+ export declare class PlaybackLoudnessMeter {
109
+ private native;
110
+ private released;
111
+ constructor(channels: number, sampleRate: number);
112
+ /** Feeds interleaved frames of any length. */
113
+ pushInterleaved(samples: Float32Array): void;
114
+ /** Integrated loudness of everything pushed so far, in LUFS. */
115
+ integratedLufs(): number;
116
+ /** Releases the native handle. Idempotent, as the Node facade is. */
117
+ delete(): void;
118
+ /** Alias for {@link delete}, provided for cross-binding (Node) compatibility. */
119
+ destroy(): void;
120
+ }
121
+ /**
122
+ * Offline one-shot playback render: builds a renderer internally, feeds the
123
+ * whole interleaved signal through it, and removes the renderer's own latency
124
+ * so the output aligns with the input frame for frame.
125
+ * An empty or non-finite `samples` is refused with an `InvalidParameter` error.
126
+ */
127
+ export declare function renderPlayback(request: RenderPlaybackRequest): RenderPlaybackResult;
128
+ //# sourceMappingURL=playback_renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"playback_renderer.d.ts","sourceRoot":"","sources":["../src/playback_renderer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AAsBjC;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,OAAO;IAClB,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,QAAQ,CAAS;IAEzB,OAAO;IAIP,oEAAoE;IACpE,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO;IAI5C,qEAAqE;IACrE,MAAM,IAAI,IAAI;IAQd,iFAAiF;IACjF,OAAO,IAAI,IAAI;CAGhB;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,QAAQ,CAAS;gBAEb,OAAO,EAAE,uBAAuB;IAS5C;;;;;;;OAOG;IACH,aAAa,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE;IAIrD,8GAA8G;IAC9G,kBAAkB,CAAC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,GAAG,YAAY;IAI3E,+EAA+E;IAC/E,SAAS,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,GAAG,IAAI;IAIxD,mDAAmD;IACnD,MAAM,IAAI,sBAAsB;IAIhC;;;;;OAKG;IACH,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,SAAI,EAAE,OAAO,SAAI,GAAG,IAAI;IAInE;;;;OAIG;IACH,KAAK,IAAI,IAAI;IAIb;;;;OAIG;IACH,cAAc,IAAI,MAAM;IAIxB;;;;OAIG;IACH,aAAa,IAAI,MAAM;IAIvB,0CAA0C;IAC1C,cAAc,IAAI,MAAM;IAIxB;;;OAGG;IACH,WAAW,IAAI,mBAAmB;IAIlC,mEAAmE;IACnE,qBAAqB,IAAI,MAAM;IAI/B,qEAAqE;IACrE,MAAM,IAAI,IAAI;IAQd,iFAAiF;IACjF,OAAO,IAAI,IAAI;CAGhB;AAED;;;;GAIG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,QAAQ,CAAS;gBAEb,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAIhD,8CAA8C;IAC9C,eAAe,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI;IAI5C,gEAAgE;IAChE,cAAc,IAAI,MAAM;IAIxB,qEAAqE;IACrE,MAAM,IAAI,IAAI;IAQd,iFAAiF;IACjF,OAAO,IAAI,IAAI;CAGhB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,oBAAoB,CAQnF"}
@@ -0,0 +1,202 @@
1
+ import type { NoteEditInput, NoteObject, PolyphonicAnalysisOptions, PolyphonicRenderOptions } from './public_types';
2
+ import type { ValidateOptions } from './validation';
3
+ /** Canonical request form for {@link analyzePolyphonic}. */
4
+ export interface AnalyzePolyphonicRequest extends PolyphonicAnalysisOptions, ValidateOptions {
5
+ samples: Float32Array;
6
+ /**
7
+ * Sample rate in Hz. Required: every duration in the chain — the ridge
8
+ * minimum, the note minimum, the per-frame windows — is converted to samples
9
+ * with this rate, so a wrong value silently analyses differently.
10
+ */
11
+ sampleRate: number;
12
+ }
13
+ /**
14
+ * A polyphonic analysis, held as a handle so one note of a chord can be edited
15
+ * and the result re-rendered without analysing the audio again.
16
+ *
17
+ * Created by {@link analyzePolyphonic}. **Release it with {@link destroy} as soon
18
+ * as you are done with it**: the handle owns the source's complex spectrogram plus
19
+ * the claimed bins of every note, which is the input over again plus the claims.
20
+ * That is the price of re-rendering an edit for free, and it is why this is a
21
+ * handle and not a result object — the measurement never crosses into JS.
22
+ *
23
+ * What crosses is what a host acts on: the notes ({@link notes}), each note's
24
+ * pending edit ({@link setNoteEdit}), the per-frame voice count
25
+ * ({@link polyphony}), and per note a pitch, a level and a salience curve. The
26
+ * spectrogram, the masks and the per-bin weights do not, and no method reports a
27
+ * per-bin figure.
28
+ *
29
+ * Using the analysis after it has been released throws `InvalidState` rather than
30
+ * reaching a freed native object.
31
+ */
32
+ export declare class PolyphonicAnalysis {
33
+ private native;
34
+ /** Analyses the request's audio. {@link analyzePolyphonic} is the same call. */
35
+ constructor(request: AnalyzePolyphonicRequest);
36
+ private handle;
37
+ /** Number of notes, which is also the number of claim sets. */
38
+ get noteCount(): number;
39
+ /** Number of STFT frames the analysis ran over. */
40
+ get frameCount(): number;
41
+ /**
42
+ * Every note, in the order their claim sets are held in — the same
43
+ * {@link NoteObject} shape `extractNotes` returns, so a host that edits through
44
+ * both doors sees one note.
45
+ *
46
+ * Each note carries its sample span, its frame span (in the analysis's own
47
+ * framing), its median pitch, its steadiness, its per-frame `amplitude` and its
48
+ * pending edit. The curves a note does not carry inline have their own accessors:
49
+ * {@link noteF0}, {@link noteSalience}, and {@link noteEnvelope} for the points
50
+ * last set through {@link setNoteEdit}. `amplitude` is {@link noteAmplitude}'s
51
+ * curve, read once per note.
52
+ */
53
+ notes(): NoteObject[];
54
+ /**
55
+ * Replaces one note's pending edit.
56
+ *
57
+ * The only thing a host writes. Everything else on a note is a measurement, and
58
+ * the order is the pairing with the claim sets, so neither is settable.
59
+ *
60
+ * An omitted field is the identity, so `{}` restores the identity edit. The
61
+ * envelope is `edit.amplitudeEnvelope`, which the handle copies, and its points
62
+ * are per-frame linear gains over the note's span on top of `gainDb` — stretched
63
+ * over whatever length the note renders at, so one entry is a constant gain and
64
+ * the count need not match the note's frame count. Every value must be finite
65
+ * and non-negative, which {@link render} is where it is checked, so one refusal
66
+ * names one place.
67
+ *
68
+ * @param note - Index below {@link noteCount}
69
+ * @throws {SonareError} `InvalidParameter` when `note` is out of range
70
+ */
71
+ setNoteEdit(note: number, edit: NoteEditInput): void;
72
+ /**
73
+ * Voices estimated per frame, before tracking dropped anything — one entry per
74
+ * frame from frame 0.
75
+ *
76
+ * What the estimation saw rather than what survived: a frame reported as three
77
+ * voices with two notes spanning it is the difference between the two stages,
78
+ * which is the figure a host deciding what to edit wants.
79
+ */
80
+ polyphony(): Int32Array;
81
+ /**
82
+ * One note's F0 in Hz, per frame over its own span.
83
+ *
84
+ * `frameEnd - frameStart` entries, so the value at index `i` belongs to frame
85
+ * `frameStart + i`. This is the curve the monophonic door makes a caller pass
86
+ * back in; here the handle already holds it, so a curve edit needs nothing from
87
+ * the caller.
88
+ *
89
+ * @throws {SonareError} `InvalidParameter` when `note` is out of range
90
+ */
91
+ noteF0(note: number): Float32Array;
92
+ /** One note's linear RMS, per frame over its own span. Indexed as {@link noteF0}. */
93
+ noteAmplitude(note: number): Float32Array;
94
+ /**
95
+ * One note's salience, per frame over its own span. Indexed as {@link noteF0},
96
+ * and the one curve here that is not the note's own: it is the tracked ridge's,
97
+ * so a frame of the note the ridge does not reach reads 0.
98
+ *
99
+ * Salience is what the estimation scored the candidate at, so it says how well
100
+ * the material supported this note rather than how loud the note is —
101
+ * {@link noteAmplitude} is the loud.
102
+ */
103
+ noteSalience(note: number): Float32Array;
104
+ /**
105
+ * The stretch fitted for each note, one entry per note in {@link notes}' order.
106
+ *
107
+ * Empty when `estimateInharmonicity` was not set, so an empty array means the
108
+ * fit was never asked for. A non-negative entry is a fitted stretch; **exactly
109
+ * `-1` is the refusal**, and a refused note's claims were placed at the
110
+ * `inharmonicity` the request declared instead.
111
+ *
112
+ * **`0` is a fitted result and means the harmonic series**, which is why the
113
+ * refusal is reported at all: the declared stretch also defaults to 0, so the
114
+ * effective value alone cannot separate a fit that reached the material from one
115
+ * that did not. The fit refuses a chord at the default framing, so the
116
+ * distinction is the usual case rather than an edge one.
117
+ *
118
+ * @example
119
+ * ```typescript
120
+ * const analysis = analyzePolyphonic({ samples, sampleRate, estimateInharmonicity: true });
121
+ * const fitted = analysis.noteInharmonicity();
122
+ * const reached = [...fitted].filter((stretch) => stretch >= 0).length;
123
+ * ```
124
+ */
125
+ noteInharmonicity(): Float32Array;
126
+ /**
127
+ * One note's amplitude envelope points, as last set — the same array
128
+ * `notes()[note].edit.amplitudeEnvelope` carries.
129
+ *
130
+ * Indexed from 0 rather than over the note's span: an envelope is a set of gain
131
+ * points stretched over whatever length the note renders at, not a per-frame
132
+ * signal. The only one of the four curves that is not a measurement, and empty on
133
+ * a note carrying no envelope.
134
+ */
135
+ noteEnvelope(note: number): Float32Array;
136
+ /**
137
+ * Renders the analysis back to audio with whatever edits its notes carry, at the
138
+ * source's length.
139
+ *
140
+ * Each note's claimed share is inverted, edited, and added to the residual — the
141
+ * part of the input no note claimed. With every edit identity the result is the
142
+ * analysis's own round trip, not the source bit for bit, the STFT round trip's
143
+ * error being neither added to nor removed here.
144
+ *
145
+ * The render is additive per note with no cross-note term, so an unedited note's
146
+ * contribution is identical between two renders. That is also the limit: a host
147
+ * cannot tell from two renders whether a claim set divided the energy correctly.
148
+ *
149
+ * @throws {SonareError} `InvalidParameter` on an option or an edit field the
150
+ * renderer rejects — a non-positive stretch ratio, a negative or non-finite
151
+ * envelope point, or a vibrato or drift edit on a note carrying no usable
152
+ * pitch curve
153
+ */
154
+ render(options?: PolyphonicRenderOptions): Float32Array;
155
+ /**
156
+ * Releases the underlying WASM object and everything it holds. Idempotent,
157
+ * as the Node facade is; any other method called after this one still
158
+ * throws `InvalidState` rather than reaching a freed native object.
159
+ */
160
+ delete(): void;
161
+ /** Alias for {@link delete}, provided for cross-binding (Node) compatibility. */
162
+ destroy(): void;
163
+ }
164
+ /**
165
+ * Analyses audio into editable notes and returns a handle to the analysis.
166
+ *
167
+ * One pass: one STFT, the multi-F0 extraction over it, a claim set per tracked
168
+ * ridge, the apportionment of the bins two notes stand on, and the measured fields
169
+ * of each note. Every note comes back with the identity edit, so rendering the
170
+ * result unchanged reproduces the analysis's own round trip.
171
+ *
172
+ * An analysis finding no notes is not an error. Silence, or material the register
173
+ * of the framing cannot resolve, tracks no ridge; rendering that is the residual
174
+ * alone, which is the whole round trip.
175
+ *
176
+ * **This is for spans, not for whole songs.** The handle holds the source's
177
+ * complex spectrogram plus every note's claimed bins — roughly 1,440 MiB for five
178
+ * minutes of audio against a 2 GiB linear-memory cap — so analyse the passage you
179
+ * are editing and {@link PolyphonicAnalysis.destroy} it when done.
180
+ *
181
+ * @throws {RangeError} on empty samples, a non-finite sample, or a `sampleRate`
182
+ * outside `[8000, 384000]`
183
+ * @throws {SonareError} `InvalidParameter` on a config value the chain rejects,
184
+ * or on audio too short for two STFT frames at the configured `nFft`/`hopLength`
185
+ * (roughly one `hopLength`, ~512 samples at the default)
186
+ *
187
+ * @example
188
+ * ```typescript
189
+ * const analysis = analyzePolyphonic({ samples, sampleRate, maxPolyphony: 3 });
190
+ * try {
191
+ * // Transpose the lowest note of the chord up a semitone.
192
+ * const notes = analysis.notes();
193
+ * const lowest = notes.reduce((a, b) => (a.medianHz <= b.medianHz ? a : b));
194
+ * analysis.setNoteEdit(notes.indexOf(lowest), { pitchShiftSemitones: 1 });
195
+ * const edited = analysis.render();
196
+ * } finally {
197
+ * analysis.destroy();
198
+ * }
199
+ * ```
200
+ */
201
+ export declare function analyzePolyphonic(request: AnalyzePolyphonicRequest): PolyphonicAnalysis;
202
+ //# sourceMappingURL=polyphony.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"polyphony.d.ts","sourceRoot":"","sources":["../src/polyphony.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EACV,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAGpD,4DAA4D;AAC5D,MAAM,WAAW,wBAAyB,SAAQ,yBAAyB,EAAE,eAAe;IAC1F,OAAO,EAAE,YAAY,CAAC;IACtB;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAgC;IAE9C,gFAAgF;gBACpE,OAAO,EAAE,wBAAwB;IAW7C,OAAO,CAAC,MAAM;IAWd,+DAA+D;IAC/D,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,mDAAmD;IACnD,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED;;;;;;;;;;;OAWG;IACH,KAAK,IAAI,UAAU,EAAE;IAIrB;;;;;;;;;;;;;;;;OAgBG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,GAAG,IAAI;IAIpD;;;;;;;OAOG;IACH,SAAS,IAAI,UAAU;IAIvB;;;;;;;;;OASG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY;IAIlC,qFAAqF;IACrF,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY;IAIzC;;;;;;;;OAQG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY;IAIxC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,iBAAiB,IAAI,YAAY;IAIjC;;;;;;;;OAQG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY;IAIxC;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,OAAO,GAAE,uBAA4B,GAAG,YAAY;IAI3D;;;;OAIG;IACH,MAAM,IAAI,IAAI;IASd,iFAAiF;IACjF,OAAO,IAAI,IAAI;CAGhB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,kBAAkB,CAEvF"}
@@ -0,0 +1,8 @@
1
+ export type { Articulation, BuiltinSynthBinding, BuiltinSynthConfig, BuiltinSynthWaveform, ControllerAxis, ControllerBinding, ControllerInput, MpeDimension, NoteTracking, SampleDesc, SampleDescLoopMode, SampleKeyTrack, SampleLoopMode, SampleZoneDesc, Sf2InstrumentConfig, Sf2ProgramStatus, SourceBackend, SynthBodyType, SynthEngineMode, SynthEnumTables, SynthFilterModel, SynthFilterOutput, SynthModDestination, SynthModRouting, SynthModSource, SynthOscWaveform, SynthPatch, SynthRetrigger, } from './instrument_types';
2
+ export { ARTICULATIONS, BUILTIN_SYNTH_WAVEFORMS, CONTROLLER_AXES, CONTROLLER_INPUTS, MPE_DIMENSIONS, NOTE_TRACKINGS, SAMPLE_KEY_TRACKS, SAMPLE_LOOP_MODES, SYNTH_BODY_TYPES, SYNTH_ENGINE_MODES, SYNTH_FILTER_MODELS, SYNTH_FILTER_OUTPUTS, SYNTH_MOD_DESTINATIONS, SYNTH_MOD_SOURCES, SYNTH_OSC_WAVEFORMS, SYNTH_RETRIGGERS, } from './instrument_types';
3
+ export { Project } from './project_class';
4
+ export { controllerProfileNames, projectAbiVersion, synthEnumTables, synthGsDrumKitIsVoicedApart, synthGsDrumKitName, synthGsVariationIsVoicedApart, synthPatchRoundTripForTest, synthPresetNames, synthPresetPatch, } from './project_synth';
5
+ export type { AlignTakeToReferenceRequest, AlignTakeToReferenceResult, ExternalSeparatedStem, ExternalSeparatedStemImportRequest, ExternalSeparatedStemImportResult, MidiCcLearnOptions, ProjectAssistSidecar, ProjectAssistSidecarInput, ProjectAutomationCurve, ProjectAutomationLaneDesc, ProjectAutomationPoint, ProjectAutomationTargetKind, ProjectBounceOptions, ProjectChordSymbol, ProjectClip, ProjectClipCompSegment, ProjectClipDesc, ProjectClipFade, ProjectClipTake, ProjectCompileResult, ProjectDeserializeResult, ProjectDiagnostic, ProjectFadeCurve, ProjectKeySegment, ProjectLoopMode, ProjectLoopRecordingDesc, ProjectLoopRecordingResult, ProjectMarker, ProjectMidiCcBinding, ProjectMidiCcBindingKind, ProjectMidiClipResult, ProjectMidiEvent, ProjectMidiFxBakeRequest, ProjectMidiFxBakeResult, ProjectMidiFxPreviewRequest, ProjectMidiRouteConfig, ProjectMidiRouteResult, ProjectNotePairValidation, ProjectSource, ProjectTempoCandidate, ProjectTempoOptions, ProjectTempoSegment, ProjectTimeSignatureSegment, ProjectTrack, ProjectTrackDesc, ProjectTrackKind, ProjectTranscribeRequest, ProjectWarpAnchor, ProjectWarpMapDesc, ProjectWarpMode, TakeAlignment, TranscribeOptions, TranscribeResult, } from './project_types';
6
+ export { AutomationTargetKind, EXPECTED_PROJECT_ABI_VERSION, MarkerKind, PROJECT_AUTOMATION_TARGET_OPAQUE, PROJECT_AUTOMATION_TARGET_TRACK_FADER_DB, PROJECT_AUTOMATION_TARGET_TRACK_PAN, } from './project_types';
7
+ export { SampleBank } from './sample_bank';
8
+ //# sourceMappingURL=project.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,cAAc,GACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,eAAe,EACf,2BAA2B,EAC3B,kBAAkB,EAClB,6BAA6B,EAC7B,0BAA0B,EAC1B,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,2BAA2B,EAC3B,0BAA0B,EAC1B,qBAAqB,EACrB,kCAAkC,EAClC,iCAAiC,EACjC,kBAAkB,EAClB,oBAAoB,EACpB,yBAAyB,EACzB,sBAAsB,EACtB,yBAAyB,EACzB,sBAAsB,EACtB,2BAA2B,EAC3B,oBAAoB,EACpB,kBAAkB,EAClB,WAAW,EACX,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,wBAAwB,EACxB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,wBAAwB,EACxB,0BAA0B,EAC1B,aAAa,EACb,oBAAoB,EACpB,wBAAwB,EACxB,qBAAqB,EACrB,gBAAgB,EAChB,wBAAwB,EACxB,uBAAuB,EACvB,2BAA2B,EAC3B,sBAAsB,EACtB,sBAAsB,EACtB,yBAAyB,EACzB,aAAa,EACb,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,2BAA2B,EAC3B,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,wBAAwB,EACxB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,oBAAoB,EACpB,4BAA4B,EAC5B,UAAU,EACV,gCAAgC,EAChC,wCAAwC,EACxC,mCAAmC,GACpC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC"}