@libraz/libsonare 1.7.2 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (303) hide show
  1. package/NOTICE +178 -0
  2. package/README.md +26 -203
  3. package/dist/_chain_config.d.ts +14 -0
  4. package/dist/_chain_config.d.ts.map +1 -0
  5. package/dist/_effects_common.d.ts +6 -0
  6. package/dist/_effects_common.d.ts.map +1 -0
  7. package/dist/_feature_validation.d.ts +8 -0
  8. package/dist/_feature_validation.d.ts.map +1 -0
  9. package/dist/_fft_options.d.ts +24 -0
  10. package/dist/_fft_options.d.ts.map +1 -0
  11. package/dist/align_take.d.ts +50 -0
  12. package/dist/align_take.d.ts.map +1 -0
  13. package/dist/analysis.d.ts +29 -5840
  14. package/dist/analysis.d.ts.map +1 -0
  15. package/dist/analysis.js +873 -722
  16. package/dist/analysis.js.map +1 -1
  17. package/dist/analysis_helpers.d.ts +9 -0
  18. package/dist/analysis_helpers.d.ts.map +1 -0
  19. package/dist/audio.d.ts +163 -0
  20. package/dist/audio.d.ts.map +1 -0
  21. package/dist/clip_page_streamer.d.ts +133 -0
  22. package/dist/clip_page_streamer.d.ts.map +1 -0
  23. package/dist/codes.d.ts +44 -0
  24. package/dist/codes.d.ts.map +1 -0
  25. package/dist/effects_mastering.d.ts +23 -0
  26. package/dist/effects_mastering.d.ts.map +1 -0
  27. package/dist/effects_note_ops.d.ts +477 -0
  28. package/dist/effects_note_ops.d.ts.map +1 -0
  29. package/dist/effects_percussive.d.ts +185 -0
  30. package/dist/effects_percussive.d.ts.map +1 -0
  31. package/dist/effects_separation.d.ts +65 -0
  32. package/dist/effects_separation.d.ts.map +1 -0
  33. package/dist/effects_spectral.d.ts +28 -0
  34. package/dist/effects_spectral.d.ts.map +1 -0
  35. package/dist/effects_timepitch.d.ts +129 -0
  36. package/dist/effects_timepitch.d.ts.map +1 -0
  37. package/dist/effects_voice_change.d.ts +53 -0
  38. package/dist/effects_voice_change.d.ts.map +1 -0
  39. package/dist/errors.d.ts +51 -0
  40. package/dist/errors.d.ts.map +1 -0
  41. package/dist/feature_core.d.ts +341 -0
  42. package/dist/feature_core.d.ts.map +1 -0
  43. package/dist/feature_decompose.d.ts +278 -0
  44. package/dist/feature_decompose.d.ts.map +1 -0
  45. package/dist/feature_inverse.d.ts +128 -0
  46. package/dist/feature_inverse.d.ts.map +1 -0
  47. package/dist/feature_loudness.d.ts +66 -0
  48. package/dist/feature_loudness.d.ts.map +1 -0
  49. package/dist/feature_music.d.ts +307 -0
  50. package/dist/feature_music.d.ts.map +1 -0
  51. package/dist/feature_pitch.d.ts +108 -0
  52. package/dist/feature_pitch.d.ts.map +1 -0
  53. package/dist/feature_resample.d.ts +16 -0
  54. package/dist/feature_resample.d.ts.map +1 -0
  55. package/dist/feature_spectral.d.ts +137 -0
  56. package/dist/feature_spectral.d.ts.map +1 -0
  57. package/dist/feature_spectrogram.d.ts +198 -0
  58. package/dist/feature_spectrogram.d.ts.map +1 -0
  59. package/dist/features.d.ts +10 -0
  60. package/dist/features.d.ts.map +1 -0
  61. package/dist/hrtf/default.shrf +0 -0
  62. package/dist/index.d.ts +74 -7431
  63. package/dist/index.d.ts.map +1 -0
  64. package/dist/index.js +3758 -1362
  65. package/dist/index.js.map +1 -1
  66. package/dist/instrument_types.d.ts +517 -0
  67. package/dist/instrument_types.d.ts.map +1 -0
  68. package/dist/live_audio.d.ts +35 -0
  69. package/dist/live_audio.d.ts.map +1 -0
  70. package/dist/mastering_chain.d.ts +213 -0
  71. package/dist/mastering_chain.d.ts.map +1 -0
  72. package/dist/mastering_core.d.ts +457 -0
  73. package/dist/mastering_core.d.ts.map +1 -0
  74. package/dist/mastering_dynamics.d.ts +80 -0
  75. package/dist/mastering_dynamics.d.ts.map +1 -0
  76. package/dist/metering.d.ts +287 -0
  77. package/dist/metering.d.ts.map +1 -0
  78. package/dist/mixer.d.ts +464 -0
  79. package/dist/mixer.d.ts.map +1 -0
  80. package/dist/mixing_assistant.d.ts +62 -0
  81. package/dist/mixing_assistant.d.ts.map +1 -0
  82. package/dist/mixing_oneshot.d.ts +40 -0
  83. package/dist/mixing_oneshot.d.ts.map +1 -0
  84. package/dist/module_state.d.ts +15 -0
  85. package/dist/module_state.d.ts.map +1 -0
  86. package/dist/opfs_clip_pages.d.ts +28 -0
  87. package/dist/opfs_clip_pages.d.ts.map +1 -0
  88. package/dist/playback_renderer.d.ts +128 -0
  89. package/dist/playback_renderer.d.ts.map +1 -0
  90. package/dist/polyphony.d.ts +202 -0
  91. package/dist/polyphony.d.ts.map +1 -0
  92. package/dist/project.d.ts +8 -0
  93. package/dist/project.d.ts.map +1 -0
  94. package/dist/project_class.d.ts +562 -0
  95. package/dist/project_class.d.ts.map +1 -0
  96. package/dist/project_internal.d.ts +194 -0
  97. package/dist/project_internal.d.ts.map +1 -0
  98. package/dist/project_synth.d.ts +74 -0
  99. package/dist/project_synth.d.ts.map +1 -0
  100. package/dist/project_types.d.ts +652 -0
  101. package/dist/project_types.d.ts.map +1 -0
  102. package/dist/public_types.d.ts +185 -0
  103. package/dist/public_types.d.ts.map +1 -0
  104. package/dist/public_types_acoustic.d.ts +215 -0
  105. package/dist/public_types_acoustic.d.ts.map +1 -0
  106. package/dist/public_types_mastering.d.ts +510 -0
  107. package/dist/public_types_mastering.d.ts.map +1 -0
  108. package/dist/public_types_mixing.d.ts +436 -0
  109. package/dist/public_types_mixing.d.ts.map +1 -0
  110. package/dist/public_types_music.d.ts +619 -0
  111. package/dist/public_types_music.d.ts.map +1 -0
  112. package/dist/public_types_playback.d.ts +164 -0
  113. package/dist/public_types_playback.d.ts.map +1 -0
  114. package/dist/public_types_realtime.d.ts +174 -0
  115. package/dist/public_types_realtime.d.ts.map +1 -0
  116. package/dist/public_types_repair.d.ts +424 -0
  117. package/dist/public_types_repair.d.ts.map +1 -0
  118. package/dist/public_types_spectral.d.ts +697 -0
  119. package/dist/public_types_spectral.d.ts.map +1 -0
  120. package/dist/quick_analysis.d.ts +445 -0
  121. package/dist/quick_analysis.d.ts.map +1 -0
  122. package/dist/realtime_engine.d.ts +850 -0
  123. package/dist/realtime_engine.d.ts.map +1 -0
  124. package/dist/realtime_voice_changer.d.ts +158 -0
  125. package/dist/realtime_voice_changer.d.ts.map +1 -0
  126. package/dist/repair_dereverb.d.ts +187 -0
  127. package/dist/repair_dereverb.d.ts.map +1 -0
  128. package/dist/repair_impulsive.d.ts +186 -0
  129. package/dist/repair_impulsive.d.ts.map +1 -0
  130. package/dist/repair_noise.d.ts +239 -0
  131. package/dist/repair_noise.d.ts.map +1 -0
  132. package/dist/repair_trim.d.ts +123 -0
  133. package/dist/repair_trim.d.ts.map +1 -0
  134. package/dist/sample_bank.d.ts +84 -0
  135. package/dist/sample_bank.d.ts.map +1 -0
  136. package/dist/scale.d.ts +10 -0
  137. package/dist/scale.d.ts.map +1 -0
  138. package/dist/schemas/mixer-scene.schema.json +393 -0
  139. package/dist/schemas/playback-renderer-config.schema.json +392 -0
  140. package/dist/sonare-analysis.d.ts +8 -0
  141. package/dist/sonare-analysis.js +2 -2
  142. package/dist/sonare-analysis.wasm +0 -0
  143. package/dist/sonare.d.ts +3909 -0
  144. package/dist/sonare.js +2 -2
  145. package/dist/sonare.wasm +0 -0
  146. package/dist/stream_analyzer.d.ts +163 -0
  147. package/dist/stream_analyzer.d.ts.map +1 -0
  148. package/dist/stream_types.d.ts +214 -0
  149. package/dist/stream_types.d.ts.map +1 -0
  150. package/dist/streaming_mixing.d.ts +6 -0
  151. package/dist/streaming_mixing.d.ts.map +1 -0
  152. package/dist/streaming_processors.d.ts +335 -0
  153. package/dist/streaming_processors.d.ts.map +1 -0
  154. package/dist/transcribe.d.ts +77 -0
  155. package/dist/transcribe.d.ts.map +1 -0
  156. package/dist/validation.d.ts +140 -0
  157. package/dist/validation.d.ts.map +1 -0
  158. package/dist/web_midi.d.ts +77 -0
  159. package/dist/web_midi.d.ts.map +1 -0
  160. package/dist/worker.d.ts +5 -48
  161. package/dist/worker.d.ts.map +1 -0
  162. package/dist/worker.js +94 -41
  163. package/dist/worker.js.map +1 -1
  164. package/dist/worker_client.d.ts +96 -0
  165. package/dist/worker_client.d.ts.map +1 -0
  166. package/dist/worker_protocol.d.ts +43 -0
  167. package/dist/worker_protocol.d.ts.map +1 -0
  168. package/dist/worklet/audio_types.d.ts +21 -0
  169. package/dist/worklet/audio_types.d.ts.map +1 -0
  170. package/dist/worklet/engine-automation.d.ts +29 -0
  171. package/dist/worklet/engine-automation.d.ts.map +1 -0
  172. package/dist/worklet/engine-capture-facade.d.ts +35 -0
  173. package/dist/worklet/engine-capture-facade.d.ts.map +1 -0
  174. package/dist/worklet/engine-clips.d.ts +23 -0
  175. package/dist/worklet/engine-clips.d.ts.map +1 -0
  176. package/dist/worklet/engine-markers.d.ts +40 -0
  177. package/dist/worklet/engine-markers.d.ts.map +1 -0
  178. package/dist/worklet/engine-mixer-facade.d.ts +128 -0
  179. package/dist/worklet/engine-mixer-facade.d.ts.map +1 -0
  180. package/dist/worklet/engine-node.d.ts +81 -0
  181. package/dist/worklet/engine-node.d.ts.map +1 -0
  182. package/dist/worklet/engine-offline.d.ts +81 -0
  183. package/dist/worklet/engine-offline.d.ts.map +1 -0
  184. package/dist/worklet/engine-options.d.ts +12 -0
  185. package/dist/worklet/engine-options.d.ts.map +1 -0
  186. package/dist/worklet/engine-parameter-facade.d.ts +106 -0
  187. package/dist/worklet/engine-parameter-facade.d.ts.map +1 -0
  188. package/dist/worklet/engine-processor.d.ts +68 -0
  189. package/dist/worklet/engine-processor.d.ts.map +1 -0
  190. package/dist/worklet/engine-register.d.ts +2 -0
  191. package/dist/worklet/engine-register.d.ts.map +1 -0
  192. package/dist/worklet/engine-strips.d.ts +73 -0
  193. package/dist/worklet/engine-strips.d.ts.map +1 -0
  194. package/dist/worklet/engine-sync.d.ts +37 -0
  195. package/dist/worklet/engine-sync.d.ts.map +1 -0
  196. package/dist/worklet/engine-tempo-facade.d.ts +48 -0
  197. package/dist/worklet/engine-tempo-facade.d.ts.map +1 -0
  198. package/dist/worklet/engine.d.ts +397 -0
  199. package/dist/worklet/engine.d.ts.map +1 -0
  200. package/dist/worklet/guards.d.ts +47 -0
  201. package/dist/worklet/guards.d.ts.map +1 -0
  202. package/dist/worklet/messages.d.ts +710 -0
  203. package/dist/worklet/messages.d.ts.map +1 -0
  204. package/dist/worklet/mixer-processor.d.ts +46 -0
  205. package/dist/worklet/mixer-processor.d.ts.map +1 -0
  206. package/dist/worklet/playback-processor.d.ts +62 -0
  207. package/dist/worklet/playback-processor.d.ts.map +1 -0
  208. package/dist/worklet/protocol.d.ts +323 -0
  209. package/dist/worklet/protocol.d.ts.map +1 -0
  210. package/dist/worklet/voice-changer-processor.d.ts +41 -0
  211. package/dist/worklet/voice-changer-processor.d.ts.map +1 -0
  212. package/dist/worklet.d.ts +16 -2515
  213. package/dist/worklet.d.ts.map +1 -0
  214. package/dist/worklet.js +2763 -501
  215. package/dist/worklet.js.map +1 -1
  216. package/package.json +23 -12
  217. package/src/_effects_common.ts +17 -0
  218. package/src/_feature_validation.ts +34 -0
  219. package/src/_fft_options.ts +39 -0
  220. package/src/align_take.ts +64 -0
  221. package/src/analysis.ts +56 -3
  222. package/src/analysis_helpers.ts +7 -0
  223. package/src/audio.ts +106 -3
  224. package/src/codes.ts +39 -2
  225. package/src/effects_mastering.ts +97 -22
  226. package/src/effects_note_ops.ts +635 -0
  227. package/src/effects_percussive.ts +217 -0
  228. package/src/effects_separation.ts +150 -0
  229. package/src/effects_spectral.ts +60 -0
  230. package/src/effects_timepitch.ts +377 -0
  231. package/src/errors.ts +23 -1
  232. package/src/feature_core.ts +127 -2
  233. package/src/feature_decompose.ts +633 -0
  234. package/src/feature_inverse.ts +454 -0
  235. package/src/feature_loudness.ts +125 -0
  236. package/src/feature_music.ts +107 -14
  237. package/src/feature_pitch.ts +96 -1
  238. package/src/feature_spectral.ts +16 -611
  239. package/src/feature_spectrogram.ts +63 -450
  240. package/src/features.ts +36 -22
  241. package/src/index.ts +282 -30
  242. package/src/instrument_types.ts +645 -0
  243. package/src/live_audio.ts +27 -1
  244. package/src/mastering_chain.ts +184 -0
  245. package/src/mastering_core.ts +346 -32
  246. package/src/mastering_dynamics.ts +22 -11
  247. package/src/metering.ts +67 -24
  248. package/src/mixer.ts +212 -3
  249. package/src/mixing_assistant.ts +138 -0
  250. package/src/mixing_oneshot.ts +10 -5
  251. package/src/module_state.ts +24 -2
  252. package/src/playback_renderer.ts +252 -0
  253. package/src/polyphony.ts +279 -0
  254. package/src/project.ts +61 -24
  255. package/src/project_class.ts +450 -27
  256. package/src/project_internal.ts +149 -42
  257. package/src/project_synth.ts +67 -1
  258. package/src/project_types.ts +268 -270
  259. package/src/public_types.ts +122 -3
  260. package/src/public_types_acoustic.ts +112 -3
  261. package/src/public_types_mastering.ts +254 -73
  262. package/src/public_types_mixing.ts +363 -1
  263. package/src/public_types_music.ts +312 -2
  264. package/src/public_types_playback.ts +195 -0
  265. package/src/public_types_realtime.ts +39 -7
  266. package/src/public_types_repair.ts +446 -0
  267. package/src/public_types_spectral.ts +487 -1
  268. package/src/quick_analysis.ts +203 -26
  269. package/src/realtime_engine.ts +711 -28
  270. package/src/realtime_voice_changer.ts +55 -1
  271. package/src/repair_dereverb.ts +299 -0
  272. package/src/repair_impulsive.ts +395 -0
  273. package/src/repair_noise.ts +425 -0
  274. package/src/repair_trim.ts +226 -0
  275. package/src/sample_bank.ts +113 -0
  276. package/src/sonare.js.d.ts +1122 -30
  277. package/src/stream_analyzer.ts +36 -4
  278. package/src/stream_types.ts +37 -0
  279. package/src/streaming_mixing.ts +1 -1
  280. package/src/streaming_processors.ts +194 -10
  281. package/src/transcribe.ts +89 -0
  282. package/src/validation.ts +285 -11
  283. package/src/web_midi.ts +1 -6
  284. package/src/worker.ts +18 -2
  285. package/src/worklet/audio_types.ts +37 -0
  286. package/src/worklet/engine-mixer-facade.ts +444 -10
  287. package/src/worklet/engine-node.ts +78 -26
  288. package/src/worklet/engine-offline.ts +14 -8
  289. package/src/worklet/engine-parameter-facade.ts +21 -0
  290. package/src/worklet/engine-processor.ts +272 -83
  291. package/src/worklet/engine-register.ts +32 -18
  292. package/src/worklet/engine-strips.ts +280 -9
  293. package/src/worklet/engine-sync.ts +14 -6
  294. package/src/worklet/engine.ts +365 -31
  295. package/src/worklet/guards.ts +140 -44
  296. package/src/worklet/messages.ts +227 -2
  297. package/src/worklet/mixer-processor.ts +109 -47
  298. package/src/worklet/playback-processor.ts +300 -0
  299. package/src/worklet/protocol.ts +53 -3
  300. package/src/worklet/voice-changer-processor.ts +17 -11
  301. package/src/worklet.ts +17 -0
  302. package/src/effects_transform.ts +0 -718
  303. package/src/mastering_repair.ts +0 -273
