@libraz/libsonare 1.8.0 → 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.
Files changed (85) hide show
  1. package/README.md +2 -2
  2. package/dist/_effects_common.d.ts +2 -1
  3. package/dist/_effects_common.d.ts.map +1 -1
  4. package/dist/analysis.js +1 -0
  5. package/dist/analysis.js.map +1 -1
  6. package/dist/effects_mastering.d.ts +2 -2
  7. package/dist/effects_mastering.d.ts.map +1 -1
  8. package/dist/effects_note_ops.d.ts +55 -30
  9. package/dist/effects_note_ops.d.ts.map +1 -1
  10. package/dist/effects_timepitch.d.ts +17 -12
  11. package/dist/effects_timepitch.d.ts.map +1 -1
  12. package/dist/feature_decompose.d.ts +1 -1
  13. package/dist/feature_decompose.d.ts.map +1 -1
  14. package/dist/index.d.ts +3 -3
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +216 -60
  17. package/dist/index.js.map +1 -1
  18. package/dist/mastering_core.d.ts +27 -1
  19. package/dist/mastering_core.d.ts.map +1 -1
  20. package/dist/mixer.d.ts.map +1 -1
  21. package/dist/project_types.d.ts +7 -5
  22. package/dist/project_types.d.ts.map +1 -1
  23. package/dist/public_types_mastering.d.ts +19 -1
  24. package/dist/public_types_mastering.d.ts.map +1 -1
  25. package/dist/public_types_playback.d.ts +1 -0
  26. package/dist/public_types_playback.d.ts.map +1 -1
  27. package/dist/public_types_spectral.d.ts +5 -5
  28. package/dist/public_types_spectral.d.ts.map +1 -1
  29. package/dist/realtime_engine.d.ts +49 -6
  30. package/dist/realtime_engine.d.ts.map +1 -1
  31. package/dist/sonare-analysis.wasm +0 -0
  32. package/dist/sonare.d.ts +36 -0
  33. package/dist/sonare.js +1 -1
  34. package/dist/sonare.wasm +0 -0
  35. package/dist/streaming_processors.d.ts +5 -0
  36. package/dist/streaming_processors.d.ts.map +1 -1
  37. package/dist/worker.js.map +1 -1
  38. package/dist/worklet/engine-mixer-facade.d.ts +40 -4
  39. package/dist/worklet/engine-mixer-facade.d.ts.map +1 -1
  40. package/dist/worklet/engine-node.d.ts +2 -0
  41. package/dist/worklet/engine-node.d.ts.map +1 -1
  42. package/dist/worklet/engine-processor.d.ts +4 -0
  43. package/dist/worklet/engine-processor.d.ts.map +1 -1
  44. package/dist/worklet/engine-strips.d.ts +4 -2
  45. package/dist/worklet/engine-strips.d.ts.map +1 -1
  46. package/dist/worklet/engine-sync.d.ts +4 -2
  47. package/dist/worklet/engine-sync.d.ts.map +1 -1
  48. package/dist/worklet/engine.d.ts +27 -6
  49. package/dist/worklet/engine.d.ts.map +1 -1
  50. package/dist/worklet/guards.d.ts +7 -1
  51. package/dist/worklet/guards.d.ts.map +1 -1
  52. package/dist/worklet/messages.d.ts +4 -4
  53. package/dist/worklet/messages.d.ts.map +1 -1
  54. package/dist/worklet/mixer-processor.d.ts +2 -2
  55. package/dist/worklet/mixer-processor.d.ts.map +1 -1
  56. package/dist/worklet/protocol.d.ts +10 -2
  57. package/dist/worklet/protocol.d.ts.map +1 -1
  58. package/dist/worklet.js +585 -188
  59. package/dist/worklet.js.map +1 -1
  60. package/package.json +1 -1
  61. package/src/_effects_common.ts +36 -6
  62. package/src/effects_mastering.ts +4 -0
  63. package/src/effects_note_ops.ts +92 -44
  64. package/src/effects_timepitch.ts +42 -31
  65. package/src/feature_decompose.ts +2 -2
  66. package/src/index.ts +6 -0
  67. package/src/mastering_core.ts +95 -0
  68. package/src/mixer.ts +39 -19
  69. package/src/project_types.ts +7 -5
  70. package/src/public_types_mastering.ts +21 -0
  71. package/src/public_types_playback.ts +1 -0
  72. package/src/public_types_spectral.ts +5 -5
  73. package/src/realtime_engine.ts +71 -15
  74. package/src/sonare.js.d.ts +36 -0
  75. package/src/streaming_processors.ts +8 -0
  76. package/src/worklet/engine-mixer-facade.ts +420 -86
  77. package/src/worklet/engine-node.ts +22 -4
  78. package/src/worklet/engine-processor.ts +83 -33
  79. package/src/worklet/engine-strips.ts +5 -10
  80. package/src/worklet/engine-sync.ts +6 -1
  81. package/src/worklet/engine.ts +49 -37
  82. package/src/worklet/guards.ts +55 -0
  83. package/src/worklet/messages.ts +4 -2
  84. package/src/worklet/mixer-processor.ts +10 -3
  85. package/src/worklet/protocol.ts +29 -8
