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