@libraz/libsonare 1.7.1 → 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 -170
  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 -5837
  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 -7329
  63. package/dist/index.d.ts.map +1 -0
  64. package/dist/index.js +3816 -1359
  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 -2142
  213. package/dist/worklet.d.ts.map +1 -0
  214. package/dist/worklet.js +2889 -466
  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 +285 -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 +64 -24
  255. package/src/project_class.ts +502 -29
  256. package/src/project_internal.ts +151 -42
  257. package/src/project_synth.ts +67 -1
  258. package/src/project_types.ts +302 -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 +750 -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 +1125 -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 +212 -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 +85 -28
  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 +307 -71
  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 +239 -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 +22 -0
  302. package/src/effects_transform.ts +0 -718
  303. package/src/mastering_repair.ts +0 -273
@@ -0,0 +1,517 @@
1
+ /**
2
+ * Instrument definitions a project source plays through: the built-in synth
3
+ * patch, the SoundFont player, and the sample bank's descriptors.
4
+ */
5
+ import type { SampleBank } from './sample_bank';
6
+ /** Names accepted by the minimal built-in oscillator synth. */
7
+ export declare const BUILTIN_SYNTH_WAVEFORMS: readonly ["sine", "saw", "sawtooth", "square", "triangle"];
8
+ /** Oscillator waveform for the built-in synth. */
9
+ export type BuiltinSynthWaveform = (typeof BUILTIN_SYNTH_WAVEFORMS)[number] | 0 | 1 | 2 | 3;
10
+ /**
11
+ * Built-in synth patch + MIDI routing for
12
+ * {@link Project.bounceWithBuiltinInstrument}. Every field is optional; a
13
+ * non-positive (or omitted) numeric field falls back to the C-ABI default
14
+ * (gain 0.2, attack 5ms, decay 60ms, sustain 0.7, release 120ms, 16 voices),
15
+ * so `{}` is a usable default sine patch.
16
+ */
17
+ export interface BuiltinSynthBinding {
18
+ /** MIDI destination id this patch answers to (default 0; see {@link Project.setTrackMidiDestination}). */
19
+ destinationId?: number;
20
+ /**
21
+ * Oscillator waveform (default `'sine'`). The one field with no nearest
22
+ * sensible value — a name or an ordinal outside the set throws rather than
23
+ * falling back to sine.
24
+ */
25
+ waveform?: BuiltinSynthWaveform;
26
+ /** Master output gain, linear (0 => 0.2). */
27
+ gain?: number;
28
+ /** ADSR attack in ms (0 => 5). */
29
+ attackMs?: number;
30
+ /** ADSR decay in ms (0 => 60). */
31
+ decayMs?: number;
32
+ /** ADSR sustain level [0,1] (0 => 0.7). */
33
+ sustain?: number;
34
+ /** ADSR release in ms (0 => 120). */
35
+ releaseMs?: number;
36
+ /** Max simultaneous voices (0 => 16, clamped to [1, 64]). */
37
+ polyphony?: number;
38
+ }
39
+ /**
40
+ * Cross-binding alias of {@link BuiltinSynthBinding}. The same built-in-synth
41
+ * patch concept is named `BuiltinSynthConfig` in the Python binding; this alias
42
+ * lets portable code use that shared name on the WASM surface too.
43
+ */
44
+ export type BuiltinSynthConfig = BuiltinSynthBinding;
45
+ /**
46
+ * SoundFont (SF2) player patch + MIDI routing for
47
+ * {@link Project.bounceWithSf2Instrument}. Every field is optional; a
48
+ * non-positive (or omitted) numeric field falls back to the C-ABI default
49
+ * (gain 0.5, 48 voices), so `{}` is a usable default patch.
50
+ */
51
+ export interface Sf2InstrumentConfig {
52
+ /** MIDI destination id this player answers to (default 0; see {@link Project.setTrackMidiDestination}). */
53
+ destinationId?: number;
54
+ /** Master output gain, linear (0 => 0.5). */
55
+ gain?: number;
56
+ /** Max simultaneous voices (0 => 48, clamped to [1, 64]). */
57
+ polyphony?: number;
58
+ /** Prefer dedicated physical models for covered melodic GM programs. Defaults to false; drums stay SF2-first. */
59
+ preferModelForModeledFamilies?: boolean;
60
+ /**
61
+ * Render the instrument alone, without the stage the bank binds after its
62
+ * voice — the amplifier and cabinet an electric guitar is never heard
63
+ * without. Defaults to false, so a MIDI file that selects a distorted guitar
64
+ * and asks for nothing else still comes out amplified. Set it to get the
65
+ * direct signal, which is what a voice is calibrated against.
66
+ */
67
+ clearBankRig?: boolean;
68
+ /**
69
+ * How the GS insertion effects (EFX) are realised: 'modern' (default) or
70
+ * 'classic'. Any other value is refused by name.
71
+ */
72
+ gsEfxRealization?: 'modern' | 'classic';
73
+ }
74
+ /** Source backend a resolved MIDI program renders through. */
75
+ export type SourceBackend = 'sf2' | 'synth';
76
+ /**
77
+ * One {@link Project.soundFontManifest} entry: a (channel, bank, program)
78
+ * combination the arrangement plays, with the backend it resolves to.
79
+ */
80
+ export interface Sf2ProgramStatus {
81
+ /** MIDI channel (0-15). */
82
+ channel: number;
83
+ /** Effective SF2 bank (drum channels report 128). */
84
+ bank: number;
85
+ /** Program number (0-127). */
86
+ program: number;
87
+ /** `'sf2'` when the loaded SoundFont covers the program, else `'synth'`. */
88
+ backend: SourceBackend;
89
+ /** Resolved SF2 preset name (GS fallback included); empty for `'synth'`. */
90
+ presetName: string;
91
+ }
92
+ /**
93
+ * Every NativeSynth engine selector, by ordinal.
94
+ *
95
+ * @remarks
96
+ * Not seventeen interchangeable choices. Selecting a mode blanks every engine
97
+ * section but its own, and four engines have nothing to voice until a section
98
+ * is supplied: `'fm'` needs operators, `'modal'` a mode table, `'percussion'` a
99
+ * kit and `'sample'` a {@link SampleBank}. Each renders exact silence from an
100
+ * otherwise default patch (measured: peak 0), while the other thirteen sound
101
+ * and differ from one another. A host offering this array as a control offers
102
+ * those four as dead entries unless it also supplies the section, which a
103
+ * preset does.
104
+ */
105
+ export 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", "harpsichord", "sample"];
106
+ export declare const SAMPLE_LOOP_MODES: readonly ["default", "none", "continuous", "key-down"];
107
+ export declare const SAMPLE_KEY_TRACKS: readonly ["default", "on", "off"];
108
+ export declare const SYNTH_RETRIGGERS: readonly ["default", "free", "note"];
109
+ export declare const SYNTH_OSC_WAVEFORMS: readonly ["default", "sine", "saw", "square", "triangle", "noise"];
110
+ export declare const SYNTH_FILTER_MODELS: readonly ["default", "svf", "moog-ladder", "diode-ladder", "sallen-key"];
111
+ export declare const SYNTH_FILTER_OUTPUTS: readonly ["default", "lowpass", "bandpass", "highpass"];
112
+ export declare const SYNTH_BODY_TYPES: readonly ["default", "none", "guitar", "violin", "wood-tube", "brass-bell", "vocal"];
113
+ export declare const SYNTH_MOD_SOURCES: readonly ["none", "amp-env", "filter-env", "lfo1", "lfo2", "velocity", "key-track", "mod-wheel", "random", "breath", "aftertouch", "expression-cc", "pitch-bend"];
114
+ export declare const SYNTH_MOD_DESTINATIONS: readonly ["none", "pitch-cents", "cutoff-cents", "amp-gain", "pan-units", "resonance-q", "vibrato-depth-cents", "filter-env-depth", "lfo1-rate-scale", "excitation-force", "excitation-position", "excitation-brightness", "spectrum-morph"];
115
+ /** How a device spells a gesture (see {@link ControllerBinding}). */
116
+ export declare const CONTROLLER_INPUTS: readonly ["control-change", "channel-pressure", "poly-pressure", "pitch-bend", "velocity"];
117
+ /** What a gesture means — the expression axis a binding drives. */
118
+ export declare const CONTROLLER_AXES: readonly ["none", "excitation", "position", "brightness", "morph", "loudness", "pitch-cents", "vibrato-depth"];
119
+ /**
120
+ * What a channel does with a note-on while another note on that channel is
121
+ * still held. `'mono-legato'` carries the sounding voice and only moves its
122
+ * pitch — a wind player's slur — and is deliberately out of reach of any MIDI
123
+ * message: CC126 names a monophonic mode but not this one.
124
+ */
125
+ export declare const ARTICULATIONS: readonly ["poly", "mono-retrigger", "mono-legato"];
126
+ /** The three dimensions MPE carries per note ({@link RealtimeEngine.setControllerNoteTracking}). */
127
+ export declare const MPE_DIMENSIONS: readonly ["bend", "pressure", "timbre"];
128
+ /**
129
+ * Which note a value addressed to a whole MIDI channel belongs to when several
130
+ * are sounding on it ({@link RealtimeEngine.setControllerNoteTracking}).
131
+ *
132
+ * MPE poses this question and declines to answer it — how a controller affects
133
+ * the notes when more than one is active on a member channel is left to the
134
+ * device — so this is a choice rather than a rule. A released note is never
135
+ * selected, whatever the rule and however long a pedal keeps it sounding.
136
+ */
137
+ export declare const NOTE_TRACKINGS: readonly ["last", "lowest", "highest", "all"];
138
+ export interface SynthEnumTables {
139
+ engineModes: string[];
140
+ waveforms: string[];
141
+ builtinWaveforms: string[];
142
+ filterModels: string[];
143
+ filterOutputs: string[];
144
+ bodyTypes: string[];
145
+ modSources: string[];
146
+ modDestinations: string[];
147
+ controllerInputs: string[];
148
+ controllerAxes: string[];
149
+ articulations: string[];
150
+ mpeDimensions: string[];
151
+ noteTrackings: string[];
152
+ }
153
+ /** NativeSynth engine selector ({@link SynthPatch}; `'default'` keeps the base patch's). */
154
+ export type SynthEngineMode = (typeof SYNTH_ENGINE_MODES)[number];
155
+ /**
156
+ * Per-patch loop override for the sample engine (`'default'` keeps what the
157
+ * bank recorded for the sample the zone names).
158
+ *
159
+ * A different set of values from {@link SampleDesc.loopMode}, which is the
160
+ * SoundFont `sampleModes` number describing the recording itself.
161
+ */
162
+ export type SampleLoopMode = (typeof SAMPLE_LOOP_MODES)[number];
163
+ /** Whether a sample follows the played key (`'default'` keeps the base patch's). */
164
+ export type SampleKeyTrack = (typeof SAMPLE_KEY_TRACKS)[number];
165
+ /**
166
+ * What a note-on restarts on a {@link SynthPatch} (`'default'` keeps the base
167
+ * patch's). `'free'` seeds each voice's start phases and random streams from
168
+ * the voice slot and a running note count, so two plays of one note differ;
169
+ * `'note'` seeds them from the note number alone.
170
+ */
171
+ export type SynthRetrigger = (typeof SYNTH_RETRIGGERS)[number];
172
+ /**
173
+ * Loop behaviour recorded for one sample in a {@link SampleBank}.
174
+ *
175
+ * A number is the raw SoundFont `sampleModes` value the C struct carries
176
+ * (`0` no loop, `1` continuous, `3` while the key is held), so SF2-derived data
177
+ * passes through untranslated; the names are the readable spellings of the same
178
+ * three states. There is no `'default'`: a sample's own loop mode is where the
179
+ * default comes from.
180
+ */
181
+ export type SampleDescLoopMode = 'none' | 'continuous' | 'key-down';
182
+ /**
183
+ * Tuning and looping of one sample, in units relative to that sample
184
+ * ({@link SampleBank.addSample}).
185
+ *
186
+ * Every field is optional and the omitted state is meaningful: the empty
187
+ * descriptor is an unlooped sample rooted at middle C and played at the
188
+ * render's own rate.
189
+ */
190
+ export interface SampleDesc {
191
+ /** MIDI key at which the sample sounds at its recorded pitch. Defaults to 60. */
192
+ rootKey?: number;
193
+ /** Fine tuning applied on top of {@link SampleDesc.rootKey}. */
194
+ fineTuneCents?: number;
195
+ /** Rate the sample was recorded at; omit to play it at the render's rate. */
196
+ sourceRate?: number;
197
+ /** Loop start, as a frame offset inside this sample. */
198
+ loopStart?: number;
199
+ /** Loop end, as a frame offset inside this sample. */
200
+ loopEnd?: number;
201
+ /**
202
+ * The sample's own loop behaviour. A loop that survives clamping empty is
203
+ * dropped, so a malformed loop plays unlooped rather than wrapping over
204
+ * nothing. {@link SynthPatch.sampleLoop} overrides this per patch.
205
+ */
206
+ loopMode?: SampleDescLoopMode | number;
207
+ }
208
+ /**
209
+ * One key/velocity rectangle mapped onto a sample ({@link SampleBank.addZone}).
210
+ *
211
+ * Every bound defaults on its own, so narrowing one edge never collapses
212
+ * another: an omitted upper bound is `127`, an omitted `velLo` is `1` (velocity
213
+ * zero is a note-off, not a dynamic), and an omitted `keyLo` is simply the
214
+ * lowest key. `{ keyLo: 48 }` is therefore keys 48-127 at every velocity and
215
+ * `{ velLo: 64 }` its exact mirror, while an empty rectangle is the whole
216
+ * keyboard. The one rectangle this cannot express is the single key `0`.
217
+ */
218
+ export interface SampleZoneDesc {
219
+ /**
220
+ * Keymap set the zone joins; a {@link SynthPatch} names a set through
221
+ * {@link SynthPatch.sampleSet}. Sets below it are created. Defaults to `0`.
222
+ */
223
+ setIndex?: number;
224
+ /** Sample the zone plays, as returned by {@link SampleBank.addSample}. */
225
+ sampleIndex?: number;
226
+ /** Lowest key of the rectangle. Defaults to `0`. */
227
+ keyLo?: number;
228
+ /** Highest key of the rectangle. Defaults to `127`. */
229
+ keyHi?: number;
230
+ /** Lowest velocity of the rectangle. Defaults to `1`. */
231
+ velLo?: number;
232
+ /** Highest velocity of the rectangle. Defaults to `127`. */
233
+ velHi?: number;
234
+ /** Added to the sample's own fine tuning. */
235
+ tuneCents?: number;
236
+ /** Linear gain; omit for unity. */
237
+ gain?: number;
238
+ /** Pan in the voice mixer's units, `-500` to `500`. */
239
+ panUnits?: number;
240
+ }
241
+ /** NativeSynth oscillator waveform (`'default'` keeps the base patch's). */
242
+ export type SynthOscWaveform = (typeof SYNTH_OSC_WAVEFORMS)[number];
243
+ /** NativeSynth filter model — the character core (`'default'` keeps the base patch's). */
244
+ export type SynthFilterModel = (typeof SYNTH_FILTER_MODELS)[number];
245
+ /** NativeSynth filter output (SVF only; `'default'` keeps the base patch's). */
246
+ export type SynthFilterOutput = (typeof SYNTH_FILTER_OUTPUTS)[number];
247
+ /** NativeSynth body/formant resonance voicing (`'default'` keeps the base patch's). */
248
+ export type SynthBodyType = (typeof SYNTH_BODY_TYPES)[number];
249
+ /** {@link SynthPatch} mod-matrix source. */
250
+ export type SynthModSource = (typeof SYNTH_MOD_SOURCES)[number];
251
+ /** {@link SynthPatch} mod-matrix destination. */
252
+ export type SynthModDestination = (typeof SYNTH_MOD_DESTINATIONS)[number];
253
+ /** Input side of a {@link ControllerBinding}: how the device spells the gesture. */
254
+ export type ControllerInput = (typeof CONTROLLER_INPUTS)[number];
255
+ /** Output side of a {@link ControllerBinding}: which expression axis it means. */
256
+ export type ControllerAxis = (typeof CONTROLLER_AXES)[number];
257
+ /** Per-channel note-overlap rule ({@link RealtimeEngine.setArticulation}). */
258
+ export type Articulation = (typeof ARTICULATIONS)[number];
259
+ /** One per-note MPE dimension ({@link MPE_DIMENSIONS}). */
260
+ export type MpeDimension = (typeof MPE_DIMENSIONS)[number];
261
+ /** One note-attribution rule ({@link NOTE_TRACKINGS}). */
262
+ export type NoteTracking = (typeof NOTE_TRACKINGS)[number];
263
+ /**
264
+ * One device gesture bound to one expression axis
265
+ * ({@link RealtimeEngine.bindController}).
266
+ *
267
+ * Binding the same input twice with different axes is how a single gesture
268
+ * reaches two of them, which is what a breath controller driving both
269
+ * excitation and loudness needs. `input` and `axis` are required and are the
270
+ * canonical names (or their C ordinals); an unknown name throws rather than
271
+ * resolving to the first member.
272
+ *
273
+ * @example
274
+ * ```ts
275
+ * engine.bindController(0, { input: 'control-change', index: 2, axis: 'excitation' });
276
+ * ```
277
+ */
278
+ export interface ControllerBinding {
279
+ /** How the device spells the gesture. */
280
+ input: ControllerInput | number;
281
+ /**
282
+ * CC number 0-127 for `'control-change'`. Every other input is identified by
283
+ * its message status alone and ignores this. Default `0`.
284
+ */
285
+ index?: number;
286
+ /**
287
+ * Which expression axis the gesture means. `'none'` is refused: a binding
288
+ * that means nothing is a caller mistake, not an empty slot.
289
+ */
290
+ axis: ControllerAxis | number;
291
+ /**
292
+ * Axis value at zero deflection, in the axis's own unit — normalized `[0,1]`
293
+ * for the excitation axes and loudness, cents for pitch and vibrato depth.
294
+ * Default `0`.
295
+ */
296
+ lo?: number;
297
+ /** Axis value at full deflection; `lo > hi` inverts the gesture. Default `1`. */
298
+ hi?: number;
299
+ /**
300
+ * Exponent applied to the normalized input before the range maps it. Default
301
+ * `1` (linear) and deliberately so: a wind controller has already applied the
302
+ * curve its player chose, and a second one on this side bends a gesture that
303
+ * was already shaped. Must be finite and positive.
304
+ */
305
+ curve?: number;
306
+ }
307
+ /** One {@link SynthPatch} mod-matrix routing (name or C ordinal per field). */
308
+ export interface SynthModRouting {
309
+ /**
310
+ * Mod-matrix source. `'none'` is refused: a routing driven by nothing is a
311
+ * caller mistake, not an empty slot.
312
+ */
313
+ source: SynthModSource | number;
314
+ /**
315
+ * Mod-matrix destination. `'none'` is refused, for the same reason as
316
+ * `source`.
317
+ */
318
+ destination: SynthModDestination | number;
319
+ /**
320
+ * Destination units at full source deflection, summed onto whatever the
321
+ * patch or a CC already set and then handled per destination:
322
+ *
323
+ * - `pan-units`: SF2 pan units, clamped to `[-500, 500]` — `1` moves the
324
+ * image by about 0.2% of a side.
325
+ * - `amp-gain` / `filter-env-depth`: multiplicative. Each routing's amount
326
+ * composes onto a running multiplier that clamps to `[0, 4]`.
327
+ * `filter-env-depth` has nothing to scale while the patch's
328
+ * `envToCutoffCents` is `0` — the filter envelope contributes no cents for
329
+ * it to multiply.
330
+ * - `resonance-q`: added to the patch's own Q, then floored at a fixed
331
+ * `0.5` (not at that patch's own Q).
332
+ * - `lfo1-rate-scale`: multiplicative, clamped to `[1/16, 16]`. Audible only
333
+ * once something else already reads LFO1's output — vibrato depth, the
334
+ * filter's LFO amount, tremolo — since it retunes LFO1 rather than
335
+ * sounding on its own; the bare patch's built-in mod-wheel vibrato is the
336
+ * usual path.
337
+ * - The three `excitation-*` destinations and `spectrum-morph`: an offset in
338
+ * the engine's own normalized `[0, 1]` axis units, the same scale the
339
+ * live-control CCs drive, clamped to `[-1, 1]`. Reach is per engine and not
340
+ * uniform across the three: `excitation-force` reaches pipe organ, bowed
341
+ * string, reed, brass, flute and free reed; `excitation-position` reaches
342
+ * bowed string only; `excitation-brightness` reaches pipe organ, reed,
343
+ * brass, flute, free reed and vocal. An engine outside a destination's list
344
+ * ignores it — its exciter is finished before the second sample renders, or
345
+ * it has none. `spectrum-morph` travels between the two spectral tables an
346
+ * additive patch carries; a patch needs an explicit `drawbars_b` distinct
347
+ * from `drawbars` to have a second table to travel to, and no catalog
348
+ * preset ships one, so the destination is currently unreachable from a
349
+ * preset name alone.
350
+ *
351
+ * Percussion reaches none of the above: a drum channel's voice runs the
352
+ * per-note kit patch instead of this one, so the whole mod matrix is
353
+ * discarded before the voice starts.
354
+ */
355
+ depth: number;
356
+ }
357
+ /**
358
+ * Versioned NativeSynth patch for {@link Project.bounceWithSynthInstrument}
359
+ * and {@link RealtimeEngine.setSynthInstrument}.
360
+ *
361
+ * The patch starts from a BASE — the named `preset` (see
362
+ * {@link synthPresetNames}; a `"va:"` routing prefix is accepted) or, when
363
+ * `preset` is omitted, the default subtractive patch. Omitting a numeric field
364
+ * keeps the base value; supplying one overrides it (clamped to its audible
365
+ * range), including an explicit `0` such as `stereoSpread: 0`. The enum fields
366
+ * reserve `'default'` as keep. A `modRoutings` array REPLACES the base mod
367
+ * matrix, and an empty array clears it, while omitting the key keeps it.
368
+ *
369
+ * Mode-specific deep parameters (FM operator stacks, modal mode tables,
370
+ * drawbar registrations, kit pieces, piano strings) travel inside the named
371
+ * presets; the patch exposes the wrapper sections most engines share. Two
372
+ * exceptions: `waveform` is read by the subtractive engine only, and on a
373
+ * percussion channel the whole section below is discarded in favor of the
374
+ * per-note drum-kit patch — only `gain`, `busDrive` and `polyphony` still act.
375
+ */
376
+ export interface SynthPatch {
377
+ /**
378
+ * Optional binding convenience for JS realtime/offline helpers. It is not
379
+ * part of the NativeSynth patch itself; Python uses explicit
380
+ * `(destination_id, patch)` bindings instead. Defaults to `0`.
381
+ */
382
+ destinationId?: number;
383
+ /** Resolve MIDI channels from incoming GM bank/program changes; defaults to false. */
384
+ useGmPrograms?: boolean;
385
+ /** Base preset name (see {@link synthPresetNames}); omit for the init patch. */
386
+ preset?: string;
387
+ engineMode?: SynthEngineMode | number;
388
+ /** Oscillator waveform. Read by the subtractive engine only; every other engine ignores it. */
389
+ waveform?: SynthOscWaveform | number;
390
+ /** Detuned-stack width [1, 7]. */
391
+ unison?: number;
392
+ detuneCents?: number;
393
+ /** Per-voice slow pitch drift depth (cents). */
394
+ driftCents?: number;
395
+ /** Pre-filter drive [0, 1]. */
396
+ drive?: number;
397
+ filterModel?: SynthFilterModel | number;
398
+ filterOutput?: SynthFilterOutput | number;
399
+ cutoffHz?: number;
400
+ /**
401
+ * Series 12 dB/oct highpass after the main filter, in Hz; 0 disables the
402
+ * stage. The other end of a band the lowpass alone cannot make. It runs at
403
+ * Butterworth Q -- `resonanceQ` belongs to the main filter.
404
+ */
405
+ hpCutoffHz?: number;
406
+ /**
407
+ * Rate the voice's output is held at, in Hz; 0 disables the stage. The
408
+ * voice's own converter, ahead of its amplitude envelope: the aliased images
409
+ * it folds down are as much of a sound as its samples are. Per voice, so a
410
+ * patch layering several voices can convert some and leave others alone.
411
+ *
412
+ * Percussion never reads this: a drum channel's voice runs the per-note kit
413
+ * patch instead of this one, so the field is discarded before the voice
414
+ * starts.
415
+ */
416
+ sampleHoldHz?: number;
417
+ /**
418
+ * Word length the held value is quantized to, in bits; 0 disables the
419
+ * quantizer. Fractional values are meaningful — a converter's effective
420
+ * resolution is rarely a whole number of bits.
421
+ */
422
+ bitDepth?: number;
423
+ resonanceQ?: number;
424
+ /** Cutoff keyboard tracking [0, 1]. */
425
+ keyTrack?: number;
426
+ /**
427
+ * Filter envelope's cutoff depth, in cents at full envelope; 0 leaves the
428
+ * envelope's cutoff contribution off. The cutoff is multiplied by
429
+ * 2^(envelope × envToCutoffCents / 1200), so the response moves by exactly
430
+ * that interval wherever the corner sits well below Nyquist; near the top the
431
+ * `svf` moves slightly less and the ladders slightly more. `cutoffHz` is the
432
+ * −3 dB corner only for `svf` at `resonanceQ` 0.707: with resonance the `svf`
433
+ * corner sits above it, and the ladder and Sallen-Key models put their
434
+ * resonant peak on it with the −3 dB point one to three octaves lower, so
435
+ * measure a depth as a ratio of corners rather than against `cutoffHz`.
436
+ */
437
+ envToCutoffCents?: number;
438
+ /**
439
+ * Velocity's cutoff depth, in cents. The rendered term is
440
+ * `velToCutoffCents * (velocity / 127 - 1)`, so velocity 127 is the anchor
441
+ * where it is exactly zero: a positive value darkens softer notes, a
442
+ * negative value brightens them, and both effects grow the further the
443
+ * velocity sits below 127.
444
+ */
445
+ velToCutoffCents?: number;
446
+ /**
447
+ * Constant transposition of the voice's own pitch, in cents, clamped to
448
+ * [-4800, 4800]; 0 leaves the pitch alone. Applied on top of the note, so it
449
+ * shifts a whole patch without rewriting the part — a detuned layer, a sample
450
+ * set mapped a semitone off, an instrument pitched to a reference other than
451
+ * A440. Carried in the per-sample pitch factor every engine's render already
452
+ * takes, so it applies the same amount on all of them — except percussion,
453
+ * whose per-note kit patch replaces this whole section and never reads it.
454
+ *
455
+ * Also automatable under this same name through
456
+ * {@link RealtimeEngine.resolveInstrumentAutomationId}; it is one of the names
457
+ * that reaches a voice that is already sounding, rather than waiting for the
458
+ * next note.
459
+ */
460
+ pitchOffsetCents?: number;
461
+ ampAttackMs?: number;
462
+ ampDecayMs?: number;
463
+ ampSustain?: number;
464
+ ampReleaseMs?: number;
465
+ filterAttackMs?: number;
466
+ filterDecayMs?: number;
467
+ filterSustain?: number;
468
+ filterReleaseMs?: number;
469
+ lfoRateHz?: number;
470
+ lfoToPitchCents?: number;
471
+ lfo2RateHz?: number;
472
+ glideMs?: number;
473
+ body?: SynthBodyType | number;
474
+ /** Body resonance mix [0, 1]. */
475
+ bodyMix?: number;
476
+ /** Seeded per-voice pan scatter [0, 1]. */
477
+ stereoSpread?: number;
478
+ /**
479
+ * Seed source for each voice's start state. `'note'` derives oscillator start
480
+ * phases, unison jitter, drift and every engine's noise stream from the note
481
+ * number, so the same note played again after its tail has ended renders the
482
+ * same samples; `'free'` (the built-in patches' choice) varies them per note.
483
+ * State outside the voice is reset by neither: controllers, the bus DC
484
+ * blocker, a piano's shared soundboard, a plucked string's sympathetic halo,
485
+ * an organ's wind chest and effect tails. The `'drum-kit'` preset's per-note
486
+ * pieces keep their own mode.
487
+ */
488
+ retrigger?: SynthRetrigger | number;
489
+ /** Mod matrix (at most 8 routings; REPLACES the base matrix when non-empty). */
490
+ modRoutings?: SynthModRouting[];
491
+ /** Master output gain (linear). */
492
+ gain?: number;
493
+ /** Max simultaneous voices [1, 64]. */
494
+ polyphony?: number;
495
+ /** Gain-neutral bus saturation [0, 1]. */
496
+ busDrive?: number;
497
+ /**
498
+ * Bank the sample engine reads its PCM from. Binding convenience for the JS
499
+ * offline helpers rather than part of the patch itself, like `destinationId`:
500
+ * it is resolved to a native handle before the patch crosses into WASM.
501
+ * A `'sample'` patch bound without a bank renders silence.
502
+ */
503
+ sampleBank?: SampleBank;
504
+ /**
505
+ * Keymap set in the bound bank (negative selects none). Read only by a
506
+ * `'sample'` patch, which is what lets set `0` stay addressable without a
507
+ * "keep the base value" sentinel of its own.
508
+ */
509
+ sampleSet?: number;
510
+ /** Linear gain on the sample. */
511
+ sampleLevel?: number;
512
+ sampleLoop?: SampleLoopMode | number;
513
+ /** Attack skip, as a fraction of the mapped region. */
514
+ sampleStartOffset?: number;
515
+ sampleKeyTrack?: SampleKeyTrack | number;
516
+ }
517
+ //# sourceMappingURL=instrument_types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instrument_types.d.ts","sourceRoot":"","sources":["../src/instrument_types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,+DAA+D;AAC/D,eAAO,MAAM,uBAAuB,4DAA6D,CAAC;AAElG,kDAAkD;AAClD,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAE5F;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC,0GAA0G;IAC1G,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC,6CAA6C;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kCAAkC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qCAAqC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AAErD;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,2GAA2G;IAC3G,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,6CAA6C;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iHAAiH;IACjH,6BAA6B,CAAC,EAA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CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,aAAa,GAAG,MAAM,CAAC;IAC9B,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC;IACpC,gFAAgF;IAChF,WAAW,CAAC,EAAE,eAAe,EAAE,CAAC;IAChC,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iCAAiC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC;IACrC,uDAAuD;IACvD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC;CAC1C"}
@@ -0,0 +1,35 @@
1
+ import type { SonareRealtimeEngineNode } from './worklet';
2
+ export interface BindMicrophoneInputOptions extends MediaStreamConstraints {
3
+ /**
4
+ * Stream to bind instead of requesting one. Supplying it also transfers
5
+ * ownership: {@link MicrophoneInputBinding.close} leaves its tracks running,
6
+ * because they may be feeding a recorder, a level meter or a second
7
+ * `AudioContext` that this binding knows nothing about.
8
+ */
9
+ stream?: MediaStream;
10
+ /**
11
+ * Whether {@link MicrophoneInputBinding.close} stops the stream's audio
12
+ * tracks. Defaults to whether this binding acquired the stream itself: `true`
13
+ * for a stream it requested through `getUserMedia`, `false` for one the
14
+ * caller supplied. Set it explicitly to override in either direction.
15
+ */
16
+ stopTracksOnClose?: boolean;
17
+ }
18
+ export interface MicrophoneInputBinding {
19
+ stream: MediaStream;
20
+ source: MediaStreamAudioSourceNode;
21
+ /** Whether this binding acquired {@link stream} rather than being handed one. */
22
+ ownsStream: boolean;
23
+ close(): void;
24
+ }
25
+ /**
26
+ * Route microphone audio into a realtime engine node.
27
+ *
28
+ * Ownership is decided by provenance, the same rule `ownsWorker` applies in
29
+ * `opfs_clip_pages.ts` and `worker_client.ts`: a resource the caller handed in
30
+ * is the caller's to release. `close()` used to stop the tracks of a supplied
31
+ * stream by default, which killed a microphone the rest of the page was still
32
+ * using.
33
+ */
34
+ export declare function bindMicrophoneInput(context: AudioContext, engine: SonareRealtimeEngineNode | AudioWorkletNode, options?: BindMicrophoneInputOptions): Promise<MicrophoneInputBinding>;
35
+ //# sourceMappingURL=live_audio.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"live_audio.d.ts","sourceRoot":"","sources":["../src/live_audio.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAE1D,MAAM,WAAW,0BAA2B,SAAQ,sBAAsB;IACxE;;;;;OAKG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,EAAE,0BAA0B,CAAC;IACnC,iFAAiF;IACjF,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,IAAI,IAAI,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,wBAAwB,GAAG,gBAAgB,EACnD,OAAO,GAAE,0BAA+B,GACvC,OAAO,CAAC,sBAAsB,CAAC,CAgCjC"}