@libraz/libsonare 1.7.2 → 1.8.1
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 -203
- package/dist/_chain_config.d.ts +14 -0
- package/dist/_chain_config.d.ts.map +1 -0
- package/dist/_effects_common.d.ts +7 -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 -5840
- package/dist/analysis.d.ts.map +1 -0
- package/dist/analysis.js +874 -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 +502 -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 +134 -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 -7431
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4173 -1621
- 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 +483 -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 +654 -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 +528 -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 +165 -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 +893 -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 +3945 -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 +340 -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 +164 -0
- package/dist/worklet/engine-mixer-facade.d.ts.map +1 -0
- package/dist/worklet/engine-node.d.ts +83 -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 +72 -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 +75 -0
- package/dist/worklet/engine-strips.d.ts.map +1 -0
- package/dist/worklet/engine-sync.d.ts +39 -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 +418 -0
- package/dist/worklet/engine.d.ts.map +1 -0
- package/dist/worklet/guards.d.ts +53 -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 +331 -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 -2515
- package/dist/worklet.d.ts.map +1 -0
- package/dist/worklet.js +3200 -541
- package/dist/worklet.js.map +1 -1
- package/package.json +23 -12
- package/src/_effects_common.ts +47 -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 +101 -22
- package/src/effects_note_ops.ts +683 -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 +388 -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 +288 -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 +441 -32
- package/src/mastering_dynamics.ts +22 -11
- package/src/metering.ts +67 -24
- package/src/mixer.ts +251 -22
- 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 +61 -24
- package/src/project_class.ts +450 -27
- package/src/project_internal.ts +149 -42
- package/src/project_synth.ts +67 -1
- package/src/project_types.ts +271 -271
- package/src/public_types.ts +122 -3
- package/src/public_types_acoustic.ts +112 -3
- package/src/public_types_mastering.ts +275 -73
- package/src/public_types_mixing.ts +363 -1
- package/src/public_types_music.ts +312 -2
- package/src/public_types_playback.ts +196 -0
- package/src/public_types_realtime.ts +39 -7
- package/src/public_types_repair.ts +446 -0
- package/src/public_types_spectral.ts +491 -5
- package/src/quick_analysis.ts +203 -26
- package/src/realtime_engine.ts +773 -34
- 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 +1158 -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 +202 -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 +800 -32
- package/src/worklet/engine-node.ts +99 -29
- package/src/worklet/engine-offline.ts +14 -8
- package/src/worklet/engine-parameter-facade.ts +21 -0
- package/src/worklet/engine-processor.ts +332 -93
- package/src/worklet/engine-register.ts +32 -18
- package/src/worklet/engine-strips.ts +275 -9
- package/src/worklet/engine-sync.ts +20 -7
- package/src/worklet/engine.ts +394 -48
- package/src/worklet/guards.ts +195 -44
- package/src/worklet/messages.ts +229 -2
- package/src/worklet/mixer-processor.ts +117 -48
- package/src/worklet/playback-processor.ts +300 -0
- package/src/worklet/protocol.ts +82 -11
- package/src/worklet/voice-changer-processor.ts +17 -11
- package/src/worklet.ts +17 -0
- package/src/effects_transform.ts +0 -718
- package/src/mastering_repair.ts +0 -273
package/dist/mixer.d.ts
ADDED
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
import type { AutomationCurve, GoniometerPoint, MeterTap, MixerProcessResult, MixMeterSnapshot, PanLawInput, PanMode, SendTiming, SurroundPan } from './public_types';
|
|
2
|
+
/**
|
|
3
|
+
* One master-output meter reading. All dB fields are finite and floored at
|
|
4
|
+
* -120; `truePeakDb*` is an inter-sample peak from the ITU-R BS.1770-4
|
|
5
|
+
* polyphase reconstruction at 4x, not a sample peak. That reconstruction is a
|
|
6
|
+
* streaming measurement: its centered stencil needs a few future samples a
|
|
7
|
+
* realtime path does not have, so each block's last samples read marginally low
|
|
8
|
+
* (about 0.1 dB across 64..8192-sample blocks on a near-Nyquist tone, always
|
|
9
|
+
* under-reading). Use `meteringTruePeakDb` over the whole signal for an exact
|
|
10
|
+
* dBTP number.
|
|
11
|
+
*/
|
|
12
|
+
export interface MixerMeterSnapshot {
|
|
13
|
+
peakDbL: number;
|
|
14
|
+
peakDbR: number;
|
|
15
|
+
rmsDbL: number;
|
|
16
|
+
rmsDbR: number;
|
|
17
|
+
correlation: number;
|
|
18
|
+
truePeakDbL: number;
|
|
19
|
+
truePeakDbR: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Meter configuration for a strip added with {@link Mixer.addStrip}.
|
|
23
|
+
*
|
|
24
|
+
* The field names and defaults are the scene document's `strips[].metering`
|
|
25
|
+
* object, so a strip added imperatively and one declared in a scene describe the
|
|
26
|
+
* same thing. A strip's meters size their buffers when the strip is built, so
|
|
27
|
+
* this is the only place the configuration can be chosen — there is no setter.
|
|
28
|
+
* A full meter costs about 646 KB at 48 kHz and a strip carries two of them.
|
|
29
|
+
*/
|
|
30
|
+
export interface StripMeteringOptions {
|
|
31
|
+
/** Both meters; `false` drops them (about 145 KB for the strip instead of 1.4 MB). Default `true`. */
|
|
32
|
+
enabled?: boolean;
|
|
33
|
+
/** LUFS measurement; `false` takes one meter to about 83 KB. Default `true`. */
|
|
34
|
+
lufs?: boolean;
|
|
35
|
+
/** Inter-sample (true) peak measurement. Default `true`. */
|
|
36
|
+
truePeak?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Requested true-peak oversampling factor in `[0, 16]`; the meter resolves it
|
|
39
|
+
* to the nearest of 2x / 4x / 8x. `0` selects the library default (4x).
|
|
40
|
+
*/
|
|
41
|
+
truePeakOversample?: number;
|
|
42
|
+
}
|
|
43
|
+
export interface MixerRealtimeBuffer {
|
|
44
|
+
leftInputs: Float32Array[];
|
|
45
|
+
rightInputs: Float32Array[];
|
|
46
|
+
outLeft: Float32Array;
|
|
47
|
+
outRight: Float32Array;
|
|
48
|
+
process: (numSamples?: number) => void;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Persistent, scene-based stereo mixer.
|
|
52
|
+
*
|
|
53
|
+
* Build one from a scene JSON string (e.g. {@link mixingScenePresetJson} or a
|
|
54
|
+
* hand-authored scene), then feed per-strip stereo blocks through
|
|
55
|
+
* {@link processStereo} to get the routed stereo master. Strips, sends, buses,
|
|
56
|
+
* and inserts are described entirely by the scene; the routing graph is
|
|
57
|
+
* compiled lazily on the first {@link processStereo} call (or eagerly via
|
|
58
|
+
* {@link compile}).
|
|
59
|
+
*
|
|
60
|
+
* Call {@link delete} (or use a `try/finally`) to release the underlying WASM
|
|
61
|
+
* object — the embind handle is not garbage-collected automatically.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* const mixer = Mixer.fromSceneJson(mixingScenePresetJson('vocalReverbSend'), 48000, 512);
|
|
66
|
+
* try {
|
|
67
|
+
* const out = mixer.processStereo([stripL], [stripR]);
|
|
68
|
+
* } finally {
|
|
69
|
+
* mixer.delete();
|
|
70
|
+
* }
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export declare class Mixer {
|
|
74
|
+
private mixer;
|
|
75
|
+
private released;
|
|
76
|
+
private readonly blockSize;
|
|
77
|
+
private constructor();
|
|
78
|
+
/**
|
|
79
|
+
* Build a mixer from a scene JSON string.
|
|
80
|
+
*
|
|
81
|
+
* A strip's meters are sized when the strip is built, so this is where their
|
|
82
|
+
* configuration is chosen: an optional `metering` object on the strip
|
|
83
|
+
* (`enabled` / `lufs` / `truePeak` / `truePeakOversample`) selects it, and
|
|
84
|
+
* leaving it out keeps the full default (LUFS + true peak at 4x, about 1.4 MB
|
|
85
|
+
* per strip at 48 kHz). `{"enabled": false}` drops both meters for a strip
|
|
86
|
+
* whose snapshots are never read.
|
|
87
|
+
*
|
|
88
|
+
* @param json - Scene JSON (strips, buses, sends, connections, inserts)
|
|
89
|
+
* @param sampleRate - Sample rate in Hz (default: 48000)
|
|
90
|
+
* @param blockSize - Maximum block size per {@link processStereo} call (default: 512)
|
|
91
|
+
*/
|
|
92
|
+
static fromSceneJson(json: string, sampleRate?: number, blockSize?: number): Mixer;
|
|
93
|
+
/**
|
|
94
|
+
* Rebuild and compile the routing graph without resetting its absolute
|
|
95
|
+
* automation sample position or queued strip automation.
|
|
96
|
+
*/
|
|
97
|
+
compile(): void;
|
|
98
|
+
/**
|
|
99
|
+
* Non-fatal warnings captured when this mixer was built from scene JSON: one
|
|
100
|
+
* entry per channel-strip insert that was handed param keys it does not read
|
|
101
|
+
* (a likely typo, or a key meant for a different processor). The scene still
|
|
102
|
+
* loaded; these keys simply took no effect. Empty when every key was consumed.
|
|
103
|
+
* Use {@link masteringInsertParamNames} to discover the keys an insert accepts.
|
|
104
|
+
*/
|
|
105
|
+
sceneWarnings(): string[];
|
|
106
|
+
/**
|
|
107
|
+
* Mix one block of per-strip stereo audio into the stereo master.
|
|
108
|
+
*
|
|
109
|
+
* @param leftChannels - `leftChannels[i]` is the left channel of strip `i`
|
|
110
|
+
* @param rightChannels - `rightChannels[i]` is the right channel of strip `i`
|
|
111
|
+
* @returns Mixed stereo master (`left`, `right`, `sampleRate`)
|
|
112
|
+
*/
|
|
113
|
+
processStereo(leftChannels: Float32Array[], rightChannels: Float32Array[]): MixerProcessResult;
|
|
114
|
+
/**
|
|
115
|
+
* Mix one block into caller-owned output arrays.
|
|
116
|
+
*
|
|
117
|
+
* This avoids allocating the result object and result `Float32Array`s. It is
|
|
118
|
+
* intended for realtime bridges such as AudioWorklet; the input channel count
|
|
119
|
+
* must match the scene strip count and all arrays must have the same length.
|
|
120
|
+
*/
|
|
121
|
+
processStereoInto(leftChannels: Float32Array[], rightChannels: Float32Array[], outLeft: Float32Array, outRight: Float32Array): void;
|
|
122
|
+
/**
|
|
123
|
+
* Create reusable WASM-heap input/output views for realtime-style processing.
|
|
124
|
+
*
|
|
125
|
+
* Fill `leftInputs[i]` / `rightInputs[i]`, call `process()`, then read
|
|
126
|
+
* `outLeft` / `outRight`. The views are owned by this mixer and become invalid
|
|
127
|
+
* after {@link delete}.
|
|
128
|
+
*/
|
|
129
|
+
createRealtimeBuffer(): MixerRealtimeBuffer;
|
|
130
|
+
/**
|
|
131
|
+
* Turn the master-output meter on or off.
|
|
132
|
+
*
|
|
133
|
+
* While on, every {@link MixerRealtimeBuffer.process} call meters the stereo
|
|
134
|
+
* master it just produced, so a caller reads {@link meterSnapshot} instead of
|
|
135
|
+
* copying the output and measuring it again. `truePeakDb*` is an inter-sample
|
|
136
|
+
* peak taken after oversampling (ITU-R BS.1770-4 Annex 2 requires at least
|
|
137
|
+
* 4x), which is a different and higher quantity than the sample peak.
|
|
138
|
+
*
|
|
139
|
+
* Enabling resets the meter, so a reading never mixes in audio from a period
|
|
140
|
+
* when metering was off.
|
|
141
|
+
*
|
|
142
|
+
* @param enabled - Whether to meter the master output.
|
|
143
|
+
* @param truePeakOversample - 0 (= 4x) or a power of two in [1, 16].
|
|
144
|
+
*/
|
|
145
|
+
configureMeter(enabled: boolean, truePeakOversample?: number): void;
|
|
146
|
+
/**
|
|
147
|
+
* Latest master-output meter reading, describing the most recently metered
|
|
148
|
+
* block. All dB fields are finite and floored at -120.
|
|
149
|
+
*
|
|
150
|
+
* @throws When the meter has never been enabled.
|
|
151
|
+
*/
|
|
152
|
+
meterSnapshot(): MixerMeterSnapshot;
|
|
153
|
+
/**
|
|
154
|
+
* Latch the latest meter reading into the mixer's internal scratch so
|
|
155
|
+
* {@link meterScratchValue} can read it back one number at a time.
|
|
156
|
+
*
|
|
157
|
+
* This is the allocation-free form of {@link meterSnapshot}, for an audio
|
|
158
|
+
* render callback that must not create a JS object per interval. It returns
|
|
159
|
+
* `false` instead of throwing when the meter has never been enabled.
|
|
160
|
+
*
|
|
161
|
+
* @returns Whether a reading was latched.
|
|
162
|
+
*/
|
|
163
|
+
latchMeterSnapshot(): boolean;
|
|
164
|
+
/**
|
|
165
|
+
* Read one field of the snapshot latched by {@link latchMeterSnapshot}.
|
|
166
|
+
*
|
|
167
|
+
* @param field - `0` peakDbL, `1` peakDbR, `2` rmsDbL, `3` rmsDbR,
|
|
168
|
+
* `4` correlation, `5` truePeakDbL, `6` truePeakDbR. Any other index
|
|
169
|
+
* reads `0`.
|
|
170
|
+
*/
|
|
171
|
+
meterScratchValue(field: number): number;
|
|
172
|
+
/** Number of strips in the mixer (e.g. strips loaded from the scene). */
|
|
173
|
+
stripCount(): number;
|
|
174
|
+
/**
|
|
175
|
+
* Schedule sample-accurate insert-parameter automation on a strip's insert.
|
|
176
|
+
*
|
|
177
|
+
* @param stripIndex - Strip index in `[0, stripCount())`
|
|
178
|
+
* @param insertIndex - Index into the strip's combined insert sequence
|
|
179
|
+
* (`[pre-inserts... post-inserts...]`)
|
|
180
|
+
* @param paramId - Processor-specific parameter id
|
|
181
|
+
* @param samplePos - Absolute samples from the start of processing (the mixer
|
|
182
|
+
* advances an internal position from 0 on the first {@link processStereo}
|
|
183
|
+
* call; recompiling resets it to 0)
|
|
184
|
+
* @param value - Target parameter value
|
|
185
|
+
* @param curve - Interpolation curve (default: `'linear'`)
|
|
186
|
+
* @throws If the strip index is out of range or the schedule call fails
|
|
187
|
+
* (unknown curve, out-of-range insert index, or full event lane)
|
|
188
|
+
*/
|
|
189
|
+
scheduleInsertAutomation(stripIndex: number, insertIndex: number, paramId: number, samplePos: number, value: number, curve?: AutomationCurve): void;
|
|
190
|
+
/**
|
|
191
|
+
* Resolve a strip's index in `[0, stripCount())` from its scene id, or `null`
|
|
192
|
+
* when no strip with that id exists (matches the Node binding's `number | null`).
|
|
193
|
+
*/
|
|
194
|
+
stripById(id: string): number | null;
|
|
195
|
+
/**
|
|
196
|
+
* Add a channel strip to the mixer topology. `metering` configures the strip's
|
|
197
|
+
* pre/post taps; omitting it keeps the full default (LUFS + true peak at 4x,
|
|
198
|
+
* about 1.4 MB per strip at 48 kHz). Marks the routing graph dirty; call
|
|
199
|
+
* {@link compile} (or {@link processStereo}) to rebuild.
|
|
200
|
+
*
|
|
201
|
+
* @throws If the id is already taken, or `truePeakOversample` is outside `[0, 16]`
|
|
202
|
+
*/
|
|
203
|
+
addStrip(id: string, metering?: StripMeteringOptions): void;
|
|
204
|
+
/**
|
|
205
|
+
* Add a bus to the mixer topology. `role` is one of `'master'`, `'aux'`, or
|
|
206
|
+
* `'submix'` (defaults to `'aux'`). Marks the routing graph dirty; call
|
|
207
|
+
* {@link compile} (or {@link processStereo}) to rebuild.
|
|
208
|
+
*/
|
|
209
|
+
addBus(id: string, role?: string): void;
|
|
210
|
+
/** Remove a bus by id. Marks the routing graph dirty. */
|
|
211
|
+
removeBus(id: string): void;
|
|
212
|
+
/** Number of buses in the mixer topology. */
|
|
213
|
+
busCount(): number;
|
|
214
|
+
/**
|
|
215
|
+
* Add a VCA group with the given gain offset (dB). `members` is a list of
|
|
216
|
+
* strip ids governed by the group (may be empty).
|
|
217
|
+
*/
|
|
218
|
+
addVcaGroup(id: string, gainDb?: number, members?: string[]): void;
|
|
219
|
+
/** Set an existing VCA group's gain in dB. */
|
|
220
|
+
setVcaGroupGainDb(id: string, gainDb: number): void;
|
|
221
|
+
/** Replace an existing VCA group's strip membership. */
|
|
222
|
+
setVcaGroupMembers(id: string, members: string[]): void;
|
|
223
|
+
/** Remove a VCA group by id. */
|
|
224
|
+
removeVcaGroup(id: string): void;
|
|
225
|
+
/** Number of VCA groups in the mixer topology. */
|
|
226
|
+
vcaGroupCount(): number;
|
|
227
|
+
/** Set the strip's input trim in dB. */
|
|
228
|
+
setInputTrimDb(stripIndex: number, db: number): void;
|
|
229
|
+
/** Set the strip's fader level in dB. */
|
|
230
|
+
setFaderDb(stripIndex: number, db: number): void;
|
|
231
|
+
/**
|
|
232
|
+
* Set the strip's pan position.
|
|
233
|
+
*
|
|
234
|
+
* @param stripIndex - Strip index in `[0, stripCount())`
|
|
235
|
+
* @param pan - Pan position in `[-1, 1]`
|
|
236
|
+
* @param panMode - Optional pan mode. When omitted the strip's current pan
|
|
237
|
+
* mode is kept (passes `SONARE_PAN_MODE_KEEP`), so a plain pan nudge does
|
|
238
|
+
* not reset a scene-defined `'stereoPan'` / `'dualPan'` mode back to
|
|
239
|
+
* balance. Pass `'balance'` (or `0`) explicitly to force balance mode.
|
|
240
|
+
*/
|
|
241
|
+
setPan(stripIndex: number, pan: number, panMode?: PanMode | number): void;
|
|
242
|
+
/** Set the strip's stereo width. */
|
|
243
|
+
setWidth(stripIndex: number, width: number): void;
|
|
244
|
+
/**
|
|
245
|
+
* Snap the strip's input-trim, fader, pan and width smoothers to the values
|
|
246
|
+
* already set on it, so the next processed block opens at those values
|
|
247
|
+
* instead of gliding to them over the smoothing window (~5 ms).
|
|
248
|
+
*
|
|
249
|
+
* Call it after configuring a strip and before rendering a finite buffer: a
|
|
250
|
+
* strip is smoothed for a live fader, and an offline render that does not
|
|
251
|
+
* settle carries that glide as a level and image sweep across the head of
|
|
252
|
+
* its output. Unlike a reset it clears nothing — automation, meters and
|
|
253
|
+
* insert state are untouched.
|
|
254
|
+
*
|
|
255
|
+
* @param stripIndex - Strip index in `[0, stripCount())`
|
|
256
|
+
*
|
|
257
|
+
* @example
|
|
258
|
+
* ```typescript
|
|
259
|
+
* mixer.setFaderDb(0, -3);
|
|
260
|
+
* mixer.setPan(0, 0.3);
|
|
261
|
+
* mixer.settle(0);
|
|
262
|
+
* const { left, right } = mixer.processStereo([dryLeft], [dryRight]);
|
|
263
|
+
* ```
|
|
264
|
+
*/
|
|
265
|
+
settle(stripIndex: number): void;
|
|
266
|
+
/** Set the strip's mute state. */
|
|
267
|
+
setMuted(stripIndex: number, muted: boolean): void;
|
|
268
|
+
/**
|
|
269
|
+
* Set a strip's solo state. Takes effect on the next process without a
|
|
270
|
+
* graph recompile.
|
|
271
|
+
*/
|
|
272
|
+
setSoloed(stripIndex: number, soloed: boolean): void;
|
|
273
|
+
/**
|
|
274
|
+
* Mark a strip solo-safe so it is never implied-muted by another strip's
|
|
275
|
+
* solo. Takes effect on the next process without a graph recompile.
|
|
276
|
+
*/
|
|
277
|
+
setSoloSafe(stripIndex: number, soloSafe: boolean): void;
|
|
278
|
+
/** Invert the polarity of the left and/or right channel of a strip. */
|
|
279
|
+
setPolarityInvert(stripIndex: number, invertLeft: boolean, invertRight: boolean): void;
|
|
280
|
+
/** Set the strip's pan law (a {@link PanLawName} alias or raw C ABI ordinal). */
|
|
281
|
+
setPanLaw(stripIndex: number, panLaw: PanLawInput): void;
|
|
282
|
+
/**
|
|
283
|
+
* Set a per-strip channel delay in samples. This changes the strip's reported
|
|
284
|
+
* latency; recompile to re-run latency compensation.
|
|
285
|
+
*/
|
|
286
|
+
setChannelDelaySamples(stripIndex: number, delaySamples: number): void;
|
|
287
|
+
/** Set the strip's live VCA gain offset in dB (not persisted to the scene). */
|
|
288
|
+
setVcaOffsetDb(stripIndex: number, offsetDb: number): void;
|
|
289
|
+
/** Set independent left/right pan positions (dual-pan mode). */
|
|
290
|
+
setDualPan(stripIndex: number, leftPan: number, rightPan: number): void;
|
|
291
|
+
/**
|
|
292
|
+
* Set the strip's surround pan position, used when it feeds a >2-channel bus.
|
|
293
|
+
*
|
|
294
|
+
* Applied when the engine's track mixer renders this strip's lane into a
|
|
295
|
+
* destination with more than two channels. This stereo-only mixer's own
|
|
296
|
+
* block entry points ignore it.
|
|
297
|
+
*/
|
|
298
|
+
setSurroundPan(stripIndex: number, pan: SurroundPan): void;
|
|
299
|
+
/**
|
|
300
|
+
* Add a send to a strip after construction.
|
|
301
|
+
*
|
|
302
|
+
* @param stripIndex - Strip index in `[0, stripCount())`
|
|
303
|
+
* @param id - Send id
|
|
304
|
+
* @param destinationBusId - Destination bus id
|
|
305
|
+
* @param sendDb - Initial send level in dB
|
|
306
|
+
* @param timing - `'preFader'` or `'postFader'` (default: `'postFader'`)
|
|
307
|
+
* @returns The new send's index
|
|
308
|
+
*/
|
|
309
|
+
addSend(stripIndex: number, id: string, destinationBusId: string, sendDb?: number, timing?: SendTiming | number): number;
|
|
310
|
+
/** Set the send level (in dB) for an existing send by index. */
|
|
311
|
+
setSendDb(stripIndex: number, sendIndex: number, sendDb: number): void;
|
|
312
|
+
/**
|
|
313
|
+
* Remove an existing send from a strip by index.
|
|
314
|
+
*
|
|
315
|
+
* Sends are addressed in add order. After removal, sends with a higher index
|
|
316
|
+
* than `sendIndex` shift down by one. Recompile (or process) before reading
|
|
317
|
+
* results so the routing graph rebuilds.
|
|
318
|
+
*
|
|
319
|
+
* @param stripIndex - Strip index in `[0, stripCount())`
|
|
320
|
+
* @param sendIndex - Send index in add order
|
|
321
|
+
*/
|
|
322
|
+
removeSend(stripIndex: number, sendIndex: number): void;
|
|
323
|
+
/**
|
|
324
|
+
* Read a strip's meter snapshot at the given tap point.
|
|
325
|
+
*
|
|
326
|
+
* @param stripIndex - Strip index in `[0, stripCount())`
|
|
327
|
+
* @param tap - `'preFader'` or `'postFader'` (default: `'postFader'`)
|
|
328
|
+
*/
|
|
329
|
+
meterTap(stripIndex: number, tap?: MeterTap): MixMeterSnapshot;
|
|
330
|
+
/**
|
|
331
|
+
* Read a strip's meter snapshot.
|
|
332
|
+
*
|
|
333
|
+
* With no `tap` argument this reads the strip's own (post-fader) meter,
|
|
334
|
+
* matching the Node/Python tap-less `stripMeter` contract. Pass an optional
|
|
335
|
+
* `tap` (`'preFader'` / `'postFader'`) to read the tap-selectable snapshot
|
|
336
|
+
* instead — the same backing call as {@link meterTap}.
|
|
337
|
+
*
|
|
338
|
+
* @param stripIndex - Strip index in `[0, stripCount())`
|
|
339
|
+
* @param tap - Optional tap point (`'preFader'` / `'postFader'`); when omitted
|
|
340
|
+
* the tap-less post-fader strip meter is read.
|
|
341
|
+
*/
|
|
342
|
+
stripMeter(stripIndex: number, tap?: MeterTap | number): MixMeterSnapshot;
|
|
343
|
+
/** Read the post-insert meter for a compiled bus, including master. */
|
|
344
|
+
busMeter(busId: string): MixMeterSnapshot;
|
|
345
|
+
/**
|
|
346
|
+
* Number of blocks in which the strip discarded recursive state because a
|
|
347
|
+
* non-finite value had reached it.
|
|
348
|
+
*
|
|
349
|
+
* Advisory telemetry, and the only thing that separates a degraded strip
|
|
350
|
+
* from a clean one. A discard returns the affected state to its
|
|
351
|
+
* post-reset value, so the strip recovers in silence and the output stays
|
|
352
|
+
* finite and in range while carrying samples unrelated to the input;
|
|
353
|
+
* nothing else reports that this happened.
|
|
354
|
+
*
|
|
355
|
+
* The count covers the strip's own state, its EQ, every insert it owns and
|
|
356
|
+
* both of its meters. None of those is separately addressable here, so a
|
|
357
|
+
* discard inside one is observable only through this number -- and a
|
|
358
|
+
* meter that loses its loudness window then reports the floor, which is
|
|
359
|
+
* exactly what a genuinely silent strip reports, so nothing else
|
|
360
|
+
* distinguishes the two.
|
|
361
|
+
*
|
|
362
|
+
* A meter's own discard lags by one block: it checks its loudness state at
|
|
363
|
+
* the top of a block, before consuming that block's samples, so the block
|
|
364
|
+
* that corrupts it is not the block the count moves on -- read this again
|
|
365
|
+
* after one more block has processed. The EQ and inserts have no such lag;
|
|
366
|
+
* they discard at the end of their own process, in the same block that
|
|
367
|
+
* carried the poison.
|
|
368
|
+
*
|
|
369
|
+
* Cumulative since the strip was created and never cleared, so two
|
|
370
|
+
* readings bracket a span of audio. The unit is one processed block, never
|
|
371
|
+
* a channel, so a stereo block that discards on both channels adds one and
|
|
372
|
+
* the number does not depend on a dimension the caller did not choose.
|
|
373
|
+
*
|
|
374
|
+
* @param stripIndex - Strip index in `[0, stripCount())`
|
|
375
|
+
*/
|
|
376
|
+
stripNonFiniteDiscardCount(stripIndex: number): number;
|
|
377
|
+
/**
|
|
378
|
+
* Number of blocks in which a bus discarded recursive state because a
|
|
379
|
+
* non-finite value had reached it. Same contract as
|
|
380
|
+
* {@link stripNonFiniteDiscardCount}, for a bus: covers every insert the
|
|
381
|
+
* bus owns and its meter, neither separately addressable, so a discard
|
|
382
|
+
* inside one is observable only here. Cumulative across graph recompiles
|
|
383
|
+
* -- the count lives with the bus, not the compiled node, so an unrelated
|
|
384
|
+
* edit elsewhere in the mixer does not reset it.
|
|
385
|
+
*
|
|
386
|
+
* A bus's DSP record is created by the first {@link compile}. Throws for a
|
|
387
|
+
* bus that has been declared with {@link addBus} but never compiled --
|
|
388
|
+
* reading zero there would read as clean, and it is not. Also throws for
|
|
389
|
+
* an unknown bus id.
|
|
390
|
+
*
|
|
391
|
+
* @param busId - Bus id, as passed to {@link addBus} or declared in scene JSON
|
|
392
|
+
*/
|
|
393
|
+
busNonFiniteDiscardCount(busId: string): number;
|
|
394
|
+
/**
|
|
395
|
+
* Schedule sample-accurate fader automation on a strip.
|
|
396
|
+
*
|
|
397
|
+
* @param stripIndex - Strip index in `[0, stripCount())`
|
|
398
|
+
* @param samplePos - Absolute samples from the start of processing
|
|
399
|
+
* @param faderDb - Target fader level in dB
|
|
400
|
+
* @param curve - Interpolation curve (default: `'linear'`)
|
|
401
|
+
*/
|
|
402
|
+
scheduleFaderAutomation(stripIndex: number, samplePos: number, faderDb: number, curve?: AutomationCurve): void;
|
|
403
|
+
/**
|
|
404
|
+
* Schedule sample-accurate pan automation on a strip.
|
|
405
|
+
*
|
|
406
|
+
* @param stripIndex - Strip index in `[0, stripCount())`
|
|
407
|
+
* @param samplePos - Absolute samples from the start of processing
|
|
408
|
+
* @param pan - Target pan position
|
|
409
|
+
* @param curve - Interpolation curve (default: `'linear'`)
|
|
410
|
+
*/
|
|
411
|
+
schedulePanAutomation(stripIndex: number, samplePos: number, pan: number, curve?: AutomationCurve): void;
|
|
412
|
+
/**
|
|
413
|
+
* Schedule sample-accurate width automation on a strip.
|
|
414
|
+
*
|
|
415
|
+
* @param stripIndex - Strip index in `[0, stripCount())`
|
|
416
|
+
* @param samplePos - Absolute samples from the start of processing
|
|
417
|
+
* @param width - Target stereo width
|
|
418
|
+
* @param curve - Interpolation curve (default: `'linear'`)
|
|
419
|
+
*/
|
|
420
|
+
scheduleWidthAutomation(stripIndex: number, samplePos: number, width: number, curve?: AutomationCurve): void;
|
|
421
|
+
/**
|
|
422
|
+
* Schedule sample-accurate send-level automation on a strip's send.
|
|
423
|
+
*
|
|
424
|
+
* @param stripIndex - Strip index in `[0, stripCount())`
|
|
425
|
+
* @param sendIndex - Send index in the strip's add order
|
|
426
|
+
* @param samplePos - Absolute samples from the start of processing
|
|
427
|
+
* @param db - Target send level in dB
|
|
428
|
+
* @param curve - Interpolation curve (default: `'linear'`)
|
|
429
|
+
*/
|
|
430
|
+
scheduleSendAutomation(stripIndex: number, sendIndex: number, samplePos: number, db: number, curve?: AutomationCurve): void;
|
|
431
|
+
/**
|
|
432
|
+
* Read up to `maxPoints` of a strip's most recent goniometer samples
|
|
433
|
+
* (oldest to newest).
|
|
434
|
+
*
|
|
435
|
+
* `maxPoints` must be a finite non-negative integer; anything else throws an
|
|
436
|
+
* `InvalidParameter` error. It is a request rather than an allocation size —
|
|
437
|
+
* a value beyond the strip's goniometer ring simply returns every point the
|
|
438
|
+
* ring holds.
|
|
439
|
+
*/
|
|
440
|
+
readGoniometerLatest(stripIndex: number, maxPoints: number): GoniometerPoint[];
|
|
441
|
+
/** Serialize the current scene (strips, buses, sends, connections) to JSON. */
|
|
442
|
+
toSceneJson(): string;
|
|
443
|
+
/**
|
|
444
|
+
* Longest audible serial processor-tail path to the master, in samples. Lazily
|
|
445
|
+
* compiles the routing graph if the topology is dirty.
|
|
446
|
+
*/
|
|
447
|
+
tailSamples(): number;
|
|
448
|
+
/**
|
|
449
|
+
* Reported latency (samples) of the compiled mixer graph, for aligning
|
|
450
|
+
* dry/wet material. Lazily compiles the routing graph if the topology is dirty.
|
|
451
|
+
*/
|
|
452
|
+
latencySamples(): number;
|
|
453
|
+
/**
|
|
454
|
+
* Drain delayed / tail audio by processing a zero-input block of `numSamples`
|
|
455
|
+
* frames after the host stops feeding strip inputs. Returns the mixed stereo
|
|
456
|
+
* master (`left`, `right`, `sampleRate`).
|
|
457
|
+
*/
|
|
458
|
+
drainTailStereo(numSamples: number): MixerProcessResult;
|
|
459
|
+
/** Release the underlying WASM object. Idempotent, as the Node facade is. */
|
|
460
|
+
delete(): void;
|
|
461
|
+
/** Alias for {@link delete}, provided for cross-binding (Node) compatibility. */
|
|
462
|
+
destroy(): void;
|
|
463
|
+
}
|
|
464
|
+
//# sourceMappingURL=mixer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mixer.d.ts","sourceRoot":"","sources":["../src/mixer.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,QAAQ,EACR,kBAAkB,EAClB,gBAAgB,EAChB,WAAW,EACX,OAAO,EACP,UAAU,EACV,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAExB;;;;;;;;;GASG;AACH,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,oBAAoB;IACnC,sGAAsG;IACtG,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gFAAgF;IAChF,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,YAAY,EAAE,CAAC;IAC3B,WAAW,EAAE,YAAY,EAAE,CAAC;IAC5B,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE,CAAC,UAAU,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;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;IACH,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,kBAAkB;IASvD,6EAA6E;IAC7E,MAAM,IAAI,IAAI;IAQd,iFAAiF;IACjF,OAAO,IAAI,IAAI;CAGhB"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { MixAssistantOptions, MixAssistantResult, MixAssistantTrack } from './public_types';
|
|
2
|
+
/** Inputs for the {@link suggestMixScene} / {@link suggestMixSceneJson} facades. */
|
|
3
|
+
export interface SuggestMixSceneRequest {
|
|
4
|
+
/** Tracks to mix, in the order their profiles are reported. */
|
|
5
|
+
tracks: MixAssistantTrack[];
|
|
6
|
+
/**
|
|
7
|
+
* Shared sample rate in Hz for every track. Required: every band edge,
|
|
8
|
+
* high-pass corner, sibilance band and alignment lag is derived from it, so a
|
|
9
|
+
* guessed rate would silently misread 44.1 kHz material by 8.8% and report
|
|
10
|
+
* `channelDelaySamples` and `durationSec` wrong with it.
|
|
11
|
+
*/
|
|
12
|
+
sampleRate: number;
|
|
13
|
+
/** Assistant tunables; every field falls back to the core default. */
|
|
14
|
+
options?: MixAssistantOptions;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Analyze a set of tracks and suggest a mixer scene.
|
|
18
|
+
*
|
|
19
|
+
* Offline only: the pipeline runs an STFT per track and evaluates every track
|
|
20
|
+
* pair, so it is measured in milliseconds per track and must never be called
|
|
21
|
+
* from an audio callback.
|
|
22
|
+
*
|
|
23
|
+
* The assistant suggests, it does not apply. Nothing is processed and no audio
|
|
24
|
+
* is returned; realizing the suggestion means handing the scene to
|
|
25
|
+
* {@link Mixer.fromSceneJson} as an explicit second step, for which
|
|
26
|
+
* {@link suggestMixSceneJson} returns the scene already serialized.
|
|
27
|
+
*
|
|
28
|
+
* Degenerate input is not an error: no tracks, all-silent tracks or tracks too
|
|
29
|
+
* short to measure yield an empty scene and an empty `explanation`.
|
|
30
|
+
*
|
|
31
|
+
* @param request - Tracks, shared sample rate and assistant options
|
|
32
|
+
* @returns The suggested scene, per-track profiles, cross-track measurements
|
|
33
|
+
* and the explanation behind each change
|
|
34
|
+
*/
|
|
35
|
+
export declare function suggestMixScene(request: SuggestMixSceneRequest): MixAssistantResult;
|
|
36
|
+
/**
|
|
37
|
+
* Suggest a mixer scene and return only the scene, as JSON.
|
|
38
|
+
*
|
|
39
|
+
* The same analysis as {@link suggestMixScene}, serialized in the schema
|
|
40
|
+
* {@link Mixer.fromSceneJson} reads, so a caller that only wants to apply the
|
|
41
|
+
* suggestion neither digs the scene out of the fuller result nor re-serializes
|
|
42
|
+
* it.
|
|
43
|
+
*
|
|
44
|
+
* @param request - Tracks, shared sample rate and assistant options
|
|
45
|
+
* @returns Scene JSON string
|
|
46
|
+
*/
|
|
47
|
+
export declare function suggestMixSceneJson(request: SuggestMixSceneRequest): string;
|
|
48
|
+
/**
|
|
49
|
+
* Source-class identifiers the assistant can report, in enum order.
|
|
50
|
+
*
|
|
51
|
+
* The index of a name in this list is the value
|
|
52
|
+
* {@link mixSourceClassFromName} resolves it to.
|
|
53
|
+
*/
|
|
54
|
+
export declare function mixSourceClassNames(): string[];
|
|
55
|
+
/**
|
|
56
|
+
* Resolve a source-class identifier to its index in {@link mixSourceClassNames}.
|
|
57
|
+
*
|
|
58
|
+
* @param name - Source-class identifier, e.g. `"kick"`
|
|
59
|
+
* @returns The index, or -1 when the name is unknown
|
|
60
|
+
*/
|
|
61
|
+
export declare function mixSourceClassFromName(name: string): number;
|
|
62
|
+
//# sourceMappingURL=mixing_assistant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mixing_assistant.d.ts","sourceRoot":"","sources":["../src/mixing_assistant.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAOjG,oFAAoF;AACpF,MAAM,WAAW,sBAAsB;IACrC,+DAA+D;IAC/D,MAAM,EAAE,iBAAiB,EAAE,CAAC;IAC5B;;;;;OAKG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,sEAAsE;IACtE,OAAO,CAAC,EAAE,mBAAmB,CAAC;CAC/B;AA4DD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,kBAAkB,CAEnF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,sBAAsB,GAAG,MAAM,CAE3E;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,EAAE,CAE9C;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE3D"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { MixOptions, MixResult } from './public_types';
|
|
2
|
+
export declare function mixingScenePresetNames(): string[];
|
|
3
|
+
/**
|
|
4
|
+
* Get a built-in mixing scene preset serialized as JSON. This is the canonical
|
|
5
|
+
* name shared with the Node and Python bindings; the returned JSON loads
|
|
6
|
+
* directly into a {@link Mixer} via {@link Mixer.fromSceneJson}.
|
|
7
|
+
*
|
|
8
|
+
* @param presetName - Preset name (see {@link mixingScenePresetNames})
|
|
9
|
+
* @returns Scene JSON string
|
|
10
|
+
*/
|
|
11
|
+
export declare function mixingScenePresetJson(presetName: string): string;
|
|
12
|
+
/** Inputs for the one-shot {@link mixStereo} facade. */
|
|
13
|
+
export interface MixStereoRequest extends MixOptions {
|
|
14
|
+
leftChannels: Float32Array[];
|
|
15
|
+
rightChannels: Float32Array[];
|
|
16
|
+
sampleRate?: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* One-shot stereo mix of multiple strips through the routing graph + master bus.
|
|
20
|
+
*
|
|
21
|
+
* Each returned per-strip meter reflects only this single one-shot block. The
|
|
22
|
+
* LUFS fields (`momentaryLufs`, `shortTermLufs`, `integratedLufs`) are
|
|
23
|
+
* integrators whose windows that block does not fill, so they read the -120 dB
|
|
24
|
+
* floor sentinel; drive a streaming {@link Mixer} block-by-block if you need
|
|
25
|
+
* meaningful loudness.
|
|
26
|
+
*
|
|
27
|
+
* The true-peak fields are not integrators and need no streaming: each is a
|
|
28
|
+
* max-hold over the block just processed and is valid from the first one,
|
|
29
|
+
* flooring only on silence. This facade mixes the whole input as a single block,
|
|
30
|
+
* which is the whole-signal case, so the block-edge under-read documented on
|
|
31
|
+
* `MixMeterSnapshot.truePeakDbL` does not apply to the reading here.
|
|
32
|
+
*
|
|
33
|
+
* @param leftChannels - Per-strip left input buffers (all the same length)
|
|
34
|
+
* @param rightChannels - Per-strip right input buffers (all the same length)
|
|
35
|
+
* @param sampleRate - Sample rate in Hz
|
|
36
|
+
* @param options - Per-strip mix options (trim, fader, pan, width, mute)
|
|
37
|
+
*/
|
|
38
|
+
export declare function mixStereo(request: MixStereoRequest): MixResult;
|
|
39
|
+
export declare function mixStereo(leftChannels: Float32Array[], rightChannels: Float32Array[], sampleRate?: number, options?: MixOptions): MixResult;
|
|
40
|
+
//# sourceMappingURL=mixing_oneshot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mixing_oneshot.d.ts","sourceRoot":"","sources":["../src/mixing_oneshot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAM5D,wBAAgB,sBAAsB,IAAI,MAAM,EAAE,CAEjD;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED,wDAAwD;AACxD,MAAM,WAAW,gBAAiB,SAAQ,UAAU;IAClD,YAAY,EAAE,YAAY,EAAE,CAAC;IAC7B,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,SAAS,CAAC;AAChE,wBAAgB,SAAS,CACvB,YAAY,EAAE,YAAY,EAAE,EAC5B,aAAa,EAAE,YAAY,EAAE,EAC7B,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,UAAU,GACnB,SAAS,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SonareModule } from './sonare.js';
|
|
2
|
+
/**
|
|
3
|
+
* Recover the native exception-object pointer from a value thrown across the
|
|
4
|
+
* WASM boundary. emscripten surfaces a C++ throw in two shapes depending on the
|
|
5
|
+
* toolchain/exception mode:
|
|
6
|
+
* - a raw pointer number (older / classic surfacing), or
|
|
7
|
+
* - a `CppException` object exposing the pointer as `excPtr` (emscripten with
|
|
8
|
+
* `-fexceptions`).
|
|
9
|
+
* Returns null when the thrown value is neither (a genuine JS error), so the
|
|
10
|
+
* caller rethrows it unchanged.
|
|
11
|
+
*/
|
|
12
|
+
export declare function nativeExceptionPtr(error: unknown): number | null;
|
|
13
|
+
export declare function setSonareModule(module: SonareModule): void;
|
|
14
|
+
export declare function getSonareModule(): SonareModule;
|
|
15
|
+
//# sourceMappingURL=module_state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module_state.d.ts","sourceRoot":"","sources":["../src/module_state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAahD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAWhE;AAsKD,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAE1D;AAED,wBAAgB,eAAe,IAAI,YAAY,CAK9C"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ClipPageProvider, ClipPageRequest, RealtimeEngine } from './realtime_engine';
|
|
2
|
+
export interface OpfsClipPageProviderOptions {
|
|
3
|
+
path: string;
|
|
4
|
+
numChannels: number;
|
|
5
|
+
numSamples: number;
|
|
6
|
+
pageFrames: number;
|
|
7
|
+
dataOffsetBytes?: number;
|
|
8
|
+
worker?: Worker;
|
|
9
|
+
terminateWorkerOnClose?: boolean;
|
|
10
|
+
/** Internal bridge hook used to mirror a supplied page into an AudioWorklet. */
|
|
11
|
+
onPageSupplied?: (pageIndex: number, channels: Float32Array[]) => void;
|
|
12
|
+
/** Internal bridge hook used to mirror an eviction into an AudioWorklet. */
|
|
13
|
+
onPageCleared?: (pageIndex: number) => void;
|
|
14
|
+
/** Internal bridge hook called after the local provider is destroyed. */
|
|
15
|
+
onClose?: () => void;
|
|
16
|
+
}
|
|
17
|
+
export interface OpfsClipPageProviderBinding {
|
|
18
|
+
provider: ClipPageProvider;
|
|
19
|
+
supplyPage(pageIndex: number): Promise<boolean>;
|
|
20
|
+
supplyRequest(request: ClipPageRequest): Promise<boolean>;
|
|
21
|
+
/** Evict one resident page from every configured consumer. */
|
|
22
|
+
clearPage?(pageIndex: number): void;
|
|
23
|
+
close(): void;
|
|
24
|
+
}
|
|
25
|
+
export declare const opfsClipPageWorkerSource = "\nconst sonareClipPageReadQueues = new Map();\n\nfunction sonareEnqueueClipPageRead(key, task) {\n const previous = sonareClipPageReadQueues.get(key) || Promise.resolve();\n const next = previous.catch(() => undefined).then(task);\n const queued = next.finally(() => {\n if (sonareClipPageReadQueues.get(key) === queued) {\n sonareClipPageReadQueues.delete(key);\n }\n });\n sonareClipPageReadQueues.set(key, queued);\n return next;\n}\n\nself.onmessage = async (event) => {\n const message = event.data;\n if (!message || message.type !== 'sonare:read-clip-page') return;\n const { requestId, path, pageIndex, numChannels, numSamples, pageFrames, dataOffsetBytes = 0 } = message;\n await sonareEnqueueClipPageRead(String(path), async () => {\n try {\n if (pageIndex < 0) {\n self.postMessage({ type: 'sonare:clip-page', requestId, pageIndex, ok: false });\n return;\n }\n const startFrame = pageIndex * pageFrames;\n if (startFrame >= numSamples) {\n self.postMessage({ type: 'sonare:clip-page', requestId, pageIndex, ok: false });\n return;\n }\n const root = await self.navigator.storage.getDirectory();\n let dir = root;\n const parts = String(path).split('/').filter(Boolean);\n for (let i = 0; i < parts.length - 1; ++i) {\n dir = await dir.getDirectoryHandle(parts[i]);\n }\n const fileHandle = await dir.getFileHandle(parts[parts.length - 1]);\n const access = await fileHandle.createSyncAccessHandle();\n try {\n const frames = Math.min(pageFrames, numSamples - startFrame);\n const frameBytes = numChannels * 4;\n const bytes = new Uint8Array(frames * frameBytes);\n let bytesReadTotal = 0;\n const readOffset = dataOffsetBytes + startFrame * frameBytes;\n while (bytesReadTotal < bytes.byteLength) {\n const bytesRead = access.read(bytes.subarray(bytesReadTotal), {\n at: readOffset + bytesReadTotal,\n });\n if (bytesRead <= 0) {\n break;\n }\n bytesReadTotal += bytesRead;\n }\n if (bytesReadTotal !== bytes.byteLength || bytesReadTotal % frameBytes !== 0) {\n self.postMessage({ type: 'sonare:clip-page', requestId, pageIndex, ok: false });\n return;\n }\n const framesRead = bytesReadTotal / frameBytes;\n const view = new DataView(bytes.buffer, 0, framesRead * frameBytes);\n const channelBuffers = Array.from({ length: numChannels }, () => new ArrayBuffer(framesRead * 4));\n for (let ch = 0; ch < numChannels; ++ch) {\n const channel = new Float32Array(channelBuffers[ch]);\n for (let frame = 0; frame < framesRead; ++frame) {\n channel[frame] = view.getFloat32((frame * numChannels + ch) * 4, true);\n }\n }\n self.postMessage(\n { type: 'sonare:clip-page', requestId, pageIndex, ok: true, frames: framesRead, channelBuffers },\n channelBuffers,\n );\n } finally {\n access.close();\n }\n } catch (error) {\n self.postMessage({\n type: 'sonare:clip-page',\n requestId,\n pageIndex,\n ok: false,\n error: error instanceof Error ? error.message : String(error),\n });\n }\n });\n};\n";
|
|
26
|
+
export declare function createOpfsClipPageWorker(): Worker;
|
|
27
|
+
export declare function createOpfsClipPageProvider(engine: RealtimeEngine, options: OpfsClipPageProviderOptions): OpfsClipPageProviderBinding;
|
|
28
|
+
//# sourceMappingURL=opfs_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