@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
package/dist/worklet.d.ts CHANGED
@@ -1,2515 +1,16 @@
1
- import { WasmExternalMidiEvent, WasmEngineTransportState, WasmEngineTempoSegment, WasmEngineTimeSignatureSegment, WasmEngineParameterInfo, WasmEngineAutomationPoint, WasmEngineMarker, WasmEngineMetronomeConfig, WasmEngineGraphSpec, WasmEngineClip, WasmClipPageRequest, WasmEngineCaptureStatus, WasmEngineProcessWithMonitorResult, WasmEngineBounceOptions, WasmEngineBounceResult, WasmEngineFreezeOptions, WasmEngineFreezeResult, WasmEngineTelemetry, WasmEngineMeterTelemetry, WasmEngineMeterTelemetryWide, WasmEngineScopeTelemetry, SonareModule } from './sonare.js';
2
-
3
- declare const SYNTH_ENGINE_MODES: readonly ["default", "subtractive", "fm", "karplus-strong", "modal", "additive", "percussion", "piano", "pipe-organ", "bowed-string", "reed", "brass", "flute", "plucked-string", "vocal", "free-reed"];
4
- declare const SYNTH_OSC_WAVEFORMS: readonly ["default", "sine", "saw", "square", "triangle", "noise"];
5
- declare const SYNTH_FILTER_MODELS: readonly ["default", "svf", "moog-ladder", "diode-ladder", "sallen-key"];
6
- declare const SYNTH_FILTER_OUTPUTS: readonly ["default", "lowpass", "bandpass", "highpass"];
7
- declare const SYNTH_BODY_TYPES: readonly ["default", "none", "guitar", "violin", "wood-tube", "brass-bell", "vocal"];
8
- declare const SYNTH_MOD_SOURCES: readonly ["none", "amp-env", "filter-env", "lfo1", "lfo2", "velocity", "key-track", "mod-wheel", "random"];
9
- declare const SYNTH_MOD_DESTINATIONS: readonly ["none", "pitch-cents", "cutoff-cents", "amp-gain", "pan-units"];
10
- /** NativeSynth engine selector ({@link SynthPatch}; `'default'` keeps the base patch's). */
11
- type SynthEngineMode = (typeof SYNTH_ENGINE_MODES)[number];
12
- /** NativeSynth oscillator waveform (`'default'` keeps the base patch's). */
13
- type SynthOscWaveform = (typeof SYNTH_OSC_WAVEFORMS)[number];
14
- /** NativeSynth filter model — the character core (`'default'` keeps the base patch's). */
15
- type SynthFilterModel = (typeof SYNTH_FILTER_MODELS)[number];
16
- /** NativeSynth filter output (SVF only; `'default'` keeps the base patch's). */
17
- type SynthFilterOutput = (typeof SYNTH_FILTER_OUTPUTS)[number];
18
- /** NativeSynth body/formant resonance voicing (`'default'` keeps the base patch's). */
19
- type SynthBodyType = (typeof SYNTH_BODY_TYPES)[number];
20
- /** {@link SynthPatch} mod-matrix source. */
21
- type SynthModSource = (typeof SYNTH_MOD_SOURCES)[number];
22
- /** {@link SynthPatch} mod-matrix destination. */
23
- type SynthModDestination = (typeof SYNTH_MOD_DESTINATIONS)[number];
24
- /** One {@link SynthPatch} mod-matrix routing (name or C ordinal per field). */
25
- interface SynthModRouting {
26
- source: SynthModSource | number;
27
- destination: SynthModDestination | number;
28
- /** Destination units at full source deflection. */
29
- depth: number;
30
- }
31
- /**
32
- * Versioned NativeSynth patch for {@link Project.bounceWithSynthInstrument}
33
- * and {@link RealtimeEngine.setSynthInstrument}.
34
- *
35
- * The patch starts from a BASE — the named `preset` (see
36
- * {@link synthPresetNames}; a `"va:"` routing prefix is accepted) or, when
37
- * `preset` is omitted, the default subtractive patch. Omitting a numeric field
38
- * keeps the base value; supplying one overrides it (clamped to its audible
39
- * range), including an explicit `0` such as `stereoSpread: 0`. The enum fields
40
- * reserve `'default'` as keep. A `modRoutings` array REPLACES the base mod
41
- * matrix, and an empty array clears it, while omitting the key keeps it.
42
- *
43
- * Mode-specific deep parameters (FM operator stacks, modal mode tables,
44
- * drawbar registrations, kit pieces, piano strings) travel inside the named
45
- * presets; the patch exposes the wrapper sections every engine shares.
46
- */
47
- interface SynthPatch {
48
- /**
49
- * Optional binding convenience for JS realtime/offline helpers. It is not
50
- * part of the NativeSynth patch itself; Python uses explicit
51
- * `(destination_id, patch)` bindings instead. Defaults to `0`.
52
- */
53
- destinationId?: number;
54
- /** Resolve MIDI channels from incoming GM bank/program changes; defaults to false. */
55
- useGmPrograms?: boolean;
56
- /** Base preset name (see {@link synthPresetNames}); omit for the init patch. */
57
- preset?: string;
58
- engineMode?: SynthEngineMode | number;
59
- waveform?: SynthOscWaveform | number;
60
- /** Detuned-stack width [1, 7]. */
61
- unison?: number;
62
- detuneCents?: number;
63
- /** Per-voice slow pitch drift depth (cents). */
64
- driftCents?: number;
65
- /** Pre-filter drive [0, 1]. */
66
- drive?: number;
67
- filterModel?: SynthFilterModel | number;
68
- filterOutput?: SynthFilterOutput | number;
69
- cutoffHz?: number;
70
- resonanceQ?: number;
71
- /** Cutoff keyboard tracking [0, 1]. */
72
- keyTrack?: number;
73
- envToCutoffCents?: number;
74
- velToCutoffCents?: number;
75
- ampAttackMs?: number;
76
- ampDecayMs?: number;
77
- ampSustain?: number;
78
- ampReleaseMs?: number;
79
- filterAttackMs?: number;
80
- filterDecayMs?: number;
81
- filterSustain?: number;
82
- filterReleaseMs?: number;
83
- lfoRateHz?: number;
84
- lfoToPitchCents?: number;
85
- lfo2RateHz?: number;
86
- glideMs?: number;
87
- body?: SynthBodyType | number;
88
- /** Body resonance mix [0, 1]. */
89
- bodyMix?: number;
90
- /** Seeded per-voice pan scatter [0, 1]. */
91
- stereoSpread?: number;
92
- /** Mod matrix (at most 8 routings; REPLACES the base matrix when non-empty). */
93
- modRoutings?: SynthModRouting[];
94
- /** Master output gain (linear). */
95
- gain?: number;
96
- /** Max simultaneous voices [1, 64]. */
97
- polyphony?: number;
98
- /** Gain-neutral bus saturation [0, 1]. */
99
- busDrive?: number;
100
- }
101
- type ProjectMidiCcBindingKind = 0 | 1 | 2 | 3;
102
- /** MIDI CC <-> automation binding descriptor used by CC learn/conversion helpers. */
103
- interface ProjectMidiCcBinding {
104
- ccNumber: number;
105
- /** MIDI channel 0..15, or 255 for any channel. */
106
- channel: number;
107
- /** 0 = 7-bit CC, 1 = 14-bit CC, 2 = RPN, 3 = NRPN. */
108
- kind: ProjectMidiCcBindingKind;
109
- ccLsbNumber?: number;
110
- selectorMsb?: number;
111
- selectorLsb?: number;
112
- paramId: number;
113
- minValue: number;
114
- maxValue: number;
115
- }
116
-
117
- /**
118
- * Nested mastering-chain configuration. A boolean toggles a module/processor's
119
- * `enabled` flag; setting any field implicitly enables its module unless
120
- * `enabled: false` is also given.
121
- *
122
- * Exception — color stages as `masterAudio` overrides: the `saturation.tape`
123
- * and `saturation.exciter` stages are engaged from an override only when you
124
- * pass `enabled: true` explicitly. On a preset where they are off, adjusting a
125
- * parameter alone (e.g. `saturation: { tape: { driveDb: 6 } }`) has no audible
126
- * effect; use `saturation: { tape: { enabled: true, driveDb: 6 } }`.
127
- */
128
- interface MasteringChainConfig {
129
- repair?: {
130
- /** `boolean` is retained as a deprecated shorthand for `{ enabled }`. */
131
- denoise?: boolean | {
132
- enabled?: boolean;
133
- nFft?: number;
134
- hopLength?: number;
135
- ddAlpha?: number;
136
- gainFloor?: number;
137
- overSubtraction?: number;
138
- spectralFloor?: number;
139
- noiseEstimationQuantile?: number;
140
- speechPresenceGain?: boolean;
141
- gainSmoothing?: boolean;
142
- };
143
- nFft?: number;
144
- hopLength?: number;
145
- ddAlpha?: number;
146
- gainFloor?: number;
147
- declip?: {
148
- enabled?: boolean;
149
- clipThreshold?: number;
150
- lpcOrder?: number;
151
- iterations?: number;
152
- lpcBlend?: number;
153
- };
154
- decrackle?: {
155
- enabled?: boolean;
156
- threshold?: number;
157
- /** 0 = median, 1 = wavelet shrinkage. */
158
- mode?: number;
159
- levels?: number;
160
- };
161
- dehum?: {
162
- enabled?: boolean;
163
- fundamentalHz?: number;
164
- harmonics?: number;
165
- q?: number;
166
- adaptive?: boolean;
167
- searchRangeHz?: number;
168
- adaptation?: number;
169
- frameSize?: number;
170
- pllBandwidth?: number;
171
- };
172
- declick?: {
173
- enabled?: boolean;
174
- threshold?: number;
175
- neighborRatio?: number;
176
- maxClickSamples?: number;
177
- lpcOrder?: number;
178
- residualRatio?: number;
179
- };
180
- dereverb?: {
181
- enabled?: boolean;
182
- threshold?: number;
183
- attenuation?: number;
184
- nFft?: number;
185
- hopLength?: number;
186
- t60Sec?: number;
187
- lateDelayMs?: number;
188
- overSubtraction?: number;
189
- spectralFloor?: number;
190
- wpeEnabled?: boolean;
191
- wpeIterations?: number;
192
- wpeTaps?: number;
193
- wpeStrength?: number;
194
- };
195
- };
196
- eq?: {
197
- /** Canonical nested tilt stage. */
198
- tilt?: {
199
- enabled?: boolean;
200
- tiltDb?: number;
201
- pivotHz?: number;
202
- };
203
- /** @deprecated Use `eq.tilt.tiltDb`. */
204
- tiltDb?: number;
205
- /** @deprecated Use `eq.tilt.pivotHz`. */
206
- pivotHz?: number;
207
- };
208
- dynamics?: {
209
- compressor?: {
210
- enabled?: boolean;
211
- thresholdDb?: number;
212
- ratio?: number;
213
- attackMs?: number;
214
- releaseMs?: number;
215
- kneeDb?: number;
216
- makeupGainDb?: number;
217
- autoMakeup?: boolean;
218
- };
219
- deesser?: {
220
- enabled?: boolean;
221
- frequencyHz?: number;
222
- thresholdDb?: number;
223
- ratio?: number;
224
- attackMs?: number;
225
- releaseMs?: number;
226
- rangeDb?: number;
227
- bandpassQ?: number;
228
- };
229
- transientShaper?: {
230
- enabled?: boolean;
231
- attackGainDb?: number;
232
- sustainGainDb?: number;
233
- fastAttackMs?: number;
234
- fastReleaseMs?: number;
235
- slowAttackMs?: number;
236
- slowReleaseMs?: number;
237
- sensitivity?: number;
238
- maxGainDb?: number;
239
- gainSmoothingMs?: number;
240
- lookaheadMs?: number;
241
- };
242
- multibandComp?: {
243
- enabled?: boolean;
244
- lowCutoffHz?: number;
245
- highCutoffHz?: number;
246
- lowThresholdDb?: number;
247
- lowRatio?: number;
248
- lowAttackMs?: number;
249
- lowReleaseMs?: number;
250
- midThresholdDb?: number;
251
- midRatio?: number;
252
- midAttackMs?: number;
253
- midReleaseMs?: number;
254
- highThresholdDb?: number;
255
- highRatio?: number;
256
- highAttackMs?: number;
257
- highReleaseMs?: number;
258
- };
259
- };
260
- saturation?: {
261
- tape?: {
262
- enabled?: boolean;
263
- driveDb?: number;
264
- saturation?: number;
265
- hysteresis?: number;
266
- outputGainDb?: number;
267
- speedIps?: number;
268
- headBumpDb?: number;
269
- bias?: number;
270
- gapLoss?: number;
271
- };
272
- exciter?: {
273
- enabled?: boolean;
274
- frequencyHz?: number;
275
- driveDb?: number;
276
- amount?: number;
277
- q?: number;
278
- evenOddMix?: number;
279
- };
280
- };
281
- spectral?: {
282
- airBand?: {
283
- enabled?: boolean;
284
- amount?: number;
285
- shelfFrequencyHz?: number;
286
- dynamicThresholdDb?: number;
287
- dynamicRangeDb?: number;
288
- };
289
- };
290
- stereo?: {
291
- imager?: {
292
- enabled?: boolean;
293
- width?: number;
294
- outputGainDb?: number;
295
- decorrelationAmount?: number;
296
- preserveEnergy?: boolean;
297
- };
298
- monoMaker?: {
299
- enabled?: boolean;
300
- amount?: number;
301
- frequencyHz?: number;
302
- };
303
- };
304
- maximizer?: {
305
- truePeakLimiter?: {
306
- enabled?: boolean;
307
- ceilingDb?: number;
308
- lookaheadMs?: number;
309
- releaseMs?: number;
310
- oversampleFactor?: number;
311
- applyGainAtInputRate?: boolean;
312
- };
313
- };
314
- loudness?: {
315
- enabled?: boolean;
316
- targetLufs?: number;
317
- ceilingDb?: number;
318
- truePeakOversample?: number;
319
- releaseMs?: number;
320
- applyGainAtInputRate?: boolean;
321
- };
322
- /**
323
- * Dot-notation spelling of any leaf above, e.g. `'loudness.targetLufs': -20`
324
- * beside or instead of `loudness: { targetLufs: -20 }`. It is the form the C
325
- * ABI carries parameters in, so a caller assembling overrides dynamically can
326
- * emit it directly; the core validates the key and rejects an unknown one.
327
- * The nested spelling is canonical — prefer it in hand-written code, where it
328
- * is checked field by field while a dotted key is only checked at run time.
329
- */
330
- [flatKey: `${string}.${string}`]: number | boolean | undefined;
331
- }
332
- /**
333
- * Configuration for the block-by-block {@link StreamingMasteringChain}.
334
- *
335
- * Extends {@link MasteringChainConfig} with optional precomputed loudness
336
- * parameters. The streaming chain cannot measure whole-signal integrated LUFS,
337
- * so an enabled `loudness` stage normally throws at construction. To let a
338
- * preset's streaming preview match its offline render, the caller may
339
- * precompute the loudness normalization gain offline (e.g.
340
- * `targetLufs - measuredIntegratedLufs`) and supply it here.
341
- */
342
- interface StreamingMasteringChainConfig extends MasteringChainConfig {
343
- /**
344
- * Precomputed static loudness gain in dB. When omitted (the default), an
345
- * enabled `loudness` stage still throws. When provided and `loudness.enabled`
346
- * is set, the chain applies this fixed gain per block before the loudness
347
- * stage's true-peak limiter instead of throwing.
348
- */
349
- loudnessStaticGainDb?: number;
350
- /**
351
- * Offline-measured true-peak (dBFS) of the source the static gain was
352
- * computed for. When provided, the static gain is clamped to
353
- * `loudness.ceilingDb - loudnessStaticGainPeakDb` so the streaming preview
354
- * does not drive the loudness limiter harder than the offline chain. When
355
- * omitted (the default) the static gain is applied verbatim.
356
- */
357
- loudnessStaticGainPeakDb?: number;
358
- }
359
-
360
- type PanMode = 'balance' | 'pan' | 'stereoPan' | 'stereo-pan' | 'dualPan' | 'dual-pan' | number;
361
- /**
362
- * Interpolation curve for scheduled automation events
363
- * (see {@link Mixer.scheduleInsertAutomation}).
364
- */
365
- type AutomationCurve = 'linear' | 'exponential' | 'hold' | 's-curve';
366
- /**
367
- * Pan law applied when computing left/right gains from a pan position
368
- * (see {@link Mixer.setPanLaw}). On mono strips it changes the centre gain;
369
- * on stereo Balance strips it changes only the far-channel taper, while centre
370
- * remains unity. Maps to the underlying integer code.
371
- */
372
- type PanLaw = 'const3dB' | 'const4.5dB' | 'const6dB' | 'linear0dB';
373
- /** Accepted pan-law name aliases for mixer and realtime-engine inputs. */
374
- type PanLawName = PanLaw | 'const-3db' | '-3db' | 'const-4.5db' | '-4.5db' | 'const-6db' | '-6db' | 'linear-0db' | 'linear' | '0db';
375
- /** Pan-law name or raw C ABI ordinal. */
376
- type PanLawInput = PanLawName | number;
377
- /** Pre/post-fader send timing (see {@link Mixer.addSend}). */
378
- type SendTiming = 'preFader' | 'postFader';
379
-
380
- /**
381
- * Equalizer band type (string union mirroring `sonare::mastering::eq::EqBandType`).
382
- */
383
- type EqBandType = 'Peak' | 'LowShelf' | 'HighShelf' | 'LowPass' | 'HighPass' | 'BandPass' | 'Notch' | 'TiltShelf' | 'FlatTilt';
384
- /** Biquad coefficient design mode. */
385
- type EqCoeffMode = 'Rbj' | 'Vicanek';
386
- /** Stereo placement for an EQ band. */
387
- type EqStereoPlacement = 'Stereo' | 'Left' | 'Right' | 'Mid' | 'Side';
388
- /** Per-band phase behaviour. */
389
- type EqBandPhase = 'Inherit' | 'ZeroLatency' | 'NaturalPhase' | 'LinearPhase';
390
- /**
391
- * Equalizer band configuration accepted by {@link StreamingEqualizer.setBand}.
392
- *
393
- * All fields are optional; omitted values fall back to the C++ band defaults
394
- * (Peak, 1000 Hz, 0 dB gain, Butterworth Q, disabled).
395
- */
396
- interface EqBand {
397
- type?: EqBandType;
398
- frequencyHz?: number;
399
- gainDb?: number;
400
- q?: number;
401
- enabled?: boolean;
402
- coeffMode?: EqCoeffMode;
403
- slopeDbOct?: number;
404
- placement?: EqStereoPlacement;
405
- phase?: EqBandPhase;
406
- soloed?: boolean;
407
- bypassed?: boolean;
408
- proportionalQ?: boolean;
409
- proportionalQStrength?: number;
410
- dynamic?: boolean;
411
- thresholdDb?: number;
412
- autoThreshold?: boolean;
413
- ratio?: number;
414
- rangeDb?: number;
415
- attackMs?: number;
416
- releaseMs?: number;
417
- lookaheadMs?: number;
418
- externalSidechain?: boolean;
419
- sidechainFreqHz?: number;
420
- sidechainQ?: number;
421
- }
422
- type VoicePresetId = 'neutral-monitor' | 'bright-idol' | 'soft-whisper' | 'deep-narrator' | 'robot-mascot' | 'dark-villain';
423
- type VoicePresetCategory = 'monitor' | 'bright' | 'soft' | 'deep' | 'robot' | 'dark' | 'custom';
424
- interface RealtimeVoiceChangerPresetMetadata {
425
- schemaVersion: 1;
426
- id: string;
427
- name: string;
428
- description?: string;
429
- category: VoicePresetCategory;
430
- }
431
- type RealtimeVoiceChangerPreset = (RealtimeVoiceChangerPresetMetadata & {
432
- dsp: Record<string, unknown>;
433
- macros?: never;
434
- }) | (RealtimeVoiceChangerPresetMetadata & {
435
- macros: Record<string, number>;
436
- dsp?: never;
437
- });
438
- type RealtimeVoiceChangerConfigInput = VoicePresetId | RealtimeVoiceChangerPreset;
439
- /**
440
- * Flat (POD) realtime voice-changer configuration. Keys are camelCase to match
441
- * the Node addon getter, so a preset config reads identically across both JS
442
- * surfaces (the underlying C ABI / Python POD uses the snake_case equivalents).
443
- */
444
- interface RealtimeVoiceChangerPodConfig {
445
- inputGainDb: number;
446
- outputGainDb: number;
447
- wetMix: number;
448
- retuneSemitones: number;
449
- retuneMix: number;
450
- retuneGrainSize: number;
451
- formantFactor: number;
452
- formantAmount: number;
453
- formantBody: number;
454
- formantBrightness: number;
455
- formantNasal: number;
456
- eqHighpassHz: number;
457
- eqBodyDb: number;
458
- eqPresenceDb: number;
459
- eqAirDb: number;
460
- gateThresholdDb: number;
461
- gateAttackMs: number;
462
- gateReleaseMs: number;
463
- gateRangeDb: number;
464
- compressorThresholdDb: number;
465
- compressorRatio: number;
466
- compressorAttackMs: number;
467
- compressorReleaseMs: number;
468
- compressorMakeupGainDb: number;
469
- deesserFrequencyHz: number;
470
- deesserThresholdDb: number;
471
- deesserRatio: number;
472
- deesserRangeDb: number;
473
- reverbMix: number;
474
- reverbTimeMs: number;
475
- reverbDamping: number;
476
- reverbSeed: number;
477
- limiterCeilingDb: number;
478
- limiterReleaseMs: number;
479
- /** Non-zero enables the 4x-oversampled inter-sample-peak limiter (default enabled). */
480
- limiterEnableIspLimiter: boolean;
481
- /** True-peak ceiling in dBTP applied by the ISP limiter (default -1.0). */
482
- limiterIspCeilingDbtp: number;
483
- }
484
-
485
- type EngineClip = WasmEngineClip;
486
- type ClipPageRequest = WasmClipPageRequest;
487
- type EngineParameterInfo = WasmEngineParameterInfo;
488
- type EngineAutomationPoint = WasmEngineAutomationPoint;
489
- type EngineMarker = WasmEngineMarker;
490
- type EngineMetronomeConfig = WasmEngineMetronomeConfig;
491
- type EngineGraphSpec = WasmEngineGraphSpec;
492
- type EngineCaptureStatus = WasmEngineCaptureStatus;
493
- type EngineCaptureSource = EngineCaptureStatus['source'] | number;
494
- type EngineBounceOptions = WasmEngineBounceOptions;
495
- type EngineBounceResult = WasmEngineBounceResult;
496
- type EngineFreezeOptions = WasmEngineFreezeOptions;
497
- type EngineFreezeResult = WasmEngineFreezeResult;
498
- type EngineTelemetry = WasmEngineTelemetry;
499
- type EngineMeterTelemetry = WasmEngineMeterTelemetry;
500
- type EngineMeterTelemetryWide = WasmEngineMeterTelemetryWide;
501
- type EngineScopeTelemetry = WasmEngineScopeTelemetry;
502
- type EngineTransportState = WasmEngineTransportState;
503
- type EngineTempoSegment = WasmEngineTempoSegment;
504
- type EngineTimeSignatureSegment = WasmEngineTimeSignatureSegment;
505
- interface EngineTrackSend {
506
- busId: number;
507
- levelDb?: number;
508
- enabled?: boolean;
509
- /**
510
- * Pre/post-fader tap point. Defaults to post-fader when omitted, matching the
511
- * historical lane-send behavior and the scene-JSON default.
512
- */
513
- sendTiming?: SendTiming | number;
514
- }
515
- interface EngineTrackLane {
516
- trackId: number;
517
- sends?: EngineTrackSend[];
518
- /**
519
- * Bus the lane's post-fader output sums into instead of the master mix
520
- * (group/folder routing); 0 or absent keeps the lane on the master mix.
521
- */
522
- outputBusId?: number;
523
- /**
524
- * Input channel layout of the source feeding this lane (`SonareChannelLayout`:
525
- * 0 mono, 1 stereo, 2 5.1, 3 7.1). Absent defaults to stereo. Stored but inert
526
- * until the surround DSP path lands.
527
- */
528
- sourceChannelLayout?: number;
529
- }
530
- /** Per-track cue/monitor tap mode: off, pre-fader listen, or after-fader listen. */
531
- type EngineTrackMonitorMode = 'off' | 'pfl' | 'afl' | 0 | 1 | 2;
532
- interface EngineBus {
533
- busId: number;
534
- gainDb?: number;
535
- /**
536
- * Channel layout of the bus (`SonareChannelLayout`: 0 mono, 1 stereo, 2 5.1,
537
- * 3 7.1). A surround layout makes this a surround group bus: lanes routed to
538
- * it are surround-panned and it sums into the master plane-by-plane. Defaults
539
- * to stereo.
540
- */
541
- channelLayout?: number;
542
- }
543
- interface EngineMidiEvent {
544
- renderFrame: number;
545
- word0?: number;
546
- word1?: number;
547
- word2?: number;
548
- word3?: number;
549
- wordCount?: number;
550
- group?: number;
551
- sysexHandle?: number;
552
- data0?: number;
553
- data1?: number;
554
- }
555
- interface EngineMidiClipSchedule {
556
- id?: number;
557
- trackId?: number;
558
- destinationId?: number;
559
- startSample?: number;
560
- startPpq?: number;
561
- lengthSamples?: number;
562
- loop?: boolean;
563
- loopLengthSamples?: number;
564
- events: EngineMidiEvent[];
565
- }
566
- /** Options for {@link RealtimeEngine.bindMidiCc}. All fields are optional. */
567
- interface MidiCcBindOptions {
568
- /** Lower end of the mapped parameter range. Default `0`. */
569
- minValue?: number;
570
- /** Upper end of the mapped parameter range. Default `1`. */
571
- maxValue?: number;
572
- }
573
- declare class RealtimeEngine {
574
- private native;
575
- constructor(sampleRate?: number, maxBlockSize?: number, commandCapacity?: number, telemetryCapacity?: number, maxChannels?: number);
576
- prepare(sampleRate: number, maxBlockSize: number, commandCapacity?: number, telemetryCapacity?: number, maxChannels?: number): void;
577
- /** Queue a sample-accurate parameter change (engine kSetParam). */
578
- setParameter(paramId: number, value: number, renderFrame?: number): void;
579
- /** Queue a smoothed parameter change (engine kSetParamSmoothed). */
580
- setParameterSmoothed(paramId: number, value: number, renderFrame?: number): void;
581
- /**
582
- * Set the default ramp time (ms) for engine-level smoothed parameters —
583
- * fader/pan glides, insert-parameter automation, and MIDI-CC mappings. The
584
- * default is 20 ms; pass `0` for instant (un-ramped) changes.
585
- */
586
- setParamSmoothingMs(smoothingMs: number): void;
587
- setSoloMute(laneIndex: number, solo: boolean, mute: boolean, renderFrame?: number): void;
588
- /** Queue a per-track PFL/AFL monitor tap mode change. */
589
- setTrackMonitorMode(laneIndex: number, mode: EngineTrackMonitorMode, renderFrame?: number): void;
590
- setMidiClips(clips: readonly EngineMidiClipSchedule[]): void;
591
- setBuiltinInstrument(config?: {
592
- destinationId?: number;
593
- } & Record<string, unknown>, destinationId?: number): void;
594
- /**
595
- * Bind the patch-driven NativeSynth to a realtime MIDI destination. `patch`
596
- * is a {@link SynthPatch} or a preset-name string (`'saw-lead'` /
597
- * `'va:saw-lead'`; see {@link synthPresetNames}), resolving exactly like
598
- * {@link Project.bounceWithSynthInstrument}. Live note/CC commands and
599
- * scheduled MIDI clips routed to that destination render through the synth.
600
- * Unknown preset names throw. An object patch's `destinationId` is a JS
601
- * binding convenience, not part of the NativeSynth patch itself.
602
- */
603
- setSynthInstrument(patch?: SynthPatch | string, destinationId?: number): void;
604
- /**
605
- * Load (parse) SoundFont 2 bytes into the engine so SF2 instruments can be
606
- * bound with {@link setSf2Instrument}. The host fetches the `.sf2` and
607
- * passes the raw bytes; they are copied into linear memory for the call and
608
- * not referenced afterwards. Replaces any previously loaded SoundFont.
609
- */
610
- loadSoundFont(data: Uint8Array): void;
611
- /**
612
- * Bind a GS-compatible SoundFont player to a realtime MIDI destination, fed
613
- * by the engine's loaded SoundFont ({@link loadSoundFont}). Live note/CC
614
- * commands and scheduled MIDI clips routed to that destination render
615
- * through the player (16 MIDI channels, channel 10 drums, GS NRPN part
616
- * edits, GS/GM SysEx resets). Without a loaded SoundFont — or for programs
617
- * the SoundFont does not cover — notes play through the built-in
618
- * synthesizer GM fallback bank (the data-free floor).
619
- */
620
- setSf2Instrument(config?: {
621
- destinationId?: number;
622
- gain?: number;
623
- polyphony?: number;
624
- preferModelForModeledFamilies?: boolean;
625
- }, destinationId?: number): void;
626
- clearMidiInstrument(destinationId?: number): void;
627
- midiInstrumentCount(): number;
628
- /**
629
- * Bind a live MIDI CC to an engine automation parameter. The MIDI event still
630
- * reaches the destination instrument; when bound, its 7-bit value is also
631
- * mapped into [minValue, maxValue] for `paramId`.
632
- */
633
- bindMidiCc(channel: number, controller: number, paramId: number, options?: MidiCcBindOptions): void;
634
- /** Bind a 7/14-bit CC, RPN, or NRPN descriptor to a live parameter. */
635
- bindMidiCcBinding(binding: ProjectMidiCcBinding): void;
636
- clearMidiCcBindings(): void;
637
- midiCcBindingCount(): number;
638
- /** Install/replace a live non-destructive MIDI-FX insert for one destination. */
639
- setMidiFx(destinationId: number, configJson: string): void;
640
- clearMidiFx(destinationId?: number): void;
641
- /** Enable the engine-owned live MIDI input source for a destination. */
642
- setMidiInputSource(destinationId?: number): void;
643
- clearMidiInputSource(): void;
644
- midiInputPendingCount(): number;
645
- /**
646
- * Route a destination's (track lane's) MIDI to the external output queue
647
- * instead of the internal instrument rack, so the track plays an external
648
- * device. Clearing it restores internal-synth playback.
649
- */
650
- setMidiDestinationExternal(destinationId: number, external: boolean): void;
651
- /**
652
- * Enable/disable forwarding MIDI clock + transport (start/continue/stop) to
653
- * the external output queue so external gear tracks the transport tempo.
654
- */
655
- setExternalMidiClockEnabled(enabled: boolean): void;
656
- /** Count of external-MIDI events dropped because the output queue was full. */
657
- externalMidiDroppedCount(): number;
658
- externalMidiPendingCount(): number;
659
- /**
660
- * Drain queued external-MIDI events, already lowered to MIDI 1.0 byte
661
- * messages ready to write to a Web MIDI output port. Call once per audio
662
- * block / animation frame. `maxRecords` caps the number of output events
663
- * returned — the shared unit across every surface. Events past the cap stay
664
- * queued for the next call (lossless); call again to drain the rest.
665
- */
666
- drainExternalMidi(maxRecords?: number): WasmExternalMidiEvent[];
667
- /** Scalar, allocation-free external-MIDI drain for AudioWorklet SAB output. */
668
- popExternalMidiToScratch(): boolean;
669
- externalMidiScratchDestinationId(): number;
670
- externalMidiScratchRenderFrame(): number;
671
- externalMidiScratchByteWord(): number;
672
- externalMidiScratchByteCount(): number;
673
- consumeExternalMidiScratch(): void;
674
- pushMidiInputNoteOn(group: number, channel: number, note: number, velocity: number, portTimeSamples?: number): void;
675
- pushMidiInputNoteOff(group: number, channel: number, note: number, velocity?: number, portTimeSamples?: number): void;
676
- pushMidiInputCc(group: number, channel: number, controller: number, value: number, portTimeSamples?: number): void;
677
- pushMidiNoteOn(destinationId: number, group: number, channel: number, note: number, velocity: number, renderFrame?: number): void;
678
- pushMidiNoteOff(destinationId: number, group: number, channel: number, note: number, velocity?: number, renderFrame?: number): void;
679
- /**
680
- * Queue an immediate (live) MIDI control change to a MIDI destination
681
- * (engine kMidiCcImmediate). `group`/`channel` are 0..15; `controller`/`value`
682
- * are 7-bit (0..127). `renderFrame` is the frame to fire at, or -1 for
683
- * immediate. Mirrors the Node/Python/C-ABI `pushMidiCc`.
684
- */
685
- pushMidiCc(destinationId: number, group: number, channel: number, controller: number, value: number, renderFrame?: number): void;
686
- /** Queue one immediate MIDI 1.0 channel-voice UMP word for a destination. */
687
- pushMidiUmp(destinationId: number, word0: number, renderFrame?: number): void;
688
- /**
689
- * Queue an immediate (live) MIDI SysEx frame to a MIDI destination. `data` is
690
- * the full message including the leading 0xF0 and trailing 0xF7 (1..512
691
- * bytes). `renderFrame` is the frame to fire at, or -1 for immediate. Mirrors
692
- * the Node/Python/C-ABI `pushMidiSysex`.
693
- */
694
- pushMidiSysex(destinationId: number, data: Uint8Array, renderFrame?: number): void;
695
- /**
696
- * Queue a MIDI panic (all-notes-off) releasing every sounding note at
697
- * `renderFrame` (-1 = immediate). Mirrors the C-ABI `pushMidiPanic`.
698
- */
699
- pushMidiPanic(renderFrame?: number): void;
700
- /**
701
- * Remove all registered parameters (and their automation lanes). Control-thread
702
- * only; not realtime-safe. Mirrors the C-ABI `clearParameters`.
703
- */
704
- clearParameters(): void;
705
- /** Read back the current transport state snapshot. */
706
- getTransportState(): EngineTransportState;
707
- play(renderFrame?: number): void;
708
- stop(renderFrame?: number): void;
709
- seekSample(timelineSample: number, renderFrame?: number): void;
710
- /**
711
- * Snaps every in-flight parameter ramp (engine-level smoothed params, mixer
712
- * lane fader/pan/gate, bus gains) to its target value. Offline renders call
713
- * this after a priming process() block so the first audible block renders at
714
- * settled values instead of ramping in from defaults.
715
- */
716
- settleParameters(): void;
717
- /** Drains queued commands on an offline/control-only engine immediately. */
718
- flushControlCommands(): void;
719
- seekPpq(ppq: number, renderFrame?: number): void;
720
- /** Set a finite tempo in the range (0, 100000] BPM. */
721
- setTempo(bpm: number): void;
722
- setTempoSegments(segments: readonly EngineTempoSegment[]): void;
723
- setTimeSignature(numerator: number, denominator: number): void;
724
- setTimeSignatureSegments(segments: readonly EngineTimeSignatureSegment[]): void;
725
- sampleAtPpq(ppq: number): number;
726
- setLoop(startPpq: number, endPpq: number, enabled?: boolean): void;
727
- addParameter(info: EngineParameterInfo): void;
728
- parameterCount(): number;
729
- parameterInfoByIndex(index: number): EngineParameterInfo;
730
- parameterInfo(id: number): EngineParameterInfo;
731
- setAutomationLane(paramId: number, points: EngineAutomationPoint[]): void;
732
- automationLaneCount(): number;
733
- setMarkers(markers: EngineMarker[]): void;
734
- markerCount(): number;
735
- markerByIndex(index: number): EngineMarker;
736
- marker(id: number): EngineMarker;
737
- seekMarker(markerId: number, renderFrame?: number): void;
738
- setLoopFromMarkers(startMarkerId: number, endMarkerId: number): void;
739
- /** Set a metronome config; click lengths are limited to one second. */
740
- setMetronome(config: EngineMetronomeConfig): void;
741
- metronome(): Required<EngineMetronomeConfig>;
742
- countInEndSample(startSample: number, bars: number): number;
743
- setGraph(spec: EngineGraphSpec): void;
744
- graphNodeCount(): number;
745
- graphConnectionCount(): number;
746
- setClips(clips: EngineClip[]): void;
747
- /**
748
- * Returns the PCM generated for a tempo-sync clip by the control-thread
749
- * setter, or `null` when the clip did not require a tempo-sync bake.
750
- */
751
- prebakedClipChannels(clipId: number): Float32Array[] | null;
752
- clipCount(): number;
753
- setTrackLanes(lanes: Array<number | EngineTrackLane>): void;
754
- /**
755
- * Keys one insert of a lane strip from another lane's post-strip audio
756
- * (ducking/sidechainRouter inserts). sourceTrackId 0 removes the binding.
757
- */
758
- setLaneSidechain(trackId: number, insertIndex: number, sourceTrackId: number): void;
759
- setTrackBuses(buses: EngineBus[]): void;
760
- setBusStripJson(busId: number, sceneJson: string): void;
761
- setTrackStripJson(trackId: number, sceneJson: string): void;
762
- setTrackStripEqBand(trackId: number, bandIndex: number, band: EqBand | string): void;
763
- setTrackStripEqBandJson(trackId: number, bandIndex: number, bandJson: string): void;
764
- setTrackStripInsertBypassed(trackId: number, insertIndex: number, bypassed: boolean, resetOnBypass?: boolean): void;
765
- setMasterStripJson(sceneJson: string): void;
766
- setMasterStripEqBand(bandIndex: number, band: EqBand | string): void;
767
- setMasterStripEqBandJson(bandIndex: number, bandJson: string): void;
768
- setMasterStripInsertBypassed(insertIndex: number, bypassed: boolean, resetOnBypass?: boolean): void;
769
- /**
770
- * Changes one track-strip insert parameter in realtime, addressed by the
771
- * processor's JSON-key parameter name (see {@link masteringInsertParamInfo}).
772
- * Applied at the next block head via the engine command queue; safe during
773
- * playback. Throws if the track, insert, or name is unknown, the param is not
774
- * realtime-safe, or the command queue is full.
775
- */
776
- setTrackStripInsertParamByName(trackId: number, insertIndex: number, paramName: string, value: number): void;
777
- /** Master-strip counterpart of {@link setTrackStripInsertParamByName}. */
778
- setMasterStripInsertParamByName(insertIndex: number, paramName: string, value: number): void;
779
- /** Bus-strip counterpart of {@link setTrackStripInsertParamByName}. */
780
- setBusStripInsertParamByName(busId: number, insertIndex: number, paramName: string, value: number): void;
781
- /** Bus-strip counterpart of {@link setTrackStripInsertBypassed}. */
782
- setBusStripInsertBypassed(busId: number, insertIndex: number, bypassed: boolean, resetOnBypass?: boolean): void;
783
- /**
784
- * Resolves a track-lane insert parameter (by its JSON-key name) to the
785
- * reserved automation id usable with `setAutomationLane` / `setParameter`.
786
- * Returns `-1` when the track, insert, or name is unknown. (The Python binding
787
- * raises a `SonareError` for an unknown id where Node/WASM return the `-1`
788
- * sentinel.)
789
- *
790
- * This trio is how a mastering processor gets time-varying automation: the
791
- * `eq.*`, `dynamics.*`, `saturation.*`, `spectral.*`, `stereo.*`,
792
- * `maximizer.*` and `multiband.*` processors are all available as strip
793
- * inserts, so placing one on a strip and resolving its parameter here drives
794
- * it at audio-block precision, live and offline alike. The whole-signal
795
- * stages of the offline mastering chain (`repair.*`, `loudness`, and the
796
- * match stages) have no insert form and no automation id: they buffer the
797
- * entire signal by construction and do not run on the realtime path.
798
- */
799
- resolveTrackInsertAutomationId(trackId: number, insertIndex: number, paramName: string): number;
800
- resolveMasterInsertAutomationId(insertIndex: number, paramName: string): number;
801
- resolveBusInsertAutomationId(busId: number, insertIndex: number, paramName: string): number;
802
- /** Sets a track lane strip's pan position in realtime (glitch-free). */
803
- setTrackStripPan(trackId: number, pan: number): void;
804
- /** Sets a track lane strip's pan law in realtime. */
805
- setTrackStripPanLaw(trackId: number, panLaw: PanLawInput): void;
806
- /** Sets a track lane strip's pan mode in realtime. */
807
- setTrackStripPanMode(trackId: number, panMode: PanMode | number): void;
808
- /** Sets a track lane strip's dual-pan left/right positions in realtime. */
809
- setTrackStripDualPan(trackId: number, leftPan: number, rightPan: number): void;
810
- /**
811
- * Sets a track lane strip's inter-channel alignment delay (whole samples).
812
- * Adjusts strip latency, so PDC and reported graph latency are refreshed.
813
- */
814
- setTrackStripChannelDelaySamples(trackId: number, delaySamples: number): void;
815
- createClipPageProvider(numChannels: number, numSamples: number, pageFrames: number): ClipPageProvider;
816
- supplyClipPage(providerId: number, pageIndex: number, channels: Float32Array[]): void;
817
- clearClipPage(providerId: number, pageIndex: number): void;
818
- destroyClipPageProvider(providerId: number): void;
819
- popClipPageRequest(): ClipPageRequest | null;
820
- /**
821
- * Moves one native request into the binding's persistent scalar scratch.
822
- * This avoids creating an embind JS object in AudioWorklet process().
823
- */
824
- popClipPageRequestToScratch(): boolean;
825
- clipPageRequestScratchClipId(): number;
826
- clipPageRequestScratchSample(): number;
827
- /** Cumulative page misses dropped because the native bounded request queue was full. */
828
- clipPageRequestOverflowCount(): number;
829
- setCaptureBuffer(numChannels: number, capacityFrames: number): void;
830
- armCapture(armed?: boolean): void;
831
- setCapturePunch(startSample: number, endSample: number, enabled?: boolean): void;
832
- setCaptureSource(source: EngineCaptureSource): void;
833
- /** Positive values delay capture relative to the punch window. */
834
- setRecordOffsetSamples(offsetSamples: number): void;
835
- setInputMonitor(enabled: boolean, gain?: number): void;
836
- resetCapture(): void;
837
- captureStatus(): EngineCaptureStatus;
838
- capturedAudio(): Float32Array[];
839
- /**
840
- * Renders in place, adding engine output to `channels`. Zero each plane first
841
- * when it contains no upstream input.
842
- */
843
- process(channels: Float32Array[]): Float32Array[];
844
- /**
845
- * Allocates persistent per-channel WASM-heap scratch for the zero-copy
846
- * `getChannelBuffer` / `processPrepared` realtime path. Call once (off the
847
- * audio thread) before driving `processPrepared` from an AudioWorklet so the
848
- * render callback never allocates on the C++/JS heap.
849
- */
850
- prepareChannels(numChannels: number, maxFrames: number): void;
851
- /**
852
- * Returns a Float32Array view onto the persistent WASM-heap scratch for one
853
- * channel (valid for up to `numFrames`). Fill it, call `processPrepared`, then
854
- * read the same view back. Re-acquire after WASM memory growth.
855
- */
856
- getChannelBuffer(channel: number, numFrames: number): Float32Array;
857
- /**
858
- * Runs the engine in place over the prepared per-channel scratch buffers.
859
- * Zero each active span first when it contains no upstream input.
860
- * Allocation-free: safe to call on the AudioWorklet render thread after
861
- * `prepareChannels`.
862
- */
863
- processPrepared(numFrames: number): void;
864
- /**
865
- * Allocates the cue-bus counterpart of {@link prepareChannels}. Needed only
866
- * when PFL/AFL monitoring must reach a separate output: `processPrepared`
867
- * folds the cue bus into the program output, while
868
- * {@link processPreparedWithMonitor} keeps the two apart. Call once, off the
869
- * audio thread, with at least as many channels as `prepareChannels` got.
870
- */
871
- prepareMonitorChannels(numChannels: number, maxFrames: number): void;
872
- /**
873
- * Returns a Float32Array view onto the persistent cue-bus scratch for one
874
- * channel (valid for up to `numFrames`). Read it after
875
- * {@link processPreparedWithMonitor}. Re-acquire after WASM memory growth.
876
- */
877
- getMonitorChannelBuffer(channel: number, numFrames: number): Float32Array;
878
- /**
879
- * Runs the engine in place over the prepared scratch, writing the cue bus to
880
- * the monitor scratch instead of folding it into the program output.
881
- * Allocation-free: safe on the AudioWorklet render thread after
882
- * `prepareChannels` and `prepareMonitorChannels`.
883
- */
884
- processPreparedWithMonitor(numFrames: number): void;
885
- processWithMonitor(channels: Float32Array[]): WasmEngineProcessWithMonitorResult;
886
- renderOffline(channels: Float32Array[], blockSize?: number): Float32Array[];
887
- bounceOffline(options: EngineBounceOptions): EngineBounceResult;
888
- freezeOffline(options: EngineFreezeOptions): EngineFreezeResult;
889
- drainTelemetry(maxRecords?: number): EngineTelemetry[];
890
- popTelemetryToScratch(): boolean;
891
- telemetryScratchType(): number;
892
- telemetryScratchError(): number;
893
- telemetryScratchRenderFrame(): number;
894
- telemetryScratchTimelineSample(): number;
895
- telemetryScratchAudibleTimelineSample(): number;
896
- telemetryScratchGraphLatencySamplesQ8(): number;
897
- telemetryScratchValue(): number;
898
- popMeterTelemetryToScratch(): boolean;
899
- meterScratchTargetId(): number;
900
- meterScratchRenderFrame(): number;
901
- meterScratchValue(field: number): number;
902
- drainMeterTelemetry(maxRecords?: number): EngineMeterTelemetry[];
903
- /**
904
- * Drains pending meter telemetry as per-plane (wide) records for a surround
905
- * target. Use this for a surround mix target; {@link drainMeterTelemetry}
906
- * stays the stereo fast path. The two share one queue — call only one per
907
- * target. The live AudioWorklet path owns the queue via the stereo drain, so
908
- * this wide drain is for an offline (non-worklet) engine instance; per-plane
909
- * surround meters are not delivered over the live worklet meter ring.
910
- */
911
- drainMeterTelemetryWide(maxRecords?: number): EngineMeterTelemetryWide[];
912
- /**
913
- * Enables per-target spectrum + vectorscope capture. @param intervalFrames is
914
- * the minimum render-frame gap between snapshots (0 disables). @param bandCount
915
- * is the FFT band resolution (1..64); changing it re-prepares the tap. Returns
916
- * the band count actually applied.
917
- */
918
- configureScopeTelemetry(intervalFrames: number, bandCount: number): number;
919
- /** Drains pending spectrum + vectorscope snapshots (per mix target). */
920
- drainScopeTelemetry(maxRecords?: number): EngineScopeTelemetry[];
921
- popScopeTelemetryToScratch(): boolean;
922
- scopeScratchTargetId(): number;
923
- scopeScratchRenderFrame(): number;
924
- scopeScratchBandCount(): number;
925
- scopeScratchBand(index: number): number;
926
- scopeScratchPointCount(): number;
927
- scopeScratchPointLeft(index: number): number;
928
- scopeScratchPointRight(index: number): number;
929
- destroy(): void;
930
- }
931
- declare class ClipPageProvider {
932
- private readonly engine;
933
- readonly id: number;
934
- private disposed;
935
- constructor(engine: RealtimeEngine, id: number);
936
- supply(pageIndex: number, channels: Float32Array[]): void;
937
- clear(pageIndex: number): void;
938
- destroy(): void;
939
- }
940
-
941
- interface OpfsClipPageProviderOptions {
942
- path: string;
943
- numChannels: number;
944
- numSamples: number;
945
- pageFrames: number;
946
- dataOffsetBytes?: number;
947
- worker?: Worker;
948
- terminateWorkerOnClose?: boolean;
949
- /** Internal bridge hook used to mirror a supplied page into an AudioWorklet. */
950
- onPageSupplied?: (pageIndex: number, channels: Float32Array[]) => void;
951
- /** Internal bridge hook used to mirror an eviction into an AudioWorklet. */
952
- onPageCleared?: (pageIndex: number) => void;
953
- /** Internal bridge hook called after the local provider is destroyed. */
954
- onClose?: () => void;
955
- }
956
- interface OpfsClipPageProviderBinding {
957
- provider: ClipPageProvider;
958
- supplyPage(pageIndex: number): Promise<boolean>;
959
- supplyRequest(request: ClipPageRequest): Promise<boolean>;
960
- /** Evict one resident page from every configured consumer. */
961
- clearPage?(pageIndex: number): void;
962
- close(): void;
963
- }
964
-
965
- /**
966
- * Minimal engine surface the streamer drives. {@link RealtimeEngine} satisfies
967
- * this structurally; tests can supply a lightweight stand-in.
968
- */
969
- interface ClipPageStreamerEngine {
970
- /** Drain one pending audio-thread page-miss request, or `null` when empty. */
971
- popClipPageRequest(): ClipPageStreamerRequest | null;
972
- }
973
- /**
974
- * A page miss reported by either a direct engine (`sample`) or the worklet
975
- * bridge (`pageIndex`). Exactly one position form is required.
976
- */
977
- interface ClipPageStreamerRequest {
978
- clipId: number;
979
- sample?: number;
980
- pageIndex?: number;
981
- }
982
- /** A paged clip the streamer keeps fed from its backing store. */
983
- interface ClipPageStreamSource {
984
- /** Clip schedule id passed to `setClips` (matches {@link ClipPageRequest.clipId}). */
985
- clipId: number;
986
- /** OPFS-backed page provider binding for this clip. */
987
- binding: OpfsClipPageProviderBinding;
988
- /** Page size in frames (must equal the provider's `pageFrames`). */
989
- pageFrames: number;
990
- /** Total sample count of the clip source. */
991
- numSamples: number;
992
- }
993
- interface ClipPageStreamerOptions {
994
- /**
995
- * Pages to prefetch ahead of the page a miss was reported for. Larger values
996
- * hide fetch latency at the cost of more resident memory. Default 2.
997
- */
998
- readAheadPages?: number;
999
- /**
1000
- * Pages to retain behind the playback frontier before eviction, so a small
1001
- * backward seek does not immediately miss. Default 1.
1002
- */
1003
- retainBehindPages?: number;
1004
- /**
1005
- * Upper bound on requests drained per {@link ClipPageStreamer.pump} call, so a
1006
- * burst of misses cannot spin unbounded. Default 256.
1007
- */
1008
- maxRequestsPerPump?: number;
1009
- }
1010
- /**
1011
- * Keeps OPFS-paged clips fed within a bounded sliding window around the live
1012
- * playback position, so a multitrack arrangement never holds its full PCM in
1013
- * WASM memory.
1014
- *
1015
- * The audio thread reports a page miss whenever the {@link ClipPlayer} reads a
1016
- * sample whose page is not resident. {@link pump} drains those requests, fetches
1017
- * the missing page plus a read-ahead window from each clip's backing store, and
1018
- * evicts pages that fall outside the window via the provider's `clear`. The
1019
- * resident set per clip is therefore bounded to
1020
- * `retainBehindPages + readAheadPages + 1` pages regardless of clip length.
1021
- *
1022
- * Call {@link pump} on a cadence that keeps up with playback — typically once
1023
- * per animation frame or per worklet control tick on the main/control thread
1024
- * (never the audio thread; fetches are asynchronous).
1025
- */
1026
- declare class ClipPageStreamer {
1027
- private readonly engine;
1028
- private readonly readAheadPages;
1029
- private readonly retainBehindPages;
1030
- private readonly maxRequestsPerPump;
1031
- private readonly sources;
1032
- private closed;
1033
- constructor(engine: ClipPageStreamerEngine, options?: ClipPageStreamerOptions);
1034
- /**
1035
- * Register a paged clip. Pages already supplied to the provider before
1036
- * registration (for example a primed first page) should be passed in
1037
- * `initialResidentPages` so they participate in eviction.
1038
- */
1039
- addSource(source: ClipPageStreamSource, initialResidentPages?: Iterable<number>): void;
1040
- /** Stop tracking a clip. Does not close its binding (the caller owns that). */
1041
- removeSource(clipId: number): void;
1042
- /**
1043
- * Explicitly start a new playback generation after a host seek/loop. Resident
1044
- * pages are evicted and any older in-flight fetch is cleared when it settles.
1045
- * The next miss establishes the new bounded window.
1046
- */
1047
- resetSource(clipId: number): void;
1048
- /**
1049
- * Drain pending page-miss requests, fetch the missing pages plus their
1050
- * read-ahead window, and evict out-of-window pages. Resolves once this round's
1051
- * fetches settle. Concurrent fetches are serialized inside each binding.
1052
- */
1053
- pump(): Promise<void>;
1054
- /** Close every registered clip's binding and stop tracking. */
1055
- close(): void;
1056
- private serviceFrontier;
1057
- private resetState;
1058
- private clearPage;
1059
- }
1060
- interface OpfsClipStreamOptions extends OpfsClipPageProviderOptions {
1061
- /** Clip schedule id used in `setClips` (matches the page-miss request clipId). */
1062
- clipId: number;
1063
- /**
1064
- * Leading pages fetched synchronously before returning, so playback can start
1065
- * without an immediate miss. Default 1.
1066
- */
1067
- primePages?: number;
1068
- }
1069
- interface OpfsClipStream {
1070
- binding: OpfsClipPageProviderBinding;
1071
- /** Pass as `addClip`'s buffer argument to schedule the streaming clip. */
1072
- provider: ClipPageProvider;
1073
- }
1074
- /** Structural seam implemented by the AudioWorklet-backed `SonareEngine`. */
1075
- interface WorkletOpfsClipStreamHost {
1076
- attachOpfsClipStream(options: OpfsClipStreamOptions): Promise<OpfsClipStream>;
1077
- }
1078
- /**
1079
- * One-call wiring of an OPFS-backed streaming clip: creates the page provider,
1080
- * primes the leading pages, and registers it with `streamer` so later misses are
1081
- * serviced within the bounded window. Returns the binding (for `close`) and the
1082
- * provider to schedule via `addClip(trackId, provider, startPpq, { id: clipId })`.
1083
- *
1084
- * @param streamer Shared streamer pumped on the control thread.
1085
- * @param engine Engine the provider is created on (the same one `streamer` drives).
1086
- * @param options Provider options plus `clipId` and optional `primePages`.
1087
- */
1088
- declare function attachOpfsClipStream(streamer: ClipPageStreamer, engine: RealtimeEngine, options: OpfsClipStreamOptions): Promise<OpfsClipStream>;
1089
- /**
1090
- * Worklet overload: delegates to `SonareEngine.attachOpfsClipStream`, which
1091
- * creates the remote provider and drives this same sliding-window policy from
1092
- * worklet page-miss messages.
1093
- */
1094
- declare function attachOpfsClipStream(engine: WorkletOpfsClipStreamHost, options: OpfsClipStreamOptions): Promise<OpfsClipStream>;
1095
-
1096
- /**
1097
- * Block-by-block streaming variant of {@link masteringChain}.
1098
- *
1099
- * Maintains processor state across {@link processMono}/{@link processStereo}
1100
- * calls. Only ProcessorBase-backed stages are supported. Configurations that
1101
- * enable `repair.denoise` throw at construction. An enabled `loudness` stage
1102
- * also throws unless {@link StreamingMasteringChainConfig.loudnessStaticGainDb}
1103
- * supplies a precomputed normalization gain.
1104
- *
1105
- * Call {@link delete} (or use a `try/finally`) to release the underlying WASM
1106
- * object — the embind handle is not garbage-collected automatically.
1107
- *
1108
- * Reachable from the AudioWorklet realm through the `sonare/worklet` entry, but
1109
- * the realtime contract is the caller's to keep:
1110
- *
1111
- * - {@link prepare} builds the processors and allocates. Call it once from a
1112
- * message handler, never from `AudioWorkletProcessor.process()`.
1113
- * - {@link processMono}/{@link processStereo} return fresh arrays. On the render
1114
- * thread, reuse the returned reference for the block rather than retaining it.
1115
- * - An enabled `loudness` stage needs `loudnessStaticGainDb` measured offline,
1116
- * because whole-signal integrated LUFS cannot be measured block by block. Pass
1117
- * `loudnessStaticGainPeakDb` too and the static gain is clamped exactly as the
1118
- * offline chain clamps it, so the live preview matches the render.
1119
- * - {@link flush} output starts {@link latencySamples} samples early; discard
1120
- * that many leading samples when time alignment matters.
1121
- *
1122
- * The chain is a host-side stage, not an engine insert: it does not participate
1123
- * in the engine's PDC or bypass, so latency compensation against other engine
1124
- * outputs is also the caller's.
1125
- *
1126
- * @example
1127
- * ```typescript
1128
- * const chain = new StreamingMasteringChain({ eq: { tiltDb: 1.0 } });
1129
- * try {
1130
- * chain.prepare(44100, 512, 1);
1131
- * const out = chain.processMono(blockSamples);
1132
- * } finally {
1133
- * chain.delete();
1134
- * }
1135
- * ```
1136
- */
1137
- declare class StreamingMasteringChain {
1138
- private chain;
1139
- constructor(config: StreamingMasteringChainConfig);
1140
- /**
1141
- * Initialize processors for the given sample rate and block layout.
1142
- *
1143
- * @param sampleRate - Sample rate in Hz
1144
- * @param maxBlockSize - Maximum block size per process call
1145
- * @param numChannels - 1 (mono) or 2 (stereo)
1146
- */
1147
- prepare(sampleRate: number, maxBlockSize: number, numChannels: number): void;
1148
- /**
1149
- * Process one mono block, returning the processed samples (same length).
1150
- */
1151
- processMono(samples: Float32Array): Float32Array;
1152
- /**
1153
- * Process one stereo block, returning the processed channels.
1154
- */
1155
- processStereo(left: Float32Array, right: Float32Array): {
1156
- left: Float32Array;
1157
- right: Float32Array;
1158
- };
1159
- /**
1160
- * Emit delayed audio and finite processor tails after the final mono block.
1161
- * Call until this returns an empty array. The initial `latencySamples()`
1162
- * samples of the concatenated stream are delayed and should be discarded for
1163
- * time-aligned output.
1164
- */
1165
- flushMono(): Float32Array;
1166
- /** Stereo counterpart of {@link flushMono}. */
1167
- flushStereo(): {
1168
- left: Float32Array;
1169
- right: Float32Array;
1170
- };
1171
- /** Reset all processor state without rebuilding. */
1172
- reset(): void;
1173
- /** Total reported latency in samples across all active processors. */
1174
- latencySamples(): number;
1175
- /** Ordered stage names that will run (e.g. `"eq.tilt"`). */
1176
- stageNames(): string[];
1177
- /** Release the underlying WASM object. Safe to call only once. */
1178
- delete(): void;
1179
- }
1180
-
1181
- /**
1182
- * sonare - Audio Analysis Library
1183
- *
1184
- * @example
1185
- * ```typescript
1186
- * import { init, detectBpm, detectKey, analyze } from '@libraz/libsonare';
1187
- *
1188
- * await init();
1189
- *
1190
- * // Detect BPM from audio samples
1191
- * const bpm = detectBpm(samples, sampleRate);
1192
- *
1193
- * // Detect musical key
1194
- * const key = detectKey(samples, sampleRate);
1195
- *
1196
- * // Full analysis
1197
- * const result = analyze(samples, sampleRate);
1198
- * ```
1199
- */
1200
-
1201
- /**
1202
- * Initialize the WASM module.
1203
- * Must be called before using any analysis functions.
1204
- *
1205
- * @param options - Optional module configuration
1206
- * @returns Promise that resolves when initialization is complete
1207
- */
1208
- declare function init(options?: {
1209
- locateFile?: (path: string, prefix: string) => string;
1210
- wasmBinary?: ArrayBuffer | Uint8Array;
1211
- moduleFactory?: (options?: {
1212
- locateFile?: (path: string, prefix: string) => string;
1213
- wasmBinary?: ArrayBuffer | Uint8Array;
1214
- }) => Promise<SonareModule>;
1215
- }): Promise<void>;
1216
- /**
1217
- * Check if the module is initialized.
1218
- */
1219
- declare function isInitialized(): boolean;
1220
-
1221
- interface SonareWorkletMeterSnapshot {
1222
- type: 'meter';
1223
- targetId: number;
1224
- frame: number;
1225
- peakDbL: number;
1226
- peakDbR: number;
1227
- rmsDbL: number;
1228
- rmsDbR: number;
1229
- correlation: number;
1230
- truePeakDbL: number;
1231
- truePeakDbR: number;
1232
- momentaryLufs: number;
1233
- shortTermLufs: number;
1234
- integratedLufs: number;
1235
- gainReductionDb: number;
1236
- }
1237
- interface SonareWorkletSpectrumSnapshot {
1238
- type: 'spectrum';
1239
- frame: number;
1240
- bands: Float32Array;
1241
- }
1242
- declare const SONARE_METER_RING_HEADER_INTS = 4;
1243
- declare const SONARE_METER_RING_RECORD_FLOATS = 14;
1244
- declare const SONARE_SPECTRUM_RING_HEADER_INTS = 5;
1245
- declare const SONARE_SCOPE_RING_HEADER_INTS = 6;
1246
- /** Low 24 bits of a frame index (exact in Float32). */
1247
- declare function encodeFrameLo(frame: number): number;
1248
- /** High bits of a frame index above 2^24 (exact in Float32 up to ~2^48). */
1249
- declare function encodeFrameHi(frame: number): number;
1250
- /** Reconstruct a frame index from its low/high Float32 lanes. */
1251
- declare function decodeFrame(lo: number, hi: number): number;
1252
- declare const SONARE_ENGINE_RING_HEADER_INTS = 5;
1253
- declare const SONARE_ENGINE_COMMAND_RECORD_BYTES = 32;
1254
- declare const SONARE_ENGINE_TELEMETRY_RECORD_BYTES = 48;
1255
- declare const SONARE_CLIP_PAGE_REQUEST_RING_HEADER_INTS = 5;
1256
- declare const SONARE_CLIP_PAGE_REQUEST_RING_RECORD_UINT32S = 2;
1257
- declare const SONARE_EXTERNAL_MIDI_RING_HEADER_INTS = 5;
1258
- declare const SONARE_EXTERNAL_MIDI_RING_RECORD_UINT32S = 4;
1259
- declare enum SonareEngineCommandType {
1260
- SetParam = 0,
1261
- SetParamSmoothed = 1,
1262
- TransportPlay = 2,
1263
- TransportStop = 3,
1264
- TransportSeekSample = 4,
1265
- TransportSeekPpq = 5,
1266
- SetTempoMap = 6,
1267
- SetLoop = 7,
1268
- SwapGraph = 8,
1269
- SwapAutomation = 9,
1270
- SetSoloMute = 10,
1271
- AddClip = 11,
1272
- RemoveClip = 12,
1273
- ArmRecord = 13,
1274
- Punch = 14,
1275
- SetMetronome = 15,
1276
- SetMarker = 16,
1277
- SeekMarker = 17,
1278
- SetTrackMonitorMode = 26
1279
- }
1280
- declare enum SonareEngineTelemetryType {
1281
- ProcessBlock = 0,
1282
- Error = 1
1283
- }
1284
- declare enum SonareEngineTelemetryError {
1285
- None = 0,
1286
- CommandQueueOverflow = 1,
1287
- PendingCommandOverflow = 2,
1288
- BoundaryOverflow = 3,
1289
- TelemetryOverflow = 4,
1290
- CaptureOverflow = 5,
1291
- MaxBlockExceeded = 6,
1292
- UnknownTarget = 7,
1293
- NonRealtimeSafeParameter = 8,
1294
- NotPrepared = 9,
1295
- NonQueueableCommand = 10,
1296
- AutomationBindTargetOverflow = 11,
1297
- StaleAutomationLanes = 12,
1298
- SmoothedParameterCapacity = 13,
1299
- CommandBacklogDeferred = 14,
1300
- ClipPageUnderrun = 15,
1301
- InsertAutomationOverflow = 16,
1302
- MidiClockOverflow = 17,
1303
- MetronomeOverflow = 18,
1304
- InvalidCommand = 19,
1305
- MaxChannelsExceeded = 20
1306
- }
1307
- interface SonareMeterRingBuffer {
1308
- sharedBuffer: SharedArrayBuffer;
1309
- header: Int32Array;
1310
- records: Float32Array;
1311
- capacity: number;
1312
- }
1313
- interface SonareMeterRingReadResult {
1314
- nextReadIndex: number;
1315
- meters: SonareWorkletMeterSnapshot[];
1316
- }
1317
- interface SonareSpectrumRingBuffer {
1318
- sharedBuffer: SharedArrayBuffer;
1319
- header: Int32Array;
1320
- records: Float32Array;
1321
- capacity: number;
1322
- bands: number;
1323
- }
1324
- interface SonareSpectrumRingReadResult {
1325
- nextReadIndex: number;
1326
- spectra: SonareWorkletSpectrumSnapshot[];
1327
- }
1328
- /**
1329
- * A single target-addressed scope record drained from the realtime engine's
1330
- * scope ring: an FFT magnitude spectrum plus a decimated goniometer/vectorscope
1331
- * point cloud. Unlike {@link SonareWorkletSpectrumSnapshot} (the legacy
1332
- * coarse-DFT meter spectrum), this carries a `targetId` (master/lane/bus) and a
1333
- * stereo point cloud, mirroring the engine's `ScopeTelemetryRecord`.
1334
- */
1335
- interface SonareWorkletScopeSnapshot {
1336
- type: 'scope';
1337
- targetId: number;
1338
- frame: number;
1339
- /** Linear-band magnitudes in dB (length = the configured band count). */
1340
- bands: Float32Array;
1341
- /** Interleaved stereo goniometer points: [l0, r0, l1, r1, ...]. */
1342
- points: Float32Array;
1343
- }
1344
- interface SonareScopeRingBuffer {
1345
- sharedBuffer: SharedArrayBuffer;
1346
- header: Int32Array;
1347
- records: Float32Array;
1348
- capacity: number;
1349
- bands: number;
1350
- maxPoints: number;
1351
- }
1352
- interface SonareScopeRingReadResult {
1353
- nextReadIndex: number;
1354
- scopes: SonareWorkletScopeSnapshot[];
1355
- }
1356
- interface SonareExternalMidiRingEvent {
1357
- destinationId: number;
1358
- renderFrame: number;
1359
- byteWord: number;
1360
- byteCount: number;
1361
- }
1362
- interface SonareExternalMidiRingBuffer {
1363
- sharedBuffer: SharedArrayBuffer;
1364
- header: Int32Array;
1365
- records: Uint32Array;
1366
- capacity: number;
1367
- }
1368
- interface SharedExternalMidiRingWriter {
1369
- header: Int32Array;
1370
- records: Uint32Array;
1371
- capacity: number;
1372
- }
1373
- interface SonareExternalMidiRingReadResult {
1374
- events: SonareExternalMidiRingEvent[];
1375
- dropped: number;
1376
- }
1377
- interface SonareEngineCommandRecord {
1378
- type: SonareEngineCommandType | number;
1379
- targetId?: number;
1380
- sampleTime?: number | bigint;
1381
- argFloat?: number;
1382
- argInt?: number | bigint;
1383
- }
1384
- interface SonareEngineTelemetryRecord {
1385
- type: SonareEngineTelemetryType | number;
1386
- error: SonareEngineTelemetryError | number;
1387
- renderFrame: number;
1388
- timelineSample: number;
1389
- audibleTimelineSample: number;
1390
- graphLatencySamplesQ8: number;
1391
- value: number;
1392
- }
1393
- interface SonareEngineCommandRingBuffer {
1394
- sharedBuffer: SharedArrayBuffer;
1395
- header: Int32Array;
1396
- view: DataView;
1397
- capacity: number;
1398
- }
1399
- interface SonareEngineTelemetryRingBuffer {
1400
- sharedBuffer: SharedArrayBuffer;
1401
- header: Int32Array;
1402
- view: DataView;
1403
- capacity: number;
1404
- }
1405
- interface SonareEngineTelemetryRingReadResult {
1406
- nextReadIndex: number;
1407
- telemetry: SonareEngineTelemetryRecord[];
1408
- }
1409
- interface SonareClipPageRequest {
1410
- clipId: number;
1411
- pageIndex: number;
1412
- }
1413
- interface SonareClipPageRequestRingBuffer {
1414
- sharedBuffer: SharedArrayBuffer;
1415
- header: Int32Array;
1416
- records: Uint32Array;
1417
- capacity: number;
1418
- }
1419
- interface SharedClipPageRequestRingWriter {
1420
- header: Int32Array;
1421
- records: Uint32Array;
1422
- capacity: number;
1423
- }
1424
- interface SonareClipPageRequestRingReadResult {
1425
- requests: SonareClipPageRequest[];
1426
- /** Cumulative uint32 drop count for native and SAB-ring overflows. */
1427
- dropped: number;
1428
- }
1429
- declare function sonareMeterRingBufferByteLength(capacity: number): number;
1430
- declare function createSonareMeterRingBuffer(capacity?: number): SonareMeterRingBuffer;
1431
- declare function readSonareMeterRingBuffer(ring: SonareMeterRingBuffer, readIndex?: number): SonareMeterRingReadResult;
1432
- declare function sonareSpectrumRingBufferByteLength(capacity: number, bands?: number): number;
1433
- declare function createSonareSpectrumRingBuffer(capacity?: number, bands?: number): SonareSpectrumRingBuffer;
1434
- declare function readSonareSpectrumRingBuffer(ring: SonareSpectrumRingBuffer, readIndex?: number): SonareSpectrumRingReadResult;
1435
- declare function sonareScopeRingBufferByteLength(capacity: number, bands?: number, maxPoints?: number): number;
1436
- declare function createSonareScopeRingBuffer(capacity?: number, bands?: number, maxPoints?: number): SonareScopeRingBuffer;
1437
- declare function readSonareScopeRingBuffer(ring: SonareScopeRingBuffer, readIndex?: number): SonareScopeRingReadResult;
1438
- declare function sonareEngineCommandRingBufferByteLength(capacity: number): number;
1439
- declare function sonareEngineTelemetryRingBufferByteLength(capacity: number): number;
1440
- declare function sonareClipPageRequestRingBufferByteLength(capacity: number): number;
1441
- declare function sonareExternalMidiRingBufferByteLength(capacity: number): number;
1442
- declare function createSonareExternalMidiRingBuffer(capacity?: number): SonareExternalMidiRingBuffer;
1443
- /** Write one lowered MIDI-1 event without allocations from the audio worklet. */
1444
- declare function pushSonareExternalMidiRingBuffer(ring: SharedExternalMidiRingWriter, destinationId: number, renderFrame: number, byteWord: number, byteCount: number): boolean;
1445
- /** Main-thread drain. It is intentionally the only place MIDI byte arrays are built. */
1446
- declare function readSonareExternalMidiRingBuffer(ring: SonareExternalMidiRingBuffer): SonareExternalMidiRingReadResult;
1447
- declare function createSonareClipPageRequestRingBuffer(capacity?: number): SonareClipPageRequestRingBuffer;
1448
- /**
1449
- * Writes one request without allocating. Invalid uint32 coordinates and a full
1450
- * ring are counted as drops so the main thread can surface a bounded-loss
1451
- * diagnostic without receiving a worklet postMessage.
1452
- */
1453
- declare function pushSonareClipPageRequestRingBuffer(ring: SharedClipPageRequestRingWriter, clipId: number, pageIndex: number): boolean;
1454
- /** Drains the SPSC request ring on the main thread. Object creation is here, never in process(). */
1455
- declare function readSonareClipPageRequestRingBuffer(ring: SonareClipPageRequestRingBuffer): SonareClipPageRequestRingReadResult;
1456
- declare function createSonareEngineCommandRingBuffer(capacity?: number): SonareEngineCommandRingBuffer;
1457
- declare function createSonareEngineTelemetryRingBuffer(capacity?: number): SonareEngineTelemetryRingBuffer;
1458
- declare function pushSonareEngineCommandRingBuffer(ring: SonareEngineCommandRingBuffer, command: SonareEngineCommandRecord): boolean;
1459
- declare function popSonareEngineCommandRingBuffer(ring: SonareEngineCommandRingBuffer): SonareEngineCommandRecord | null;
1460
- declare function writeSonareEngineTelemetryRingBuffer(ring: SonareEngineTelemetryRingBuffer, telemetry: SonareEngineTelemetryRecord): void;
1461
- declare function readSonareEngineTelemetryRingBuffer(ring: SonareEngineTelemetryRingBuffer, readIndex?: number): SonareEngineTelemetryRingReadResult;
1462
-
1463
- interface SonareWorkletProcessorOptions {
1464
- sceneJson: string;
1465
- sampleRate?: number;
1466
- blockSize?: number;
1467
- stripCount?: number;
1468
- meterIntervalFrames?: number;
1469
- meterSharedBuffer?: SharedArrayBuffer;
1470
- meterRingCapacity?: number;
1471
- spectrumIntervalFrames?: number;
1472
- spectrumBands?: number;
1473
- spectrumSharedBuffer?: SharedArrayBuffer;
1474
- spectrumRingCapacity?: number;
1475
- }
1476
- interface SonareRealtimeEngineWorkletProcessorOptions {
1477
- wasmBinary?: ArrayBuffer | Uint8Array;
1478
- initialSyncMessages?: SonareEngineSyncMessage[];
1479
- initialCommands?: SonareEngineCommandRecord[];
1480
- sampleRate?: number;
1481
- blockSize?: number;
1482
- channelCount?: number;
1483
- meterIntervalFrames?: number;
1484
- commandSharedBuffer?: SharedArrayBuffer;
1485
- commandRingCapacity?: number;
1486
- telemetrySharedBuffer?: SharedArrayBuffer;
1487
- telemetryRingCapacity?: number;
1488
- meterSharedBuffer?: SharedArrayBuffer;
1489
- meterRingCapacity?: number;
1490
- scopeIntervalFrames?: number;
1491
- scopeBands?: number;
1492
- scopeSharedBuffer?: SharedArrayBuffer;
1493
- scopeRingCapacity?: number;
1494
- /**
1495
- * Lock-free SPSC queue for clip-page cache misses. Supplying this is required
1496
- * for realtime-safe OPFS streaming: it avoids both embind object creation and
1497
- * postMessage structured cloning from AudioWorklet process().
1498
- */
1499
- clipPageRequestSharedBuffer?: SharedArrayBuffer;
1500
- clipPageRequestRingCapacity?: number;
1501
- /** Lock-free worklet-to-main-thread MIDI-1 output ring. */
1502
- externalMidiSharedBuffer?: SharedArrayBuffer;
1503
- externalMidiRingCapacity?: number;
1504
- /**
1505
- * Route the PFL/AFL cue bus to the processor's SECOND output instead of
1506
- * folding it into the program output. Off by default, so an existing
1507
- * single-output host keeps its current mix sample for sample. The node must
1508
- * be constructed with two outputs for the cue to be audible.
1509
- */
1510
- cueOutput?: boolean;
1511
- }
1512
- interface SonareRealtimeVoiceChangerWorkletProcessorOptions {
1513
- preset?: RealtimeVoiceChangerConfigInput;
1514
- sampleRate?: number;
1515
- blockSize?: number;
1516
- channelCount?: number;
1517
- }
1518
- interface SonareRealtimeVoiceChangerSetConfigMessage {
1519
- type: 'setConfig';
1520
- /** Pre-normalized by the main thread; never JSON parsed in the worklet. */
1521
- config: RealtimeVoiceChangerPodConfig;
1522
- }
1523
- interface SonareRealtimeVoiceChangerResetMessage {
1524
- type: 'reset';
1525
- }
1526
- interface SonareRealtimeVoiceChangerDestroyMessage {
1527
- type: 'destroy';
1528
- }
1529
- type SonareRealtimeVoiceChangerMessage = SonareRealtimeVoiceChangerSetConfigMessage | SonareRealtimeVoiceChangerResetMessage | SonareRealtimeVoiceChangerDestroyMessage;
1530
- interface SonareRealtimeEngineNodeCapabilities {
1531
- mode: 'sab' | 'postMessage';
1532
- runtimeTarget: 'embind';
1533
- sharedArrayBuffer: boolean;
1534
- atomics: boolean;
1535
- audioWorklet: boolean;
1536
- /** True only when clip-page misses use the bounded SAB ring. */
1537
- clipPageRequestsRealtimeSafe: boolean;
1538
- /** True when external MIDI uses the SAB output ring rather than postMessage. */
1539
- externalMidiRealtimeSafe: boolean;
1540
- /**
1541
- * True when the node carries a second output fed by the PFL/AFL cue bus. When
1542
- * false the cue is folded into the program output, as it always was.
1543
- */
1544
- cueOutput: boolean;
1545
- engineAbiVersion?: number;
1546
- expectedEngineAbiVersion?: number;
1547
- abiCompatible?: boolean;
1548
- degradedReason?: string;
1549
- readyMessage?: boolean;
1550
- }
1551
- interface SonareRealtimeEngineNodeOptions extends SonareRealtimeEngineWorkletProcessorOptions {
1552
- processorName?: string;
1553
- moduleUrl?: string | URL;
1554
- mode?: 'auto' | 'sab' | 'postMessage';
1555
- engineAbiVersion?: number;
1556
- expectedEngineAbiVersion?: number;
1557
- requireAbiCompatible?: boolean;
1558
- nodeFactory?: (context: BaseAudioContext, processorName: string, options: AudioWorkletNodeOptions) => AudioWorkletNode;
1559
- }
1560
- interface SonareEngineTransportFacade {
1561
- play(sampleTime?: number): boolean;
1562
- stop(sampleTime?: number): boolean;
1563
- seekPpq(ppq: number, sampleTime?: number): boolean;
1564
- seekSeconds(seconds: number, sampleTime?: number): boolean;
1565
- setTempo(bpm: number): void;
1566
- setTempoSegments(segments: readonly EngineTempoSegment[]): void;
1567
- setLoop(startPpq: number, endPpq: number, enabled?: boolean): boolean;
1568
- }
1569
- interface SonareWorkletScheduleInsertAutomationMessage {
1570
- type: 'scheduleInsertAutomation';
1571
- stripIndex: number;
1572
- insertIndex: number;
1573
- paramId: number;
1574
- value: number;
1575
- samplePos?: number;
1576
- curve?: AutomationCurve;
1577
- }
1578
- interface SonareWorkletSetMeterIntervalMessage {
1579
- type: 'setMeterInterval';
1580
- frames: number;
1581
- }
1582
- interface SonareWorkletDestroyMessage {
1583
- type: 'destroy';
1584
- }
1585
- type SonareWorkletMessage = SonareWorkletScheduleInsertAutomationMessage | SonareWorkletSetMeterIntervalMessage | SonareWorkletDestroyMessage;
1586
- /** One external-MIDI event delivered to the main thread, lowered to MIDI 1.0
1587
- * bytes ready for a Web MIDI output port. */
1588
- interface SonareWorkletExternalMidiEvent {
1589
- /** Originating track lane, or 0xFFFFFFFF for transport/clock bytes. */
1590
- destinationId: number;
1591
- /** Sample position within the producing block. */
1592
- renderFrame: number;
1593
- /** MIDI 1.0 status + data bytes (1..3 entries). */
1594
- bytes: number[];
1595
- }
1596
- /** Batch of external-MIDI events posted from the worklet once per render block. */
1597
- interface SonareWorkletExternalMidiMessage {
1598
- type: 'externalMidi';
1599
- events: SonareWorkletExternalMidiEvent[];
1600
- }
1601
- /** A control-plane sync message that the worklet rejected without crashing. */
1602
- interface SonareEngineSyncErrorMessage {
1603
- type: 'syncError';
1604
- syncType: SonareEngineSyncMessage['type'];
1605
- message: string;
1606
- }
1607
- type SonareWorkletTransportMessage = SonareWorkletMeterSnapshot | SonareWorkletSpectrumSnapshot | SonareWorkletExternalMidiMessage | SonareEngineClipPageRequestMessage | SonareEngineTelemetryRecord;
1608
- interface WorkletTransport {
1609
- postMessage?: (message: SonareWorkletTransportMessage | SonareEngineCaptureResponseMessageInternal | SonareEngineTransportResponseMessage | SonareEngineSyncErrorMessage, transfer?: Transferable[]) => void;
1610
- onMeter?: (meter: SonareWorkletMeterSnapshot) => void;
1611
- onSpectrum?: (spectrum: SonareWorkletSpectrumSnapshot) => void;
1612
- }
1613
- interface SonareEngineSyncClipsMessage {
1614
- type: 'syncClips';
1615
- clips: EngineClip[];
1616
- }
1617
- interface SonareEngineSyncClipsDeltaMessage {
1618
- type: 'syncClipsDelta';
1619
- upserts: EngineClip[];
1620
- removeIds: number[];
1621
- }
1622
- /** Begins a paged, pre-baked clip transfer. PCM pages follow in FIFO order. */
1623
- interface SonareEngineSyncClipPageProviderMessage {
1624
- type: 'syncClipPageProvider';
1625
- clipId: number;
1626
- /** Omitted when an OPFS stream is primed before its clip is scheduled. */
1627
- clip?: EngineClip;
1628
- numChannels: number;
1629
- numSamples: number;
1630
- pageFrames: number;
1631
- }
1632
- /** Supplies one bounded PCM page for a pending pre-baked clip transfer. */
1633
- interface SonareEngineSyncClipPageMessage {
1634
- type: 'syncClipPage';
1635
- clipId: number;
1636
- pageIndex: number;
1637
- channels: Float32Array[];
1638
- }
1639
- /** Evicts one page after the main-thread sliding window advances. */
1640
- interface SonareEngineSyncClipPageClearMessage {
1641
- type: 'syncClipPageClear';
1642
- clipId: number;
1643
- pageIndex: number;
1644
- }
1645
- /** Releases a provider whose clip was removed or whose stream was closed. */
1646
- interface SonareEngineSyncClipPageDestroyMessage {
1647
- type: 'syncClipPageDestroy';
1648
- clipId: number;
1649
- }
1650
- /** Makes a fully supplied paged clip visible to the audio engine. */
1651
- interface SonareEngineSyncClipPageCommitMessage {
1652
- type: 'syncClipPageCommit';
1653
- clipId: number;
1654
- /**
1655
- * Clip schedule to publish with a provider that was primed before its
1656
- * schedule was known. The original pre-baked push path supplies it on the
1657
- * provider message instead.
1658
- */
1659
- clip?: EngineClip;
1660
- }
1661
- /**
1662
- * A bounded batch of page misses emitted by the AudioWorklet. The main thread
1663
- * resolves these from OPFS and responds with `syncClipPage`; a missing page is
1664
- * silent until that response arrives.
1665
- */
1666
- interface SonareEngineClipPageRequestMessage {
1667
- type: 'clipPageRequest';
1668
- requests: Array<{
1669
- clipId: number;
1670
- pageIndex: number;
1671
- }>;
1672
- /** Number of misses dropped because a bounded native or SAB request queue was full. */
1673
- dropped?: number;
1674
- }
1675
- interface SonareEngineSyncMidiClipsMessage {
1676
- type: 'syncMidiClips';
1677
- clips: EngineMidiClipSchedule[];
1678
- }
1679
- interface SonareEngineSyncMarkersMessage {
1680
- type: 'syncMarkers';
1681
- markers: EngineMarker[];
1682
- }
1683
- interface SonareEngineSyncMetronomeMessage {
1684
- type: 'syncMetronome';
1685
- config: EngineMetronomeConfig;
1686
- }
1687
- interface SonareEngineSyncAutomationMessage {
1688
- type: 'syncAutomation';
1689
- paramId: number;
1690
- points: EngineAutomationPoint[];
1691
- }
1692
- /** Replaces the live engine's registered custom-parameter set. */
1693
- interface SonareEngineSyncParametersMessage {
1694
- type: 'syncParameters';
1695
- parameters: EngineParameterInfo[];
1696
- }
1697
- interface SonareEngineSyncTempoMessage {
1698
- type: 'syncTempo';
1699
- bpm: number;
1700
- timeSignature: {
1701
- numerator: number;
1702
- denominator: number;
1703
- };
1704
- tempoSegments?: EngineTempoSegment[];
1705
- timeSignatureSegments?: EngineTimeSignatureSegment[];
1706
- }
1707
- interface SonareEngineSyncMixerMessage {
1708
- type: 'syncMixer';
1709
- lanes: EngineTrackLane[];
1710
- buses?: EngineBus[];
1711
- trackStrips?: Array<{
1712
- trackId: number;
1713
- sceneJson: string;
1714
- }>;
1715
- busStrips?: Array<{
1716
- busId: number;
1717
- sceneJson: string;
1718
- }>;
1719
- masterStripJson?: string;
1720
- /** Lane insert sidechain bindings (replayed after lanes/strips). */
1721
- laneSidechains?: Array<{
1722
- trackId: number;
1723
- insertIndex: number;
1724
- sourceTrackId: number;
1725
- }>;
1726
- }
1727
- interface SonareEngineSyncCaptureMessage {
1728
- type: 'syncCapture';
1729
- bufferFrames: number;
1730
- channels: number;
1731
- source: EngineCaptureStatus['source'];
1732
- recordOffsetSamples: number;
1733
- inputMonitor: {
1734
- enabled: boolean;
1735
- gain: number;
1736
- };
1737
- }
1738
- interface SonareEngineSyncTrackStripEqBandMessage {
1739
- type: 'syncTrackStripEqBand';
1740
- trackId: number;
1741
- bandIndex: number;
1742
- bandJson: string;
1743
- }
1744
- interface SonareEngineSyncMasterStripEqBandMessage {
1745
- type: 'syncMasterStripEqBand';
1746
- bandIndex: number;
1747
- bandJson: string;
1748
- }
1749
- interface SonareEngineSyncTrackStripInsertBypassedMessage {
1750
- type: 'syncTrackStripInsertBypassed';
1751
- trackId: number;
1752
- insertIndex: number;
1753
- bypassed: boolean;
1754
- resetOnBypass: boolean;
1755
- }
1756
- interface SonareEngineSyncMasterStripInsertBypassedMessage {
1757
- type: 'syncMasterStripInsertBypassed';
1758
- insertIndex: number;
1759
- bypassed: boolean;
1760
- resetOnBypass: boolean;
1761
- }
1762
- interface SonareEngineSyncTrackStripInsertParamByNameMessage {
1763
- type: 'syncTrackStripInsertParamByName';
1764
- trackId: number;
1765
- insertIndex: number;
1766
- paramName: string;
1767
- value: number;
1768
- }
1769
- interface SonareEngineSyncMasterStripInsertParamByNameMessage {
1770
- type: 'syncMasterStripInsertParamByName';
1771
- insertIndex: number;
1772
- paramName: string;
1773
- value: number;
1774
- }
1775
- interface SonareEngineSyncBusStripInsertParamByNameMessage {
1776
- type: 'syncBusStripInsertParamByName';
1777
- busId: number;
1778
- insertIndex: number;
1779
- paramName: string;
1780
- value: number;
1781
- }
1782
- interface SonareEngineSyncTrackStripPanMessage {
1783
- type: 'syncTrackStripPan';
1784
- trackId: number;
1785
- pan: number;
1786
- }
1787
- interface SonareEngineSyncTrackStripPanLawMessage {
1788
- type: 'syncTrackStripPanLaw';
1789
- trackId: number;
1790
- panLaw: number;
1791
- }
1792
- interface SonareEngineSyncTrackStripPanModeMessage {
1793
- type: 'syncTrackStripPanMode';
1794
- trackId: number;
1795
- panMode: number;
1796
- }
1797
- interface SonareEngineSyncTrackStripDualPanMessage {
1798
- type: 'syncTrackStripDualPan';
1799
- trackId: number;
1800
- leftPan: number;
1801
- rightPan: number;
1802
- }
1803
- interface SonareEngineSyncTrackStripChannelDelaySamplesMessage {
1804
- type: 'syncTrackStripChannelDelaySamples';
1805
- trackId: number;
1806
- delaySamples: number;
1807
- }
1808
- interface SonareEngineSyncBuiltinInstrumentMessage {
1809
- type: 'syncBuiltinInstrument';
1810
- destinationId: number;
1811
- config: {
1812
- destinationId?: number;
1813
- } & Record<string, unknown>;
1814
- }
1815
- interface SonareEngineSyncSynthInstrumentMessage {
1816
- type: 'syncSynthInstrument';
1817
- destinationId: number;
1818
- patch: Record<string, unknown> | string;
1819
- }
1820
- interface SonareEngineSyncSf2InstrumentMessage {
1821
- type: 'syncSf2Instrument';
1822
- destinationId: number;
1823
- config: {
1824
- destinationId?: number;
1825
- gain?: number;
1826
- polyphony?: number;
1827
- preferModelForModeledFamilies?: boolean;
1828
- };
1829
- }
1830
- interface SonareEngineSyncLoadSoundFontMessage {
1831
- type: 'syncLoadSoundFont';
1832
- data: Uint8Array;
1833
- }
1834
- interface SonareEngineSyncMidiFxMessage {
1835
- type: 'syncMidiFx' | 'syncClearMidiFx';
1836
- destinationId: number;
1837
- /** Engine MIDI-FX config JSON; present for 'syncMidiFx', absent for a clear. */
1838
- configJson?: string;
1839
- }
1840
- interface SonareEngineSyncMidiNoteMessage {
1841
- type: 'syncMidiNoteOn' | 'syncMidiNoteOff';
1842
- destinationId: number;
1843
- group: number;
1844
- channel: number;
1845
- note: number;
1846
- velocity: number;
1847
- renderFrame: number;
1848
- }
1849
- interface SonareEngineSyncMidiCcMessage {
1850
- type: 'syncMidiCc';
1851
- destinationId: number;
1852
- group: number;
1853
- channel: number;
1854
- controller: number;
1855
- value: number;
1856
- renderFrame: number;
1857
- }
1858
- interface SonareEngineSyncMidiUmpMessage {
1859
- type: 'syncMidiUmp';
1860
- destinationId: number;
1861
- word0: number;
1862
- renderFrame: number;
1863
- }
1864
- interface SonareEngineSyncMidiSysexMessage {
1865
- type: 'syncMidiSysex';
1866
- destinationId: number;
1867
- data: Uint8Array;
1868
- renderFrame: number;
1869
- }
1870
- interface SonareEngineSyncMidiPanicMessage {
1871
- type: 'syncMidiPanic';
1872
- renderFrame: number;
1873
- }
1874
- interface SonareEngineSyncMidiDestinationExternalMessage {
1875
- type: 'syncMidiDestinationExternal';
1876
- destinationId: number;
1877
- external: boolean;
1878
- }
1879
- interface SonareEngineSyncExternalMidiClockMessage {
1880
- type: 'syncExternalMidiClock';
1881
- enabled: boolean;
1882
- }
1883
- interface SonareEngineSyncMidiInputSourceMessage {
1884
- type: 'syncMidiInputSource' | 'syncClearMidiInputSource';
1885
- destinationId?: number;
1886
- }
1887
- interface SonareEngineSyncMidiCcBindingMessage {
1888
- type: 'syncMidiCcBinding';
1889
- channel: number;
1890
- controller: number;
1891
- paramId: number;
1892
- minValue: number;
1893
- maxValue: number;
1894
- }
1895
- interface SonareEngineSyncMidiInputEventMessage {
1896
- type: 'syncMidiInputNoteOn' | 'syncMidiInputNoteOff' | 'syncMidiInputCc';
1897
- group: number;
1898
- channel: number;
1899
- data0: number;
1900
- data1: number;
1901
- portTimeSamples: number;
1902
- }
1903
- /** Releases the realtime engine and all worklet-owned clip buffers. */
1904
- interface SonareEngineDestroyMessage {
1905
- type: 'destroy';
1906
- }
1907
- type SonareEngineSyncMessage = SonareEngineSyncClipsMessage | SonareEngineSyncClipsDeltaMessage | SonareEngineSyncClipPageProviderMessage | SonareEngineSyncClipPageMessage | SonareEngineSyncClipPageClearMessage | SonareEngineSyncClipPageCommitMessage | SonareEngineSyncClipPageDestroyMessage | SonareEngineSyncMidiClipsMessage | SonareEngineSyncMarkersMessage | SonareEngineSyncMetronomeMessage | SonareEngineSyncAutomationMessage | SonareEngineSyncParametersMessage | SonareEngineSyncTempoMessage | SonareEngineSyncMixerMessage | SonareEngineSyncCaptureMessage | SonareEngineSyncTrackStripEqBandMessage | SonareEngineSyncMasterStripEqBandMessage | SonareEngineSyncTrackStripInsertBypassedMessage | SonareEngineSyncMasterStripInsertBypassedMessage | SonareEngineSyncTrackStripInsertParamByNameMessage | SonareEngineSyncMasterStripInsertParamByNameMessage | SonareEngineSyncBusStripInsertParamByNameMessage | SonareEngineSyncTrackStripPanMessage | SonareEngineSyncTrackStripPanLawMessage | SonareEngineSyncTrackStripPanModeMessage | SonareEngineSyncTrackStripDualPanMessage | SonareEngineSyncTrackStripChannelDelaySamplesMessage | SonareEngineSyncBuiltinInstrumentMessage | SonareEngineSyncSynthInstrumentMessage | SonareEngineSyncSf2InstrumentMessage | SonareEngineSyncLoadSoundFontMessage | SonareEngineSyncMidiFxMessage | SonareEngineSyncMidiNoteMessage | SonareEngineSyncMidiCcMessage | SonareEngineSyncMidiUmpMessage | SonareEngineSyncMidiSysexMessage | SonareEngineSyncMidiPanicMessage | SonareEngineSyncMidiDestinationExternalMessage | SonareEngineSyncExternalMidiClockMessage | SonareEngineSyncMidiInputSourceMessage | SonareEngineSyncMidiCcBindingMessage | SonareEngineSyncMidiInputEventMessage | SonareEngineDestroyMessage;
1908
- interface SonareEngineCaptureRequestMessage {
1909
- type: 'captureRequest';
1910
- requestId: number;
1911
- op: 'status' | 'read' | 'reset';
1912
- }
1913
- /**
1914
- * Public capture response shape retained for source compatibility.
1915
- *
1916
- * The worklet wire protocol is stricter than this legacy structural type; use
1917
- * `SonareEngineCaptureResponseMessageInternal` inside the implementation.
1918
- */
1919
- interface SonareEngineCaptureResponseMessage {
1920
- type: 'captureResponse';
1921
- requestId: number;
1922
- ok: boolean;
1923
- status?: EngineCaptureStatus;
1924
- channels?: Float32Array[] | number[][];
1925
- error?: string;
1926
- }
1927
- interface SonareEngineCaptureStatusResponseMessageInternal {
1928
- type: 'captureResponse';
1929
- requestId: number;
1930
- ok: true;
1931
- status: EngineCaptureStatus;
1932
- }
1933
- interface SonareEngineCaptureReadResponseMessageInternal {
1934
- type: 'captureResponse';
1935
- requestId: number;
1936
- ok: true;
1937
- channels: Float32Array[];
1938
- }
1939
- interface SonareEngineCaptureResetResponseMessageInternal {
1940
- type: 'captureResponse';
1941
- requestId: number;
1942
- ok: true;
1943
- }
1944
- interface SonareEngineCaptureErrorResponseMessageInternal {
1945
- type: 'captureResponse';
1946
- requestId: number;
1947
- ok: false;
1948
- error: string;
1949
- }
1950
- /** Strict wire response type used only by the worklet implementation. */
1951
- type SonareEngineCaptureResponseMessageInternal = SonareEngineCaptureStatusResponseMessageInternal | SonareEngineCaptureReadResponseMessageInternal | SonareEngineCaptureResetResponseMessageInternal | SonareEngineCaptureErrorResponseMessageInternal;
1952
- interface SonareEngineTransportRequestMessage {
1953
- type: 'transportRequest';
1954
- requestId: number;
1955
- op: 'state';
1956
- }
1957
- interface SonareEngineTransportResponseMessage {
1958
- type: 'transportResponse';
1959
- requestId: number;
1960
- ok: boolean;
1961
- state?: EngineTransportState;
1962
- error?: string;
1963
- }
1964
-
1965
- /** Capture configuration options accepted by the engine's `configureCapture`. */
1966
- interface CaptureOptions {
1967
- bufferFrames: number;
1968
- channels?: number;
1969
- source?: EngineCaptureStatus['source'];
1970
- recordOffsetSamples?: number;
1971
- inputMonitor?: {
1972
- enabled: boolean;
1973
- gain?: number;
1974
- };
1975
- }
1976
-
1977
- interface SonareEngineOptions extends SonareRealtimeEngineNodeOptions {
1978
- offlineEngine?: RealtimeEngine;
1979
- offlineBlockSize?: number;
1980
- offlineChannelCount?: number;
1981
- }
1982
-
1983
- declare class SonareEngine {
1984
- readonly node: AudioWorkletNode;
1985
- readonly capabilities: SonareRealtimeEngineNodeCapabilities;
1986
- readonly transport: SonareEngineTransportFacade;
1987
- private readonly realtimeNode;
1988
- private readonly offlineEngine;
1989
- private readonly context;
1990
- private readonly sampleRate;
1991
- private readonly offlineBlockSize;
1992
- private readonly offlineChannelCount;
1993
- private readonly automationLanes;
1994
- private readonly clips;
1995
- private readonly midiClips;
1996
- private readonly markers;
1997
- private readonly trackLaneIds;
1998
- private readonly trackSends;
1999
- private readonly trackOutputBus;
2000
- private readonly laneSidechains;
2001
- private readonly buses;
2002
- private readonly trackStripJson;
2003
- private readonly busStripJson;
2004
- private masterStripJson;
2005
- private captureConfig;
2006
- private tempoBpm;
2007
- private timeSignature;
2008
- private tempoSegments;
2009
- private timeSignatureSegments;
2010
- private latestTransportState;
2011
- private nextClipId;
2012
- private nextMarkerId;
2013
- private transportPlaying;
2014
- private readonly pendingInstrumentSync;
2015
- private readonly workletClipPageRequests;
2016
- private readonly workletPageProviderClipIds;
2017
- private workletClipStreamer;
2018
- private workletClipPump;
2019
- private workletClipPagePollTimer;
2020
- private unsubscribeWorkletClipRequests;
2021
- private destroyed;
2022
- private constructor();
2023
- static create(context: BaseAudioContext, options?: SonareEngineOptions): Promise<SonareEngine>;
2024
- suspend(): Promise<void>;
2025
- resume(): Promise<void>;
2026
- setTempo(bpm: number): void;
2027
- setTempoSegments(segments: readonly EngineTempoSegment[]): void;
2028
- setTimeSignature(numerator: number, denominator: number): void;
2029
- setTimeSignatureSegments(segments: readonly EngineTimeSignatureSegment[]): void;
2030
- setLoop(startPpq: number, endPpq: number, enabled?: boolean): boolean;
2031
- countInEndSample(startSample: number, bars: number): number;
2032
- getTransportState(): Promise<EngineTransportState>;
2033
- cachedTransportState(): EngineTransportState | undefined;
2034
- setParam(nodeId: string, param: string | number, value: number): boolean;
2035
- scheduleParam(nodeId: string, param: string | number, ppq: number, value: number, curve?: number | 'linear' | 'exponential'): void;
2036
- addAutomationPoint(laneId: string | number, ppq: number, value: number, curve?: number | 'linear' | 'exponential'): void;
2037
- /**
2038
- * Replaces the automation lane for `paramId` with the given breakpoints. An
2039
- * empty array clears the lane; the points are defensively copied and sorted
2040
- * by ppq before mirroring to the offline and live worklet engines.
2041
- */
2042
- setAutomationLane(paramId: number, points: ReadonlyArray<EngineAutomationPoint>): void;
2043
- /**
2044
- * Returns the automation target id for a mixer strip parameter.
2045
- *
2046
- * The id addresses the engine's reserved mixer namespace, so it can be fed
2047
- * straight to setAutomationLane to automate a fader or pan without
2048
- * registering a parameter.
2049
- *
2050
- * @param target Track id (declares a mixer lane on first use) or 'master'.
2051
- * @param kind Strip parameter to address.
2052
- * @returns Reserved engine parameter id for the strip parameter.
2053
- */
2054
- automationParamId(target: string | number, kind: 'faderDb' | 'pan'): number;
2055
- /**
2056
- * Returns the automation target id for a bus fader.
2057
- *
2058
- * @param busId Bus id (declares the mixer bus on first use).
2059
- * @returns Reserved engine parameter id for the bus fader gain (dB).
2060
- */
2061
- busAutomationParamId(busId: number): number;
2062
- /**
2063
- * Resolves a track-lane insert parameter (JSON-key name) to the reserved
2064
- * insert-automation id fed straight to setAutomationLane. Declares the track's
2065
- * mixer lane first (like automationParamId) so the offline engine resolves the
2066
- * same strip selector the realtime engine uses.
2067
- *
2068
- * @param target Track id (declares a mixer lane on first use).
2069
- * @param insertIndex Index into the strip's combined insert sequence.
2070
- * @param paramName Processor JSON-key parameter name.
2071
- * @returns Reserved insert-automation id, or -1 when strip/insert/key unknown.
2072
- */
2073
- resolveTrackInsertAutomationId(target: string | number, insertIndex: number, paramName: string): number;
2074
- /**
2075
- * Resolves a master-strip insert parameter to its reserved insert-automation
2076
- * id.
2077
- *
2078
- * @param insertIndex Index into the master strip's insert sequence.
2079
- * @param paramName Processor JSON-key parameter name.
2080
- * @returns Reserved insert-automation id, or -1 when insert/key unknown.
2081
- */
2082
- resolveMasterInsertAutomationId(insertIndex: number, paramName: string): number;
2083
- /**
2084
- * Resolves a bus-strip insert parameter to its reserved insert-automation id.
2085
- * Declares the mixer bus first so the offline engine resolves the same bus
2086
- * selector.
2087
- *
2088
- * @param busId Bus id (declares the mixer bus on first use).
2089
- * @param insertIndex Index into the bus strip's insert sequence.
2090
- * @param paramName Processor JSON-key parameter name.
2091
- * @returns Reserved insert-automation id, or -1 when bus/insert/key unknown.
2092
- */
2093
- resolveBusInsertAutomationId(busId: number, insertIndex: number, paramName: string): number;
2094
- /**
2095
- * Returns the number of automation lanes installed on the engine, including
2096
- * lanes whose breakpoint list is currently empty.
2097
- *
2098
- * @returns Engine-side automation lane count.
2099
- */
2100
- automationLaneCount(): number;
2101
- listParameters(): EngineParameterInfo[];
2102
- /** Registers a custom parameter on the offline mirror and worklet engine. */
2103
- addParameter(info: EngineParameterInfo): void;
2104
- /** Clears custom parameters and their automation lanes on both engines. */
2105
- clearParameters(): void;
2106
- setSoloMute(target: string | number, solo: boolean, mute: boolean): boolean;
2107
- /** Queues a per-track PFL/AFL monitor tap mode change. */
2108
- setTrackMonitorMode(target: string | number, mode: EngineTrackMonitorMode, renderFrame?: number): boolean;
2109
- setStripGain(target: string | number, db: number): boolean;
2110
- setStripPan(target: string | number, pan: number): boolean;
2111
- /**
2112
- * Declares the mixer track lanes in an explicit order.
2113
- *
2114
- * Lane indices are append-only: once a track id occupies a lane, its index
2115
- * stays fixed for the engine's lifetime. The given list must therefore start
2116
- * with the already-declared lane ids in their current order and may only
2117
- * append new track ids after them. Entries carrying `sends` replace that
2118
- * track's send list; entries without `sends` leave existing sends untouched.
2119
- *
2120
- * @param lanes Track ids or lane descriptors in the desired lane order.
2121
- */
2122
- setTrackLanes(lanes: ReadonlyArray<number | EngineTrackLane>): void;
2123
- /**
2124
- * Routes a track lane's post-fader output into a declared bus instead of
2125
- * the master mix (group/folder routing); busId 0 restores the master mix.
2126
- */
2127
- setTrackOutputBus(target: string | number, busId: number): void;
2128
- /**
2129
- * Keys one insert of a lane strip from another lane's post-strip pre-fader
2130
- * audio (ducking/sidechainRouter inserts). sourceTarget null removes the
2131
- * binding.
2132
- */
2133
- setLaneSidechain(target: string | number, insertIndex: number, sourceTarget: string | number | null): void;
2134
- setSends(target: string | number, sends: EngineTrackSend[]): void;
2135
- setTrackBuses(buses: EngineBus[]): void;
2136
- setBusGain(busId: number, db: number): boolean;
2137
- setTrackStripJson(target: string | number, sceneJson: string): void;
2138
- setTrackStripEqBand(target: string | number, bandIndex: number, band: EqBand | string): void;
2139
- setTrackStripInsertBypassed(target: string | number, insertIndex: number, bypassed: boolean, resetOnBypass?: boolean): void;
2140
- setTrackStripInsertParamByName(target: string | number, insertIndex: number, paramName: string, value: number): void;
2141
- setTrackStripPan(target: string | number, pan: number): void;
2142
- setTrackStripPanLaw(target: string | number, panLaw: PanLaw | number): void;
2143
- setTrackStripPanMode(target: string | number, panMode: PanMode | number): void;
2144
- setTrackStripDualPan(target: string | number, leftPan: number, rightPan: number): void;
2145
- setTrackStripChannelDelaySamples(target: string | number, delaySamples: number): void;
2146
- setStripEq(target: string | number, bandIndex: number, band: EqBand | string): void;
2147
- setStripInsertBypassed(target: string | number, insertIndex: number, bypassed: boolean, resetOnBypass?: boolean): void;
2148
- setStripInserts(target: string | number, sceneJson: string): void;
2149
- setBusStripJson(busId: number, sceneJson: string): void;
2150
- setMasterStripJson(sceneJson: string): void;
2151
- setMasterStripEqBand(bandIndex: number, band: EqBand | string): void;
2152
- setMasterStripInsertBypassed(insertIndex: number, bypassed: boolean, resetOnBypass?: boolean): void;
2153
- setMasterStripInsertParamByName(insertIndex: number, paramName: string, value: number): void;
2154
- setBusStripInsertParamByName(busId: number, insertIndex: number, paramName: string, value: number): void;
2155
- setStripInsertParamByName(target: string | number, insertIndex: number, paramName: string, value: number): void;
2156
- setMasterChain(sceneJson: string): void;
2157
- /**
2158
- * Creates and primes an OPFS-backed page provider for this live worklet
2159
- * engine. Pass the returned `provider` to {@link addClip} in place of a
2160
- * `Float32Array[]`; the `clipId` in `options` must equal that clip's explicit
2161
- * `opts.id`. Subsequent cache misses are fetched on the main thread and
2162
- * supplied back to the worklet through its bounded pull protocol.
2163
- */
2164
- attachOpfsClipStream(options: OpfsClipStreamOptions): Promise<{
2165
- binding: OpfsClipPageProviderBinding;
2166
- provider: ClipPageProvider;
2167
- }>;
2168
- addClip(trackId: string | number, buffer: Float32Array[] | ClipPageProvider, startPpq: number, opts?: Partial<Omit<EngineClip, 'channels' | 'pageProvider' | 'startPpq'>>): number;
2169
- removeClip(clipId: number): void;
2170
- setMidiClips(schedules: readonly EngineMidiClipSchedule[]): void;
2171
- setBuiltinInstrument(trackId: string | number, config?: {
2172
- destinationId?: number;
2173
- } & Record<string, unknown>): void;
2174
- setSynthInstrument(trackId: string | number, patch?: Record<string, unknown> | string): void;
2175
- loadSoundFont(data: Uint8Array): void;
2176
- setSf2Instrument(trackId: string | number, config?: {
2177
- destinationId?: number;
2178
- gain?: number;
2179
- polyphony?: number;
2180
- preferModelForModeledFamilies?: boolean;
2181
- }): void;
2182
- /**
2183
- * Route a track's MIDI to the external output (drained via {@link onMidiOut})
2184
- * instead of an internal instrument, so the track plays an external device.
2185
- * Pass `external=false` to restore internal-synth playback.
2186
- */
2187
- setMidiDestinationExternal(trackId: string | number, external: boolean): void;
2188
- /**
2189
- * Enable/disable forwarding MIDI clock + transport (start/continue/stop) to
2190
- * the external output so external gear tracks the transport tempo. The bytes
2191
- * arrive through {@link onMidiOut} tagged with the transport destination.
2192
- */
2193
- setExternalMidiClockEnabled(enabled: boolean): void;
2194
- /**
2195
- * Install or replace a live, non-destructive MIDI-FX insert for one
2196
- * destination. The insert transforms the destination's MIDI before
2197
- * synthesis (transpose, quantize, velocity shaping, humanize, harmonize,
2198
- * arpeggiate) without rewriting any stored notes, so it can be bypassed by
2199
- * {@link clearMidiFx}. The config JSON is the flat object the engine's
2200
- * MIDI-FX accepts (the same schema as the offline `Project.bakeMidiFx`).
2201
- */
2202
- setMidiFx(trackId: string | number, configJson: string): void;
2203
- /** Remove the live MIDI-FX insert from one destination (a no-op when none). */
2204
- clearMidiFx(trackId: string | number): void;
2205
- pushMidiNoteOn(trackId: string | number, group: number, channel: number, note: number, velocity: number, renderFrame?: number): void;
2206
- pushMidiNoteOff(trackId: string | number, group: number, channel: number, note: number, velocity?: number, renderFrame?: number): void;
2207
- pushMidiCc(trackId: string | number, group: number, channel: number, controller: number, value: number, renderFrame?: number): void;
2208
- pushMidiUmp(trackId: string | number, word0: number, renderFrame?: number): void;
2209
- pushMidiSysex(trackId: string | number, data: Uint8Array, renderFrame?: number): void;
2210
- bindMidiCc(channel: number, controller: number, paramId: number, options?: MidiCcBindOptions): void;
2211
- setMidiInputSource(destinationId?: number): void;
2212
- clearMidiInputSource(): void;
2213
- pushMidiInputNoteOn(group: number, channel: number, note: number, velocity: number, portTimeSamples?: number): void;
2214
- pushMidiInputNoteOff(group: number, channel: number, note: number, velocity?: number, portTimeSamples?: number): void;
2215
- pushMidiInputCc(group: number, channel: number, controller: number, value: number, portTimeSamples?: number): void;
2216
- pushMidiPanic(renderFrame?: number): void;
2217
- configureCapture(options: CaptureOptions): void;
2218
- /**
2219
- * Arms the engine-global capture path. `trackId` is retained for source
2220
- * compatibility and must be `0`; per-track capture is not implemented.
2221
- */
2222
- armRecord(trackId: string | number, enabled: boolean): boolean;
2223
- punch(inPpq: number, outPpq: number): boolean;
2224
- captureStatus(): Promise<EngineCaptureStatus>;
2225
- capturedAudio(): Promise<Float32Array[]>;
2226
- resetCapture(): Promise<void>;
2227
- setMetronome(opts: EngineMetronomeConfig): void;
2228
- addMarker(ppq: number, name?: string): number;
2229
- /**
2230
- * Replaces the whole marker set in one call. Entries without an `id` are
2231
- * assigned fresh ids; entries carrying an `id` keep it. Returns the resolved
2232
- * markers in the order given.
2233
- */
2234
- setMarkers(entries: ReadonlyArray<{
2235
- ppq: number;
2236
- name?: string;
2237
- id?: number;
2238
- }>): EngineMarker[];
2239
- markerCount(): number;
2240
- markerByIndex(index: number): EngineMarker;
2241
- marker(markerId: number): EngineMarker;
2242
- seekMarker(markerId: number): boolean;
2243
- setLoopFromMarkers(startMarkerId: number, endMarkerId: number): boolean;
2244
- renderOffline(totalFrames: number): Promise<Float32Array[]>;
2245
- /**
2246
- * Subscribe to external-MIDI batches (already lowered to MIDI 1.0 bytes) for
2247
- * delivery to Web MIDI output ports. Fires once per render block that
2248
- * produced events. Returns an unsubscribe function.
2249
- */
2250
- onMidiOut(callback: (events: SonareWorkletExternalMidiEvent[]) => void): () => void;
2251
- onMeter(callback: (meter: SonareWorkletMeterSnapshot) => void): () => void;
2252
- onScope(callback: (scope: SonareWorkletScopeSnapshot) => void): () => void;
2253
- onTelemetry(callback: (telemetry: SonareEngineTelemetryRecord) => void): () => void;
2254
- pollTelemetry(): SonareEngineTelemetryRecord[];
2255
- pollMeters(): SonareWorkletMeterSnapshot[];
2256
- pollScope(): SonareWorkletScopeSnapshot[];
2257
- destroy(): void;
2258
- private ensureWorkletClipStreamer;
2259
- /**
2260
- * SAB requests have no postMessage wake-up by design. Polling on the main
2261
- * thread is therefore intentionally outside the audio callback; 8 ms keeps
2262
- * the bounded OPFS prefetch frontier responsive without adding worklet GC.
2263
- */
2264
- private startWorkletClipPagePolling;
2265
- private pumpWorkletClipPages;
2266
- private enqueueWorkletClipPageRequest;
2267
- private popWorkletClipPageRequest;
2268
- private commitWorkletClipPageProvider;
2269
- private mixerLanes;
2270
- private syncMixer;
2271
- private postInstrumentSync;
2272
- private flushPendingInstrumentSync;
2273
- private postSync;
2274
- private flushOfflineMirror;
2275
- private sendMirroredCommand;
2276
- private get mixerContext();
2277
- private get stripContext();
2278
- private get automationContext();
2279
- private get captureContext();
2280
- private get parameterContext();
2281
- private get tempoContext();
2282
- private get clipContext();
2283
- private get markerContext();
2284
- private stripParamId;
2285
- private sendSmoothedParam;
2286
- private resolveParamId;
2287
- private syncParameters;
2288
- private resolveTargetId;
2289
- private ensureTrackLane;
2290
- private ensureBus;
2291
- }
2292
-
2293
- declare class SonareRealtimeEngineNode {
2294
- readonly node: AudioWorkletNode;
2295
- readonly capabilities: SonareRealtimeEngineNodeCapabilities;
2296
- readonly commandRing?: SonareEngineCommandRingBuffer;
2297
- readonly telemetryRing?: SonareEngineTelemetryRingBuffer;
2298
- readonly meterRing?: SonareMeterRingBuffer;
2299
- readonly scopeRing?: SonareScopeRingBuffer;
2300
- readonly clipPageRequestRing?: SonareClipPageRequestRingBuffer;
2301
- readonly externalMidiRing?: SonareExternalMidiRingBuffer;
2302
- readonly ready: Promise<void>;
2303
- private telemetryReadIndex;
2304
- private meterReadIndex;
2305
- private scopeReadIndex;
2306
- private clipPageRequestDroppedRead;
2307
- private ringPollTimer;
2308
- private telemetryListeners;
2309
- private meterListeners;
2310
- private scopeListeners;
2311
- private midiOutListeners;
2312
- private clipPageRequestListeners;
2313
- private syncErrorListeners;
2314
- private captureRequestId;
2315
- private readonly captureRequests;
2316
- private transportRequestId;
2317
- private readonly transportRequests;
2318
- private resolveReady;
2319
- private rejectReady;
2320
- private destroyed;
2321
- private constructor();
2322
- /** Subscribes to control-plane sync rejections reported by the worklet. */
2323
- onSyncError(listener: (message: SonareEngineSyncErrorMessage) => void): () => void;
2324
- static create(context: BaseAudioContext, options?: SonareRealtimeEngineNodeOptions): Promise<SonareRealtimeEngineNode>;
2325
- play(sampleTime?: number): boolean;
2326
- stop(sampleTime?: number): boolean;
2327
- seekSample(timelineSample: number, sampleTime?: number): boolean;
2328
- seekPpq(ppq: number, sampleTime?: number): boolean;
2329
- sendCommand(command: SonareEngineCommandRecord): boolean;
2330
- requestCaptureStatus(): Promise<EngineCaptureStatus>;
2331
- requestCapturedAudio(): Promise<Float32Array[]>;
2332
- requestCaptureReset(): Promise<void>;
2333
- requestTransportState(): Promise<EngineTransportState>;
2334
- pollTelemetry(): SonareEngineTelemetryRecord[];
2335
- pollMeters(): SonareWorkletMeterSnapshot[];
2336
- pollScope(): SonareWorkletScopeSnapshot[];
2337
- /** Drain lowered MIDI-1 records from the SAB ring on the main thread. */
2338
- pollMidiOut(): SonareWorkletExternalMidiEvent[];
2339
- /**
2340
- * Drains bounded paged-clip misses from the SAB ring and forwards one batch
2341
- * to subscribers. In postMessage mode the legacy handler remains available,
2342
- * but that degraded path is not realtime-safe for OPFS streaming.
2343
- */
2344
- pollClipPageRequests(): SonareEngineClipPageRequestMessage | undefined;
2345
- onTelemetry(callback: (telemetry: SonareEngineTelemetryRecord) => void): () => void;
2346
- onMeter(callback: (meter: SonareWorkletMeterSnapshot) => void): () => void;
2347
- onScope(callback: (scope: SonareWorkletScopeSnapshot) => void): () => void;
2348
- /**
2349
- * Subscribe to external-MIDI batches drained from the engine (one call per
2350
- * render block that produced events), already lowered to MIDI 1.0 bytes for a
2351
- * Web MIDI output port. Returns an unsubscribe function.
2352
- */
2353
- onMidiOut(callback: (events: SonareWorkletExternalMidiEvent[]) => void): () => void;
2354
- /**
2355
- * Subscribe to bounded batches of paged-clip misses from the worklet. The
2356
- * callback runs on the main thread and may initiate asynchronous OPFS I/O.
2357
- */
2358
- onClipPageRequests(callback: (message: SonareEngineClipPageRequestMessage) => void): () => void;
2359
- destroy(): void;
2360
- private emitTelemetry;
2361
- private startRingPolling;
2362
- private stopRingPollingIfUnused;
2363
- private emitMeter;
2364
- private emitMidiOut;
2365
- private emitClipPageRequests;
2366
- private emitScope;
2367
- private sendCaptureRequest;
2368
- private sendTransportRequest;
2369
- }
2370
-
2371
- type WorkletInput = readonly (readonly Float32Array[])[];
2372
- type WorkletOutput = Float32Array[][];
2373
-
2374
- /**
2375
- * AudioWorklet-style bridge for the DAW realtime engine facade.
2376
- *
2377
- * Backed by the `sonare.wasm` embind facade.
2378
- */
2379
- declare class SonareRealtimeEngineWorkletProcessor {
2380
- private static warnedChannelScratchOverflow;
2381
- readonly sampleRate: number;
2382
- readonly blockSize: number;
2383
- readonly channelCount: number;
2384
- private engine;
2385
- private closed;
2386
- private commandRing?;
2387
- private telemetryRing?;
2388
- private meterRing?;
2389
- private scopeRing?;
2390
- private clipPageRequestRing?;
2391
- private externalMidiRing?;
2392
- private transport?;
2393
- private meterIntervalFrames;
2394
- private lastMeterFrame;
2395
- private metronomeConfig;
2396
- private channelBuffers;
2397
- private monitorBuffers;
2398
- private readonly cueOutput;
2399
- private readonly liveClips;
2400
- private readonly pagedClipProviders;
2401
- private readonly pagedClipPageFrames;
2402
- private readonly pendingPagedClips;
2403
- private readonly clipPageRequestClipIds;
2404
- private readonly clipPageRequestPageIndices;
2405
- private clipPageRequestOverflowReported;
2406
- constructor(options?: SonareRealtimeEngineWorkletProcessorOptions, transport?: WorkletTransport);
2407
- process(inputs: WorkletInput, outputs: WorkletOutput): boolean;
2408
- private reacquireChannelBuffers;
2409
- private reacquireMonitorBuffers;
2410
- receiveCommand(command: SonareEngineCommandRecord): void;
2411
- receiveSync(message: SonareEngineSyncMessage): void;
2412
- private applySync;
2413
- receiveCaptureRequest(message: SonareEngineCaptureRequestMessage): void;
2414
- receiveTransportRequest(message: SonareEngineTransportRequestMessage): void;
2415
- destroy(): void;
2416
- private drainCommands;
2417
- private safeApplyCommand;
2418
- private applyCommand;
2419
- private publishTelemetry;
2420
- private writeTelemetryScratch;
2421
- private publishTelemetryRecord;
2422
- private publishMeters;
2423
- private writeMeterScratch;
2424
- private writeMeterRing;
2425
- private publishScope;
2426
- private writeScopeScratch;
2427
- private publishExternalMidi;
2428
- /**
2429
- * Forward a bounded batch of native page misses to the main thread. This
2430
- * deliberately runs after audio rendering: a cache miss is silence for this
2431
- * block, and OPFS I/O must never delay `process()`.
2432
- */
2433
- private publishClipPageRequests;
2434
- private removePagedClipProvider;
2435
- private clearPagedClipProviders;
2436
- private commandRingFromSharedBuffer;
2437
- private telemetryRingFromSharedBuffer;
2438
- }
2439
-
2440
- declare function registerSonareRealtimeEngineWorkletProcessor(name?: string): void;
2441
-
2442
- /**
2443
- * AudioWorklet-style mixer bridge backed by the package's single `sonare.wasm`.
2444
- *
2445
- * The WASM module must already be initialized via `init()` before constructing
2446
- * this bridge. Each AudioWorklet input is treated as one stereo strip:
2447
- * `inputs[strip][0]` is left and `inputs[strip][1]` is right. Missing channels
2448
- * are replaced with preallocated silence.
2449
- */
2450
- declare class SonareWorkletProcessor {
2451
- readonly sampleRate: number;
2452
- readonly blockSize: number;
2453
- private mixer;
2454
- private realtime;
2455
- private closed;
2456
- private processedFrames;
2457
- private lastMeterFrame;
2458
- private meterIntervalFrames;
2459
- private spectrumIntervalFrames;
2460
- private lastSpectrumFrame;
2461
- private transport?;
2462
- private meterRing?;
2463
- private spectrumRing?;
2464
- private spectrumBands;
2465
- constructor(options: SonareWorkletProcessorOptions, transport?: WorkletTransport);
2466
- process(inputs: WorkletInput, outputs: WorkletOutput): boolean;
2467
- receiveMessage(message: SonareWorkletMessage): void;
2468
- destroy(): void;
2469
- private publishMeter;
2470
- private writeMeterRing;
2471
- private publishSpectrum;
2472
- private computeSpectrum;
2473
- private writeSpectrumRing;
2474
- }
2475
- declare function registerSonareWorkletProcessor(name?: string): void;
2476
-
2477
- declare class SonareRealtimeVoiceChangerWorkletProcessor {
2478
- private static warnedMonoOverflow;
2479
- private static warnedInterleavedOverflow;
2480
- private changer;
2481
- private readonly sampleRate;
2482
- private readonly blockSize;
2483
- private readonly channelCount;
2484
- private monoInput;
2485
- private monoOutput;
2486
- private bufferGeneration;
2487
- private planarChannels;
2488
- private destroyed;
2489
- constructor(options?: SonareRealtimeVoiceChangerWorkletProcessorOptions);
2490
- /**
2491
- * Handles a control-plane message from the main thread. AudioWorklet port
2492
- * handlers run on the same audio rendering thread as `process()`: this path
2493
- * therefore accepts only a pre-normalized POD and never parses JSON.
2494
- */
2495
- receiveMessage(message: SonareRealtimeVoiceChangerMessage): void;
2496
- process(inputs: WorkletInput, outputs: WorkletOutput): boolean;
2497
- destroy(): void;
2498
- private reacquireBuffers;
2499
- /**
2500
- * Returns the number of frames we can actually process given the
2501
- * pre-allocated capacity. If the host requests more frames than the
2502
- * worst-case block size declared at construction time, we clamp to the
2503
- * available capacity and warn once — we MUST NOT reallocate on the
2504
- * realtime audio thread.
2505
- */
2506
- private ensureMonoCapacity;
2507
- /**
2508
- * Same contract as ensureMonoCapacity but for the planar per-channel
2509
- * scratch. Returns the number of frames that fit in the available capacity.
2510
- */
2511
- private ensureInterleavedCapacity;
2512
- }
2513
- declare function registerSonareRealtimeVoiceChangerWorkletProcessor(name?: string): void;
2514
-
2515
- export { type OpfsClipStream, type OpfsClipStreamOptions, SONARE_CLIP_PAGE_REQUEST_RING_HEADER_INTS, SONARE_CLIP_PAGE_REQUEST_RING_RECORD_UINT32S, SONARE_ENGINE_COMMAND_RECORD_BYTES, SONARE_ENGINE_RING_HEADER_INTS, SONARE_ENGINE_TELEMETRY_RECORD_BYTES, SONARE_EXTERNAL_MIDI_RING_HEADER_INTS, SONARE_EXTERNAL_MIDI_RING_RECORD_UINT32S, SONARE_METER_RING_HEADER_INTS, SONARE_METER_RING_RECORD_FLOATS, SONARE_SCOPE_RING_HEADER_INTS, SONARE_SPECTRUM_RING_HEADER_INTS, type SonareClipPageRequest, type SonareClipPageRequestRingBuffer, type SonareClipPageRequestRingReadResult, SonareEngine, type SonareEngineCaptureRequestMessage, type SonareEngineCaptureResponseMessage, type SonareEngineClipPageRequestMessage, type SonareEngineCommandRecord, type SonareEngineCommandRingBuffer, SonareEngineCommandType, type SonareEngineOptions, type SonareEngineSyncAutomationMessage, type SonareEngineSyncBuiltinInstrumentMessage, type SonareEngineSyncCaptureMessage, type SonareEngineSyncClipsDeltaMessage, type SonareEngineSyncClipsMessage, type SonareEngineSyncLoadSoundFontMessage, type SonareEngineSyncMarkersMessage, type SonareEngineSyncMasterStripEqBandMessage, type SonareEngineSyncMasterStripInsertBypassedMessage, type SonareEngineSyncMessage, type SonareEngineSyncMetronomeMessage, type SonareEngineSyncMidiCcMessage, type SonareEngineSyncMidiClipsMessage, type SonareEngineSyncMidiNoteMessage, type SonareEngineSyncMidiPanicMessage, type SonareEngineSyncMixerMessage, type SonareEngineSyncSf2InstrumentMessage, type SonareEngineSyncSynthInstrumentMessage, type SonareEngineSyncTempoMessage, type SonareEngineSyncTrackStripEqBandMessage, type SonareEngineSyncTrackStripInsertBypassedMessage, SonareEngineTelemetryError, type SonareEngineTelemetryRecord, type SonareEngineTelemetryRingBuffer, type SonareEngineTelemetryRingReadResult, SonareEngineTelemetryType, type SonareEngineTransportFacade, type SonareEngineTransportRequestMessage, type SonareEngineTransportResponseMessage, type SonareExternalMidiRingBuffer, type SonareExternalMidiRingReadResult, type SonareMeterRingBuffer, type SonareMeterRingReadResult, SonareRealtimeEngineNode, type SonareRealtimeEngineNodeCapabilities, type SonareRealtimeEngineNodeOptions, SonareRealtimeEngineWorkletProcessor, type SonareRealtimeEngineWorkletProcessorOptions, type SonareRealtimeVoiceChangerDestroyMessage, type SonareRealtimeVoiceChangerMessage, type SonareRealtimeVoiceChangerResetMessage, type SonareRealtimeVoiceChangerSetConfigMessage, SonareRealtimeVoiceChangerWorkletProcessor, type SonareRealtimeVoiceChangerWorkletProcessorOptions, type SonareScopeRingBuffer, type SonareScopeRingReadResult, type SonareSpectrumRingBuffer, type SonareSpectrumRingReadResult, type SonareWorkletDestroyMessage, type SonareWorkletMessage, type SonareWorkletMeterSnapshot, SonareWorkletProcessor, type SonareWorkletProcessorOptions, type SonareWorkletScheduleInsertAutomationMessage, type SonareWorkletScopeSnapshot, type SonareWorkletSetMeterIntervalMessage, type SonareWorkletSpectrumSnapshot, type SonareWorkletTransportMessage, StreamingMasteringChain, type StreamingMasteringChainConfig, attachOpfsClipStream, createSonareClipPageRequestRingBuffer, createSonareEngineCommandRingBuffer, createSonareEngineTelemetryRingBuffer, createSonareExternalMidiRingBuffer, createSonareMeterRingBuffer, createSonareScopeRingBuffer, createSonareSpectrumRingBuffer, decodeFrame, encodeFrameHi, encodeFrameLo, init, isInitialized, popSonareEngineCommandRingBuffer, pushSonareClipPageRequestRingBuffer, pushSonareEngineCommandRingBuffer, pushSonareExternalMidiRingBuffer, readSonareClipPageRequestRingBuffer, readSonareEngineTelemetryRingBuffer, readSonareExternalMidiRingBuffer, readSonareMeterRingBuffer, readSonareScopeRingBuffer, readSonareSpectrumRingBuffer, registerSonareRealtimeEngineWorkletProcessor, registerSonareRealtimeVoiceChangerWorkletProcessor, registerSonareWorkletProcessor, sonareClipPageRequestRingBufferByteLength, sonareEngineCommandRingBufferByteLength, sonareEngineTelemetryRingBufferByteLength, sonareExternalMidiRingBufferByteLength, sonareMeterRingBufferByteLength, sonareScopeRingBufferByteLength, sonareSpectrumRingBufferByteLength, writeSonareEngineTelemetryRingBuffer };
1
+ export type { OpfsClipStream, OpfsClipStreamOptions } from './clip_page_streamer';
2
+ export { attachOpfsClipStream } from './clip_page_streamer';
3
+ export { init, isInitialized } from './index';
4
+ export type { StreamingMasteringChainConfig } from './public_types';
5
+ export { StreamingMasteringChain } from './streaming_processors';
6
+ export { SonareEngine } from './worklet/engine';
7
+ export { SonareRealtimeEngineNode } from './worklet/engine-node';
8
+ export type { SonareEngineOptions } from './worklet/engine-options';
9
+ export { SonareRealtimeEngineWorkletProcessor } from './worklet/engine-processor';
10
+ export { registerSonareRealtimeEngineWorkletProcessor } from './worklet/engine-register';
11
+ export type { SonareEngineCaptureRequestMessage, SonareEngineCaptureResponseMessage, SonareEngineClipPageRequestMessage, SonareEngineSyncAutomationMessage, SonareEngineSyncBuiltinInstrumentMessage, SonareEngineSyncBusStripEqBandMessage, SonareEngineSyncCaptureMessage, SonareEngineSyncClipsDeltaMessage, SonareEngineSyncClipsMessage, SonareEngineSyncLoadSoundFontMessage, SonareEngineSyncMarkersMessage, SonareEngineSyncMasterStripEqBandMessage, SonareEngineSyncMasterStripInsertBypassedMessage, SonareEngineSyncMessage, SonareEngineSyncMetronomeMessage, SonareEngineSyncMidiCcMessage, SonareEngineSyncMidiClipsMessage, SonareEngineSyncMidiNoteMessage, SonareEngineSyncMidiPanicMessage, SonareEngineSyncMixerMessage, SonareEngineSyncSf2InstrumentMessage, SonareEngineSyncSynthInstrumentMessage, SonareEngineSyncTempoMessage, SonareEngineSyncTrackStripEqBandMessage, SonareEngineSyncTrackStripInsertBypassedMessage, SonareEngineTransportFacade, SonareEngineTransportRequestMessage, SonareEngineTransportResponseMessage, SonarePlaybackConfigMessage, SonarePlaybackDestroyMessage, SonarePlaybackDiagnosticsReplyMessage, SonarePlaybackDiagnosticsRequestMessage, SonarePlaybackErrorMessage, SonarePlaybackMessage, SonarePlaybackNodeOptions, SonarePlaybackOrientationMessage, SonarePlaybackResetMessage, SonarePlaybackWorkletDiagnostics, SonarePlaybackWorkletProcessorOptions, SonareRealtimeEngineNodeCapabilities, SonareRealtimeEngineNodeOptions, SonareRealtimeEngineWorkletProcessorOptions, SonareRealtimeVoiceChangerDestroyMessage, SonareRealtimeVoiceChangerMessage, SonareRealtimeVoiceChangerResetMessage, SonareRealtimeVoiceChangerSetConfigMessage, SonareRealtimeVoiceChangerWorkletProcessorOptions, SonareWorkletDestroyMessage, SonareWorkletMessage, SonareWorkletProcessorOptions, SonareWorkletScheduleInsertAutomationMessage, SonareWorkletSetMeterIntervalMessage, SonareWorkletTransportMessage, } from './worklet/messages';
12
+ export { registerSonareWorkletProcessor, SonareWorkletProcessor, } from './worklet/mixer-processor';
13
+ export { createSonarePlaybackNode, registerSonarePlaybackWorkletProcessor, SonarePlaybackWorkletProcessor, } from './worklet/playback-processor';
14
+ export { createSonareClipPageRequestRingBuffer, createSonareEngineCommandRingBuffer, createSonareEngineTelemetryRingBuffer, createSonareExternalMidiRingBuffer, createSonareMeterRingBuffer, createSonareScopeRingBuffer, createSonareSpectrumRingBuffer, decodeFrame, encodeFrameHi, encodeFrameLo, popSonareEngineCommandRingBuffer, pushSonareClipPageRequestRingBuffer, pushSonareEngineCommandRingBuffer, pushSonareExternalMidiRingBuffer, readSonareClipPageRequestRingBuffer, readSonareEngineTelemetryRingBuffer, readSonareExternalMidiRingBuffer, readSonareMeterRingBuffer, readSonareScopeRingBuffer, readSonareSpectrumRingBuffer, SONARE_CLIP_PAGE_REQUEST_RING_HEADER_INTS, SONARE_CLIP_PAGE_REQUEST_RING_RECORD_UINT32S, SONARE_ENGINE_COMMAND_RECORD_BYTES, SONARE_ENGINE_RING_HEADER_INTS, SONARE_ENGINE_TELEMETRY_RECORD_BYTES, SONARE_EXTERNAL_MIDI_RING_HEADER_INTS, SONARE_EXTERNAL_MIDI_RING_RECORD_UINT32S, SONARE_METER_RING_HEADER_INTS, SONARE_METER_RING_RECORD_FLOATS, SONARE_SCOPE_RING_HEADER_INTS, SONARE_SPECTRUM_RING_HEADER_INTS, type SonareClipPageRequest, type SonareClipPageRequestRingBuffer, type SonareClipPageRequestRingReadResult, type SonareEngineCommandRecord, type SonareEngineCommandRingBuffer, SonareEngineCommandType, SonareEngineTelemetryError, type SonareEngineTelemetryRecord, type SonareEngineTelemetryRingBuffer, type SonareEngineTelemetryRingReadResult, SonareEngineTelemetryType, type SonareExternalMidiRingBuffer, type SonareExternalMidiRingReadResult, type SonareMeterRingBuffer, type SonareMeterRingReadResult, type SonareScopeRingBuffer, type SonareScopeRingReadResult, type SonareSpectrumRingBuffer, type SonareSpectrumRingReadResult, type SonareWorkletMeterSnapshot, type SonareWorkletScopeSnapshot, type SonareWorkletSpectrumSnapshot, sonareClipPageRequestRingBufferByteLength, sonareEngineCommandRingBufferByteLength, sonareEngineTelemetryRingBufferByteLength, sonareExternalMidiRingBufferByteLength, sonareMeterRingBufferByteLength, sonareScopeRingBufferByteLength, sonareSpectrumRingBufferByteLength, writeSonareEngineTelemetryRingBuffer, } from './worklet/protocol';
15
+ export { registerSonareRealtimeVoiceChangerWorkletProcessor, SonareRealtimeVoiceChangerWorkletProcessor, } from './worklet/voice-changer-processor';
16
+ //# sourceMappingURL=worklet.d.ts.map