package/dist/index.js CHANGED
@@ -624,13 +624,30 @@ function alignTakeToReference(request) {
624
624
  }
625
625
 
626
626
  // src/_effects_common.ts
627
- function toVoicedFloat32(voiced) {
627
+ function toVoicedFloat32(fnName, voiced) {
628
+ if (!(voiced instanceof Int32Array || voiced instanceof Uint8Array || voiced instanceof Float32Array || Array.isArray(voiced))) {
629
+ throw new TypeError(
630
+ `${fnName}: voiced must be an Int32Array, Uint8Array, Float32Array, number[], or boolean[]`
631
+ );
632
+ }
628
633
  const out = new Float32Array(voiced.length);
629
634
  for (let index = 0; index < voiced.length; index += 1) {
630
- out[index] = voiced[index] ? 1 : 0;
635
+ const value = voiced[index];
636
+ if (typeof value !== "number" && typeof value !== "boolean") {
637
+ throw new TypeError(`${fnName}: voiced array entries must be numbers or booleans`);
638
+ }
639
+ out[index] = value ? 1 : 0;
631
640
  }
632
641
  return out;
633
642
  }
643
+ function assertPitchTrackLengths(fnName, f0Hz, voiced, voicedProb) {
644
+ if (voiced != null && voiced.length !== f0Hz.length) {
645
+ throw new RangeError(`${fnName}: voiced must have the same length as f0Hz`);
646
+ }
647
+ if (voiced == null && voicedProb != null && voicedProb.length !== f0Hz.length) {
648
+ throw new RangeError(`${fnName}: voicedProb must have the same length as f0Hz`);
649
+ }
650
+ }
634
651
 
635
652
  // src/effects_note_ops.ts
636
653
  function requireModule() {
@@ -639,13 +656,9 @@ function requireModule() {
639
656
  function assertNoteTrack(fnName, request) {
640
657
  assertSamples(fnName, request.samples, request.validate !== false);
641
658
  assertSampleRate(fnName, request.sampleRate);
642
- if (request.voiced && request.voiced.length !== request.f0Hz.length) {
643
- throw new RangeError(`${fnName}: voiced length must match f0Hz length`);
644
- }
645
- if (request.voicedProb && request.voicedProb.length !== request.f0Hz.length) {
646
- throw new RangeError(`${fnName}: voicedProb length must match f0Hz length`);
647
- }
648
- return request.voiced ? toVoicedFloat32(request.voiced) : void 0;
659
+ const voicedF32 = request.voiced == null ? void 0 : toVoicedFloat32(fnName, request.voiced);
660
+ assertPitchTrackLengths(fnName, request.f0Hz, request.voiced, request.voicedProb);
661
+ return voicedF32;
649
662
  }
650
663
  function noteStretch(samples, sampleRate = 22050, options = {}) {
651
664
  const request = samples instanceof Float32Array ? { samples, sampleRate, ...options } : samples;
@@ -675,20 +688,46 @@ function extractNotes(request) {
675
688
  request.samples,
676
689
  request.sampleRate,
677
690
  request.f0Hz,
678
- request.voicedProb,
691
+ request.voiced == null ? request.voicedProb ?? void 0 : void 0,
679
692
  voicedF32,
680
693
  request.frameRate,
681
694
  request
682
695
  );
683
696
  }
684
697
  function renderNotes(request) {
685
- assertSamples("renderNotes", request.samples, request.validate !== false);
686
698
  assertSampleRate("renderNotes", request.sampleRate);
687
- return requireModule().renderNotes(request.samples, request.sampleRate, request.notes, request);
699
+ if (!Array.isArray(request.notes)) {
700
+ throw new TypeError("renderNotes: notes must be an array");
701
+ }
702
+ const f0Hz = request.f0Hz;
703
+ if (f0Hz !== void 0 && !(f0Hz instanceof Float32Array)) {
704
+ throw new TypeError("renderNotes: f0Hz must be a Float32Array");
705
+ }
706
+ if (f0Hz !== void 0) {
707
+ assertFiniteScalar("renderNotes", request.frameRate, "frameRate");
708
+ }
709
+ const { voiced: publicVoiced, ...withoutVoiced } = request;
710
+ const voiced = publicVoiced == null ? void 0 : toVoicedFloat32("renderNotes", publicVoiced);
711
+ if (publicVoiced != null && f0Hz === void 0) {
712
+ throw new RangeError("renderNotes: voiced requires f0Hz");
713
+ }
714
+ if (f0Hz !== void 0) {
715
+ assertPitchTrackLengths("renderNotes", f0Hz, publicVoiced);
716
+ }
717
+ assertSamples("renderNotes", request.samples, request.validate !== false);
718
+ const options = { ...withoutVoiced, voiced };
719
+ return requireModule().renderNotes(request.samples, request.sampleRate, request.notes, options);
688
720
  }
689
721
  function decomposeNotePitch(request) {
722
+ if (!(request.f0Hz instanceof Float32Array)) {
723
+ throw new TypeError("decomposeNotePitch: f0Hz must be a Float32Array");
724
+ }
725
+ assertFiniteScalar("decomposeNotePitch", request.frameRate, "frameRate");
726
+ const voiced = request.voiced == null ? void 0 : toVoicedFloat32("decomposeNotePitch", request.voiced);
727
+ assertPitchTrackLengths("decomposeNotePitch", request.f0Hz, request.voiced);
690
728
  return requireModule().decomposeNotePitch(
691
729
  request.f0Hz,
730
+ voiced,
692
731
  request.frameRate,
693
732
  request.medianHz,
694
733
  request.vibratoCutoffHz ?? 0
@@ -700,7 +739,7 @@ function splitNote(request) {
700
739
  request.samples,
701
740
  request.sampleRate,
702
741
  request.f0Hz,
703
- request.voicedProb,
742
+ request.voiced == null ? request.voicedProb ?? void 0 : void 0,
704
743
  voicedF32,
705
744
  request.frameRate,
706
745
  request.notes,
@@ -715,7 +754,7 @@ function mergeNotes(request) {
715
754
  request.samples,
716
755
  request.sampleRate,
717
756
  request.f0Hz,
718
- request.voicedProb,
757
+ request.voiced == null ? request.voicedProb ?? void 0 : void 0,
719
758
  voicedF32,
720
759
  request.frameRate,
721
760
  request.notes,
@@ -912,13 +951,13 @@ function pitchCorrectToMidiTimevarying(samples, f0Hz, targetMidi, sampleRate = 2
912
951
  ...options
913
952
  } : samples;
914
953
  assertSamples("pitchCorrectToMidiTimevarying", request.samples, request.validate !== false);
915
- if (request.voiced && request.voiced.length !== request.f0Hz.length) {
916
- throw new RangeError("pitchCorrectToMidiTimevarying: voiced length must match f0Hz length");
917
- }
918
- if (request.voicedProb && request.voicedProb.length !== request.f0Hz.length) {
919
- throw new RangeError("pitchCorrectToMidiTimevarying: voicedProb length must match f0Hz length");
920
- }
921
- const voicedF32 = request.voiced ? toVoicedFloat32(request.voiced) : void 0;
954
+ const voicedF32 = request.voiced == null ? void 0 : toVoicedFloat32("pitchCorrectToMidiTimevarying", request.voiced);
955
+ assertPitchTrackLengths(
956
+ "pitchCorrectToMidiTimevarying",
957
+ request.f0Hz,
958
+ request.voiced,
959
+ request.voicedProb
960
+ );
922
961
  return requireModule5().pitchCorrectToMidiTimevarying(
923
962
  request.samples,
924
963
  request.sampleRate ?? 22050,
@@ -926,21 +965,23 @@ function pitchCorrectToMidiTimevarying(samples, f0Hz, targetMidi, sampleRate = 2
926
965
  request.targetMidi,
927
966
  request.hopLength ?? 512,
928
967
  voicedF32,
929
- request.voicedProb
968
+ request.voiced == null ? request.voicedProb ?? void 0 : void 0
930
969
  );
931
970
  }
932
971
  function pitchCorrectTimevarying(samples, f0Hz, sampleRate = 22050, hopLength = 512, options = {}) {
933
972
  const request = samples instanceof Float32Array ? { samples, f0Hz, sampleRate, hopLength, ...options } : samples;
934
973
  assertSamples("pitchCorrectTimevarying", request.samples, request.validate !== false);
935
- if (request.voiced && request.voiced.length !== request.f0Hz.length) {
936
- throw new RangeError("pitchCorrectTimevarying: voiced length must match f0Hz length");
937
- }
938
- if (request.voicedProb && request.voicedProb.length !== request.f0Hz.length) {
939
- throw new RangeError("pitchCorrectTimevarying: voicedProb length must match f0Hz length");
940
- }
974
+ const voicedF32 = request.voiced == null ? void 0 : toVoicedFloat32("pitchCorrectTimevarying", request.voiced);
975
+ assertPitchTrackLengths(
976
+ "pitchCorrectTimevarying",
977
+ request.f0Hz,
978
+ request.voiced,
979
+ request.voicedProb
980
+ );
941
981
  const nativeOptions = {
942
982
  ...request,
943
- voiced: request.voiced ? toVoicedFloat32(request.voiced) : void 0
983
+ voiced: voicedF32,
984
+ voicedProb: request.voiced == null ? request.voicedProb ?? void 0 : void 0
944
985
  };
945
986
  return requireModule5().pitchCorrectTimevarying(
946
987
  request.samples,
@@ -1369,6 +1410,32 @@ function masteringPairProcess(processorName, source, reference, sampleRate = 220
1369
1410
  request.params ?? {}
1370
1411
  );
1371
1412
  }
1413
+ function masteringPairProcessStereo(processorName, sourceLeft, sourceRight, referenceLeft, referenceRight, sampleRate = 22050, params = {}) {
1414
+ const request = typeof processorName === "string" ? {
1415
+ processorName,
1416
+ sourceLeft,
1417
+ sourceRight,
1418
+ referenceLeft,
1419
+ referenceRight,
1420
+ sampleRate,
1421
+ params
1422
+ } : processorName;
1423
+ if (request.sourceLeft.length !== request.sourceRight.length) {
1424
+ throw new Error("Source left and right channel lengths must match.");
1425
+ }
1426
+ if (request.referenceLeft.length !== request.referenceRight.length) {
1427
+ throw new Error("Reference left and right channel lengths must match.");
1428
+ }
1429
+ return requireModule8().masteringPairProcessStereo(
1430
+ request.processorName,
1431
+ request.sourceLeft,
1432
+ request.sourceRight,
1433
+ request.referenceLeft,
1434
+ request.referenceRight,
1435
+ request.sampleRate ?? 22050,
1436
+ request.params ?? {}
1437
+ );
1438
+ }
1372
1439
  function masteringPairAnalyze(analysisName, source, reference, sampleRate = 22050, params = {}) {
1373
1440
  const request = typeof analysisName === "string" ? {
1374
1441
  analysisName,
@@ -1392,6 +1459,21 @@ function masteringAbMatchLoudness(request) {
1392
1459
  request.sampleRate ?? 22050
1393
1460
  );
1394
1461
  }
1462
+ function masteringAbMatchLoudnessStereo(request) {
1463
+ if (request.sourceLeft.length !== request.sourceRight.length) {
1464
+ throw new Error("Source left and right channel lengths must match.");
1465
+ }
1466
+ if (request.referenceLeft.length !== request.referenceRight.length) {
1467
+ throw new Error("Reference left and right channel lengths must match.");
1468
+ }
1469
+ return requireModule8().masteringAbMatchLoudnessStereo(
1470
+ request.sourceLeft,
1471
+ request.sourceRight,
1472
+ request.referenceLeft,
1473
+ request.referenceRight,
1474
+ request.sampleRate ?? 22050
1475
+ );
1476
+ }
1395
1477
  function masteringStereoAnalyze(analysisName, left, right, sampleRate = 22050, params = {}) {
1396
1478
  const request = typeof analysisName === "string" ? {
1397
1479
  analysisName,
@@ -2029,7 +2111,7 @@ function decomposeWithInit(s, nFeatures = 0, nFrames = 0, nComponents = 0, nIter
2029
2111
  return requireModule16().decomposeWithInit(s, nFeatures, nFrames, nComponents, nIter, beta, init2);
2030
2112
  }
2031
2113
  function decomposeStems(request) {
2032
- return requireModule16().decomposeStems(request.samples, request.sampleRate, {
2114
+ return requireModule16().decomposeStems(request.samples, request.sampleRate ?? 22050, {
2033
2115
  nComponents: request.nComponents,
2034
2116
  nFft: request.nFft,
2035
2117
  hopLength: request.hopLength,
@@ -6674,7 +6756,10 @@ var RealtimeEngine = class _RealtimeEngine {
6674
6756
  /**
6675
6757
  * Route a destination's (track lane's) MIDI to the external output queue
6676
6758
  * instead of the internal instrument rack, so the track plays an external
6677
- * device. Clearing it restores internal-synth playback.
6759
+ * device. Clearing it restores internal-synth playback. Control-thread only.
6760
+ * The change takes effect at the next processed block; switching a
6761
+ * destination's route first releases its notes and resets its controllers
6762
+ * through the old route, and drops its pending MIDI-FX events. Single writer.
6678
6763
  */
6679
6764
  setMidiDestinationExternal(destinationId, external) {
6680
6765
  this.native.setMidiDestinationExternal(destinationId, external);
@@ -6828,8 +6913,11 @@ var RealtimeEngine = class _RealtimeEngine {
6828
6913
  /**
6829
6914
  * Queue an immediate (live) MIDI SysEx frame to a MIDI destination. `data` is
6830
6915
  * the full message including the leading 0xF0 and trailing 0xF7 (1..512
6831
- * bytes). `renderFrame` is the frame to fire at, or -1 for immediate. Mirrors
6832
- * the Node/Python/C-ABI `pushMidiSysex`.
6916
+ * bytes). `renderFrame` is the frame to fire at, or -1 for immediate. Throws
6917
+ * `InvalidParameter` when the destination instrument cannot prepare
6918
+ * the SysEx (retrying cannot help), and `OutOfMemory` when the payload
6919
+ * slots or the command queue are full (retry after a processed block).
6920
+ * Mirrors the Node/Python/C-ABI `pushMidiSysex`.
6833
6921
  */
6834
6922
  pushMidiSysex(destinationId, data, renderFrame = -1) {
6835
6923
  this.native.pushMidiSysex(destinationId, data, renderFrame);
@@ -6852,12 +6940,30 @@ var RealtimeEngine = class _RealtimeEngine {
6852
6940
  getTransportState() {
6853
6941
  return this.native.getTransportState();
6854
6942
  }
6943
+ /** Queues an integrated-loudness reset; short-term and momentary windows are retained. */
6944
+ resetMasterLoudnessMeter(renderFrame = -1) {
6945
+ this.native.resetMasterLoudnessMeter(renderFrame);
6946
+ }
6947
+ /** Reads the immutable factory value for a resolved insert parameter id. */
6948
+ insertParameterConstructedValue(paramId) {
6949
+ return this.native.insertParameterConstructedValue(paramId);
6950
+ }
6855
6951
  play(renderFrame = -1) {
6856
6952
  this.native.play(renderFrame);
6857
6953
  }
6954
+ /**
6955
+ * A loop wrap, seek or stop sends note-offs plus CC64=0, CC121, CC123 and a
6956
+ * centred pitch bend on every channel played since the last reset, so
6957
+ * controller values set before a loop region are not restored at the wrap.
6958
+ */
6858
6959
  stop(renderFrame = -1) {
6859
6960
  this.native.stop(renderFrame);
6860
6961
  }
6962
+ /**
6963
+ * A loop wrap, seek or stop sends note-offs plus CC64=0, CC121, CC123 and a
6964
+ * centred pitch bend on every channel played since the last reset, so
6965
+ * controller values set before a loop region are not restored at the wrap.
6966
+ */
6861
6967
  seekSample(timelineSample, renderFrame = -1) {
6862
6968
  this.native.seekSample(timelineSample, renderFrame);
6863
6969
  }
@@ -6882,6 +6988,11 @@ var RealtimeEngine = class _RealtimeEngine {
6882
6988
  applyCommandsDueNowPreservingFuture() {
6883
6989
  this.native.applyCommandsDueNowPreservingFuture();
6884
6990
  }
6991
+ /**
6992
+ * A loop wrap, seek or stop sends note-offs plus CC64=0, CC121, CC123 and a
6993
+ * centred pitch bend on every channel played since the last reset, so
6994
+ * controller values set before a loop region are not restored at the wrap.
6995
+ */
6885
6996
  seekPpq(ppq, renderFrame = -1) {
6886
6997
  this.native.seekPpq(ppq, renderFrame);
6887
6998
  }
@@ -6901,6 +7012,11 @@ var RealtimeEngine = class _RealtimeEngine {
6901
7012
  sampleAtPpq(ppq) {
6902
7013
  return Number(this.native.sampleAtPpq(ppq));
6903
7014
  }
7015
+ /**
7016
+ * A loop wrap, seek or stop sends note-offs plus CC64=0, CC121, CC123 and a
7017
+ * centred pitch bend on every channel played since the last reset, so
7018
+ * controller values set before a loop region are not restored at the wrap.
7019
+ */
6904
7020
  setLoop(startPpq, endPpq, enabled = true) {
6905
7021
  this.native.setLoop(startPpq, endPpq, enabled);
6906
7022
  }
@@ -6995,10 +7111,10 @@ var RealtimeEngine = class _RealtimeEngine {
6995
7111
  if (typeof lane === "number") {
6996
7112
  return { trackId: lane };
6997
7113
  }
6998
- if (!lane.sends) {
6999
- return lane;
7000
- }
7001
- return { ...lane, sends: _RealtimeEngine.normalizeSends(lane.sends) };
7114
+ return {
7115
+ ...lane,
7116
+ sends: lane.sends ? _RealtimeEngine.normalizeSends(lane.sends) : void 0
7117
+ };
7002
7118
  })
7003
7119
  );
7004
7120
  }
@@ -7011,9 +7127,10 @@ var RealtimeEngine = class _RealtimeEngine {
7011
7127
  }
7012
7128
  setTrackBuses(buses) {
7013
7129
  this.native.setTrackBuses(
7014
- Array.isArray(buses) ? buses.map(
7015
- (bus) => bus.sends ? { ...bus, sends: _RealtimeEngine.normalizeSends(bus.sends) } : bus
7016
- ) : buses
7130
+ Array.isArray(buses) ? buses.map((bus) => ({
7131
+ ...bus,
7132
+ sends: bus.sends ? _RealtimeEngine.normalizeSends(bus.sends) : void 0
7133
+ })) : buses
7017
7134
  );
7018
7135
  }
7019
7136
  /**
@@ -7167,6 +7284,16 @@ var RealtimeEngine = class _RealtimeEngine {
7167
7284
  * stages of the offline mastering chain (`repair.*`, `loudness`, and the
7168
7285
  * match stages) have no insert form and no automation id: they buffer the
7169
7286
  * entire signal by construction and do not run on the realtime path.
7287
+ *
7288
+ * The returned id uses the track's current positional lane selector. When
7289
+ * `setTrackLanes` successfully changes lane order or membership, the engine
7290
+ * remaps already queued and published track automation by track id, but it
7291
+ * cannot update a numeric id retained by the caller. Re-resolve every track
7292
+ * insert id after such a topology change before passing it to
7293
+ * `setAutomationLane`, `setParameter`, or `setParameterSmoothed`. Use
7294
+ * `setTrackStripInsertParamByName` when the operation needs a stable track
7295
+ * identity. Master and bus insert ids are separate and are not invalidated by
7296
+ * track-lane changes.
7170
7297
  */
7171
7298
  resolveTrackInsertAutomationId(trackId, insertIndex, paramName) {
7172
7299
  return this.native.resolveTrackInsertAutomationId(trackId, insertIndex, paramName);
@@ -7493,6 +7620,12 @@ var RealtimeEngine = class _RealtimeEngine {
7493
7620
  meterScratchRenderFrame() {
7494
7621
  return Number(this.native.meterScratchRenderFrame());
7495
7622
  }
7623
+ meterScratchInputPeakDbL() {
7624
+ return this.native.meterScratchInputPeakDbL();
7625
+ }
7626
+ meterScratchInputPeakDbR() {
7627
+ return this.native.meterScratchInputPeakDbR();
7628
+ }
7496
7629
  meterScratchValue(field) {
7497
7630
  return this.native.meterScratchValue(field);
7498
7631
  }
@@ -7502,9 +7635,10 @@ var RealtimeEngine = class _RealtimeEngine {
7502
7635
  /**
7503
7636
  * Drains pending meter telemetry as per-plane (wide) records for a surround
7504
7637
  * target. Use this for a surround mix target; {@link drainMeterTelemetry}
7505
- * stays the stereo fast path. The two share one queue — call only one per
7506
- * target. The live AudioWorklet path owns the queue via the stereo drain, so
7507
- * this wide drain is for an offline (non-worklet) engine instance; per-plane
7638
+ * stays the stereo fast path. The two share one queue and each consumes every
7639
+ * target's records, so an engine uses only one of them. The live AudioWorklet
7640
+ * path owns the queue via the stereo drain, so this wide drain is for an
7641
+ * offline (non-worklet) engine instance; per-plane
7508
7642
  * surround meters are not delivered over the live worklet meter ring.
7509
7643
  */
7510
7644
  drainMeterTelemetryWide(maxRecords = 1024) {
@@ -7942,47 +8076,60 @@ var Mixer = class _Mixer {
7942
8076
  * after {@link delete}.
7943
8077
  */
7944
8078
  createRealtimeBuffer() {
7945
- const stripCount = this.stripCount();
7946
- let leftInputs = [];
7947
- let rightInputs = [];
8079
+ const leftInputs = [];
8080
+ const rightInputs = [];
7948
8081
  let outLeft = this.mixer.outputLeftView();
7949
8082
  let outRight = this.mixer.outputRightView();
8083
+ let acquiredStripCount = -1;
8084
+ const viewsDetached = () => outLeft.byteLength === 0 || outRight.byteLength === 0;
7950
8085
  const acquire = () => {
7951
- leftInputs = [];
7952
- rightInputs = [];
7953
- for (let index = 0; index < stripCount; index++) {
8086
+ const stripCount = this.stripCount();
8087
+ const detached = viewsDetached();
8088
+ if (detached) {
8089
+ leftInputs.length = 0;
8090
+ rightInputs.length = 0;
8091
+ } else {
8092
+ leftInputs.length = Math.min(leftInputs.length, stripCount);
8093
+ rightInputs.length = Math.min(rightInputs.length, stripCount);
8094
+ }
8095
+ for (let index = leftInputs.length; index < stripCount; index++) {
7954
8096
  leftInputs.push(this.mixer.inputLeftView(index));
8097
+ }
8098
+ for (let index = rightInputs.length; index < stripCount; index++) {
7955
8099
  rightInputs.push(this.mixer.inputRightView(index));
7956
8100
  }
7957
- outLeft = this.mixer.outputLeftView();
7958
- outRight = this.mixer.outputRightView();
8101
+ if (detached) {
8102
+ outLeft = this.mixer.outputLeftView();
8103
+ outRight = this.mixer.outputRightView();
8104
+ }
8105
+ acquiredStripCount = stripCount;
7959
8106
  };
7960
8107
  acquire();
7961
- const reacquireIfDetached = () => {
7962
- if (outLeft.byteLength === 0 || (leftInputs[0]?.byteLength ?? 1) === 0) {
8108
+ const acquireIfNeeded = () => {
8109
+ if (acquiredStripCount !== this.stripCount() || viewsDetached()) {
7963
8110
  acquire();
7964
8111
  }
7965
8112
  };
7966
8113
  return {
7967
8114
  get leftInputs() {
7968
- reacquireIfDetached();
8115
+ acquireIfNeeded();
7969
8116
  return leftInputs;
7970
8117
  },
7971
8118
  get rightInputs() {
7972
- reacquireIfDetached();
8119
+ acquireIfNeeded();
7973
8120
  return rightInputs;
7974
8121
  },
7975
8122
  get outLeft() {
7976
- reacquireIfDetached();
8123
+ acquireIfNeeded();
7977
8124
  return outLeft;
7978
8125
  },
7979
8126
  get outRight() {
7980
- reacquireIfDetached();
8127
+ acquireIfNeeded();
7981
8128
  return outRight;
7982
8129
  },
7983
- process: (numSamples = outLeft.length) => {
7984
- reacquireIfDetached();
7985
- this.mixer.processPreparedStereo(numSamples);
8130
+ process: (numSamples) => {
8131
+ acquireIfNeeded();
8132
+ this.mixer.processPreparedStereo(numSamples ?? outLeft.length);
7986
8133
  }
7987
8134
  };
7988
8135
  }
@@ -8782,6 +8929,13 @@ var StreamingMasteringChain = class {
8782
8929
  reset() {
8783
8930
  this.chain.reset();
8784
8931
  }
8932
+ /**
8933
+ * Set one realtime-safe full-chain parameter at a serialized block boundary.
8934
+ * Structural, disabled-stage and unknown parameters are rejected.
8935
+ */
8936
+ setParameter(key, value) {
8937
+ this.chain.setParameter(key, value);
8938
+ }
8785
8939
  /** Total reported latency in samples across all active processors. */
8786
8940
  latencySamples() {
8787
8941
  return this.chain.latencySamples();
@@ -9756,6 +9910,7 @@ export {
9756
9910
  masterAudioWithProgress,
9757
9911
  mastering,
9758
9912
  masteringAbMatchLoudness,
9913
+ masteringAbMatchLoudnessStereo,
9759
9914
  masteringAmpPresetCatalog,
9760
9915
  masteringAssistantSuggest,
9761
9916
  masteringAssistantSuggestChain,
@@ -9777,6 +9932,7 @@ export {
9777
9932
  masteringPairAnalysisNames,
9778
9933
  masteringPairAnalyze,
9779
9934
  masteringPairProcess,
9935
+ masteringPairProcessStereo,
9780
9936
  masteringPairProcessorNames,
9781
9937
  masteringPlatformNames,
9782
9938
  masteringPresetNames,