@@ -0,0 +1,214 @@
1
+ import type { ChordQuality, PitchClass } from './public_types';
2
+ /**
3
+ * A detected chord change in the progression
4
+ */
5
+ export interface ChordChange {
6
+ root: PitchClass;
7
+ quality: ChordQuality;
8
+ startTime: number;
9
+ confidence: number;
10
+ }
11
+ /**
12
+ * A chord detected at bar boundary (beat-synchronized)
13
+ */
14
+ export interface BarChord {
15
+ /**
16
+ * Bar number, not the index of this entry in the array: bars with no
17
+ * confident chord are not recorded and the oldest entries are dropped at the
18
+ * history cap. Group bars by pattern position with this, never with the array
19
+ * index. In `votedPattern` it is the pattern position instead.
20
+ */
21
+ barIndex: number;
22
+ root: PitchClass;
23
+ quality: ChordQuality;
24
+ /**
25
+ * Start of the bar, on the same timeline as `StreamFrame.timestamp`
26
+ * (including a `sampleOffset` anchor). Consecutive bars are `barDuration`
27
+ * apart rather than snapped to the analysis frame grid. Unused in
28
+ * `votedPattern`.
29
+ */
30
+ startTime: number;
31
+ confidence: number;
32
+ }
33
+ /**
34
+ * Pattern score for known chord progressions
35
+ */
36
+ export interface PatternScore {
37
+ name: string;
38
+ score: number;
39
+ }
40
+ /**
41
+ * Progressive estimation results for BPM, Key, and Chord
42
+ */
43
+ export interface ProgressiveEstimate {
44
+ bpm: number;
45
+ bpmConfidence: number;
46
+ /**
47
+ * Tempo candidates the most recent BPM estimate chose from; 0 until an
48
+ * estimate has run. Same quantity as the batch analysis result's field of the
49
+ * same name.
50
+ */
51
+ bpmCandidateCount: number;
52
+ key: PitchClass;
53
+ keyMinor: boolean;
54
+ keyConfidence: number;
55
+ chordRoot: PitchClass;
56
+ chordQuality: ChordQuality;
57
+ chordConfidence: number;
58
+ chordStartTime: number;
59
+ chordProgression: ChordChange[];
60
+ barChordProgression: BarChord[];
61
+ currentBar: number;
62
+ barDuration: number;
63
+ votedPattern: BarChord[];
64
+ patternLength: number;
65
+ detectedPatternName: string;
66
+ detectedPatternScore: number;
67
+ allPatternScores: PatternScore[];
68
+ accumulatedSeconds: number;
69
+ usedFrames: number;
70
+ /**
71
+ * True when the key or BPM was re-estimated since the previous stats
72
+ * snapshot. One change sets it on exactly one snapshot however the caller
73
+ * chunks its input, and a call that produced no frame does not repeat it.
74
+ */
75
+ updated: boolean;
76
+ }
77
+ /**
78
+ * Statistics and current state of the analyzer
79
+ */
80
+ export interface AnalyzerStats {
81
+ totalFrames: number;
82
+ totalSamples: number;
83
+ durationSeconds: number;
84
+ pendingFrames: number;
85
+ droppedOutputFrames: number;
86
+ droppedChordProgressionEntries: number;
87
+ droppedBarProgressionEntries: number;
88
+ /**
89
+ * Blocks in which a non-finite input sample was replaced before it could
90
+ * reach the analyzer's recursive state.
91
+ *
92
+ * Unlike the drop counts above, nothing is missing from the output: every
93
+ * estimate is produced as usual and simply stops describing the input, so
94
+ * this is the only report that the stream was degraded. The unit is one
95
+ * {@link StreamAnalyzer.process} call, never a sample, so a block carrying a
96
+ * thousand NaNs adds one. Cleared by {@link StreamAnalyzer.reset} alongside
97
+ * the drop counts, because that call rebuilds the timeline and the count
98
+ * describes a segment rather than the analyzer.
99
+ */
100
+ nonFiniteDiscardBlocks: number;
101
+ estimate: ProgressiveEstimate;
102
+ }
103
+ /**
104
+ * Frame buffer with analysis results
105
+ */
106
+ export interface FrameBuffer {
107
+ nFrames: number;
108
+ /** Number of mel bands; flat `mel` is `[nFrames * nMels]` row-major. */
109
+ nMels: number;
110
+ /** Chroma stride: 12 when enabled, otherwise 0. */
111
+ nChroma: number;
112
+ /** MEL=1, CHROMA=2, ONSET=4, SPECTRAL=8. */
113
+ featureFlags: number;
114
+ timestamps: Float32Array;
115
+ /**
116
+ * Mel spectrogram in LINEAR power (not dB) — the raw per-frame mel energies.
117
+ * The quantized read paths (`readFramesU8` / `readFramesI16`) convert to dB
118
+ * before packing, so their `mel` is dB-scaled; this float buffer is not.
119
+ */
120
+ mel: Float32Array;
121
+ chroma: Float32Array;
122
+ onsetStrength: Float32Array;
123
+ rmsEnergy: Float32Array;
124
+ spectralCentroid: Float32Array;
125
+ spectralFlatness: Float32Array;
126
+ chordRoot: Int32Array;
127
+ chordQuality: Int32Array;
128
+ chordConfidence: Float32Array;
129
+ }
130
+ /**
131
+ * Quantization ranges for the uint8/int16 bandwidth-reduction read paths
132
+ * (`StreamAnalyzer.readFramesU8` / `readFramesI16`). Omitted fields fall back to
133
+ * the library defaults shown below; widen any range whose source values exceed
134
+ * the defaults, otherwise a louder/quieter stream saturates to the endpoints.
135
+ */
136
+ export interface StreamQuantizeConfig {
137
+ /** dB floor for mel quantization (default -80). */
138
+ melDbMin?: number;
139
+ /** dB ceiling for mel quantization (default 0). */
140
+ melDbMax?: number;
141
+ /** Max expected onset strength (default 50). */
142
+ onsetMax?: number;
143
+ /** Max expected RMS energy (default 1). */
144
+ rmsMax?: number;
145
+ /** Max expected spectral centroid in Hz (default 11025). */
146
+ centroidMax?: number;
147
+ }
148
+ export interface StreamFramesU8 {
149
+ nFrames: number;
150
+ nMels: number;
151
+ nChroma: number;
152
+ /** MEL=1, CHROMA=2, ONSET=4, SPECTRAL=8. */
153
+ featureFlags: number;
154
+ timestamps: Float32Array;
155
+ /** Row-major `[nFrames * nMels]` mel in dB, quantized over `[melDbMin, melDbMax]`. */
156
+ mel: Uint8Array;
157
+ chroma: Uint8Array;
158
+ onsetStrength: Uint8Array;
159
+ rmsEnergy: Uint8Array;
160
+ spectralCentroid: Uint8Array;
161
+ spectralFlatness: Uint8Array;
162
+ }
163
+ export interface StreamFramesI16 {
164
+ nFrames: number;
165
+ nMels: number;
166
+ nChroma: number;
167
+ /** MEL=1, CHROMA=2, ONSET=4, SPECTRAL=8. */
168
+ featureFlags: number;
169
+ timestamps: Float32Array;
170
+ /** Row-major `[nFrames * nMels]` mel in dB, quantized over `[melDbMin, melDbMax]`. */
171
+ mel: Int16Array;
172
+ chroma: Int16Array;
173
+ onsetStrength: Int16Array;
174
+ rmsEnergy: Int16Array;
175
+ spectralCentroid: Int16Array;
176
+ spectralFlatness: Int16Array;
177
+ }
178
+ /**
179
+ * Configuration for StreamAnalyzer
180
+ *
181
+ * Omitted values are read from the native StreamConfig defaults via
182
+ * streamAnalyzerConfigDefault(), keeping the WASM wrapper in sync with core.
183
+ */
184
+ export interface StreamConfig {
185
+ /** Sample rate in Hz. Optional for parity with the Node/Python bindings. */
186
+ sampleRate?: number;
187
+ nFft?: number;
188
+ hopLength?: number;
189
+ nMels?: number;
190
+ fmin?: number;
191
+ fmax?: number;
192
+ /** A4 tuning reference in Hz. Defaults to 440; must be within 220..880, the
193
+ * same range `setTuningRefHz` accepts live. */
194
+ tuningRefHz?: number;
195
+ /** Unsupported: no read path surfaces per-frame magnitude spectra. */
196
+ computeMagnitude?: boolean;
197
+ computeMel?: boolean;
198
+ computeChroma?: boolean;
199
+ computeOnset?: boolean;
200
+ computeSpectral?: boolean;
201
+ emitEveryNFrames?: number;
202
+ magnitudeDownsample?: number;
203
+ /** Maximum unread frames; overflow drops the newly produced frame. */
204
+ maxPendingFrames?: number;
205
+ /** Maximum retained chord and bar progression entries; overflow drops oldest. */
206
+ maxProgressionEntries?: number;
207
+ keyUpdateIntervalSec?: number;
208
+ bpmUpdateIntervalSec?: number;
209
+ window?: number;
210
+ /** @deprecated Must be 0 (Float32). Use readFramesU8/readFramesI16 explicitly. */
211
+ outputFormat?: number;
212
+ }
213
+ export type StreamConfigDefaults = Required<StreamConfig>;
214
+ //# sourceMappingURL=stream_types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stream_types.d.ts","sourceRoot":"","sources":["../src/stream_types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,YAAY,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,YAAY,CAAC;IACtB;;;;;OAKG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAC1B,GAAG,EAAE,UAAU,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,UAAU,CAAC;IACtB,YAAY,EAAE,YAAY,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,WAAW,EAAE,CAAC;IAChC,mBAAmB,EAAE,QAAQ,EAAE,CAAC;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,QAAQ,EAAE,CAAC;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AAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;oDACgD;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sEAAsE;IACtE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,sEAAsE;IACtE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iFAAiF;IACjF,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kFAAkF;IAClF,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export type { MixerMeterSnapshot, MixerRealtimeBuffer, StripMeteringOptions } from './mixer';
2
+ export { Mixer } from './mixer';
3
+ export type { RealtimeVoiceChangerInterleavedBuffer, RealtimeVoiceChangerMonoBuffer, RealtimeVoiceChangerPlanarBuffer, } from './realtime_voice_changer';
4
+ export { RealtimeVoiceChanger, realtimeVoiceChangerPresetJson, realtimeVoiceChangerPresetNames, validateRealtimeVoiceChangerPresetJson, } from './realtime_voice_changer';
5
+ export { StreamingEqualizer, StreamingMasteringChain, StreamingRetune, } from './streaming_processors';
6
+ //# sourceMappingURL=streaming_mixing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streaming_mixing.d.ts","sourceRoot":"","sources":["../src/streaming_mixing.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC7F,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,YAAY,EACV,qCAAqC,EACrC,8BAA8B,EAC9B,gCAAgC,GACjC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,oBAAoB,EACpB,8BAA8B,EAC9B,+BAA+B,EAC/B,sCAAsC,GACvC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,eAAe,GAChB,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,335 @@
1
+ import type { EqBand, EqMatchOptions, EqSpectrumSnapshot, EqStereoPlacement, StreamingEqualizerConfig, StreamingMasteringChainConfig, StreamingRetuneConfig } from './public_types';
2
+ type EqPhaseMode = 'zero' | 'zero-latency' | 'zero_latency' | 'natural' | 'natural-phase' | 'natural_phase' | 'linear' | 'linear-phase' | 'linear_phase' | number;
3
+ /**
4
+ * Block-by-block streaming variant of {@link masteringChain}.
5
+ *
6
+ * Maintains processor state across {@link processMono}/{@link processStereo}
7
+ * calls. Only ProcessorBase-backed stages are supported: `eq.tilt`,
8
+ * `dynamics.deesser`, `dynamics.transientShaper`, `dynamics.compressor`,
9
+ * `dynamics.multibandComp`, `saturation.tape`, `saturation.exciter`,
10
+ * `spectral.airBand`, `stereo.imager` (stereo only), `stereo.monoMaker`
11
+ * (stereo only), `maximizer.truePeakLimiter`. Configurations that enable ANY of
12
+ * the five whole-signal repair stages (`repair.declick`, `repair.declip`,
13
+ * `repair.decrackle`, `repair.dehum`, `repair.dereverb`) throw at construction.
14
+ *
15
+ * `repair.denoise` runs here, but only with a noise estimator that is recursive
16
+ * in time. Its default ranks every frame of the whole signal by energy, which a
17
+ * stream never reaches the end of, so it is refused by name rather than
18
+ * substituted; set `repair.denoise.noiseEstimator` to `1` (MCRA), `2` (IMCRA)
19
+ * or `3` (speech-presence probability). The two minimum-tracking estimators
20
+ * (`1` and `2`) seed their noise floor from the first frame they see and hold it
21
+ * for the half second their minimum window spans, so a stream opened in the
22
+ * middle of the programme is over-suppressed until it turns over; `3` tracks no
23
+ * minimum and is unaffected. Prefer `3` past that opening too: `1` and `2`
24
+ * over-report the floor for as long as the programme stays intermittent, and on
25
+ * a gated tone they leave the result below the untreated input.
26
+ *
27
+ * An enabled `loudness` stage also throws unless
28
+ * {@link StreamingMasteringChainConfig.loudnessStaticGainDb} supplies a
29
+ * precomputed normalization gain.
30
+ *
31
+ * Call {@link delete} (or use a `try/finally`) to release the underlying WASM
32
+ * object — the embind handle is not garbage-collected automatically.
33
+ *
34
+ * Reachable from the AudioWorklet realm through the `sonare/worklet` entry, but
35
+ * the realtime contract is the caller's to keep:
36
+ *
37
+ * - {@link prepare} builds the processors and allocates. Call it once from a
38
+ * message handler, never from `AudioWorkletProcessor.process()`.
39
+ * - {@link processMono}/{@link processStereo} return fresh arrays. On the render
40
+ * thread, reuse the returned reference for the block rather than retaining it.
41
+ * - An enabled `loudness` stage needs `loudnessStaticGainDb` measured offline,
42
+ * because whole-signal integrated LUFS cannot be measured block by block. Pass
43
+ * `loudnessStaticGainPeakDb` too and the static gain is clamped exactly as the
44
+ * offline chain clamps it, so the live preview matches the render.
45
+ * - {@link flush} output starts {@link latencySamples} samples early; discard
46
+ * that many leading samples when time alignment matters.
47
+ *
48
+ * The chain is a host-side stage, not an engine insert: it does not participate
49
+ * in the engine's PDC or bypass, so latency compensation against other engine
50
+ * outputs is also the caller's.
51
+ *
52
+ * @example
53
+ * ```typescript
54
+ * const chain = new StreamingMasteringChain({ eq: { tiltDb: 1.0 } });
55
+ * try {
56
+ * chain.prepare(44100, 512, 1);
57
+ * const out = chain.processMono(blockSamples);
58
+ * } finally {
59
+ * chain.delete();
60
+ * }
61
+ * ```
62
+ */
63
+ export declare class StreamingMasteringChain {
64
+ private chain;
65
+ private released;
66
+ constructor(config: StreamingMasteringChainConfig);
67
+ /**
68
+ * Initialize processors for the given sample rate and block layout.
69
+ *
70
+ * @param sampleRate - Sample rate in Hz
71
+ * @param maxBlockSize - Maximum block size per process call
72
+ * @param numChannels - 1 (mono) or 2 (stereo)
73
+ */
74
+ prepare(sampleRate: number, maxBlockSize: number, numChannels: number): void;
75
+ /**
76
+ * Process one mono block, returning the processed samples (same length).
77
+ */
78
+ processMono(samples: Float32Array): Float32Array;
79
+ /**
80
+ * Process one stereo block, returning the processed channels.
81
+ */
82
+ processStereo(left: Float32Array, right: Float32Array): {
83
+ left: Float32Array;
84
+ right: Float32Array;
85
+ };
86
+ /**
87
+ * Emit delayed audio and finite processor tails after the final mono block.
88
+ * Call until this returns an empty array. The initial `latencySamples()`
89
+ * samples of the concatenated stream are delayed and should be discarded for
90
+ * time-aligned output.
91
+ */
92
+ flushMono(): Float32Array;
93
+ /** Stereo counterpart of {@link flushMono}. */
94
+ flushStereo(): {
95
+ left: Float32Array;
96
+ right: Float32Array;
97
+ };
98
+ /** Reset all processor state without rebuilding. */
99
+ reset(): void;
100
+ /** Total reported latency in samples across all active processors. */
101
+ latencySamples(): number;
102
+ /** Ordered stage names that will run (e.g. `"eq.tilt"`). */
103
+ stageNames(): string[];
104
+ /**
105
+ * Samples a stage replaced with a finite in-domain one, keeping the output
106
+ * finite and in range.
107
+ *
108
+ * A non-finite sample supplied by the caller is rejected before any stage
109
+ * runs, so a replacement is always of a value a stage itself produced.
110
+ *
111
+ * Only the true-peak limiters replace anything, so with the maximizer's
112
+ * limiter and the loudness stage both disabled a zero here means no stage was
113
+ * able to replace anything rather than that nothing needed replacing.
114
+ *
115
+ * Cumulative over every block since {@link prepare}, and aggregated over the
116
+ * stages and channels, so it identifies neither which block nor which stage.
117
+ * Read it per block and compare against the previous reading to localize one.
118
+ *
119
+ * {@link prepare} rebuilds the stages and so clears it; {@link reset} does
120
+ * not, because it drops processor state without rebuilding.
121
+ *
122
+ * @example
123
+ * ```typescript
124
+ * chain.processMono(block);
125
+ * if (chain.nonFiniteSubstitutionCount() > previous) {
126
+ * // the block just produced is not derived from `block` everywhere
127
+ * }
128
+ * ```
129
+ */
130
+ nonFiniteSubstitutionCount(): number;
131
+ /**
132
+ * Processing calls in which a stage discarded its own recursive state
133
+ * because a non-finite value had reached it.
134
+ *
135
+ * The companion to {@link nonFiniteSubstitutionCount}, and not the same
136
+ * measurement -- a caller who assumes they are will read one and think
137
+ * they have the other. That one counts SAMPLES a stage replaced and so
138
+ * sums across stages; a discard is a whole stage returning to its
139
+ * post-reset value and is counted once per call however many stages did
140
+ * it. A stage may run more than once per call, which is why this is a
141
+ * delta over the call and never a sum.
142
+ *
143
+ * Non-finite input is rejected before any stage runs, so what a stage
144
+ * discards is always state it produced itself -- a finite sample large
145
+ * enough to overflow inside a filter, most often. Unlike the substitution
146
+ * count every stage can contribute, so a zero here means no stage
147
+ * discarded rather than that none could.
148
+ *
149
+ * Both {@link processMono}/{@link processStereo} and
150
+ * {@link flushMono}/{@link flushStereo} count, since a flush drives the
151
+ * same stages. {@link prepare} rebuilds the stages and so clears it (as it
152
+ * does {@link nonFiniteSubstitutionCount}, so the two counters on one
153
+ * handle share an epoch); {@link reset} does not, because it drops
154
+ * processor state without rebuilding.
155
+ */
156
+ nonFiniteDiscardCount(): number;
157
+ /** Release the underlying WASM object. Idempotent, as the Node facade is. */
158
+ delete(): void;
159
+ /** Alias for {@link delete}, provided for cross-binding (Node) compatibility. */
160
+ destroy(): void;
161
+ }
162
+ /**
163
+ * Block-by-block streaming equalizer wrapping the unified C++
164
+ * `EqualizerProcessor` (up to 24 bands, RBJ/Vicanek biquads, dynamic EQ,
165
+ * linear-phase FIR, mid/side processing, and auto-gain).
166
+ *
167
+ * State is maintained across {@link processMono}/{@link processStereo} calls.
168
+ * Call {@link delete} (or use `try/finally`) to release the underlying WASM
169
+ * object — the embind handle is not garbage-collected automatically.
170
+ *
171
+ * @example
172
+ * ```typescript
173
+ * const eq = new StreamingEqualizer({ sampleRate: 48000, maxBlockSize: 512 });
174
+ * try {
175
+ * eq.setBand(0, { type: 'HighShelf', frequencyHz: 8000, gainDb: 6, enabled: true });
176
+ * const out = eq.processStereo(left, right);
177
+ * const snapshot = eq.spectrum();
178
+ * } finally {
179
+ * eq.delete();
180
+ * }
181
+ * ```
182
+ */
183
+ export declare class StreamingEqualizer {
184
+ private eq;
185
+ private released;
186
+ constructor(config?: StreamingEqualizerConfig);
187
+ /**
188
+ * Configure the band at `index` (0..23). Omitted fields use C++ defaults.
189
+ */
190
+ setBand(index: number, band: EqBand): void;
191
+ /** Disable and reset every band. */
192
+ clear(): void;
193
+ /**
194
+ * Set the global phase mode: `'zero'` | `'natural'` | `'linear'` or 1/2/3.
195
+ */
196
+ setPhaseMode(mode: EqPhaseMode): void;
197
+ /** Enable or disable output auto-gain compensation. */
198
+ setAutoGain(enabled: boolean): void;
199
+ /** Set all-band EQ gain scale as a 0.0..2.0 multiplier. */
200
+ setGainScale(scale: number): void;
201
+ /** Set post-EQ output gain in dB. */
202
+ setOutputGainDb(gainDb: number): void;
203
+ /** Set post-EQ stereo balance in -1.0..1.0; mono input ignores pan. */
204
+ setOutputPan(pan: number): void;
205
+ /**
206
+ * Provide a mono external sidechain key for dynamic bands that opt into
207
+ * `external_sidechain`. The samples are copied into an owned buffer.
208
+ */
209
+ setSidechainMono(samples: Float32Array): void;
210
+ /**
211
+ * Provide a stereo external sidechain key. Both channels must match length.
212
+ */
213
+ setSidechainStereo(left: Float32Array, right: Float32Array): void;
214
+ /** Release any borrowed external sidechain buffers. */
215
+ clearSidechain(): void;
216
+ /** Auto-gain applied on the most recent block, in dB. */
217
+ lastAutoGainDb(): number;
218
+ /** Reported processing latency in samples (non-zero for linear-phase bands). */
219
+ latencySamples(): number;
220
+ /**
221
+ * Number of blocks in which the EQ discarded recursive state because a
222
+ * non-finite value had reached it.
223
+ *
224
+ * Advisory telemetry, and the only thing that separates a degraded EQ from
225
+ * a clean one. A discard returns the affected filter cells to their
226
+ * post-reset value, so the EQ recovers in silence and the output stays
227
+ * finite and in range while carrying samples unrelated to the input;
228
+ * nothing else reports that this happened.
229
+ *
230
+ * The count covers every IIR plane the band layout uses -- stereo, per
231
+ * channel, and mid/side -- together with the automatic output gain and the
232
+ * detector state the dynamic bands drive. Linear-phase bands are not
233
+ * included and have nothing to include: an FIR keeps no recursive state,
234
+ * so a non-finite sample leaves its history on its own.
235
+ *
236
+ * Unlike a mixer strip's meters, nothing here lags: this EQ has no meter of
237
+ * its own, so a discard is always attributed to the block that carried it.
238
+ *
239
+ * Cumulative since this handle was created and never cleared, so two
240
+ * readings bracket a span of audio. The unit is one processed block, never
241
+ * a channel or a plane.
242
+ */
243
+ nonFiniteDiscardCount(): number;
244
+ /**
245
+ * Process one mono block, returning the equalized samples (same length).
246
+ */
247
+ processMono(samples: Float32Array): Float32Array;
248
+ /**
249
+ * Process one stereo block, returning the equalized channels.
250
+ */
251
+ processStereo(left: Float32Array, right: Float32Array): {
252
+ left: Float32Array;
253
+ right: Float32Array;
254
+ };
255
+ /**
256
+ * The composite magnitude of the bands, in dB, at each requested frequency —
257
+ * the curve to draw over {@link spectrum}.
258
+ *
259
+ * Built from the same coefficient design, tilt expansion and cut-slope
260
+ * cascade the audio path uses, so it states what the equalizer does rather
261
+ * than what its settings look like, and it carries the output gain, the gain
262
+ * scale and whatever each dynamic band is applying at the moment of the call.
263
+ * Disabled, bypassed and — when anything is soloed — unsoloed bands drop out,
264
+ * and a soloed band is drawn as the band pass it is heard as.
265
+ *
266
+ * `placement` selects which signal path the curve is for. A band placed on
267
+ * `'Stereo'` is on every path; one placed elsewhere appears only on its own,
268
+ * a mid band having no per-channel magnitude to fold into a left or right
269
+ * curve. Frequencies are clamped to [0 Hz, Nyquist].
270
+ *
271
+ * @example
272
+ * ```ts
273
+ * const freqs = new Float32Array([100, 1000, 10000]);
274
+ * const db = eq.magnitudeResponse(freqs);
275
+ * ```
276
+ */
277
+ magnitudeResponse(frequenciesHz: Float32Array, placement?: EqStereoPlacement): Float32Array;
278
+ /**
279
+ * Read the latest pre/post spectrum snapshot for metering. `seq` increments
280
+ * each time a new snapshot is published.
281
+ */
282
+ spectrum(): EqSpectrumSnapshot;
283
+ /**
284
+ * Configure bands so the source spectrum matches the reference spectrum.
285
+ *
286
+ * @param source - Source audio (mono samples)
287
+ * @param reference - Reference audio (mono samples)
288
+ * @param options - `sampleRate` (default 48000) and `maxBands` (default 8)
289
+ */
290
+ match(source: Float32Array, reference: Float32Array, options?: EqMatchOptions): void;
291
+ /** Release the underlying WASM object. Idempotent, as the Node facade is. */
292
+ delete(): void;
293
+ /** Alias for {@link delete}, provided for cross-binding (Node) compatibility. */
294
+ destroy(): void;
295
+ }
296
+ /**
297
+ * Block-by-block mono voice retune / pitch shifter.
298
+ *
299
+ * State is maintained across {@link processMono} calls. Call {@link prepare}
300
+ * before processing, and call {@link delete} (or use `try/finally`) to release
301
+ * the underlying WASM object.
302
+ */
303
+ export declare class StreamingRetune {
304
+ private retune;
305
+ private released;
306
+ constructor(config?: StreamingRetuneConfig);
307
+ /**
308
+ * Allocate and initialize native state for the given sample rate and maximum
309
+ * process block size.
310
+ */
311
+ prepare(sampleRate: number, maxBlockSize: number): void;
312
+ /** Reset delay, grain, and overlap-add state without changing config. */
313
+ reset(): void;
314
+ /**
315
+ * Update the live controls; omitted keys keep their current value. Changing
316
+ * `grainSize` takes effect after the next {@link prepare} call, and an
317
+ * omitted `grainSize` keeps whatever was last requested — including the `0`
318
+ * sentinel, so a re-{@link prepare} at another sample rate re-derives it.
319
+ */
320
+ setConfig(config: StreamingRetuneConfig): void;
321
+ /** The currently applied controls, with `grainSize` as the effective one. */
322
+ config(): Required<StreamingRetuneConfig>;
323
+ /** Resolved grain size in samples after {@link prepare}. */
324
+ grainSize(): number;
325
+ /** Fixed overlap-add latency in samples (one grain); 0 before prepare. */
326
+ latencySamples(): number;
327
+ /** Process one mono block, returning the shifted samples (same length). */
328
+ processMono(samples: Float32Array): Float32Array;
329
+ /** Release the underlying WASM object. Idempotent, as the Node facade is. */
330
+ delete(): void;
331
+ /** Alias for {@link delete}, provided for cross-binding (Node) compatibility. */
332
+ destroy(): void;
333
+ }
334
+ export {};
335
+ //# sourceMappingURL=streaming_processors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streaming_processors.d.ts","sourceRoot":"","sources":["../src/streaming_processors.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,MAAM,EACN,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,wBAAwB,EACxB,6BAA6B,EAC7B,qBAAqB,EACtB,MAAM,gBAAgB,CAAC;AAExB,KAAK,WAAW,GACZ,MAAM,GACN,cAAc,GACd,cAAc,GACd,SAAS,GACT,eAAe,GACf,eAAe,GACf,QAAQ,GACR,cAAc,GACd,cAAc,GACd,MAAM,CAAC;AA0BX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,qBAAa,uBAAuB;IAClC,OAAO,CAAC,KAAK,CAAoD;IACjE,OAAO,CAAC,QAAQ,CAAS;gBAEb,MAAM,EAAE,6BAA6B;IAUjD;;;;;;OAMG;IACH,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI;IAI5E;;OAEG;IACH,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,YAAY;IAIhD;;OAEG;IACH,aAAa,CACX,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,YAAY,GAClB;QAAE,IAAI,EAAE,YAAY,CAAC;QAAC,KAAK,EAAE,YAAY,CAAA;KAAE;IAO9C;;;;;OAKG;IACH,SAAS,IAAI,YAAY;IAIzB,+CAA+C;IAC/C,WAAW,IAAI;QAAE,IAAI,EAAE,YAAY,CAAC;QAAC,KAAK,EAAE,YAAY,CAAA;KAAE;IAI1D,oDAAoD;IACpD,KAAK,IAAI,IAAI;IAIb,sEAAsE;IACtE,cAAc,IAAI,MAAM;IAIxB,4DAA4D;IAC5D,UAAU,IAAI,MAAM,EAAE;IAItB;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AAI,EAAE,YAAY,EAClB,KAAK,EAAE,YAAY,GAClB;QAAE,IAAI,EAAE,YAAY,CAAC;QAAC,KAAK,EAAE,YAAY,CAAA;KAAE;IAO9C;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,iBAAiB,CACf,aAAa,EAAE,YAAY,EAC3B,SAAS,GAAE,iBAA4B,GACtC,YAAY;IAQf;;;OAGG;IACH,QAAQ,IAAI,kBAAkB;IAI9B;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,OAAO,GAAE,cAAmB,GAAG,IAAI;IAIxF,6EAA6E;IAC7E,MAAM,IAAI,IAAI;IAQd,iFAAiF;IACjF,OAAO,IAAI,IAAI;CAGhB;AAMD;;;;;;GAMG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAA4C;IAC1D,OAAO,CAAC,QAAQ,CAAS;gBAEb,MAAM,GAAE,qBAA0B;IAK9C;;;OAGG;IACH,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI;IAIvD,yEAAyE;IACzE,KAAK,IAAI,IAAI;IAIb;;;;;OAKG;IACH,SAAS,CAAC,MAAM,EAAE,qBAAqB,GAAG,IAAI;IAI9C,6EAA6E;IAC7E,MAAM,IAAI,QAAQ,CAAC,qBAAqB,CAAC;IAIzC,4DAA4D;IAC5D,SAAS,IAAI,MAAM;IAInB,0EAA0E;IAC1E,cAAc,IAAI,MAAM;IAIxB,2EAA2E;IAC3E,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,YAAY;IAIhD,6EAA6E;IAC7E,MAAM,IAAI,IAAI;IAQd,iFAAiF;IACjF,OAAO,IAAI,IAAI;CAGhB"}
@@ -0,0 +1,77 @@
1
+ import type { TranscribeOptions, TranscribeResult } from './project_types';
2
+ /**
3
+ * Canonical request form for {@link transcribe}.
4
+ *
5
+ * Deliberately does NOT extend `ValidateOptions`. That option's contract is
6
+ * that skipping the JS-side scan is safe because the native layer re-validates
7
+ * with an equivalent result -- and here it would not be equivalent: the
8
+ * transcription C ABI (`sonare_transcribe`) does re-validate the buffer,
9
+ * including a non-finite scan, but a rejection there surfaces as a
10
+ * `SonareError` `InvalidParameter`, not the `RangeError` this function
11
+ * documents and every other empty/non-finite/rate check on this surface
12
+ * raises. A `{ validate: false }` here would silently change the thrown error
13
+ * class instead of skipping a redundant check. The scan is also nearly free
14
+ * against this pipeline, which already reads every sample several times.
15
+ */
16
+ export interface TranscribeRequest extends TranscribeOptions {
17
+ /** Mono source audio. Must be non-empty and all-finite. */
18
+ samples: Float32Array;
19
+ /** Sample rate of `samples` in Hz, `[8000, 384000]`. */
20
+ sampleRate: number;
21
+ /**
22
+ * Tempo the PPQ grid is built on, in BPM. **Omit to have it detected** from
23
+ * `samples`, which costs an onset/tempo pass; a detector that finds nothing
24
+ * usable falls back to 120 rather than failing the transcription.
25
+ *
26
+ * Supplying a tempo is not a claim about the audio — it is the coordinate
27
+ * system the events come back in. Twice the tempo is twice as many beats per
28
+ * second, so the same audio lands on twice the ppq.
29
+ */
30
+ tempoBpm?: number;
31
+ }
32
+ /**
33
+ * Transcribes mono audio into MIDI events on a constant-tempo grid.
34
+ *
35
+ * This joins parts that already exist rather than adding a detector: the note
36
+ * spans and their measured pitch and level come from the monophonic (pYIN) or
37
+ * polyphonic (multi-F0) chain, and the output is the flat
38
+ * {@link ProjectMidiEvent} shape {@link Project.setMidiEvents} takes, so
39
+ * nothing is left to convert.
40
+ *
41
+ * Finding no notes is not an error. Silence, and material the chain cannot
42
+ * resolve, come back with an empty `events` array and `noteCount` 0, and
43
+ * `tempoBpm` still reports the tempo that was used or detected.
44
+ *
45
+ * Three things are deliberately **not** done here, because the library already
46
+ * does each of them somewhere else and a second implementation would drift:
47
+ *
48
+ * - **Quantizing to a grid** — {@link Project.bakeMidiFx}'s `quantizePpq` /
49
+ * `quantizeStrength`.
50
+ * - **Detecting and installing a tempo map** — {@link Project.autoTempo}. The
51
+ * `tempoBpm` fallback here builds one constant-tempo grid for this call and
52
+ * installs nothing; use {@link Project.transcribeToClip} to transcribe onto a
53
+ * project's real map.
54
+ * - **Annotating key and chords** — {@link Project.annotateKeys} /
55
+ * {@link Project.annotateChords}.
56
+ *
57
+ * The tuning reference is likewise not measured — see
58
+ * {@link TranscribeOptions.referenceHz}.
59
+ *
60
+ * @throws {RangeError} on empty `samples`, a non-finite sample, or a
61
+ * `sampleRate` outside `[8000, 384000]`
62
+ * @throws {SonareError} `InvalidParameter` on an option outside its domain —
63
+ * a non-negative `velocityFloorDb`, a `fixedVelocity` outside `[1, 127]`, a
64
+ * `group` or `channel` outside `[0, 15]`, an `fmax` at or below `fmin`, or a
65
+ * written `0` on any field but `group` and `channel` — or `NotSupported`
66
+ * when the library was built without the pitch editor
67
+ *
68
+ * @example
69
+ * ```typescript
70
+ * const { events, noteCount, tempoBpm } = transcribe({ samples, sampleRate, tempoBpm: 120 });
71
+ * const project = new Project();
72
+ * const { clipId } = project.addMidiClip(0, 16); // 4 bars at 4/4, in quarter notes (PPQ)
73
+ * project.setMidiEvents(clipId, events);
74
+ * ```
75
+ */
76
+ export declare function transcribe(request: TranscribeRequest): TranscribeResult;
77
+ //# sourceMappingURL=transcribe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transcribe.d.ts","sourceRoot":"","sources":["../src/transcribe.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAG3E;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IAC1D,2DAA2D;IAC3D,OAAO,EAAE,YAAY,CAAC;IACtB,wDAAwD;IACxD,UAAU,EAAE,MAAM,CAAC;IACnB;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,CASvE"}