@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
@@ -1,3 +1,5 @@
1
+ // Type-only, so the erased import adds no runtime edge to the codes module.
2
+ import type { PROJECT_AUTOMATION_CURVE_VALUES } from './codes';
1
3
  import type { Project } from './project_class';
2
4
 
3
5
  // ============================================================================
@@ -9,7 +11,7 @@ import type { Project } from './project_class';
9
11
  * `src/sonare_c_project.h`; checked against {@link projectAbiVersion} to detect
10
12
  * a WASM build whose flat project POD layout has drifted from this wrapper.
11
13
  */
12
- export const EXPECTED_PROJECT_ABI_VERSION = 1;
14
+ export const EXPECTED_PROJECT_ABI_VERSION = 2;
13
15
 
14
16
  /** Render options for {@link Project.bounce}. All fields are optional. */
15
17
  export interface ProjectBounceOptions {
@@ -17,9 +19,18 @@ export interface ProjectBounceOptions {
17
19
  totalFrames?: number;
18
20
  /** Render block size; <= 0 uses the engine default (128). */
19
21
  blockSize?: number;
20
- /** Output channel count; <= 0 uses the default (2). */
22
+ /**
23
+ * Output channel count: 1, 2, 6 or 8, and at most the width of the scene
24
+ * master's layout (mono/stereo/no master allow 2). The master is mixed at
25
+ * this width; 1 folds a 2-channel master to 0.5(L+R). <= 0 uses the default
26
+ * (2).
27
+ */
21
28
  numChannels?: number;
22
- /** Output sample rate; <= 0 uses the project sample rate. */
29
+ /**
30
+ * Output sample rate. This is not a resample: a positive value must equal
31
+ * the project's own sample rate, or the bounce is refused. <= 0 uses the
32
+ * project sample rate.
33
+ */
23
34
  sampleRate?: number;
24
35
  /** Host-instrument PDC (latency) fed to the compiler. */
25
36
  instrumentLatencySamples?: number;
@@ -116,255 +127,6 @@ export interface ProjectSource {
116
127
  externalStemRole: string;
117
128
  }
118
129
 
119
- /** Names accepted by the minimal built-in oscillator synth. */
120
- export const BUILTIN_SYNTH_WAVEFORMS = ['sine', 'saw', 'sawtooth', 'square', 'triangle'] as const;
121
-
122
- /** Oscillator waveform for the built-in synth. */
123
- export type BuiltinSynthWaveform = (typeof BUILTIN_SYNTH_WAVEFORMS)[number] | 0 | 1 | 2 | 3;
124
-
125
- /**
126
- * Built-in synth patch + MIDI routing for
127
- * {@link Project.bounceWithBuiltinInstrument}. Every field is optional; a
128
- * non-positive (or omitted) numeric field falls back to the C-ABI default
129
- * (gain 0.2, attack 5ms, decay 60ms, sustain 0.7, release 120ms, 16 voices),
130
- * so `{}` is a usable default sine patch.
131
- */
132
- export interface BuiltinSynthBinding {
133
- /** MIDI destination id this patch answers to (default 0; see {@link Project.setTrackMidiDestination}). */
134
- destinationId?: number;
135
- /** Oscillator waveform (default `'sine'`). */
136
- waveform?: BuiltinSynthWaveform;
137
- /** Master output gain, linear (0 => 0.2). */
138
- gain?: number;
139
- /** ADSR attack in ms (0 => 5). */
140
- attackMs?: number;
141
- /** ADSR decay in ms (0 => 60). */
142
- decayMs?: number;
143
- /** ADSR sustain level [0,1] (0 => 0.7). */
144
- sustain?: number;
145
- /** ADSR release in ms (0 => 120). */
146
- releaseMs?: number;
147
- /** Max simultaneous voices (0 => 16, clamped to [1, 64]). */
148
- polyphony?: number;
149
- }
150
-
151
- /**
152
- * Cross-binding alias of {@link BuiltinSynthBinding}. The same built-in-synth
153
- * patch concept is named `BuiltinSynthConfig` in the Python binding; this alias
154
- * lets portable code use that shared name on the WASM surface too.
155
- */
156
- export type BuiltinSynthConfig = BuiltinSynthBinding;
157
-
158
- /**
159
- * SoundFont (SF2) player patch + MIDI routing for
160
- * {@link Project.bounceWithSf2Instrument}. Every field is optional; a
161
- * non-positive (or omitted) numeric field falls back to the C-ABI default
162
- * (gain 0.5, 48 voices), so `{}` is a usable default patch.
163
- */
164
- export interface Sf2InstrumentConfig {
165
- /** MIDI destination id this player answers to (default 0; see {@link Project.setTrackMidiDestination}). */
166
- destinationId?: number;
167
- /** Master output gain, linear (0 => 0.5). */
168
- gain?: number;
169
- /** Max simultaneous voices (0 => 48, clamped to [1, 64]). */
170
- polyphony?: number;
171
- /** Prefer dedicated physical models for covered melodic GM programs. Defaults to false; drums stay SF2-first. */
172
- preferModelForModeledFamilies?: boolean;
173
- }
174
-
175
- /** Source backend a resolved MIDI program renders through. */
176
- export type SourceBackend = 'sf2' | 'synth';
177
-
178
- /**
179
- * One {@link Project.soundFontManifest} entry: a (channel, bank, program)
180
- * combination the arrangement plays, with the backend it resolves to.
181
- */
182
- export interface Sf2ProgramStatus {
183
- /** MIDI channel (0-15). */
184
- channel: number;
185
- /** Effective SF2 bank (drum channels report 128). */
186
- bank: number;
187
- /** Program number (0-127). */
188
- program: number;
189
- /** `'sf2'` when the loaded SoundFont covers the program, else `'synth'`. */
190
- backend: SourceBackend;
191
- /** Resolved SF2 preset name (GS fallback included); empty for `'synth'`. */
192
- presetName: string;
193
- }
194
-
195
- export const SYNTH_ENGINE_MODES = [
196
- 'default',
197
- 'subtractive',
198
- 'fm',
199
- 'karplus-strong',
200
- 'modal',
201
- 'additive',
202
- 'percussion',
203
- 'piano',
204
- 'pipe-organ',
205
- 'bowed-string',
206
- 'reed',
207
- 'brass',
208
- 'flute',
209
- 'plucked-string',
210
- 'vocal',
211
- 'free-reed',
212
- ] as const;
213
- export const SYNTH_OSC_WAVEFORMS = [
214
- 'default',
215
- 'sine',
216
- 'saw',
217
- 'square',
218
- 'triangle',
219
- 'noise',
220
- ] as const;
221
- export const SYNTH_FILTER_MODELS = [
222
- 'default',
223
- 'svf',
224
- 'moog-ladder',
225
- 'diode-ladder',
226
- 'sallen-key',
227
- ] as const;
228
- export const SYNTH_FILTER_OUTPUTS = ['default', 'lowpass', 'bandpass', 'highpass'] as const;
229
- export const SYNTH_BODY_TYPES = [
230
- 'default',
231
- 'none',
232
- 'guitar',
233
- 'violin',
234
- 'wood-tube',
235
- 'brass-bell',
236
- 'vocal',
237
- ] as const;
238
- export const SYNTH_MOD_SOURCES = [
239
- 'none',
240
- 'amp-env',
241
- 'filter-env',
242
- 'lfo1',
243
- 'lfo2',
244
- 'velocity',
245
- 'key-track',
246
- 'mod-wheel',
247
- 'random',
248
- ] as const;
249
- export const SYNTH_MOD_DESTINATIONS = [
250
- 'none',
251
- 'pitch-cents',
252
- 'cutoff-cents',
253
- 'amp-gain',
254
- 'pan-units',
255
- ] as const;
256
-
257
- export interface SynthEnumTables {
258
- engineModes: string[];
259
- waveforms: string[];
260
- builtinWaveforms: string[];
261
- filterModels: string[];
262
- filterOutputs: string[];
263
- bodyTypes: string[];
264
- modSources: string[];
265
- modDestinations: string[];
266
- }
267
-
268
- /** NativeSynth engine selector ({@link SynthPatch}; `'default'` keeps the base patch's). */
269
- export type SynthEngineMode = (typeof SYNTH_ENGINE_MODES)[number];
270
-
271
- /** NativeSynth oscillator waveform (`'default'` keeps the base patch's). */
272
- export type SynthOscWaveform = (typeof SYNTH_OSC_WAVEFORMS)[number];
273
-
274
- /** NativeSynth filter model — the character core (`'default'` keeps the base patch's). */
275
- export type SynthFilterModel = (typeof SYNTH_FILTER_MODELS)[number];
276
-
277
- /** NativeSynth filter output (SVF only; `'default'` keeps the base patch's). */
278
- export type SynthFilterOutput = (typeof SYNTH_FILTER_OUTPUTS)[number];
279
-
280
- /** NativeSynth body/formant resonance voicing (`'default'` keeps the base patch's). */
281
- export type SynthBodyType = (typeof SYNTH_BODY_TYPES)[number];
282
-
283
- /** {@link SynthPatch} mod-matrix source. */
284
- export type SynthModSource = (typeof SYNTH_MOD_SOURCES)[number];
285
-
286
- /** {@link SynthPatch} mod-matrix destination. */
287
- export type SynthModDestination = (typeof SYNTH_MOD_DESTINATIONS)[number];
288
-
289
- /** One {@link SynthPatch} mod-matrix routing (name or C ordinal per field). */
290
- export interface SynthModRouting {
291
- source: SynthModSource | number;
292
- destination: SynthModDestination | number;
293
- /** Destination units at full source deflection. */
294
- depth: number;
295
- }
296
-
297
- /**
298
- * Versioned NativeSynth patch for {@link Project.bounceWithSynthInstrument}
299
- * and {@link RealtimeEngine.setSynthInstrument}.
300
- *
301
- * The patch starts from a BASE — the named `preset` (see
302
- * {@link synthPresetNames}; a `"va:"` routing prefix is accepted) or, when
303
- * `preset` is omitted, the default subtractive patch. Omitting a numeric field
304
- * keeps the base value; supplying one overrides it (clamped to its audible
305
- * range), including an explicit `0` such as `stereoSpread: 0`. The enum fields
306
- * reserve `'default'` as keep. A `modRoutings` array REPLACES the base mod
307
- * matrix, and an empty array clears it, while omitting the key keeps it.
308
- *
309
- * Mode-specific deep parameters (FM operator stacks, modal mode tables,
310
- * drawbar registrations, kit pieces, piano strings) travel inside the named
311
- * presets; the patch exposes the wrapper sections every engine shares.
312
- */
313
- export interface SynthPatch {
314
- /**
315
- * Optional binding convenience for JS realtime/offline helpers. It is not
316
- * part of the NativeSynth patch itself; Python uses explicit
317
- * `(destination_id, patch)` bindings instead. Defaults to `0`.
318
- */
319
- destinationId?: number;
320
- /** Resolve MIDI channels from incoming GM bank/program changes; defaults to false. */
321
- useGmPrograms?: boolean;
322
- /** Base preset name (see {@link synthPresetNames}); omit for the init patch. */
323
- preset?: string;
324
- engineMode?: SynthEngineMode | number;
325
- waveform?: SynthOscWaveform | number;
326
- /** Detuned-stack width [1, 7]. */
327
- unison?: number;
328
- detuneCents?: number;
329
- /** Per-voice slow pitch drift depth (cents). */
330
- driftCents?: number;
331
- /** Pre-filter drive [0, 1]. */
332
- drive?: number;
333
- filterModel?: SynthFilterModel | number;
334
- filterOutput?: SynthFilterOutput | number;
335
- cutoffHz?: number;
336
- resonanceQ?: number;
337
- /** Cutoff keyboard tracking [0, 1]. */
338
- keyTrack?: number;
339
- envToCutoffCents?: number;
340
- velToCutoffCents?: number;
341
- ampAttackMs?: number;
342
- ampDecayMs?: number;
343
- ampSustain?: number;
344
- ampReleaseMs?: number;
345
- filterAttackMs?: number;
346
- filterDecayMs?: number;
347
- filterSustain?: number;
348
- filterReleaseMs?: number;
349
- lfoRateHz?: number;
350
- lfoToPitchCents?: number;
351
- lfo2RateHz?: number;
352
- glideMs?: number;
353
- body?: SynthBodyType | number;
354
- /** Body resonance mix [0, 1]. */
355
- bodyMix?: number;
356
- /** Seeded per-voice pan scatter [0, 1]. */
357
- stereoSpread?: number;
358
- /** Mod matrix (at most 8 routings; REPLACES the base matrix when non-empty). */
359
- modRoutings?: SynthModRouting[];
360
- /** Master output gain (linear). */
361
- gain?: number;
362
- /** Max simultaneous voices [1, 64]. */
363
- polyphony?: number;
364
- /** Gain-neutral bus saturation [0, 1]. */
365
- busDrive?: number;
366
- }
367
-
368
130
  /** Clip fade-curve for {@link Project.setClipFade}. */
369
131
  export type ProjectFadeCurve =
370
132
  | 'linear'
@@ -402,6 +164,8 @@ export interface ProjectClipCompSegment {
402
164
  startPpq: number;
403
165
  endPpq: number;
404
166
  takeId?: number;
167
+ /** Equal-power crossfade from the preceding segment, in PPQ (default 0 = butt join). */
168
+ crossfadePpq?: number;
405
169
  }
406
170
 
407
171
  /** Descriptor for {@link Project.addLoopRecordingTakes}. */
@@ -422,24 +186,29 @@ export interface ProjectLoopRecordingResult {
422
186
 
423
187
  /** Clip loop mode for {@link Project.setClipLoop}. */
424
188
  export type ProjectLoopMode = 'off' | 'loop' | 0 | 1;
425
- export type ProjectWarpMode = 'off' | 'repitch' | 'tempo-sync' | 0 | 1 | 2;
189
+ /**
190
+ * How a clip follows its warp map.
191
+ *
192
+ * - `'off'` — no warping.
193
+ * - `'repitch'` — resample along the map, so a rate change moves the pitch with
194
+ * the timing (tape-style).
195
+ * - `'tempo-sync'` — control-thread bake against the tempo map.
196
+ * - `'time-stretch'` — realtime pitch-preserving stretch. Follows the same map
197
+ * as `'repitch'` but overlap-adds instead of resampling, so a new anchor set
198
+ * takes effect from the next block with no re-bake. Falls back to `'repitch'`
199
+ * behaviour when the stretcher's voice budget is exhausted.
200
+ */
201
+ export type ProjectWarpMode = 'off' | 'repitch' | 'tempo-sync' | 'time-stretch' | 0 | 1 | 2 | 3;
426
202
 
427
203
  /**
428
204
  * Automation breakpoint interpolation for {@link ProjectAutomationPoint}.
429
205
  *
430
206
  * `'s-curve'` is the canonical spelling, matching the Node engine and the mixer
431
207
  * automation types. The legacy `'scurve'` remains accepted for compatibility.
208
+ * The spellings are derived from the resolver's own table, so the documented
209
+ * set and the accepted set cannot drift apart.
432
210
  */
433
- export type ProjectAutomationCurve =
434
- | 'linear'
435
- | 'exponential'
436
- | 'hold'
437
- | 's-curve'
438
- | 'scurve'
439
- | 0
440
- | 1
441
- | 2
442
- | 3;
211
+ export type ProjectAutomationCurve = 0 | 1 | 2 | 3 | keyof typeof PROJECT_AUTOMATION_CURVE_VALUES;
443
212
 
444
213
  /** One automation breakpoint accepted by the automation-lane edit ops. */
445
214
  export interface ProjectAutomationPoint {
@@ -449,6 +218,8 @@ export interface ProjectAutomationPoint {
449
218
  value: number;
450
219
  /** Curve to the next breakpoint (default `'linear'`). */
451
220
  curve?: ProjectAutomationCurve;
221
+ /** Alias of {@link ProjectAutomationPoint.curve}; `curve` wins when both are set. */
222
+ curveToNext?: ProjectAutomationCurve;
452
223
  }
453
224
 
454
225
  /**
@@ -487,7 +258,11 @@ export interface ProjectTempoSegment {
487
258
  startPpq: number;
488
259
  /** Tempo in beats per minute at the segment start. */
489
260
  bpm: number;
490
- /** Derived segment start in samples. Accepted for compatibility, ignored on input. */
261
+ /**
262
+ * Derived segment start in samples. Accepted for compatibility and ignored on
263
+ * input; never returned, because a project stores musical positions only and
264
+ * sample positions are derived when it is compiled.
265
+ */
491
266
  startSample?: number;
492
267
  /** Optional ramp end tempo in BPM (0 = constant tempo over the segment). */
493
268
  endBpm?: number;
@@ -504,6 +279,40 @@ export interface ProjectTimeSignatureSegment {
504
279
  }
505
280
 
506
281
  /** A ranked primary/half/double tempo hypothesis returned by {@link Project.analyzeTempo}. */
282
+ /**
283
+ * Scoring options for the beat-analysis to tempo-map bridge, shared by
284
+ * {@link Project.analyzeTempo} and {@link Project.autoTempo}.
285
+ *
286
+ * @remarks
287
+ * Every field is optional and falls back to the native default. Pair the two
288
+ * calls on the same options: `candidateIndex` indexes the ranking `analyzeTempo`
289
+ * produced under whatever options it was given.
290
+ */
291
+ export interface ProjectTempoOptions {
292
+ /**
293
+ * Whether beat tracking may follow a tempo that moves during the take
294
+ * (default: `false`).
295
+ *
296
+ * @remarks
297
+ * With it off the tracker fits one tempo to the whole take, so on a
298
+ * performance that accelerates, slows or breathes every segment the bridge
299
+ * emits sits near the take's average. Leave it off for material recorded to a
300
+ * click; turn it on for a performance. Constant-tempo material still comes
301
+ * back as a single segment either way.
302
+ */
303
+ adaptiveTempo?: boolean;
304
+ /** Beats of context the local tempo estimate is read over. Used only when {@link adaptiveTempo} is on. */
305
+ tempoUpdateIntervalBeats?: number;
306
+ /**
307
+ * Relative tempo change at which one segment closes and the next opens
308
+ * (default: `0.02`). Smaller follows the performance more closely and emits
309
+ * more segments; larger merges more of it into constant stretches.
310
+ */
311
+ rampThreshold?: number;
312
+ /** Whether to rank the half- and double-tempo alternatives alongside the primary (default: `true`). */
313
+ includeOctaveCandidates?: boolean;
314
+ }
315
+
507
316
  export interface ProjectTempoCandidate {
508
317
  bpm: number;
509
318
  confidence: number;
@@ -586,6 +395,79 @@ export interface ProjectWarpMapDesc {
586
395
  anchors: ProjectWarpAnchor[];
587
396
  }
588
397
 
398
+ /**
399
+ * Canonical request form for {@link alignTakeToReference}.
400
+ *
401
+ * Both resolution fields are optional and omitting one takes the library value.
402
+ * A `0` is **refused** rather than read as a request for the default: neither
403
+ * field has a meaning at 0, so omission is already how you ask for the default,
404
+ * and a substituted value is indistinguishable downstream from one you chose.
405
+ */
406
+ export interface AlignTakeToReferenceRequest {
407
+ /**
408
+ * The reference timeline — the guide take, or the backing track the takes were
409
+ * sung against. Must be non-empty and all-finite.
410
+ */
411
+ reference: Float32Array;
412
+ /** The take to be placed under it. Must be non-empty and all-finite. */
413
+ take: Float32Array;
414
+ /**
415
+ * Sample rate of **both** buffers in Hz, `[8000, 384000]`. Resample first if
416
+ * they differ: the alignment does no rate conversion.
417
+ */
418
+ sampleRate: number;
419
+ /**
420
+ * Chroma hop in samples, which sets the time resolution of the anchors — a
421
+ * smaller hop measures more frames and yields more anchors. Default `512`;
422
+ * must be a positive integer.
423
+ */
424
+ hopLength?: number;
425
+ /**
426
+ * Chroma bins per octave — the CQT resolution the twelve pitch classes are
427
+ * folded from. Default `12`; must be a positive **multiple of 12**, since each
428
+ * pitch class takes the mean of a whole number of CQT bins.
429
+ */
430
+ binsPerOctave?: number;
431
+ }
432
+
433
+ /**
434
+ * How well an alignment was conditioned, reported by
435
+ * {@link AlignTakeToReferenceResult}.
436
+ *
437
+ * Every field is descriptive: none of them makes the call fail, and a caller
438
+ * deciding what is acceptable supplies its own threshold.
439
+ */
440
+ export interface TakeAlignment {
441
+ /**
442
+ * Mean absolute frame residual of the path around its diagonal trend. A coarse
443
+ * indicator of how far the alignment strayed from a constant rate, not an error
444
+ * bound.
445
+ */
446
+ meanResidualFrames: number;
447
+ /** Chroma frames the reference produced. */
448
+ referenceFrames: number;
449
+ /**
450
+ * Chroma frames the take produced. Its ratio to `referenceFrames` is the
451
+ * overall rate difference the anchors encode.
452
+ */
453
+ takeFrames: number;
454
+ }
455
+
456
+ /** Result of {@link alignTakeToReference}. */
457
+ export interface AlignTakeToReferenceResult {
458
+ /**
459
+ * At least two finite, strictly increasing anchors, ready to hand to
460
+ * {@link Project.setWarpMap} as the take clip's own warp map.
461
+ *
462
+ * `warpSample` is a position on the **reference** timeline and `sourceSample`
463
+ * the corresponding position in the **take**, which is the direction a clip
464
+ * whose source is that take needs.
465
+ */
466
+ anchors: ProjectWarpAnchor[];
467
+ /** How well the alignment was conditioned. */
468
+ alignment: TakeAlignment;
469
+ }
470
+
589
471
  /** Descriptor for {@link Project.addClip}. */
590
472
  export interface ProjectClipDesc {
591
473
  trackId: number;
@@ -596,6 +478,11 @@ export interface ProjectClipDesc {
596
478
  gain?: number;
597
479
  audio?: Float32Array;
598
480
  audioChannels?: number;
481
+ /**
482
+ * Sample rate of `audio` in Hz. Required whenever `audio` is supplied, and
483
+ * must be in `[8000, 384000]`: omitting it sends 0, which the native side
484
+ * rejects. Ignored for a metadata-only clip.
485
+ */
599
486
  audioSampleRate?: number;
600
487
  sourceUri?: string;
601
488
  }
@@ -607,6 +494,15 @@ export interface ProjectMidiClipResult {
607
494
  }
608
495
 
609
496
  /** Flat MIDI event accepted by {@link Project.setMidiEvents}. */
497
+ /**
498
+ * One MIDI event in a clip's list: a position plus the first two UMP words.
499
+ *
500
+ * @remarks
501
+ * Channel-voice messages only. A clip's SysEx payloads live beside the event
502
+ * list and are reached by a handle this type does not carry — they survive
503
+ * {@link Project.importSmf}, {@link Project.exportSmf} and project
504
+ * serialization, and are destroyed by {@link Project.setMidiEvents}.
505
+ */
610
506
  export interface ProjectMidiEvent {
611
507
  ppq: number;
612
508
  data0: number;
@@ -643,16 +539,18 @@ export interface MidiCcLearnOptions {
643
539
  /** MIDI CC <-> automation binding descriptor used by CC learn/conversion helpers. */
644
540
  export interface ProjectMidiCcBinding {
645
541
  ccNumber: number;
646
- /** MIDI channel 0..15, or 255 for any channel. */
647
- channel: number;
648
- /** 0 = 7-bit CC, 1 = 14-bit CC, 2 = RPN, 3 = NRPN. */
649
- kind: ProjectMidiCcBindingKind;
542
+ /** MIDI channel 0..15, or 255 for any channel. Omit for the any-channel sentinel `255`. */
543
+ channel?: number;
544
+ /** 0 = 7-bit CC, 1 = 14-bit CC, 2 = RPN, 3 = NRPN. Default `0`. */
545
+ kind?: ProjectMidiCcBindingKind;
650
546
  ccLsbNumber?: number;
651
547
  selectorMsb?: number;
652
548
  selectorLsb?: number;
653
549
  paramId: number;
654
- minValue: number;
655
- maxValue: number;
550
+ /** Lower end of the mapped parameter range. Default `0`. */
551
+ minValue?: number;
552
+ /** Upper end of the mapped parameter range. Default `1`. */
553
+ maxValue?: number;
656
554
  }
657
555
 
658
556
  /** Result of {@link Project.validateMidiNotes}. */
@@ -699,6 +597,106 @@ export interface ProjectMidiFxPreviewRequest {
699
597
  configJson: string;
700
598
  }
701
599
 
600
+ /**
601
+ * Detector settings shared by {@link transcribe} and
602
+ * {@link Project.transcribeToClip}.
603
+ *
604
+ * Every field is optional and omitting one takes the documented default. A
605
+ * value outside a field's domain is **refused**, never silently replaced — a
606
+ * substituted default is indistinguishable downstream from one you chose.
607
+ *
608
+ * That includes `0` on the fields whose domain excludes it (`referenceHz`,
609
+ * `fmin`, `fmax`, `minNoteMs`, `segmentationThresholdCents`,
610
+ * `velocityFloorDb`, `fixedVelocity`): omitting the field is how you ask for
611
+ * the default, so a `0` you wrote is a value, and it is out of domain. Only
612
+ * `group` and `channel` accept `0` — there it is a value you can mean.
613
+ */
614
+ export interface TranscribeOptions {
615
+ /**
616
+ * `true` reads the multi-F0 chain, which finds overlapping notes at the cost
617
+ * of a full STFT and a mask per tracked ridge. `false` (the default) reads
618
+ * pYIN cut into notes, which follows one line at a time.
619
+ */
620
+ polyphonic?: boolean;
621
+ /**
622
+ * Tuning reference in Hz the MIDI note numbers are measured against.
623
+ * Default `440`; must be finite and positive.
624
+ *
625
+ * **It is not measured for you.** A take recorded away from A440 should have
626
+ * its reference measured first — run `pitchPyin` and feed its F0 array to
627
+ * `pitchTuning` — and the answer passed in here. Measuring it internally
628
+ * would track the pitch twice and hide which of the two answers a wrong
629
+ * transcription came from.
630
+ */
631
+ referenceHz?: number;
632
+ /**
633
+ * Monophonic tracker range in Hz. Defaults `65` and `2093`; both must be
634
+ * finite and positive, and `fmax` must exceed `fmin`. The polyphonic chain
635
+ * sets its own range and reads neither.
636
+ */
637
+ fmin?: number;
638
+ /** Upper end of the monophonic tracker range in Hz. Default `2093`. */
639
+ fmax?: number;
640
+ /** Shortest span kept as a note, in milliseconds. Default `30`; must be positive. */
641
+ minNoteMs?: number;
642
+ /**
643
+ * Pitch movement, in cents, that ends one note and starts the next.
644
+ * Default `50`; must be positive.
645
+ */
646
+ segmentationThresholdCents?: number;
647
+ /**
648
+ * Level mapped to velocity 1, in dBFS. Default `-48`; **must be negative**.
649
+ *
650
+ * A note's peak per-frame RMS is taken in dBFS and mapped linearly from
651
+ * `[velocityFloorDb, 0]` onto `[1, 127]`, clamped at both ends.
652
+ */
653
+ velocityFloorDb?: number;
654
+ /**
655
+ * An integer in `[1, 127]` gives every note that velocity and skips the level
656
+ * measurement. **Omit the field to measure** — `0` is refused, because it is
657
+ * not a MIDI velocity and omission already says "measure".
658
+ */
659
+ fixedVelocity?: number;
660
+ /** UMP group the events are emitted on, `0..15`. Default `0`. */
661
+ group?: number;
662
+ /** MIDI channel the events are emitted on, `0..15`. Default `0`. */
663
+ channel?: number;
664
+ }
665
+
666
+ /** Result of {@link transcribe}. */
667
+ export interface TranscribeResult {
668
+ /**
669
+ * Note-on / note-off pairs in canonical PPQ order, ready to hand straight to
670
+ * {@link Project.setMidiEvents}.
671
+ *
672
+ * Ordering is `(ppq, note-off before note-on)`. A note-off sharing a tick
673
+ * with the next note's on comes first, so a consumer playing the events in
674
+ * order does not start a legato repeat of the same pitch and immediately
675
+ * stop it.
676
+ */
677
+ events: ProjectMidiEvent[];
678
+ /** Number of notes, which is always half `events.length`. */
679
+ noteCount: number;
680
+ /** The tempo the PPQ coordinates were built on — yours when you gave one, the detected one otherwise. */
681
+ tempoBpm: number;
682
+ }
683
+
684
+ /**
685
+ * Request form of {@link Project.transcribeToClip}.
686
+ *
687
+ * No `tempoBpm`: the PPQ grid is the **project's own tempo map**, so a project
688
+ * whose tempo was installed by {@link Project.autoTempo} transcribes onto that
689
+ * map rather than onto a second, separately detected tempo.
690
+ */
691
+ export interface ProjectTranscribeRequest extends TranscribeOptions {
692
+ /** Target MIDI clip id. Its entire event list is replaced. */
693
+ clipId: number;
694
+ /** Mono source audio. Must be non-empty and all-finite. */
695
+ samples: Float32Array;
696
+ /** Sample rate of `samples` in Hz, `[8000, 384000]`. */
697
+ sampleRate: number;
698
+ }
699
+
702
700
  /** One compile diagnostic (mirrors SonareProjectDiagnostic). */
703
701
  export interface ProjectDiagnostic {
704
702
  code: number;