@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,850 @@
1
+ import type { Articulation, ControllerBinding, MpeDimension, NoteTracking, ProjectMidiCcBinding, SynthPatch } from './project';
2
+ import type { EqBand, PanLawInput, PanMode, SendTiming, SidechainSourceKind, UmpWords } from './public_types';
3
+ import type { WasmClipPageRequest, WasmEngineAutomationPoint, WasmEngineBounceOptions, WasmEngineBounceResult, WasmEngineCaptureStatus, WasmEngineClip, WasmEngineFreezeOptions, WasmEngineFreezeResult, WasmEngineGraphSpec, WasmEngineMarker, WasmEngineMeterTelemetry, WasmEngineMeterTelemetryWide, WasmEngineMetronomeConfig, WasmEngineParameterInfo, WasmEngineProcessWithMonitorResult, WasmEngineScopeTelemetry, WasmEngineTelemetry, WasmEngineTempoSegment, WasmEngineTimeSignatureSegment, WasmEngineTransportState, WasmExternalMidiEvent } from './sonare.js';
4
+ export type ExternalMidiEvent = WasmExternalMidiEvent;
5
+ export type EngineClip = WasmEngineClip;
6
+ export type ClipPageRequest = WasmClipPageRequest;
7
+ export type EngineParameterInfo = WasmEngineParameterInfo;
8
+ export type EngineAutomationPoint = WasmEngineAutomationPoint;
9
+ export type EngineMarker = WasmEngineMarker;
10
+ export type EngineMetronomeConfig = WasmEngineMetronomeConfig;
11
+ export type EngineGraphSpec = WasmEngineGraphSpec;
12
+ export type EngineCaptureStatus = WasmEngineCaptureStatus;
13
+ export type EngineCaptureSource = EngineCaptureStatus['source'] | number;
14
+ export type EngineBounceOptions = WasmEngineBounceOptions;
15
+ export type EngineBounceResult = WasmEngineBounceResult;
16
+ export type EngineFreezeOptions = WasmEngineFreezeOptions;
17
+ export type EngineFreezeResult = WasmEngineFreezeResult;
18
+ export type EngineTelemetry = WasmEngineTelemetry;
19
+ export type EngineMeterTelemetry = WasmEngineMeterTelemetry;
20
+ export type EngineMeterTelemetryWide = WasmEngineMeterTelemetryWide;
21
+ export type EngineScopeTelemetry = WasmEngineScopeTelemetry;
22
+ export type EngineTransportState = WasmEngineTransportState;
23
+ export type EngineTempoSegment = WasmEngineTempoSegment;
24
+ export type EngineTimeSignatureSegment = WasmEngineTimeSignatureSegment;
25
+ export interface EngineTrackSend {
26
+ busId: number;
27
+ levelDb?: number;
28
+ enabled?: boolean;
29
+ /**
30
+ * Pre/post-fader tap point. Defaults to post-fader when omitted, matching the
31
+ * historical lane-send behavior and the scene-JSON default.
32
+ */
33
+ sendTiming?: SendTiming | number;
34
+ }
35
+ export interface EngineTrackLane {
36
+ trackId: number;
37
+ sends?: EngineTrackSend[];
38
+ /**
39
+ * Bus the lane's post-fader output sums into instead of the master mix
40
+ * (group/folder routing); 0 or absent keeps the lane on the master mix.
41
+ */
42
+ outputBusId?: number;
43
+ /**
44
+ * Input channel layout of the source feeding this lane (`SonareChannelLayout`:
45
+ * 0 mono, 1 stereo, 2 5.1, 3 7.1). Absent defaults to stereo. Stored but inert
46
+ * until the surround DSP path lands.
47
+ */
48
+ sourceChannelLayout?: number;
49
+ }
50
+ /** Per-track cue/monitor tap mode: off, pre-fader listen, or after-fader listen. */
51
+ export type EngineTrackMonitorMode = 'off' | 'pfl' | 'afl' | 0 | 1 | 2;
52
+ /** Short alias for {@link EngineTrackMonitorMode}. */
53
+ export type TrackMonitorMode = EngineTrackMonitorMode;
54
+ export interface EngineBus {
55
+ busId: number;
56
+ gainDb?: number;
57
+ /**
58
+ * Channel layout of the bus (`SonareChannelLayout`: 0 mono, 1 stereo, 2 5.1,
59
+ * 3 7.1). A surround layout makes this a surround group bus: lanes routed to
60
+ * it are surround-panned and it sums into the master plane-by-plane. Defaults
61
+ * to stereo.
62
+ */
63
+ channelLayout?: number;
64
+ /**
65
+ * Bus this bus's output sums into instead of the master mix (bus-to-bus
66
+ * routing); 0 or absent keeps it on the master mix.
67
+ */
68
+ outputBusId?: number;
69
+ /**
70
+ * Sends to other buses, in the same shape as a track lane's sends. A
71
+ * pre-fader send taps before `gainDb`, a post-fader one after it.
72
+ */
73
+ sends?: EngineTrackSend[];
74
+ }
75
+ export interface EngineMidiEvent {
76
+ /** Absolute render frame for this event. Default `0`. */
77
+ renderFrame?: number;
78
+ word0?: number;
79
+ word1?: number;
80
+ word2?: number;
81
+ word3?: number;
82
+ wordCount?: number;
83
+ /**
84
+ * Redundant with `word0`, which already carries the UMP group in bits 24..27.
85
+ * The engine reads the group from `word0` — the form that reaches a device or
86
+ * a file — so packing it there is sufficient and a value here that contradicts
87
+ * `word0` is ignored. Must still be in `[0, 15]`; anything else is rejected as
88
+ * a malformed event. Default `0`.
89
+ *
90
+ * Utility (`word0` type nibble `0x0`) and UMP Stream (`0xF`) messages have no
91
+ * group field — those bits are Reserved and `form`/`status` respectively — so
92
+ * they always read as group `0` and packing a group into them has no effect.
93
+ */
94
+ group?: number;
95
+ sysexHandle?: number;
96
+ data0?: number;
97
+ data1?: number;
98
+ }
99
+ export interface EngineMidiClipSchedule {
100
+ id?: number;
101
+ trackId?: number;
102
+ destinationId?: number;
103
+ startSample?: number;
104
+ startPpq?: number;
105
+ lengthSamples?: number;
106
+ loop?: boolean;
107
+ loopLengthSamples?: number;
108
+ events: EngineMidiEvent[];
109
+ /**
110
+ * Linear gain applied to the destination instrument's rendered audio while
111
+ * this clip is the most recently started active clip on it. Absent defaults
112
+ * to `1` (unity).
113
+ */
114
+ gain?: number;
115
+ /**
116
+ * Linear fade lengths over the clip's full length (not per internal loop
117
+ * repeat). Absent defaults to `0` (no fade). `fadeOutSamples` above `0` is
118
+ * rejected when `lengthSamples` is absent or `<= 0` (open-ended): an
119
+ * open-ended clip has no end to fade out towards.
120
+ */
121
+ fadeInSamples?: number;
122
+ fadeOutSamples?: number;
123
+ }
124
+ export declare const EXPECTED_ENGINE_ABI_VERSION = 3;
125
+ /** Options for {@link RealtimeEngine.bindMidiCc}. All fields are optional. */
126
+ export interface MidiCcBindOptions {
127
+ /** Lower end of the mapped parameter range. Default `0`. */
128
+ minValue?: number;
129
+ /** Upper end of the mapped parameter range. Default `1`. */
130
+ maxValue?: number;
131
+ }
132
+ /** Request form of {@link RealtimeEngine.renderOffline}. */
133
+ export interface RenderOfflineRequest {
134
+ /** One buffer per output plane; their common length is the render span. */
135
+ channels: Float32Array[];
136
+ /** Render block size. Default `128`. */
137
+ blockSize?: number;
138
+ /**
139
+ * Whether this call ends the timeline. `true` (the default, and what a
140
+ * one-shot bounce wants) releases every sounding note and flushes the PDC /
141
+ * alignment delay lines before returning. `false` renders one CHUNK of a
142
+ * longer timeline: a note held across the chunk boundary keeps sounding into
143
+ * the next call and the delay lines carry their history over, so consecutive
144
+ * chunks concatenate to exactly what one continuous render of the same span
145
+ * produces. Call {@link RealtimeEngine.finishOfflineRender} once after the
146
+ * last chunk.
147
+ *
148
+ * Sample-exact concatenation requires every chunk to use the same `blockSize`
149
+ * and a frame count that is a whole number of blocks: each call restarts the
150
+ * block grid at its own frame 0 and renders a short final block for the
151
+ * remainder, and the clip / automation / MIDI-clip snapshots are frozen once
152
+ * per block, so a chunk that ends mid-block shifts every later block
153
+ * boundary. Audio stays continuous either way; only bit-identity is lost.
154
+ */
155
+ finalize?: boolean;
156
+ }
157
+ export interface EngineCapabilities {
158
+ engineAbiVersion: number;
159
+ expectedEngineAbiVersion: number;
160
+ abiCompatible: boolean;
161
+ sharedArrayBuffer: boolean;
162
+ atomics: boolean;
163
+ audioWorklet: boolean;
164
+ mode: 'sab' | 'postMessage';
165
+ }
166
+ export declare function engineCapabilities(): EngineCapabilities;
167
+ export declare class RealtimeEngine {
168
+ private native;
169
+ private released;
170
+ constructor(sampleRate?: number, maxBlockSize?: number, commandCapacity?: number, telemetryCapacity?: number, maxChannels?: number);
171
+ /**
172
+ * Size the engine's queues and scratch for a sample rate and block size.
173
+ *
174
+ * `commandCapacity` must not exceed 65536 and `telemetryCapacity` must not
175
+ * exceed 16384; a larger value throws and leaves the engine untouched. The
176
+ * telemetry number is not a queue depth paid for one-for-one: the engine
177
+ * reserves that many meter records per metered lane, so its memory cost is
178
+ * far larger than the number given here.
179
+ */
180
+ prepare(sampleRate: number, maxBlockSize: number, commandCapacity?: number, telemetryCapacity?: number, maxChannels?: number): void;
181
+ /** Queue a sample-accurate parameter change (engine kSetParam). */
182
+ setParameter(paramId: number, value: number, renderFrame?: number): void;
183
+ /** Queue a smoothed parameter change (engine kSetParamSmoothed). */
184
+ setParameterSmoothed(paramId: number, value: number, renderFrame?: number): void;
185
+ /**
186
+ * Set the default ramp time (ms) for engine-level smoothed parameters —
187
+ * fader/pan glides, insert-parameter automation, and MIDI-CC mappings. The
188
+ * default is 20 ms; pass `0` for instant (un-ramped) changes.
189
+ */
190
+ setParamSmoothingMs(smoothingMs: number): void;
191
+ setSoloMute(laneIndex: number, solo: boolean, mute: boolean, renderFrame?: number): void;
192
+ /** Queue a per-track PFL/AFL monitor tap mode change. */
193
+ setTrackMonitorMode(laneIndex: number, mode: EngineTrackMonitorMode, renderFrame?: number): void;
194
+ setMidiClips(clips: readonly EngineMidiClipSchedule[]): void;
195
+ setBuiltinInstrument(config?: {
196
+ destinationId?: number;
197
+ } & Record<string, unknown>, destinationId?: number): void;
198
+ /**
199
+ * Bind the patch-driven NativeSynth to a realtime MIDI destination. `patch`
200
+ * is a {@link SynthPatch} or a preset-name string (`'saw-lead'` /
201
+ * `'va:saw-lead'`; see {@link synthPresetNames}), resolving exactly like
202
+ * {@link Project.bounceWithSynthInstrument}. Live note/CC commands and
203
+ * scheduled MIDI clips routed to that destination render through the synth.
204
+ * Unknown preset names throw. An object patch's `destinationId` is a JS
205
+ * binding convenience, not part of the NativeSynth patch itself.
206
+ *
207
+ * An `engineMode: 'sample'` patch also carries the {@link SampleBank} its
208
+ * keymap names. The synth takes a share of the bank, so it may be released
209
+ * right after this call; a sample patch bound without one renders silence.
210
+ */
211
+ setSynthInstrument(patch?: SynthPatch | string, destinationId?: number): void;
212
+ /**
213
+ * Load (parse) SoundFont 2 bytes into the engine so SF2 instruments can be
214
+ * bound with {@link setSf2Instrument}. The host fetches the `.sf2` and
215
+ * passes the raw bytes; they are copied into linear memory for the call and
216
+ * not referenced afterwards. Replaces any previously loaded SoundFont.
217
+ */
218
+ loadSoundFont(data: Uint8Array): void;
219
+ /**
220
+ * Bind a GS-compatible SoundFont player to a realtime MIDI destination, fed
221
+ * by the engine's loaded SoundFont ({@link loadSoundFont}). Live note/CC
222
+ * commands and scheduled MIDI clips routed to that destination render
223
+ * through the player (16 MIDI channels, channel 10 drums, GS NRPN part
224
+ * edits, GS/GM SysEx resets). Without a loaded SoundFont — or for programs
225
+ * the SoundFont does not cover — notes play through the built-in
226
+ * synthesizer GM fallback bank (the data-free floor).
227
+ */
228
+ setSf2Instrument(config?: {
229
+ destinationId?: number;
230
+ gain?: number;
231
+ polyphony?: number;
232
+ preferModelForModeledFamilies?: boolean;
233
+ clearBankRig?: boolean;
234
+ gsEfxRealization?: 'modern' | 'classic';
235
+ }, destinationId?: number): void;
236
+ clearMidiInstrument(destinationId?: number): void;
237
+ midiInstrumentCount(): number;
238
+ /**
239
+ * Bind a live MIDI CC to an engine automation parameter. The MIDI event still
240
+ * reaches the destination instrument; when bound, its 7-bit value is also
241
+ * mapped into [minValue, maxValue] for `paramId`.
242
+ */
243
+ bindMidiCc(channel: number, controller: number, paramId: number, options?: MidiCcBindOptions): void;
244
+ /** Bind a 7/14-bit CC, RPN, or NRPN descriptor to a live parameter. */
245
+ bindMidiCcBinding(binding: ProjectMidiCcBinding): void;
246
+ clearMidiCcBindings(): void;
247
+ midiCcBindingCount(): number;
248
+ /**
249
+ * Replace a destination instrument's controller profile with a named preset
250
+ * (see {@link controllerProfileNames}). Installing a profile drops every
251
+ * channel's accumulated axis values: the new bindings say nothing about what
252
+ * the old ones had reached. An unknown name throws, and so does a destination
253
+ * with no instrument or one whose instrument holds no profile.
254
+ */
255
+ setControllerProfile(destinationId: number, presetName: string): void;
256
+ /** Add one {@link ControllerBinding} on top of the destination's current profile. */
257
+ bindController(destinationId: number, binding: ControllerBinding): void;
258
+ /**
259
+ * Drop every binding of the destination's controller profile. The instrument
260
+ * keeps a profile; it resolves nothing until something is bound again.
261
+ */
262
+ clearControllerBindings(destinationId: number): void;
263
+ controllerBindingCount(destinationId: number): number;
264
+ /**
265
+ * Whether note-on velocity is expression for this instrument. No fixed
266
+ * default is possible — a wind controller ships sending breath-derived
267
+ * velocity on one model and a constant on the next — so each preset states it
268
+ * and a host building its own profile sets it. When false the synth takes
269
+ * every note at full scale and the bound axes carry the dynamics alone.
270
+ */
271
+ setControllerVelocityMeaningful(destinationId: number, meaningful: boolean): void;
272
+ controllerVelocityMeaningful(destinationId: number): boolean;
273
+ /**
274
+ * Say which note a value addressed to a whole MIDI channel belongs to when
275
+ * several are sounding on it, for one per-note dimension
276
+ * ({@link MPE_DIMENSIONS}, {@link NOTE_TRACKINGS}).
277
+ *
278
+ * Set per dimension because the useful answers differ: pressure following the
279
+ * newest note while bend reaches every one is a real configuration, not a
280
+ * mistake. MPE poses this question and declines to answer it, so this is a
281
+ * choice rather than a rule — and it is read only inside an MPE zone, and
282
+ * only while more than one note is sounding on the channel, which an MPE
283
+ * sender avoids by giving each note its own member channel.
284
+ *
285
+ * Both arguments are required and are a name or its ordinal; an unknown
286
+ * spelling is refused rather than resolved to a default, as are a destination
287
+ * with no instrument and one whose instrument holds no controller profile.
288
+ */
289
+ setControllerNoteTracking(destinationId: number, dimension: MpeDimension | number, tracking: NoteTracking | number): void;
290
+ /**
291
+ * Read back {@link setControllerNoteTracking} for one dimension, as the
292
+ * canonical name.
293
+ */
294
+ controllerNoteTracking(destinationId: number, dimension: MpeDimension | number): NoteTracking | number;
295
+ /**
296
+ * Set how one MIDI channel (0–15) of a destination's instrument treats a
297
+ * note-on while another note on that channel is still held: `'poly'` takes a
298
+ * new voice each time, `'mono-retrigger'` stops and restarts the note (what
299
+ * GS MONO MODE and CC126 mean), `'mono-legato'` carries the sounding voice
300
+ * and only moves its pitch — a wind player's slur, which no MIDI message can
301
+ * reach by design.
302
+ *
303
+ * `'mono-legato'` is a request, not a guarantee: an engine whose exciter is
304
+ * spent at the onset — anything struck or plucked — and a target pitch below
305
+ * what the engine's delay line can hold both fall back to an ordinary note,
306
+ * which {@link legatoFallbackCount} counts. A channel outside [0,15] and an
307
+ * articulation outside the enum are refused rather than clamped, and so is a
308
+ * destination with no instrument or one whose instrument has no articulation
309
+ * of its own.
310
+ */
311
+ setArticulation(destinationId: number, channel: number, articulation: Articulation | number): void;
312
+ /**
313
+ * Read back {@link setArticulation} as the canonical name. An ordinal this
314
+ * build cannot spell is handed back as the number, the way every other enum
315
+ * leaves this surface.
316
+ */
317
+ articulation(destinationId: number, channel: number): Articulation | number;
318
+ /**
319
+ * How many times a legato continuation was asked for on this destination and
320
+ * refused, so the note started a voice of its own instead. Counted rather
321
+ * than inferred: a refusal sounds like an ordinary note, so nothing in the
322
+ * audio separates "this engine declines legato" from "the mode was never
323
+ * set". Saturates at 4294967295 rather than wrapping — matching the C ABI, so
324
+ * the same phrase reports the same number on every surface — after which it
325
+ * reads as "at least this many".
326
+ *
327
+ * Throws on a destination with no instrument, and on one whose instrument has
328
+ * no articulation of its own — the same two refusals
329
+ * {@link setArticulation} keeps apart. Reporting 0 for the second would read
330
+ * as "every slur took", which is the reading this counter exists to prevent.
331
+ */
332
+ legatoFallbackCount(destinationId: number): number;
333
+ /** Install/replace a live non-destructive MIDI-FX insert for one destination. */
334
+ setMidiFx(destinationId: number, configJson: string): void;
335
+ clearMidiFx(destinationId?: number): void;
336
+ /** Enable the engine-owned live MIDI input source for a destination. */
337
+ setMidiInputSource(destinationId?: number): void;
338
+ clearMidiInputSource(): void;
339
+ midiInputPendingCount(): number;
340
+ /**
341
+ * Route a destination's (track lane's) MIDI to the external output queue
342
+ * instead of the internal instrument rack, so the track plays an external
343
+ * device. Clearing it restores internal-synth playback.
344
+ */
345
+ setMidiDestinationExternal(destinationId: number, external: boolean): void;
346
+ /**
347
+ * Enable/disable forwarding MIDI clock + transport (start/continue/stop) to
348
+ * the external output queue so external gear tracks the transport tempo.
349
+ */
350
+ setExternalMidiClockEnabled(enabled: boolean): void;
351
+ /** Count of external-MIDI events dropped because the output queue was full. */
352
+ externalMidiDroppedCount(): number;
353
+ externalMidiPendingCount(): number;
354
+ /**
355
+ * Drain queued external-MIDI events, already lowered to MIDI 1.0 byte
356
+ * messages ready to write to a Web MIDI output port. Call once per audio
357
+ * block / animation frame. `maxRecords` caps the number of output events
358
+ * returned — the shared unit across every surface. Events past the cap stay
359
+ * queued for the next call (lossless); call again to drain the rest.
360
+ *
361
+ * One queued record lowers to at most 4 MIDI 1.0 messages (a MIDI 2.0
362
+ * registered or assignable controller becomes CC 101/100 or 99/98 plus Data
363
+ * Entry 6/38), so a positive `maxRecords` below 4 could never consume a record
364
+ * and is rejected with an `InvalidParameter` `SonareError` instead of
365
+ * returning nothing forever.
366
+ */
367
+ drainExternalMidi(maxRecords?: number): WasmExternalMidiEvent[];
368
+ /** Scalar, allocation-free external-MIDI drain for AudioWorklet SAB output. */
369
+ popExternalMidiToScratch(): boolean;
370
+ externalMidiScratchDestinationId(): number;
371
+ externalMidiScratchRenderFrame(): number;
372
+ externalMidiScratchByteWord(): number;
373
+ externalMidiScratchByteCount(): number;
374
+ consumeExternalMidiScratch(): void;
375
+ pushMidiInputNoteOn(group: number, channel: number, note: number, velocity: number, portTimeSamples?: number): void;
376
+ pushMidiInputNoteOff(group: number, channel: number, note: number, velocity?: number, portTimeSamples?: number): void;
377
+ pushMidiInputCc(group: number, channel: number, controller: number, value: number, portTimeSamples?: number): void;
378
+ /**
379
+ * Push a live MIDI pitch bend to the engine-owned MIDI input source.
380
+ *
381
+ * `bend14` is unsigned 14-bit with centre 8192 (0..16383) — the dimension is
382
+ * not 7-bit, so a value past 16383 is refused rather than narrowed. The input
383
+ * source must be enabled with {@link setMidiInputSource} first.
384
+ */
385
+ pushMidiInputPitchBend(group: number, channel: number, bend14: number, portTimeSamples?: number): void;
386
+ /**
387
+ * Push a live MIDI channel pressure to the engine-owned MIDI input source.
388
+ * `pressure` is 7-bit (0..127). Under MPE this is the member channel's
389
+ * per-note pressure.
390
+ */
391
+ pushMidiInputChannelPressure(group: number, channel: number, pressure: number, portTimeSamples?: number): void;
392
+ /**
393
+ * Push a live MIDI polyphonic key pressure to the engine-owned MIDI input
394
+ * source. `note` and `pressure` are 7-bit (0..127).
395
+ */
396
+ pushMidiInputPolyPressure(group: number, channel: number, note: number, pressure: number, portTimeSamples?: number): void;
397
+ pushMidiNoteOn(destinationId: number, group: number, channel: number, note: number, velocity: number, renderFrame?: number): void;
398
+ pushMidiNoteOff(destinationId: number, group: number, channel: number, note: number, velocity?: number, renderFrame?: number): void;
399
+ /**
400
+ * Queue an immediate (live) MIDI control change to a MIDI destination
401
+ * (engine kMidiCcImmediate). `group`/`channel` are 0..15; `controller`/`value`
402
+ * are 7-bit (0..127). `renderFrame` is the frame to fire at, or -1 for
403
+ * immediate. Mirrors the Node/Python/C-ABI `pushMidiCc`.
404
+ */
405
+ pushMidiCc(destinationId: number, group: number, channel: number, controller: number, value: number, renderFrame?: number): void;
406
+ /**
407
+ * Queue an immediate (live) MIDI pitch bend to a MIDI destination. `bend14`
408
+ * is unsigned 14-bit with centre 8192 (0..16383); `renderFrame` is the frame
409
+ * to fire at, or -1 for immediate. Mirrors the Node/Python/C-ABI
410
+ * `pushMidiPitchBend`.
411
+ */
412
+ pushMidiPitchBend(destinationId: number, group: number, channel: number, bend14: number, renderFrame?: number): void;
413
+ /**
414
+ * Queue an immediate (live) MIDI channel pressure to a MIDI destination.
415
+ * `pressure` is 7-bit (0..127); `renderFrame` is the frame to fire at, or -1
416
+ * for immediate. Mirrors the Node/Python/C-ABI `pushMidiChannelPressure`.
417
+ */
418
+ pushMidiChannelPressure(destinationId: number, group: number, channel: number, pressure: number, renderFrame?: number): void;
419
+ /**
420
+ * Queue an immediate (live) MIDI polyphonic key pressure to a MIDI
421
+ * destination. `note` and `pressure` are 7-bit (0..127); `renderFrame` is the
422
+ * frame to fire at, or -1 for immediate. Mirrors the Node/Python/C-ABI
423
+ * `pushMidiPolyPressure`.
424
+ */
425
+ pushMidiPolyPressure(destinationId: number, group: number, channel: number, note: number, pressure: number, renderFrame?: number): void;
426
+ /**
427
+ * Queue an immediate (live) raw UMP message to a MIDI destination. `words` is
428
+ * 1 to 4 words, most significant first, and its length must match the message
429
+ * type of `words[0]`. MIDI 2.0 channel-voice messages (MT 0x4) arrive at full
430
+ * width; SysEx7 / data messages (MT 0x3 / 0x5) are refused, use
431
+ * {@link pushMidiSysex}. Throws when the slot ring or command queue is full
432
+ * (retry after a process block). `renderFrame` is the render-frame time to
433
+ * apply, or -1 for immediate. A bare number is accepted as a one-word
434
+ * message.
435
+ */
436
+ pushMidiUmp(destinationId: number, words: UmpWords | number, renderFrame?: number): void;
437
+ /**
438
+ * Push one raw UMP message (1 to 4 words) to the engine-owned MIDI input
439
+ * source. The message rules match {@link pushMidiUmp}. `portTimeSamples` is
440
+ * the port timestamp in samples.
441
+ */
442
+ pushMidiInputUmp(words: UmpWords, portTimeSamples?: number): void;
443
+ /**
444
+ * Queue an immediate (live) MIDI SysEx frame to a MIDI destination. `data` is
445
+ * the full message including the leading 0xF0 and trailing 0xF7 (1..512
446
+ * bytes). `renderFrame` is the frame to fire at, or -1 for immediate. Mirrors
447
+ * the Node/Python/C-ABI `pushMidiSysex`.
448
+ */
449
+ pushMidiSysex(destinationId: number, data: Uint8Array, renderFrame?: number): void;
450
+ /**
451
+ * Queue a MIDI panic (all-notes-off) releasing every sounding note at
452
+ * `renderFrame` (-1 = immediate). Mirrors the C-ABI `pushMidiPanic`.
453
+ */
454
+ pushMidiPanic(renderFrame?: number): void;
455
+ /**
456
+ * Remove all registered parameters (and their automation lanes). Control-thread
457
+ * only; not realtime-safe. Mirrors the C-ABI `clearParameters`.
458
+ */
459
+ clearParameters(): void;
460
+ /** Read back the current transport state snapshot. */
461
+ getTransportState(): EngineTransportState;
462
+ play(renderFrame?: number): void;
463
+ stop(renderFrame?: number): void;
464
+ seekSample(timelineSample: number, renderFrame?: number): void;
465
+ /**
466
+ * Snaps every in-flight parameter ramp (engine-level smoothed params, mixer
467
+ * lane fader/pan/gate, bus gains) to its target value. Offline renders call
468
+ * this after a priming process() block so the first audible block renders at
469
+ * settled values instead of ramping in from defaults.
470
+ */
471
+ settleParameters(): void;
472
+ /** Snap only insert automation slots after structural replay. */
473
+ settleInsertParameters(): void;
474
+ /** Drains queued commands on an offline/control-only engine immediately. */
475
+ flushControlCommands(): void;
476
+ /** Applies commands already due on a control-only mirror, retaining future commands. */
477
+ applyCommandsDueNowPreservingFuture(): void;
478
+ seekPpq(ppq: number, renderFrame?: number): void;
479
+ /** Set a finite tempo in the range (0, 100000] BPM. */
480
+ setTempo(bpm: number): void;
481
+ setTempoSegments(segments: readonly EngineTempoSegment[]): void;
482
+ setTimeSignature(numerator: number, denominator: number): void;
483
+ setTimeSignatureSegments(segments: readonly EngineTimeSignatureSegment[]): void;
484
+ sampleAtPpq(ppq: number): number;
485
+ setLoop(startPpq: number, endPpq: number, enabled?: boolean): void;
486
+ addParameter(info: EngineParameterInfo): void;
487
+ parameterCount(): number;
488
+ parameterInfoByIndex(index: number): Required<EngineParameterInfo>;
489
+ parameterInfo(id: number): Required<EngineParameterInfo>;
490
+ setAutomationLane(paramId: number, points: EngineAutomationPoint[]): void;
491
+ automationLaneCount(): number;
492
+ setMarkers(markers: EngineMarker[]): void;
493
+ markerCount(): number;
494
+ markerByIndex(index: number): EngineMarker;
495
+ marker(id: number): EngineMarker;
496
+ seekMarker(markerId: number, renderFrame?: number): void;
497
+ setLoopFromMarkers(startMarkerId: number, endMarkerId: number): void;
498
+ /** Set a metronome config; click lengths are limited to one second. */
499
+ setMetronome(config: EngineMetronomeConfig): void;
500
+ metronome(): Required<EngineMetronomeConfig>;
501
+ countInEndSample(startSample: number, bars: number): number;
502
+ setGraph(spec: EngineGraphSpec): void;
503
+ graphNodeCount(): number;
504
+ graphConnectionCount(): number;
505
+ setClips(clips: EngineClip[]): void;
506
+ /**
507
+ * Returns the PCM generated for a tempo-sync clip by the control-thread
508
+ * setter, or `null` when the clip did not require a tempo-sync bake.
509
+ */
510
+ prebakedClipChannels(clipId: number): Float32Array[] | null;
511
+ clipCount(): number;
512
+ /**
513
+ * Normalizes each send's pre/post tap point to the integer the native layer
514
+ * reads (defaults to post-fader when omitted). Shared by track lanes and
515
+ * buses, which carry the same send shape.
516
+ */
517
+ private static normalizeSends;
518
+ setTrackLanes(lanes: Array<number | EngineTrackLane>): void;
519
+ /**
520
+ * Keys one insert of a lane strip from another lane's post-strip audio
521
+ * (ducking/sidechainRouter inserts). sourceTrackId 0 removes the binding.
522
+ */
523
+ setLaneSidechain(trackId: number, insertIndex: number, sourceTrackId: number): void;
524
+ setTrackBuses(buses: EngineBus[]): void;
525
+ /**
526
+ * Keys one insert of a bus strip from a track lane or another bus
527
+ * (ducking/sidechainRouter inserts). `sourceId` 0 removes the binding.
528
+ */
529
+ setBusSidechain(busId: number, insertIndex: number, sourceKind: SidechainSourceKind | number, sourceId: number): void;
530
+ /**
531
+ * Keys one insert of the master strip from a track lane or a bus. Same
532
+ * source rules as {@link setBusSidechain}.
533
+ */
534
+ setMasterSidechain(insertIndex: number, sourceKind: SidechainSourceKind | number, sourceId: number): void;
535
+ setBusStripJson(busId: number, sceneJson: string): void;
536
+ setTrackStripJson(trackId: number, sceneJson: string): void;
537
+ setTrackStripEqBand(trackId: number, bandIndex: number, band: EqBand | string): void;
538
+ setTrackStripEqBandJson(trackId: number, bandIndex: number, bandJson: string): void;
539
+ setTrackStripInsertBypassed(trackId: number, insertIndex: number, bypassed: boolean, resetOnBypass?: boolean): void;
540
+ /** Bus-strip counterpart of {@link setTrackStripEqBand}. */
541
+ setBusStripEqBand(busId: number, bandIndex: number, band: EqBand | string): void;
542
+ setBusStripEqBandJson(busId: number, bandIndex: number, bandJson: string): void;
543
+ setMasterStripJson(sceneJson: string): void;
544
+ setMasterStripEqBand(bandIndex: number, band: EqBand | string): void;
545
+ setMasterStripEqBandJson(bandIndex: number, bandJson: string): void;
546
+ setMasterStripInsertBypassed(insertIndex: number, bypassed: boolean, resetOnBypass?: boolean): void;
547
+ /**
548
+ * Changes one track-strip insert parameter in realtime, addressed by the
549
+ * processor's JSON-key parameter name — one of the entries
550
+ * {@link masteringInsertParamInfo} reports with a non-null `id`; a
551
+ * construction-only entry (`id` null) takes effect only when the insert is
552
+ * built. Applied at the next block head via the engine command queue; safe
553
+ * during playback. Throws if the track, insert, or name is unknown, the
554
+ * param is not realtime-safe, or the command queue is full.
555
+ */
556
+ setTrackStripInsertParamByName(trackId: number, insertIndex: number, paramName: string, value: number): void;
557
+ /** Apply a live insert edit on this engine's owning thread without draining its command queue. */
558
+ applyTrackStripInsertParamByNameNow(trackId: number, insertIndex: number, paramName: string, value: number): boolean;
559
+ /** Restore a retained insert value exactly after a strip scene is replayed. */
560
+ restoreTrackStripInsertParamByName(trackId: number, insertIndex: number, paramName: string, value: number): void;
561
+ /** Master-strip counterpart of {@link setTrackStripInsertParamByName}. */
562
+ setMasterStripInsertParamByName(insertIndex: number, paramName: string, value: number): void;
563
+ applyMasterStripInsertParamByNameNow(insertIndex: number, paramName: string, value: number): boolean;
564
+ restoreMasterStripInsertParamByName(insertIndex: number, paramName: string, value: number): void;
565
+ /** Bus-strip counterpart of {@link setTrackStripInsertParamByName}. */
566
+ setBusStripInsertParamByName(busId: number, insertIndex: number, paramName: string, value: number): void;
567
+ applyBusStripInsertParamByNameNow(busId: number, insertIndex: number, paramName: string, value: number): boolean;
568
+ restoreBusStripInsertParamByName(busId: number, insertIndex: number, paramName: string, value: number): void;
569
+ /**
570
+ * Forgets the remembered manual insert-parameter values of one track strip
571
+ * and discards its queued insert edits. Call before {@link setTrackStripJson}
572
+ * replaces the strip when its old values must not carry over; the setter
573
+ * never does this itself, since a queued edit may already target the new chain.
574
+ */
575
+ clearTrackInsertParameterBases(trackId: number): void;
576
+ clearBusInsertParameterBases(busId: number): void;
577
+ clearMasterInsertParameterBases(): void;
578
+ /** Bus-strip counterpart of {@link setTrackStripInsertBypassed}. */
579
+ setBusStripInsertBypassed(busId: number, insertIndex: number, bypassed: boolean, resetOnBypass?: boolean): void;
580
+ /**
581
+ * Resolves a track-lane insert parameter (by its JSON-key name) to the
582
+ * reserved automation id usable with `setAutomationLane` / `setParameter`.
583
+ * Returns `-1` when the track, insert, or name is unknown. (The Python binding
584
+ * raises a `SonareError` for an unknown id where Node/WASM return the `-1`
585
+ * sentinel.)
586
+ *
587
+ * This trio is how a mastering processor gets time-varying automation: the
588
+ * `eq.*`, `dynamics.*`, `saturation.*`, `spectral.*`, `stereo.*`,
589
+ * `maximizer.*` and `multiband.*` processors are all available as strip
590
+ * inserts, so placing one on a strip and resolving its parameter here drives
591
+ * it at audio-block precision, live and offline alike. The whole-signal
592
+ * stages of the offline mastering chain (`repair.*`, `loudness`, and the
593
+ * match stages) have no insert form and no automation id: they buffer the
594
+ * entire signal by construction and do not run on the realtime path.
595
+ */
596
+ resolveTrackInsertAutomationId(trackId: number, insertIndex: number, paramName: string): number;
597
+ resolveMasterInsertAutomationId(insertIndex: number, paramName: string): number;
598
+ resolveBusInsertAutomationId(busId: number, insertIndex: number, paramName: string): number;
599
+ /**
600
+ * Resolves a hosted instrument's continuous parameter (by its JSON-key name)
601
+ * to the reserved automation id usable with `setAutomationLane` /
602
+ * `setParameter`, so an instrument parameter is driven at audio-block
603
+ * precision exactly like a strip insert. Returns `-1` when the destination
604
+ * has no bound instrument, the instrument exposes no automatable parameters,
605
+ * or the name is unknown.
606
+ *
607
+ * For the NativeSynth ({@link setSynthInstrument}) the names are the
608
+ * continuous {@link SynthPatch} fields: `gain`, `busDrive`, `cutoffHz`,
609
+ * `resonanceQ`, `drive`, `keyTrack`, `envToCutoffCents`, `velToCutoffCents`,
610
+ * `ampAttackMs`, `ampDecayMs`, `ampSustain`, `ampReleaseMs`,
611
+ * `filterAttackMs`, `filterDecayMs`, `filterSustain`, `filterReleaseMs`,
612
+ * `lfoRateHz`, `lfoToPitchCents`, `lfo2RateHz`, `glideMs`, `bodyMix`,
613
+ * `stereoSpread`, `detuneCents`, `driftCents`, `pitchOffsetCents`,
614
+ * `hpCutoffHz`, `sampleHoldHz`, `bitDepth`.
615
+ *
616
+ * Structural fields (`preset`, `engineMode`, `waveform`, `filterModel`,
617
+ * `unison`, `polyphony`, `body`, `modRoutings`) are not automatable and
618
+ * return `-1`: they resize voice pools or swap DSP topology, which is not
619
+ * audio-thread safe. Rebind the instrument with a new patch instead.
620
+ *
621
+ * `gain`, `busDrive`, `cutoffHz`, `resonanceQ`, `envToCutoffCents`,
622
+ * `lfoToPitchCents` and `pitchOffsetCents` reach voices that are already
623
+ * sounding from the next block; the rest are cached into per-voice state at
624
+ * note-on and take effect from the next note, so a lane that moves one of
625
+ * them under a held note looks inert until the next one speaks — that is the
626
+ * behaviour, not a dropped write.
627
+ *
628
+ * The id survives an unbind/rebind of the same destination and applies
629
+ * nothing while that destination is unbound.
630
+ */
631
+ resolveInstrumentAutomationId(destinationId: number, paramName: string): number;
632
+ /** Sets a track lane strip's pan position in realtime (glitch-free). */
633
+ setTrackStripPan(trackId: number, pan: number): void;
634
+ /** Sets a track lane strip's pan law in realtime. */
635
+ setTrackStripPanLaw(trackId: number, panLaw: PanLawInput): void;
636
+ /** Sets a track lane strip's pan mode in realtime. */
637
+ setTrackStripPanMode(trackId: number, panMode: PanMode | number): void;
638
+ /** Sets a track lane strip's dual-pan left/right positions in realtime. */
639
+ setTrackStripDualPan(trackId: number, leftPan: number, rightPan: number): void;
640
+ /**
641
+ * Sets a bus strip's output pan position in realtime (glitch-free). Throws
642
+ * for an unknown bus or one wider than stereo.
643
+ */
644
+ setBusStripPan(busId: number, pan: number): void;
645
+ /** Sets a bus strip's pan law in realtime. */
646
+ setBusStripPanLaw(busId: number, panLaw: PanLawInput): void;
647
+ /** Sets a bus strip's pan mode in realtime. */
648
+ setBusStripPanMode(busId: number, panMode: PanMode | number): void;
649
+ /** Sets a bus strip's dual-pan left/right positions in realtime. */
650
+ setBusStripDualPan(busId: number, leftPan: number, rightPan: number): void;
651
+ /**
652
+ * Sets a track lane strip's inter-channel alignment delay (whole samples).
653
+ * Adjusts strip latency, so PDC and reported graph latency are refreshed.
654
+ */
655
+ setTrackStripChannelDelaySamples(trackId: number, delaySamples: number): void;
656
+ createClipPageProvider(numChannels: number, numSamples: number, pageFrames: number): ClipPageProvider;
657
+ supplyClipPage(providerId: number, pageIndex: number, channels: Float32Array[]): void;
658
+ clearClipPage(providerId: number, pageIndex: number): void;
659
+ destroyClipPageProvider(providerId: number): void;
660
+ popClipPageRequest(): ClipPageRequest | null;
661
+ /**
662
+ * Moves one native request into the binding's persistent scalar scratch.
663
+ * This avoids creating an embind JS object in AudioWorklet process().
664
+ */
665
+ popClipPageRequestToScratch(): boolean;
666
+ clipPageRequestScratchClipId(): number;
667
+ clipPageRequestScratchSample(): number;
668
+ /** Cumulative page misses dropped because the native bounded request queue was full. */
669
+ clipPageRequestOverflowCount(): number;
670
+ /** Cumulative warp-stretch requests dropped because the native queue was full. */
671
+ warpStretchOverflowCount(): number;
672
+ /**
673
+ * Sets the number of concurrent time-stretch voices. `voices` must be an
674
+ * integer in `[0, 64]`; a non-integer, negative, or larger value throws and
675
+ * leaves the capacity unchanged. Default is 8. Capacity 0 disables
676
+ * time-stretch, so every warped clip plays resampled instead and none of
677
+ * that counts toward {@link warpStretchOverflowCount}. A change applied
678
+ * while the engine is running restarts the splice state of any clip
679
+ * stretching through a voice at that moment. Control-thread only.
680
+ */
681
+ setWarpVoiceCapacity(voices: number): void;
682
+ /** Reads the current time-stretch voice capacity (default 8). */
683
+ warpVoiceCapacity(): number;
684
+ /**
685
+ * Sets the clip-page look-ahead window in timeline frames.
686
+ *
687
+ * The player reports the pages it is *about to* read that are not resident
688
+ * yet, so a streaming host can service them before the audio thread reaches
689
+ * them. Without look-ahead a page miss is only reported after the read
690
+ * already produced silence, which costs one block of silence at every page
691
+ * boundary the host has not primed — the reason a sliding-window streamer
692
+ * cannot keep a live playhead fed from miss reports alone.
693
+ *
694
+ * Look-ahead requests drain through the same `popClipPageRequest` queue and
695
+ * are queued *after* the block's genuine misses, so a host that keeps only
696
+ * the newest request per clip (as {@link ClipPageStreamer} does) tracks the
697
+ * look-ahead frontier.
698
+ *
699
+ * `prepare` defaults this to half a second at the engine's sample rate. `0`
700
+ * disables the look-ahead. A clip whose pages are all resident produces no
701
+ * requests at all, with or without look-ahead. Safe to call during playback.
702
+ */
703
+ setClipPagePrefetchFrames(frames: number): void;
704
+ /** Current clip-page look-ahead window in timeline frames. */
705
+ clipPagePrefetchFrames(): number;
706
+ setCaptureBuffer(numChannels: number, capacityFrames: number): void;
707
+ armCapture(armed?: boolean): void;
708
+ setCapturePunch(startSample: number, endSample: number, enabled?: boolean): void;
709
+ setCaptureSource(source: EngineCaptureSource): void;
710
+ /** Positive values delay capture relative to the punch window. */
711
+ setRecordOffsetSamples(offsetSamples: number): void;
712
+ setInputMonitor(enabled: boolean, gain?: number): void;
713
+ resetCapture(): void;
714
+ captureStatus(): EngineCaptureStatus;
715
+ capturedAudio(): Float32Array[];
716
+ /**
717
+ * Renders in place, adding engine output to `channels`. Zero each plane first
718
+ * when it contains no upstream input.
719
+ */
720
+ process(channels: Float32Array[]): Float32Array[];
721
+ /**
722
+ * Allocates persistent per-channel WASM-heap scratch for the zero-copy
723
+ * `getChannelBuffer` / `processPrepared` realtime path. Call once (off the
724
+ * audio thread) before driving `processPrepared` from an AudioWorklet so the
725
+ * render callback never allocates on the C++/JS heap.
726
+ */
727
+ prepareChannels(numChannels: number, maxFrames: number): void;
728
+ /**
729
+ * Returns a Float32Array view onto the persistent WASM-heap scratch for one
730
+ * channel (valid for up to `numFrames`). Fill it, call `processPrepared`, then
731
+ * read the same view back. Re-acquire after WASM memory growth.
732
+ */
733
+ getChannelBuffer(channel: number, numFrames: number): Float32Array;
734
+ /**
735
+ * Runs the engine in place over the prepared per-channel scratch buffers.
736
+ * Zero each active span first when it contains no upstream input.
737
+ * Allocation-free: safe to call on the AudioWorklet render thread after
738
+ * `prepareChannels`.
739
+ */
740
+ processPrepared(numFrames: number): void;
741
+ /**
742
+ * Allocates the cue-bus counterpart of {@link prepareChannels}. Needed only
743
+ * when PFL/AFL monitoring must reach a separate output: `processPrepared`
744
+ * folds the cue bus into the program output, while
745
+ * {@link processPreparedWithMonitor} keeps the two apart. Call once, off the
746
+ * audio thread, with at least as many channels as `prepareChannels` got.
747
+ */
748
+ prepareMonitorChannels(numChannels: number, maxFrames: number): void;
749
+ /**
750
+ * Returns a Float32Array view onto the persistent cue-bus scratch for one
751
+ * channel (valid for up to `numFrames`). Read it after
752
+ * {@link processPreparedWithMonitor}. Re-acquire after WASM memory growth.
753
+ */
754
+ getMonitorChannelBuffer(channel: number, numFrames: number): Float32Array;
755
+ /**
756
+ * Runs the engine in place over the prepared scratch, writing the cue bus to
757
+ * the monitor scratch instead of folding it into the program output.
758
+ * Allocation-free: safe on the AudioWorklet render thread after
759
+ * `prepareChannels` and `prepareMonitorChannels`.
760
+ */
761
+ processPreparedWithMonitor(numFrames: number): void;
762
+ processWithMonitor(channels: Float32Array[]): WasmEngineProcessWithMonitorResult;
763
+ /**
764
+ * Render `channels` offline from the current transport position. Requesting
765
+ * more planes than `prepare` reserved throws an `InvalidParameter`
766
+ * `SonareError` rather than returning silence that reads as a finished render.
767
+ *
768
+ * Set `finalize: false` to render one chunk of a longer timeline; see
769
+ * {@link RenderOfflineRequest.finalize} and {@link finishOfflineRender}.
770
+ */
771
+ renderOffline(request: RenderOfflineRequest): Float32Array[];
772
+ renderOffline(channels: Float32Array[], blockSize?: number): Float32Array[];
773
+ /**
774
+ * End a chunked offline render: release every note the sequencer still holds
775
+ * and flush the PDC / alignment delay lines. Required after
776
+ * `renderOffline({ finalize: false })`; the finalizing form does it itself.
777
+ *
778
+ * Skipping it leaves every note still sounding at the last chunk held. On an
779
+ * engine-internal instrument the tail simply never releases; on a destination
780
+ * marked external ({@link RealtimeEngine.setMidiDestinationExternal}) the
781
+ * note-ons already left through the external MIDI queue, so the note-offs
782
+ * emitted here are the only ones the receiving device will get and the notes
783
+ * otherwise hang outside the engine.
784
+ */
785
+ finishOfflineRender(): void;
786
+ /**
787
+ * Bounce the timeline to an interleaved buffer. `numChannels` above the
788
+ * prepared channel count throws an `InvalidParameter` `SonareError`.
789
+ */
790
+ bounceOffline(options: EngineBounceOptions): EngineBounceResult;
791
+ /**
792
+ * Freeze the current graph to audio. `numChannels` above the prepared channel
793
+ * count throws an `InvalidParameter` `SonareError`.
794
+ */
795
+ freezeOffline(options: EngineFreezeOptions): EngineFreezeResult;
796
+ drainTelemetry(maxRecords?: number): EngineTelemetry[];
797
+ popTelemetryToScratch(): boolean;
798
+ telemetryScratchType(): number;
799
+ telemetryScratchError(): number;
800
+ telemetryScratchRenderFrame(): number;
801
+ telemetryScratchTimelineSample(): number;
802
+ telemetryScratchAudibleTimelineSample(): number;
803
+ telemetryScratchGraphLatencySamplesQ8(): number;
804
+ telemetryScratchValue(): number;
805
+ popMeterTelemetryToScratch(): boolean;
806
+ meterScratchTargetId(): number;
807
+ meterScratchRenderFrame(): number;
808
+ meterScratchValue(field: number): number;
809
+ drainMeterTelemetry(maxRecords?: number): EngineMeterTelemetry[];
810
+ /**
811
+ * Drains pending meter telemetry as per-plane (wide) records for a surround
812
+ * target. Use this for a surround mix target; {@link drainMeterTelemetry}
813
+ * stays the stereo fast path. The two share one queue — call only one per
814
+ * target. The live AudioWorklet path owns the queue via the stereo drain, so
815
+ * this wide drain is for an offline (non-worklet) engine instance; per-plane
816
+ * surround meters are not delivered over the live worklet meter ring.
817
+ */
818
+ drainMeterTelemetryWide(maxRecords?: number): EngineMeterTelemetryWide[];
819
+ /**
820
+ * Enables per-target spectrum + vectorscope capture. @param intervalFrames is
821
+ * the minimum render-frame gap between snapshots (0 disables). @param bandCount
822
+ * is the FFT band resolution (1..64); changing it re-prepares the tap. Returns
823
+ * the band count actually applied.
824
+ */
825
+ configureScopeTelemetry(intervalFrames: number, bandCount: number): number;
826
+ /** Drains pending spectrum + vectorscope snapshots (per mix target). */
827
+ drainScopeTelemetry(maxRecords?: number): EngineScopeTelemetry[];
828
+ popScopeTelemetryToScratch(): boolean;
829
+ scopeScratchTargetId(): number;
830
+ scopeScratchRenderFrame(): number;
831
+ scopeScratchBandCount(): number;
832
+ scopeScratchBand(index: number): number;
833
+ scopeScratchPointCount(): number;
834
+ scopeScratchPointLeft(index: number): number;
835
+ scopeScratchPointRight(index: number): number;
836
+ /** Release the underlying WASM object. Idempotent, as the Node facade is. */
837
+ destroy(): void;
838
+ /** Alias for {@link destroy}, matching embind's own release method name. */
839
+ delete(): void;
840
+ }
841
+ export declare class ClipPageProvider {
842
+ private readonly engine;
843
+ readonly id: number;
844
+ private disposed;
845
+ constructor(engine: RealtimeEngine, id: number);
846
+ supply(pageIndex: number, channels: Float32Array[]): void;
847
+ clear(pageIndex: number): void;
848
+ destroy(): void;
849
+ }
850
+ //# sourceMappingURL=realtime_engine.d.ts.map