@libraz/libsonare 1.5.3 → 1.5.5

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.
@@ -458,6 +458,8 @@ export interface WasmLufsResult {
458
458
  integratedLufs: number;
459
459
  momentaryLufs: number;
460
460
  shortTermLufs: number;
461
+ maxMomentaryLufs: number;
462
+ maxShortTermLufs: number;
461
463
  loudnessRange: number;
462
464
  }
463
465
 
@@ -467,6 +469,7 @@ export interface WasmMasteringResult {
467
469
  inputLufs: number;
468
470
  outputLufs: number;
469
471
  appliedGainDb: number;
472
+ loudnessTargetLimited?: boolean;
470
473
  latencySamples?: number;
471
474
  }
472
475
 
@@ -479,6 +482,7 @@ export interface WasmMasteringChainResult extends WasmMasteringResult {
479
482
  stages: string[];
480
483
  outputTruePeakDbtp: number;
481
484
  outputLra: number;
485
+ loudnessTargetLimited: boolean;
482
486
  stageGainReductions: WasmStageGainReduction[];
483
487
  }
484
488
 
@@ -492,6 +496,7 @@ export interface WasmMasteringStereoChainResult {
492
496
  stages: string[];
493
497
  outputTruePeakDbtp: number;
494
498
  outputLra: number;
499
+ loudnessTargetLimited: boolean;
495
500
  stageGainReductions: WasmStageGainReduction[];
496
501
  }
497
502
 
@@ -624,8 +629,9 @@ export interface WasmEngineMetronomeConfig {
624
629
  enabled: boolean;
625
630
  beatGain?: number;
626
631
  accentGain?: number;
632
+ /** Explicit click length in samples (0..384000). The engine caps it to one second at its sample rate. */
627
633
  clickSamples?: number;
628
- /** Optional click length in seconds; > 0 overrides the engine 2 ms default. */
634
+ /** Optional click length in seconds (0..1); > 0 overrides the engine 2 ms default. */
629
635
  clickSeconds?: number;
630
636
  }
631
637
 
@@ -745,6 +751,10 @@ export interface WasmEngineTransportState {
745
751
  barCount: number;
746
752
  /** Time signature in effect at the current PPQ. */
747
753
  timeSignature: { numerator: number; denominator: number; confidence: number };
754
+ /** One-based beat within the current bar (`barCount` is zero-based). */
755
+ beat: number;
756
+ /** Fractional position within the current beat, in [0, 1). */
757
+ beatFraction: number;
748
758
  }
749
759
 
750
760
  export interface WasmEngineBounceOptions {
@@ -939,6 +949,7 @@ export interface WasmRealtimeEngine {
939
949
  minValue: number,
940
950
  maxValue: number,
941
951
  ) => void;
952
+ bindMidiCcBinding: (binding: import('./project_types').ProjectMidiCcBinding) => void;
942
953
  clearMidiCcBindings: () => void;
943
954
  midiCcBindingCount: () => number;
944
955
  setMidiFx: (destinationId: number, configJson: string) => void;
@@ -1096,7 +1107,7 @@ export interface SonareModule {
1096
1107
  detectInversions: boolean,
1097
1108
  chromaMethod: number,
1098
1109
  ) => string[];
1099
- analyze: (samples: Float32Array, sampleRate: number) => WasmAnalysisResult;
1110
+ analyze: (samples: Float32Array, sampleRate: number, options: object) => WasmAnalysisResult;
1100
1111
  _synthEnumTables: () => WasmSynthEnumTables;
1101
1112
  _synthPatchRoundTrip: (patch: unknown) => unknown;
1102
1113
  _analysisResultSchemaPaths: () => string[];
@@ -1178,6 +1189,13 @@ export interface SonareModule {
1178
1189
 
1179
1190
  meteringPeakDb: (samples: Float32Array, sampleRate: number) => number;
1180
1191
  meteringRmsDb: (samples: Float32Array, sampleRate: number) => number;
1192
+ meteringSilenceRatio: (
1193
+ samples: Float32Array,
1194
+ sampleRate: number,
1195
+ thresholdDb: number,
1196
+ frameLength: number,
1197
+ hopLength: number,
1198
+ ) => number;
1181
1199
  meteringCrestFactorDb: (samples: Float32Array, sampleRate: number) => number;
1182
1200
  meteringDcOffset: (samples: Float32Array, sampleRate: number) => number;
1183
1201
  meteringTruePeakDb: (
@@ -1691,6 +1709,7 @@ export interface SonareModule {
1691
1709
  nMfcc: number,
1692
1710
  nFrames: number,
1693
1711
  nMels: number,
1712
+ lifter: number,
1694
1713
  ) => WasmMelPowerResult;
1695
1714
  mfccToAudio: (
1696
1715
  mfcc: Float32Array,
@@ -1704,6 +1723,7 @@ export interface SonareModule {
1704
1723
  fmax: number,
1705
1724
  nIter: number,
1706
1725
  htk: boolean,
1726
+ lifter: number,
1707
1727
  ) => Float32Array;
1708
1728
 
1709
1729
  // Features - Chroma
@@ -1885,12 +1905,14 @@ export interface SonareModule {
1885
1905
  sampleRate: number,
1886
1906
  hopLength: number,
1887
1907
  nChroma: number,
1908
+ binsPerOctave: number,
1888
1909
  ) => WasmChromaResult;
1889
1910
  chromaCqt: (
1890
1911
  samples: Float32Array,
1891
1912
  sampleRate: number,
1892
1913
  hopLength: number,
1893
1914
  nChroma: number,
1915
+ binsPerOctave: number,
1894
1916
  ) => WasmChromaResult;
1895
1917
  bassChroma: (
1896
1918
  samples: Float32Array,
@@ -1898,7 +1920,13 @@ export interface SonareModule {
1898
1920
  hopLength: number,
1899
1921
  nChroma: number,
1900
1922
  ) => WasmChromaResult;
1901
- nnlsChroma: (samples: Float32Array, sampleRate: number) => WasmNnlsChromaResult;
1923
+ nnlsChroma: (
1924
+ samples: Float32Array,
1925
+ sampleRate: number,
1926
+ enableStftBlend: boolean,
1927
+ stftBlendWeight: number,
1928
+ stftBlendNFft: number,
1929
+ ) => WasmNnlsChromaResult;
1902
1930
  cqt: (
1903
1931
  samples: Float32Array,
1904
1932
  sampleRate: number,
@@ -2251,6 +2279,7 @@ export interface WasmMixer {
2251
2279
  removeSend: (stripIndex: number, sendIndex: number) => void;
2252
2280
  meterTap: (stripIndex: number, tap: number) => WasmMixMeterSnapshot;
2253
2281
  stripMeter: (stripIndex: number) => WasmMixMeterSnapshot;
2282
+ busMeter: (busId: string) => WasmMixMeterSnapshot;
2254
2283
  scheduleFaderAutomation: (
2255
2284
  stripIndex: number,
2256
2285
  samplePos: number,
@@ -2282,6 +2311,7 @@ export interface WasmMixer {
2282
2311
  busCount: () => number;
2283
2312
  addVcaGroup: (id: string, gainDb: number, members: string[]) => void;
2284
2313
  setVcaGroupGainDb: (id: string, gainDb: number) => void;
2314
+ setVcaGroupMembers: (id: string, members: string[]) => void;
2285
2315
  removeVcaGroup: (id: string) => void;
2286
2316
  vcaGroupCount: () => number;
2287
2317
  toSceneJson: () => string;
@@ -1,3 +1,4 @@
1
+ import { flattenChainConfig } from './_chain_config';
1
2
  import { getSonareModule } from './module_state';
2
3
  import type {
3
4
  EqBand,
@@ -64,7 +65,12 @@ export class StreamingMasteringChain {
64
65
 
65
66
  constructor(config: StreamingMasteringChainConfig) {
66
67
  const module = getSonareModule();
67
- this.chain = module.createStreamingMasteringChain(config as Record<string, unknown>);
68
+ const { loudnessStaticGainDb, loudnessStaticGainPeakDb, ...chainConfig } = config;
69
+ this.chain = module.createStreamingMasteringChain({
70
+ __flatParams: flattenChainConfig(chainConfig),
71
+ loudnessStaticGainDb,
72
+ loudnessStaticGainPeakDb,
73
+ });
68
74
  }
69
75
 
70
76
  /**
package/src/validation.ts CHANGED
@@ -78,6 +78,12 @@ export function assertSampleRate(fnName: string, sampleRate: number): void {
78
78
  }
79
79
  }
80
80
 
81
+ /** Validate and retain the public Audio.fromBuffer construction contract. */
82
+ export function validateAudioBuffer(samples: Float32Array, sampleRate: number): void {
83
+ assertSamples('Audio.fromBuffer', samples, true);
84
+ assertSampleRate('Audio.fromBuffer', sampleRate);
85
+ }
86
+
81
87
  export function assertNonNegativeInteger(fnName: string, value: number, argName: string): void {
82
88
  if (!Number.isInteger(value) || value < 0) {
83
89
  throw new RangeError(`${fnName}: ${argName} must be a non-negative integer`);
@@ -191,15 +191,29 @@ export interface ResolvedMetronomeConfig {
191
191
  export const DEFAULT_METRONOME_CONFIG: ResolvedMetronomeConfig = {
192
192
  beatGain: 0.35,
193
193
  accentGain: 0.7,
194
- clickSamples: 96,
194
+ clickSamples: 0,
195
195
  };
196
196
 
197
197
  export function resolveMetronomeConfig(config: EngineMetronomeConfig): ResolvedMetronomeConfig {
198
- return {
198
+ const resolved = {
199
199
  beatGain: config.beatGain ?? DEFAULT_METRONOME_CONFIG.beatGain,
200
200
  accentGain: config.accentGain ?? DEFAULT_METRONOME_CONFIG.accentGain,
201
201
  clickSamples: config.clickSamples ?? DEFAULT_METRONOME_CONFIG.clickSamples,
202
202
  };
203
+ if (
204
+ !Number.isFinite(resolved.beatGain) ||
205
+ resolved.beatGain < 0 ||
206
+ !Number.isFinite(resolved.accentGain) ||
207
+ resolved.accentGain < 0 ||
208
+ !Number.isInteger(resolved.clickSamples) ||
209
+ resolved.clickSamples < 0 ||
210
+ resolved.clickSamples > 384000 ||
211
+ (config.clickSeconds !== undefined &&
212
+ (!Number.isFinite(config.clickSeconds) || config.clickSeconds < 0 || config.clickSeconds > 1))
213
+ ) {
214
+ throw new RangeError('invalid metronome gains or click length');
215
+ }
216
+ return resolved;
203
217
  }
204
218
 
205
219
  // Out-of-band control messages posted from the main-thread SonareEngine facade
@@ -122,6 +122,8 @@ export enum SonareEngineTelemetryError {
122
122
  CommandBacklogDeferred = 14,
123
123
  ClipPageUnderrun = 15,
124
124
  InsertAutomationOverflow = 16,
125
+ MidiClockOverflow = 17,
126
+ MetronomeOverflow = 18,
125
127
  }
126
128
 
127
129
  export interface SonareMeterRingBuffer {