@libraz/libsonare 1.2.0 → 1.2.2
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/README.md +56 -4
- package/dist/index.d.ts +728 -284
- package/dist/index.js +712 -122
- package/dist/index.js.map +1 -1
- package/dist/sonare-rt.wasm +0 -0
- package/dist/sonare.js +1 -1
- package/dist/sonare.wasm +0 -0
- package/dist/worklet.d.ts +61 -2
- package/dist/worklet.js +371 -9
- package/dist/worklet.js.map +1 -1
- package/package.json +6 -6
- package/src/index.ts +1666 -305
- package/src/public_types.ts +71 -0
- package/src/sonare.js.d.ts +508 -78
- package/src/worklet.ts +295 -9
- package/src/wasm_types.ts +0 -1248
package/dist/index.js
CHANGED
|
@@ -92,6 +92,21 @@ function panLawCode(panLaw) {
|
|
|
92
92
|
return 0;
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
+
function panModeCode(panMode) {
|
|
96
|
+
if (typeof panMode === "number") {
|
|
97
|
+
return panMode;
|
|
98
|
+
}
|
|
99
|
+
switch (panMode) {
|
|
100
|
+
case "stereoPan":
|
|
101
|
+
case "stereo-pan":
|
|
102
|
+
return 1;
|
|
103
|
+
case "dualPan":
|
|
104
|
+
case "dual-pan":
|
|
105
|
+
return 2;
|
|
106
|
+
default:
|
|
107
|
+
return 0;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
95
110
|
function meterTapCode(tap) {
|
|
96
111
|
return tap === "preFader" || tap === 0 ? 0 : 1;
|
|
97
112
|
}
|
|
@@ -100,6 +115,31 @@ function sendTimingCode(timing) {
|
|
|
100
115
|
}
|
|
101
116
|
var module = null;
|
|
102
117
|
var initPromise = null;
|
|
118
|
+
function assertNonEmptySamples(fnName, samples, argName = "samples") {
|
|
119
|
+
if (samples.length === 0) {
|
|
120
|
+
throw new RangeError(`${fnName}: ${argName} must not be empty`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function assertFiniteSamples(fnName, samples, validate, argName = "samples") {
|
|
124
|
+
if (!validate) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
for (let i = 0; i < samples.length; i++) {
|
|
128
|
+
const v = samples[i];
|
|
129
|
+
if (!Number.isFinite(v)) {
|
|
130
|
+
throw new RangeError(`${fnName}: ${argName} contains NaN or Inf at index ${i}`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function assertSamples(fnName, samples, validate, argName = "samples") {
|
|
135
|
+
assertNonEmptySamples(fnName, samples, argName);
|
|
136
|
+
assertFiniteSamples(fnName, samples, validate, argName);
|
|
137
|
+
}
|
|
138
|
+
function assertFiniteScalar(fnName, value, argName) {
|
|
139
|
+
if (!Number.isFinite(value)) {
|
|
140
|
+
throw new RangeError(`${fnName}: ${argName} must be a finite number`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
103
143
|
async function init(options) {
|
|
104
144
|
if (module) {
|
|
105
145
|
return;
|
|
@@ -133,6 +173,42 @@ function engineAbiVersion() {
|
|
|
133
173
|
}
|
|
134
174
|
return module.engineAbiVersion();
|
|
135
175
|
}
|
|
176
|
+
function voiceChangerAbiVersion() {
|
|
177
|
+
if (!module) {
|
|
178
|
+
throw new Error("Module not initialized. Call init() first.");
|
|
179
|
+
}
|
|
180
|
+
return module.voiceChangerAbiVersion();
|
|
181
|
+
}
|
|
182
|
+
var VOICE_PRESET_ORDINALS = [
|
|
183
|
+
"neutral-monitor",
|
|
184
|
+
"bright-idol",
|
|
185
|
+
"soft-whisper",
|
|
186
|
+
"deep-narrator",
|
|
187
|
+
"robot-mascot",
|
|
188
|
+
"dark-villain"
|
|
189
|
+
];
|
|
190
|
+
function resolveVoicePresetOrdinal(preset) {
|
|
191
|
+
if (typeof preset === "number") {
|
|
192
|
+
return preset;
|
|
193
|
+
}
|
|
194
|
+
const ordinal = VOICE_PRESET_ORDINALS.indexOf(preset);
|
|
195
|
+
if (ordinal < 0) {
|
|
196
|
+
throw new Error(`Unknown voice character preset: ${preset}`);
|
|
197
|
+
}
|
|
198
|
+
return ordinal;
|
|
199
|
+
}
|
|
200
|
+
function voiceCharacterPresetId(preset) {
|
|
201
|
+
if (!module) {
|
|
202
|
+
throw new Error("Module not initialized. Call init() first.");
|
|
203
|
+
}
|
|
204
|
+
return module.voiceCharacterPresetId(resolveVoicePresetOrdinal(preset));
|
|
205
|
+
}
|
|
206
|
+
function realtimeVoiceChangerPresetConfig(preset) {
|
|
207
|
+
if (!module) {
|
|
208
|
+
throw new Error("Module not initialized. Call init() first.");
|
|
209
|
+
}
|
|
210
|
+
return module.realtimeVoiceChangerPresetConfig(resolveVoicePresetOrdinal(preset));
|
|
211
|
+
}
|
|
136
212
|
function engineCapabilities() {
|
|
137
213
|
const abiVersion = engineAbiVersion();
|
|
138
214
|
const sharedArrayBuffer = typeof globalThis.SharedArrayBuffer === "function";
|
|
@@ -305,13 +381,13 @@ var RealtimeEngine = class {
|
|
|
305
381
|
this.native.delete();
|
|
306
382
|
}
|
|
307
383
|
};
|
|
308
|
-
function detectBpm(samples, sampleRate) {
|
|
384
|
+
function detectBpm(samples, sampleRate = 22050) {
|
|
309
385
|
if (!module) {
|
|
310
386
|
throw new Error("Module not initialized. Call init() first.");
|
|
311
387
|
}
|
|
312
388
|
return module.detectBpm(samples, sampleRate);
|
|
313
389
|
}
|
|
314
|
-
function detectKey(samples, sampleRate, options = {}) {
|
|
390
|
+
function detectKey(samples, sampleRate = 22050, options = {}) {
|
|
315
391
|
if (!module) {
|
|
316
392
|
throw new Error("Module not initialized. Call init() first.");
|
|
317
393
|
}
|
|
@@ -400,7 +476,7 @@ function keyProfileValue(profile) {
|
|
|
400
476
|
};
|
|
401
477
|
return names[profile];
|
|
402
478
|
}
|
|
403
|
-
function detectKeyCandidates(samples, sampleRate, options = {}) {
|
|
479
|
+
function detectKeyCandidates(samples, sampleRate = 22050, options = {}) {
|
|
404
480
|
if (!module) {
|
|
405
481
|
throw new Error("Module not initialized. Call init() first.");
|
|
406
482
|
}
|
|
@@ -417,19 +493,19 @@ function detectKeyCandidates(samples, sampleRate, options = {}) {
|
|
|
417
493
|
options.genreHint ?? ""
|
|
418
494
|
).map(convertKeyCandidate);
|
|
419
495
|
}
|
|
420
|
-
function detectOnsets(samples, sampleRate) {
|
|
496
|
+
function detectOnsets(samples, sampleRate = 22050) {
|
|
421
497
|
if (!module) {
|
|
422
498
|
throw new Error("Module not initialized. Call init() first.");
|
|
423
499
|
}
|
|
424
500
|
return module.detectOnsets(samples, sampleRate);
|
|
425
501
|
}
|
|
426
|
-
function detectBeats(samples, sampleRate) {
|
|
502
|
+
function detectBeats(samples, sampleRate = 22050) {
|
|
427
503
|
if (!module) {
|
|
428
504
|
throw new Error("Module not initialized. Call init() first.");
|
|
429
505
|
}
|
|
430
506
|
return module.detectBeats(samples, sampleRate);
|
|
431
507
|
}
|
|
432
|
-
function detectDownbeats(samples, sampleRate) {
|
|
508
|
+
function detectDownbeats(samples, sampleRate = 22050) {
|
|
433
509
|
if (!module) {
|
|
434
510
|
throw new Error("Module not initialized. Call init() first.");
|
|
435
511
|
}
|
|
@@ -448,7 +524,7 @@ function convertChordAnalysisResult(wasm) {
|
|
|
448
524
|
}))
|
|
449
525
|
};
|
|
450
526
|
}
|
|
451
|
-
function detectChords(samples, sampleRate, options = {}) {
|
|
527
|
+
function detectChords(samples, sampleRate = 22050, options = {}) {
|
|
452
528
|
if (!module) {
|
|
453
529
|
throw new Error("Module not initialized. Call init() first.");
|
|
454
530
|
}
|
|
@@ -522,14 +598,14 @@ function convertAnalysisResult(wasm) {
|
|
|
522
598
|
form: wasm.form
|
|
523
599
|
};
|
|
524
600
|
}
|
|
525
|
-
function analyze(samples, sampleRate) {
|
|
601
|
+
function analyze(samples, sampleRate = 22050) {
|
|
526
602
|
if (!module) {
|
|
527
603
|
throw new Error("Module not initialized. Call init() first.");
|
|
528
604
|
}
|
|
529
605
|
const result = module.analyze(samples, sampleRate);
|
|
530
606
|
return convertAnalysisResult(result);
|
|
531
607
|
}
|
|
532
|
-
function analyzeImpulseResponse(samples, sampleRate, nOctaveBands = 6) {
|
|
608
|
+
function analyzeImpulseResponse(samples, sampleRate = 48e3, nOctaveBands = 6) {
|
|
533
609
|
if (!module) {
|
|
534
610
|
throw new Error("Module not initialized. Call init() first.");
|
|
535
611
|
}
|
|
@@ -540,7 +616,7 @@ function analyzeImpulseResponse(samples, sampleRate, nOctaveBands = 6) {
|
|
|
540
616
|
);
|
|
541
617
|
return result;
|
|
542
618
|
}
|
|
543
|
-
function detectAcoustic(samples, sampleRate, nOctaveBands = 6, nThirdOctaveSubbands = 24, minDecayDb = 30, noiseFloorMarginDb = 10) {
|
|
619
|
+
function detectAcoustic(samples, sampleRate = 48e3, nOctaveBands = 6, nThirdOctaveSubbands = 24, minDecayDb = 30, noiseFloorMarginDb = 10) {
|
|
544
620
|
if (!module) {
|
|
545
621
|
throw new Error("Module not initialized. Call init() first.");
|
|
546
622
|
}
|
|
@@ -554,14 +630,53 @@ function detectAcoustic(samples, sampleRate, nOctaveBands = 6, nThirdOctaveSubba
|
|
|
554
630
|
);
|
|
555
631
|
return result;
|
|
556
632
|
}
|
|
557
|
-
function analyzeWithProgress(samples, sampleRate, onProgress) {
|
|
633
|
+
function analyzeWithProgress(samples, sampleRate = 22050, onProgress) {
|
|
558
634
|
if (!module) {
|
|
559
635
|
throw new Error("Module not initialized. Call init() first.");
|
|
560
636
|
}
|
|
561
637
|
const result = module.analyzeWithProgress(samples, sampleRate, onProgress);
|
|
562
638
|
return convertAnalysisResult(result);
|
|
563
639
|
}
|
|
564
|
-
function
|
|
640
|
+
function analyzeBpm(samples, sampleRate = 22050, bpmMin = 30, bpmMax = 300, startBpm = 120, nFft = 2048, hopLength = 512, maxCandidates = 5) {
|
|
641
|
+
if (!module) {
|
|
642
|
+
throw new Error("Module not initialized. Call init() first.");
|
|
643
|
+
}
|
|
644
|
+
return module.analyzeBpm(
|
|
645
|
+
samples,
|
|
646
|
+
sampleRate,
|
|
647
|
+
bpmMin,
|
|
648
|
+
bpmMax,
|
|
649
|
+
startBpm,
|
|
650
|
+
nFft,
|
|
651
|
+
hopLength,
|
|
652
|
+
maxCandidates
|
|
653
|
+
);
|
|
654
|
+
}
|
|
655
|
+
function analyzeRhythm(samples, sampleRate = 22050, bpmMin = 60, bpmMax = 200, startBpm = 120, nFft = 2048, hopLength = 512) {
|
|
656
|
+
if (!module) {
|
|
657
|
+
throw new Error("Module not initialized. Call init() first.");
|
|
658
|
+
}
|
|
659
|
+
return module.analyzeRhythm(samples, sampleRate, bpmMin, bpmMax, startBpm, nFft, hopLength);
|
|
660
|
+
}
|
|
661
|
+
function analyzeDynamics(samples, sampleRate = 22050, windowSec = 0.4, hopLength = 512, compressionThreshold = 6) {
|
|
662
|
+
if (!module) {
|
|
663
|
+
throw new Error("Module not initialized. Call init() first.");
|
|
664
|
+
}
|
|
665
|
+
return module.analyzeDynamics(samples, sampleRate, windowSec, hopLength, compressionThreshold);
|
|
666
|
+
}
|
|
667
|
+
function analyzeTimbre(samples, sampleRate = 22050, nFft = 2048, hopLength = 512, nMels = 128, nMfcc = 13, windowSec = 0.5) {
|
|
668
|
+
if (!module) {
|
|
669
|
+
throw new Error("Module not initialized. Call init() first.");
|
|
670
|
+
}
|
|
671
|
+
return module.analyzeTimbre(samples, sampleRate, nFft, hopLength, nMels, nMfcc, windowSec);
|
|
672
|
+
}
|
|
673
|
+
function hasFfmpegSupport() {
|
|
674
|
+
if (!module) {
|
|
675
|
+
throw new Error("Module not initialized. Call init() first.");
|
|
676
|
+
}
|
|
677
|
+
return module.hasFfmpegSupport();
|
|
678
|
+
}
|
|
679
|
+
function hpss(samples, sampleRate = 22050, kernelHarmonic = 31, kernelPercussive = 31) {
|
|
565
680
|
if (!module) {
|
|
566
681
|
throw new Error("Module not initialized. Call init() first.");
|
|
567
682
|
}
|
|
@@ -591,22 +706,23 @@ function pitchShift(samples, sampleRate, semitones) {
|
|
|
591
706
|
}
|
|
592
707
|
return module.pitchShift(samples, sampleRate, semitones);
|
|
593
708
|
}
|
|
594
|
-
function pitchCorrectToMidi(samples, sampleRate, currentMidi, targetMidi) {
|
|
709
|
+
function pitchCorrectToMidi(samples, sampleRate = 22050, currentMidi = 69, targetMidi = 69) {
|
|
595
710
|
if (!module) {
|
|
596
711
|
throw new Error("Module not initialized. Call init() first.");
|
|
597
712
|
}
|
|
598
713
|
return module.pitchCorrectToMidi(samples, sampleRate, currentMidi, targetMidi);
|
|
599
714
|
}
|
|
600
|
-
function noteStretch(samples, sampleRate, onsetSample, offsetSample, stretchRatio) {
|
|
715
|
+
function noteStretch(samples, sampleRate = 22050, onsetSample = 0, offsetSample = 0, stretchRatio = 1) {
|
|
601
716
|
if (!module) {
|
|
602
717
|
throw new Error("Module not initialized. Call init() first.");
|
|
603
718
|
}
|
|
604
719
|
return module.noteStretch(samples, sampleRate, onsetSample, offsetSample, stretchRatio);
|
|
605
720
|
}
|
|
606
|
-
function voiceChange(samples, sampleRate, pitchSemitones, formantFactor) {
|
|
721
|
+
function voiceChange(samples, sampleRate = 22050, pitchSemitones = 0, formantFactor = 1, options = {}) {
|
|
607
722
|
if (!module) {
|
|
608
723
|
throw new Error("Module not initialized. Call init() first.");
|
|
609
724
|
}
|
|
725
|
+
assertSamples("voiceChange", samples, options.validate !== false);
|
|
610
726
|
return module.voiceChange(samples, sampleRate, pitchSemitones, formantFactor);
|
|
611
727
|
}
|
|
612
728
|
function normalize(samples, sampleRate, targetDb = 0) {
|
|
@@ -615,7 +731,7 @@ function normalize(samples, sampleRate, targetDb = 0) {
|
|
|
615
731
|
}
|
|
616
732
|
return module.normalize(samples, sampleRate, targetDb);
|
|
617
733
|
}
|
|
618
|
-
function mastering(samples, sampleRate, targetLufs = -14, ceilingDb = -1, truePeakOversample = 4) {
|
|
734
|
+
function mastering(samples, sampleRate = 22050, targetLufs = -14, ceilingDb = -1, truePeakOversample = 4) {
|
|
619
735
|
if (!module) {
|
|
620
736
|
throw new Error("Module not initialized. Call init() first.");
|
|
621
737
|
}
|
|
@@ -645,13 +761,13 @@ function masteringStereoAnalysisNames() {
|
|
|
645
761
|
}
|
|
646
762
|
return module.masteringStereoAnalysisNames();
|
|
647
763
|
}
|
|
648
|
-
function masteringProcess(processorName, samples, sampleRate, params = {}) {
|
|
764
|
+
function masteringProcess(processorName, samples, sampleRate = 22050, params = {}) {
|
|
649
765
|
if (!module) {
|
|
650
766
|
throw new Error("Module not initialized. Call init() first.");
|
|
651
767
|
}
|
|
652
768
|
return module.masteringProcess(processorName, samples, sampleRate, params);
|
|
653
769
|
}
|
|
654
|
-
function masteringProcessStereo(processorName, left, right, sampleRate, params = {}) {
|
|
770
|
+
function masteringProcessStereo(processorName, left, right, sampleRate = 22050, params = {}) {
|
|
655
771
|
if (!module) {
|
|
656
772
|
throw new Error("Module not initialized. Call init() first.");
|
|
657
773
|
}
|
|
@@ -660,49 +776,92 @@ function masteringProcessStereo(processorName, left, right, sampleRate, params =
|
|
|
660
776
|
}
|
|
661
777
|
return module.masteringProcessStereo(processorName, left, right, sampleRate, params);
|
|
662
778
|
}
|
|
663
|
-
function masteringPairProcess(processorName, source, reference, sampleRate, params = {}) {
|
|
779
|
+
function masteringPairProcess(processorName, source, reference, sampleRate = 22050, params = {}) {
|
|
664
780
|
if (!module) {
|
|
665
781
|
throw new Error("Module not initialized. Call init() first.");
|
|
666
782
|
}
|
|
667
783
|
return module.masteringPairProcess(processorName, source, reference, sampleRate, params);
|
|
668
784
|
}
|
|
669
|
-
function masteringPairAnalyze(analysisName, source, reference, sampleRate, params = {}) {
|
|
785
|
+
function masteringPairAnalyze(analysisName, source, reference, sampleRate = 22050, params = {}) {
|
|
670
786
|
if (!module) {
|
|
671
787
|
throw new Error("Module not initialized. Call init() first.");
|
|
672
788
|
}
|
|
673
789
|
return module.masteringPairAnalyze(analysisName, source, reference, sampleRate, params);
|
|
674
790
|
}
|
|
675
|
-
function masteringStereoAnalyze(analysisName, left, right, sampleRate, params = {}) {
|
|
791
|
+
function masteringStereoAnalyze(analysisName, left, right, sampleRate = 22050, params = {}) {
|
|
676
792
|
if (!module) {
|
|
677
793
|
throw new Error("Module not initialized. Call init() first.");
|
|
678
794
|
}
|
|
679
795
|
return module.masteringStereoAnalyze(analysisName, left, right, sampleRate, params);
|
|
680
796
|
}
|
|
681
|
-
function masteringAssistantSuggest(samples, sampleRate, params = {}) {
|
|
797
|
+
function masteringAssistantSuggest(samples, sampleRate = 22050, params = {}) {
|
|
682
798
|
if (!module) {
|
|
683
799
|
throw new Error("Module not initialized. Call init() first.");
|
|
684
800
|
}
|
|
685
801
|
return module.masteringAssistantSuggest(samples, sampleRate, params);
|
|
686
802
|
}
|
|
687
|
-
function masteringAudioProfile(samples, sampleRate, params = {}) {
|
|
803
|
+
function masteringAudioProfile(samples, sampleRate = 22050, params = {}) {
|
|
688
804
|
if (!module) {
|
|
689
805
|
throw new Error("Module not initialized. Call init() first.");
|
|
690
806
|
}
|
|
691
807
|
return module.masteringAudioProfile(samples, sampleRate, params);
|
|
692
808
|
}
|
|
693
|
-
function masteringStreamingPreview(samples, sampleRate, platforms = []) {
|
|
809
|
+
function masteringStreamingPreview(samples, sampleRate = 22050, platforms = []) {
|
|
694
810
|
if (!module) {
|
|
695
811
|
throw new Error("Module not initialized. Call init() first.");
|
|
696
812
|
}
|
|
697
813
|
return module.masteringStreamingPreview(samples, sampleRate, platforms);
|
|
698
814
|
}
|
|
699
|
-
function
|
|
815
|
+
function masteringRepairDeclick(samples, sampleRate, options = {}) {
|
|
816
|
+
return requireModule().masteringRepairDeclick(samples, sampleRate, options);
|
|
817
|
+
}
|
|
818
|
+
function masteringRepairDenoiseClassical(samples, sampleRate, options = {}) {
|
|
819
|
+
return requireModule().masteringRepairDenoiseClassical(samples, sampleRate, options);
|
|
820
|
+
}
|
|
821
|
+
function masteringRepairDeclip(samples, sampleRate, options = {}) {
|
|
822
|
+
return requireModule().masteringRepairDeclip(samples, sampleRate, options);
|
|
823
|
+
}
|
|
824
|
+
function masteringRepairDecrackle(samples, sampleRate, options = {}) {
|
|
825
|
+
return requireModule().masteringRepairDecrackle(samples, sampleRate, options);
|
|
826
|
+
}
|
|
827
|
+
function masteringRepairDehum(samples, sampleRate, options = {}) {
|
|
828
|
+
return requireModule().masteringRepairDehum(samples, sampleRate, options);
|
|
829
|
+
}
|
|
830
|
+
function masteringRepairDereverbClassical(samples, sampleRate, options = {}) {
|
|
831
|
+
return requireModule().masteringRepairDereverbClassical(samples, sampleRate, options);
|
|
832
|
+
}
|
|
833
|
+
function masteringRepairTrimSilence(samples, sampleRate, options = {}) {
|
|
834
|
+
return requireModule().masteringRepairTrimSilence(samples, sampleRate, options);
|
|
835
|
+
}
|
|
836
|
+
var COMPRESSOR_DETECTOR_MAP = {
|
|
837
|
+
peak: 0,
|
|
838
|
+
rms: 1,
|
|
839
|
+
log_rms: 2
|
|
840
|
+
};
|
|
841
|
+
function masteringDynamicsCompressor(samples, sampleRate, options = {}) {
|
|
842
|
+
assertSamples("masteringDynamicsCompressor", samples, options.validate !== false);
|
|
843
|
+
const detector = typeof options.detector === "string" ? COMPRESSOR_DETECTOR_MAP[options.detector] : options.detector;
|
|
844
|
+
const opts = { ...options };
|
|
845
|
+
if (detector !== void 0) {
|
|
846
|
+
opts.detector = detector;
|
|
847
|
+
}
|
|
848
|
+
return requireModule().masteringDynamicsCompressor(samples, sampleRate, opts);
|
|
849
|
+
}
|
|
850
|
+
function masteringDynamicsGate(samples, sampleRate, options = {}) {
|
|
851
|
+
assertSamples("masteringDynamicsGate", samples, options.validate !== false);
|
|
852
|
+
return requireModule().masteringDynamicsGate(samples, sampleRate, options);
|
|
853
|
+
}
|
|
854
|
+
function masteringDynamicsTransientShaper(samples, sampleRate, options = {}) {
|
|
855
|
+
assertSamples("masteringDynamicsTransientShaper", samples, options.validate !== false);
|
|
856
|
+
return requireModule().masteringDynamicsTransientShaper(samples, sampleRate, options);
|
|
857
|
+
}
|
|
858
|
+
function masteringChain(samples, sampleRate = 22050, config) {
|
|
700
859
|
if (!module) {
|
|
701
860
|
throw new Error("Module not initialized. Call init() first.");
|
|
702
861
|
}
|
|
703
862
|
return module.masteringChain(samples, sampleRate, config);
|
|
704
863
|
}
|
|
705
|
-
function masteringChainStereo(left, right, sampleRate, config) {
|
|
864
|
+
function masteringChainStereo(left, right, sampleRate = 22050, config) {
|
|
706
865
|
if (!module) {
|
|
707
866
|
throw new Error("Module not initialized. Call init() first.");
|
|
708
867
|
}
|
|
@@ -711,7 +870,7 @@ function masteringChainStereo(left, right, sampleRate, config) {
|
|
|
711
870
|
}
|
|
712
871
|
return module.masteringChainStereo(left, right, sampleRate, config);
|
|
713
872
|
}
|
|
714
|
-
function masteringChainWithProgress(samples, sampleRate, config, onProgress) {
|
|
873
|
+
function masteringChainWithProgress(samples, sampleRate = 22050, config, onProgress) {
|
|
715
874
|
if (!module) {
|
|
716
875
|
throw new Error("Module not initialized. Call init() first.");
|
|
717
876
|
}
|
|
@@ -722,7 +881,7 @@ function masteringChainWithProgress(samples, sampleRate, config, onProgress) {
|
|
|
722
881
|
onProgress
|
|
723
882
|
);
|
|
724
883
|
}
|
|
725
|
-
function masteringChainStereoWithProgress(left, right, sampleRate, config, onProgress) {
|
|
884
|
+
function masteringChainStereoWithProgress(left, right, sampleRate = 22050, config, onProgress) {
|
|
726
885
|
if (!module) {
|
|
727
886
|
throw new Error("Module not initialized. Call init() first.");
|
|
728
887
|
}
|
|
@@ -743,13 +902,13 @@ function masteringPresetNames() {
|
|
|
743
902
|
}
|
|
744
903
|
return module.masteringPresetNames();
|
|
745
904
|
}
|
|
746
|
-
function masterAudio(samples, sampleRate, presetName, overrides = null) {
|
|
905
|
+
function masterAudio(samples, sampleRate = 22050, presetName, overrides = null) {
|
|
747
906
|
if (!module) {
|
|
748
907
|
throw new Error("Module not initialized. Call init() first.");
|
|
749
908
|
}
|
|
750
909
|
return module.masterAudio(presetName, samples, sampleRate, overrides);
|
|
751
910
|
}
|
|
752
|
-
function masterAudioStereo(left, right, sampleRate, presetName, overrides = null) {
|
|
911
|
+
function masterAudioStereo(left, right, sampleRate = 22050, presetName, overrides = null) {
|
|
753
912
|
if (!module) {
|
|
754
913
|
throw new Error("Module not initialized. Call init() first.");
|
|
755
914
|
}
|
|
@@ -758,17 +917,39 @@ function masterAudioStereo(left, right, sampleRate, presetName, overrides = null
|
|
|
758
917
|
}
|
|
759
918
|
return module.masterAudioStereo(presetName, left, right, sampleRate, overrides);
|
|
760
919
|
}
|
|
920
|
+
function masterAudioWithProgress(samples, sampleRate = 22050, presetName, onProgress, overrides = null) {
|
|
921
|
+
if (!module) {
|
|
922
|
+
throw new Error("Module not initialized. Call init() first.");
|
|
923
|
+
}
|
|
924
|
+
return module.masterAudioWithProgress(presetName, samples, sampleRate, overrides, onProgress);
|
|
925
|
+
}
|
|
926
|
+
function masterAudioStereoWithProgress(left, right, sampleRate = 22050, presetName, onProgress, overrides = null) {
|
|
927
|
+
if (!module) {
|
|
928
|
+
throw new Error("Module not initialized. Call init() first.");
|
|
929
|
+
}
|
|
930
|
+
if (left.length !== right.length) {
|
|
931
|
+
throw new Error("Stereo channel lengths must match.");
|
|
932
|
+
}
|
|
933
|
+
return module.masterAudioStereoWithProgress(
|
|
934
|
+
presetName,
|
|
935
|
+
left,
|
|
936
|
+
right,
|
|
937
|
+
sampleRate,
|
|
938
|
+
overrides,
|
|
939
|
+
onProgress
|
|
940
|
+
);
|
|
941
|
+
}
|
|
761
942
|
function mixingScenePresetNames() {
|
|
762
943
|
if (!module) {
|
|
763
944
|
throw new Error("Module not initialized. Call init() first.");
|
|
764
945
|
}
|
|
765
946
|
return module.mixingScenePresetNames();
|
|
766
947
|
}
|
|
767
|
-
function mixingScenePresetJson(
|
|
948
|
+
function mixingScenePresetJson(presetName) {
|
|
768
949
|
if (!module) {
|
|
769
950
|
throw new Error("Module not initialized. Call init() first.");
|
|
770
951
|
}
|
|
771
|
-
return module.mixingScenePresetJson(
|
|
952
|
+
return module.mixingScenePresetJson(presetName);
|
|
772
953
|
}
|
|
773
954
|
function mixStereo(leftChannels, rightChannels, sampleRate = 48e3, options = {}) {
|
|
774
955
|
if (!module) {
|
|
@@ -937,11 +1118,200 @@ var StreamingEqualizer = class {
|
|
|
937
1118
|
this.eq.delete();
|
|
938
1119
|
}
|
|
939
1120
|
};
|
|
940
|
-
|
|
1121
|
+
var StreamingRetune = class {
|
|
1122
|
+
constructor(config = {}) {
|
|
1123
|
+
if (!module) {
|
|
1124
|
+
throw new Error("Module not initialized. Call init() first.");
|
|
1125
|
+
}
|
|
1126
|
+
this.retune = module.createStreamingRetune(config);
|
|
1127
|
+
}
|
|
1128
|
+
/**
|
|
1129
|
+
* Allocate and initialize native state for the given sample rate and maximum
|
|
1130
|
+
* process block size.
|
|
1131
|
+
*/
|
|
1132
|
+
prepare(sampleRate, maxBlockSize) {
|
|
1133
|
+
this.retune.prepare(sampleRate, maxBlockSize);
|
|
1134
|
+
}
|
|
1135
|
+
/** Reset delay, grain, and overlap-add state without changing config. */
|
|
1136
|
+
reset() {
|
|
1137
|
+
this.retune.reset();
|
|
1138
|
+
}
|
|
1139
|
+
/**
|
|
1140
|
+
* Update retune settings. Changing `grainSize` takes effect after the next
|
|
1141
|
+
* {@link prepare} call.
|
|
1142
|
+
*/
|
|
1143
|
+
setConfig(config) {
|
|
1144
|
+
this.retune.setConfig(config);
|
|
1145
|
+
}
|
|
1146
|
+
/** Current native config. */
|
|
1147
|
+
config() {
|
|
1148
|
+
return this.retune.config();
|
|
1149
|
+
}
|
|
1150
|
+
/** Resolved grain size in samples after {@link prepare}. */
|
|
1151
|
+
grainSize() {
|
|
1152
|
+
return this.retune.grainSize();
|
|
1153
|
+
}
|
|
1154
|
+
/** Process one mono block, returning the shifted samples (same length). */
|
|
1155
|
+
processMono(samples) {
|
|
1156
|
+
return this.retune.processMono(samples);
|
|
1157
|
+
}
|
|
1158
|
+
/** Release the underlying WASM object. Safe to call only once. */
|
|
1159
|
+
delete() {
|
|
1160
|
+
this.retune.delete();
|
|
1161
|
+
}
|
|
1162
|
+
};
|
|
1163
|
+
var RealtimeVoiceChanger = class {
|
|
1164
|
+
constructor(config = "neutral-monitor") {
|
|
1165
|
+
if (!module) {
|
|
1166
|
+
throw new Error("Module not initialized. Call init() first.");
|
|
1167
|
+
}
|
|
1168
|
+
this.changer = module.createRealtimeVoiceChanger(config);
|
|
1169
|
+
}
|
|
1170
|
+
prepare(sampleRate, maxBlockSize = 128, channels = 1) {
|
|
1171
|
+
this.changer.prepare(sampleRate, maxBlockSize, channels);
|
|
1172
|
+
}
|
|
1173
|
+
reset() {
|
|
1174
|
+
this.changer.reset();
|
|
1175
|
+
}
|
|
1176
|
+
setConfig(config) {
|
|
1177
|
+
this.changer.setConfig(config);
|
|
1178
|
+
}
|
|
1179
|
+
configJson() {
|
|
1180
|
+
return this.changer.configJson();
|
|
1181
|
+
}
|
|
1182
|
+
latencySamples() {
|
|
1183
|
+
return this.changer.latencySamples();
|
|
1184
|
+
}
|
|
1185
|
+
processMono(samples) {
|
|
1186
|
+
return this.changer.processMono(samples);
|
|
1187
|
+
}
|
|
1188
|
+
processMonoInto(samples, output) {
|
|
1189
|
+
this.changer.processMonoInto(samples, output);
|
|
1190
|
+
}
|
|
1191
|
+
processInterleaved(samples, channels) {
|
|
1192
|
+
return this.changer.processInterleaved(samples, channels);
|
|
1193
|
+
}
|
|
1194
|
+
processInterleavedInto(samples, channels, output) {
|
|
1195
|
+
this.changer.processInterleavedInto(samples, channels, output);
|
|
1196
|
+
}
|
|
1197
|
+
/**
|
|
1198
|
+
* Acquire a typed-memory view onto the WASM heap for mono input.
|
|
1199
|
+
*
|
|
1200
|
+
* Write your input samples into the returned `Float32Array` directly (e.g.
|
|
1201
|
+
* via `input.set(source)`); no copy crosses the JS↔C++ bridge until
|
|
1202
|
+
* {@link processPreparedMono} is called. The view is owned by this
|
|
1203
|
+
* RealtimeVoiceChanger and becomes invalid after {@link delete}; it may
|
|
1204
|
+
* also be invalidated if you later call this method with a larger
|
|
1205
|
+
* `numSamples` value (the underlying buffer may be reallocated).
|
|
1206
|
+
*/
|
|
1207
|
+
getMonoInputBuffer(numSamples) {
|
|
1208
|
+
return this.changer.getMonoInputBuffer(numSamples);
|
|
1209
|
+
}
|
|
1210
|
+
/** Mono output view counterpart to {@link getMonoInputBuffer}. */
|
|
1211
|
+
getMonoOutputBuffer(numSamples) {
|
|
1212
|
+
return this.changer.getMonoOutputBuffer(numSamples);
|
|
1213
|
+
}
|
|
1214
|
+
/**
|
|
1215
|
+
* Process the previously-acquired mono input buffer in place. The output
|
|
1216
|
+
* appears in the buffer returned by {@link getMonoOutputBuffer}. No JS↔C++
|
|
1217
|
+
* sample-level crossings happen on this call — it just hands control to
|
|
1218
|
+
* the underlying DSP on already-on-heap data.
|
|
1219
|
+
*/
|
|
1220
|
+
processPreparedMono(numSamples) {
|
|
1221
|
+
this.changer.processPreparedMono(numSamples);
|
|
1222
|
+
}
|
|
1223
|
+
/** Interleaved input view (layout L0,R0,L1,R1,...). */
|
|
1224
|
+
getInterleavedInputBuffer(numFrames, numChannels) {
|
|
1225
|
+
return this.changer.getInterleavedInputBuffer(numFrames, numChannels);
|
|
1226
|
+
}
|
|
1227
|
+
/** Interleaved output view counterpart. */
|
|
1228
|
+
getInterleavedOutputBuffer(numFrames, numChannels) {
|
|
1229
|
+
return this.changer.getInterleavedOutputBuffer(numFrames, numChannels);
|
|
1230
|
+
}
|
|
1231
|
+
/**
|
|
1232
|
+
* Process the previously-acquired interleaved buffer in place. Output
|
|
1233
|
+
* appears in the buffer returned by {@link getInterleavedOutputBuffer}.
|
|
1234
|
+
*/
|
|
1235
|
+
processPreparedInterleaved(numFrames, numChannels) {
|
|
1236
|
+
this.changer.processPreparedInterleaved(numFrames, numChannels);
|
|
1237
|
+
}
|
|
1238
|
+
/**
|
|
1239
|
+
* Planar-channel input/output view (one Float32Array per channel). Matches
|
|
1240
|
+
* AudioWorklet's native layout; processing happens in place.
|
|
1241
|
+
*/
|
|
1242
|
+
getPlanarChannelBuffer(channel, numFrames) {
|
|
1243
|
+
return this.changer.getPlanarChannelBuffer(channel, numFrames);
|
|
1244
|
+
}
|
|
1245
|
+
/**
|
|
1246
|
+
* Process the previously-acquired planar channel buffers in place. Each
|
|
1247
|
+
* channel must have been obtained from {@link getPlanarChannelBuffer}
|
|
1248
|
+
* with the same `numFrames`. Output replaces input in the same buffers.
|
|
1249
|
+
*/
|
|
1250
|
+
processPreparedPlanar(numFrames) {
|
|
1251
|
+
this.changer.processPreparedPlanar(numFrames);
|
|
1252
|
+
}
|
|
1253
|
+
/**
|
|
1254
|
+
* Convenience factory for the mono zero-copy path: returns the input/output
|
|
1255
|
+
* heap views plus a `process()` thunk wired to the same `numSamples`. The
|
|
1256
|
+
* views are reused across calls and become invalid after {@link delete}.
|
|
1257
|
+
*/
|
|
1258
|
+
createRealtimeMonoBuffer(numSamples) {
|
|
1259
|
+
const input = this.getMonoInputBuffer(numSamples);
|
|
1260
|
+
const output = this.getMonoOutputBuffer(numSamples);
|
|
1261
|
+
return {
|
|
1262
|
+
input,
|
|
1263
|
+
output,
|
|
1264
|
+
process: () => this.processPreparedMono(numSamples)
|
|
1265
|
+
};
|
|
1266
|
+
}
|
|
1267
|
+
/** Same as {@link createRealtimeMonoBuffer} but for interleaved I/O. */
|
|
1268
|
+
createRealtimeInterleavedBuffer(numFrames, numChannels) {
|
|
1269
|
+
const input = this.getInterleavedInputBuffer(numFrames, numChannels);
|
|
1270
|
+
const output = this.getInterleavedOutputBuffer(numFrames, numChannels);
|
|
1271
|
+
return {
|
|
1272
|
+
input,
|
|
1273
|
+
output,
|
|
1274
|
+
channels: numChannels,
|
|
1275
|
+
process: () => this.processPreparedInterleaved(numFrames, numChannels)
|
|
1276
|
+
};
|
|
1277
|
+
}
|
|
1278
|
+
/**
|
|
1279
|
+
* Convenience factory for the planar zero-copy path. Acquires one
|
|
1280
|
+
* heap-backed Float32Array per channel and returns a `process()` thunk
|
|
1281
|
+
* wired to the same `numFrames`. Buffers are reused across calls and
|
|
1282
|
+
* become invalid after {@link delete}.
|
|
1283
|
+
*/
|
|
1284
|
+
createRealtimePlanarBuffer(numFrames, numChannels) {
|
|
1285
|
+
const channels = [];
|
|
1286
|
+
for (let ch = 0; ch < numChannels; ch++) {
|
|
1287
|
+
channels.push(this.getPlanarChannelBuffer(ch, numFrames));
|
|
1288
|
+
}
|
|
1289
|
+
return {
|
|
1290
|
+
channels,
|
|
1291
|
+
process: () => this.processPreparedPlanar(numFrames)
|
|
1292
|
+
};
|
|
1293
|
+
}
|
|
1294
|
+
delete() {
|
|
1295
|
+
this.changer.delete();
|
|
1296
|
+
}
|
|
1297
|
+
};
|
|
1298
|
+
function realtimeVoiceChangerPresetNames() {
|
|
1299
|
+
if (!module) {
|
|
1300
|
+
throw new Error("Module not initialized. Call init() first.");
|
|
1301
|
+
}
|
|
1302
|
+
return module.realtimeVoiceChangerPresetNames();
|
|
1303
|
+
}
|
|
1304
|
+
function realtimeVoiceChangerPresetJson(name) {
|
|
941
1305
|
if (!module) {
|
|
942
1306
|
throw new Error("Module not initialized. Call init() first.");
|
|
943
1307
|
}
|
|
944
|
-
return module.
|
|
1308
|
+
return module.realtimeVoiceChangerPresetJson(name);
|
|
1309
|
+
}
|
|
1310
|
+
function validateRealtimeVoiceChangerPresetJson(json) {
|
|
1311
|
+
if (!module) {
|
|
1312
|
+
throw new Error("Module not initialized. Call init() first.");
|
|
1313
|
+
}
|
|
1314
|
+
return module.validateRealtimeVoiceChangerPresetJson(json);
|
|
945
1315
|
}
|
|
946
1316
|
var Mixer = class _Mixer {
|
|
947
1317
|
constructor(mixer) {
|
|
@@ -1086,6 +1456,26 @@ var Mixer = class _Mixer {
|
|
|
1086
1456
|
vcaGroupCount() {
|
|
1087
1457
|
return this.mixer.vcaGroupCount();
|
|
1088
1458
|
}
|
|
1459
|
+
/** Set the strip's input trim in dB. */
|
|
1460
|
+
setInputTrimDb(stripIndex, db) {
|
|
1461
|
+
this.mixer.setInputTrimDb(stripIndex, db);
|
|
1462
|
+
}
|
|
1463
|
+
/** Set the strip's fader level in dB. */
|
|
1464
|
+
setFaderDb(stripIndex, db) {
|
|
1465
|
+
this.mixer.setFaderDb(stripIndex, db);
|
|
1466
|
+
}
|
|
1467
|
+
/** Set the strip's pan position. */
|
|
1468
|
+
setPan(stripIndex, pan, panMode = 0) {
|
|
1469
|
+
this.mixer.setPan(stripIndex, pan, panModeCode(panMode));
|
|
1470
|
+
}
|
|
1471
|
+
/** Set the strip's stereo width. */
|
|
1472
|
+
setWidth(stripIndex, width) {
|
|
1473
|
+
this.mixer.setWidth(stripIndex, width);
|
|
1474
|
+
}
|
|
1475
|
+
/** Set the strip's mute state. */
|
|
1476
|
+
setMuted(stripIndex, muted) {
|
|
1477
|
+
this.mixer.setMuted(stripIndex, muted);
|
|
1478
|
+
}
|
|
1089
1479
|
/**
|
|
1090
1480
|
* Set a strip's solo state. Takes effect on the next process without a
|
|
1091
1481
|
* graph recompile.
|
|
@@ -1236,37 +1626,37 @@ function trim(samples, sampleRate, thresholdDb = -60) {
|
|
|
1236
1626
|
}
|
|
1237
1627
|
return module.trim(samples, sampleRate, thresholdDb);
|
|
1238
1628
|
}
|
|
1239
|
-
function stft(samples, sampleRate, nFft = 2048, hopLength = 512) {
|
|
1629
|
+
function stft(samples, sampleRate = 22050, nFft = 2048, hopLength = 512) {
|
|
1240
1630
|
if (!module) {
|
|
1241
1631
|
throw new Error("Module not initialized. Call init() first.");
|
|
1242
1632
|
}
|
|
1243
1633
|
return module.stft(samples, sampleRate, nFft, hopLength);
|
|
1244
1634
|
}
|
|
1245
|
-
function stftDb(samples, sampleRate, nFft = 2048, hopLength = 512) {
|
|
1635
|
+
function stftDb(samples, sampleRate = 22050, nFft = 2048, hopLength = 512) {
|
|
1246
1636
|
if (!module) {
|
|
1247
1637
|
throw new Error("Module not initialized. Call init() first.");
|
|
1248
1638
|
}
|
|
1249
1639
|
return module.stftDb(samples, sampleRate, nFft, hopLength);
|
|
1250
1640
|
}
|
|
1251
|
-
function melSpectrogram(samples, sampleRate, nFft = 2048, hopLength = 512, nMels = 128) {
|
|
1641
|
+
function melSpectrogram(samples, sampleRate = 22050, nFft = 2048, hopLength = 512, nMels = 128) {
|
|
1252
1642
|
if (!module) {
|
|
1253
1643
|
throw new Error("Module not initialized. Call init() first.");
|
|
1254
1644
|
}
|
|
1255
1645
|
return module.melSpectrogram(samples, sampleRate, nFft, hopLength, nMels);
|
|
1256
1646
|
}
|
|
1257
|
-
function mfcc(samples, sampleRate, nFft = 2048, hopLength = 512, nMels = 128, nMfcc =
|
|
1647
|
+
function mfcc(samples, sampleRate = 22050, nFft = 2048, hopLength = 512, nMels = 128, nMfcc = 20) {
|
|
1258
1648
|
if (!module) {
|
|
1259
1649
|
throw new Error("Module not initialized. Call init() first.");
|
|
1260
1650
|
}
|
|
1261
1651
|
return module.mfcc(samples, sampleRate, nFft, hopLength, nMels, nMfcc);
|
|
1262
1652
|
}
|
|
1263
|
-
function melToStft(melPower, nMels, nFrames, sampleRate
|
|
1653
|
+
function melToStft(melPower, nMels, nFrames, sampleRate = 22050, nFft = 2048, fmin = 0, fmax = 0) {
|
|
1264
1654
|
if (!module) {
|
|
1265
1655
|
throw new Error("Module not initialized. Call init() first.");
|
|
1266
1656
|
}
|
|
1267
|
-
return module.melToStft(melPower, nMels, nFrames, sampleRate, nFft,
|
|
1657
|
+
return module.melToStft(melPower, nMels, nFrames, sampleRate, nFft, fmin, fmax);
|
|
1268
1658
|
}
|
|
1269
|
-
function melToAudio(melPower, nMels, nFrames, sampleRate, nFft = 2048, hopLength = 512,
|
|
1659
|
+
function melToAudio(melPower, nMels, nFrames, sampleRate = 22050, nFft = 2048, hopLength = 512, fmin = 0, fmax = 0, nIter = 32) {
|
|
1270
1660
|
if (!module) {
|
|
1271
1661
|
throw new Error("Module not initialized. Call init() first.");
|
|
1272
1662
|
}
|
|
@@ -1277,9 +1667,9 @@ function melToAudio(melPower, nMels, nFrames, sampleRate, nFft = 2048, hopLength
|
|
|
1277
1667
|
sampleRate,
|
|
1278
1668
|
nFft,
|
|
1279
1669
|
hopLength,
|
|
1280
|
-
nIter,
|
|
1281
1670
|
fmin,
|
|
1282
|
-
fmax
|
|
1671
|
+
fmax,
|
|
1672
|
+
nIter
|
|
1283
1673
|
);
|
|
1284
1674
|
}
|
|
1285
1675
|
function mfccToMel(mfccCoefficients, nMfcc, nFrames, nMels = 128) {
|
|
@@ -1288,7 +1678,7 @@ function mfccToMel(mfccCoefficients, nMfcc, nFrames, nMels = 128) {
|
|
|
1288
1678
|
}
|
|
1289
1679
|
return module.mfccToMel(mfccCoefficients, nMfcc, nFrames, nMels);
|
|
1290
1680
|
}
|
|
1291
|
-
function mfccToAudio(mfccCoefficients, nMfcc, nFrames, nMels, sampleRate, nFft = 2048, hopLength = 512,
|
|
1681
|
+
function mfccToAudio(mfccCoefficients, nMfcc, nFrames, nMels = 128, sampleRate = 22050, nFft = 2048, hopLength = 512, fmin = 0, fmax = 0, nIter = 32) {
|
|
1292
1682
|
if (!module) {
|
|
1293
1683
|
throw new Error("Module not initialized. Call init() first.");
|
|
1294
1684
|
}
|
|
@@ -1300,64 +1690,155 @@ function mfccToAudio(mfccCoefficients, nMfcc, nFrames, nMels, sampleRate, nFft =
|
|
|
1300
1690
|
sampleRate,
|
|
1301
1691
|
nFft,
|
|
1302
1692
|
hopLength,
|
|
1303
|
-
nIter,
|
|
1304
1693
|
fmin,
|
|
1305
|
-
fmax
|
|
1694
|
+
fmax,
|
|
1695
|
+
nIter
|
|
1306
1696
|
);
|
|
1307
1697
|
}
|
|
1308
|
-
function chroma(samples, sampleRate, nFft = 2048, hopLength = 512) {
|
|
1698
|
+
function chroma(samples, sampleRate = 22050, nFft = 2048, hopLength = 512) {
|
|
1309
1699
|
if (!module) {
|
|
1310
1700
|
throw new Error("Module not initialized. Call init() first.");
|
|
1311
1701
|
}
|
|
1312
1702
|
return module.chroma(samples, sampleRate, nFft, hopLength);
|
|
1313
1703
|
}
|
|
1314
|
-
function spectralCentroid(samples, sampleRate, nFft = 2048, hopLength = 512) {
|
|
1704
|
+
function spectralCentroid(samples, sampleRate = 22050, nFft = 2048, hopLength = 512) {
|
|
1315
1705
|
if (!module) {
|
|
1316
1706
|
throw new Error("Module not initialized. Call init() first.");
|
|
1317
1707
|
}
|
|
1318
1708
|
return module.spectralCentroid(samples, sampleRate, nFft, hopLength);
|
|
1319
1709
|
}
|
|
1320
|
-
function
|
|
1710
|
+
function spectralContrast(samples, sampleRate = 22050, nFft = 2048, hopLength = 512, nBands = 6, fmin = 200, quantile = 0.02) {
|
|
1711
|
+
if (!module) {
|
|
1712
|
+
throw new Error("Module not initialized. Call init() first.");
|
|
1713
|
+
}
|
|
1714
|
+
return module.spectralContrast(samples, sampleRate, nFft, hopLength, nBands, fmin, quantile);
|
|
1715
|
+
}
|
|
1716
|
+
function polyFeatures(samples, sampleRate = 22050, nFft = 2048, hopLength = 512, order = 1) {
|
|
1717
|
+
if (!module) {
|
|
1718
|
+
throw new Error("Module not initialized. Call init() first.");
|
|
1719
|
+
}
|
|
1720
|
+
return module.polyFeatures(samples, sampleRate, nFft, hopLength, order);
|
|
1721
|
+
}
|
|
1722
|
+
function zeroCrossings(samples, threshold = 1e-10, refMagnitude = false, pad = true, zeroPos = true) {
|
|
1723
|
+
if (!module) {
|
|
1724
|
+
throw new Error("Module not initialized. Call init() first.");
|
|
1725
|
+
}
|
|
1726
|
+
return module.zeroCrossings(samples, threshold, refMagnitude, pad, zeroPos);
|
|
1727
|
+
}
|
|
1728
|
+
function pitchTuning(frequencies, resolution = 0.01, binsPerOctave = 12) {
|
|
1729
|
+
if (!module) {
|
|
1730
|
+
throw new Error("Module not initialized. Call init() first.");
|
|
1731
|
+
}
|
|
1732
|
+
return module.pitchTuning(frequencies, resolution, binsPerOctave);
|
|
1733
|
+
}
|
|
1734
|
+
function estimateTuning(samples, sampleRate = 22050, nFft = 2048, hopLength = 512, resolution = 0.01, binsPerOctave = 12) {
|
|
1735
|
+
if (!module) {
|
|
1736
|
+
throw new Error("Module not initialized. Call init() first.");
|
|
1737
|
+
}
|
|
1738
|
+
return module.estimateTuning(samples, sampleRate, nFft, hopLength, resolution, binsPerOctave);
|
|
1739
|
+
}
|
|
1740
|
+
function decompose(s, nFeatures, nFrames, nComponents, nIter = 50, beta = 2) {
|
|
1741
|
+
if (!module) {
|
|
1742
|
+
throw new Error("Module not initialized. Call init() first.");
|
|
1743
|
+
}
|
|
1744
|
+
return module.decompose(s, nFeatures, nFrames, nComponents, nIter, beta);
|
|
1745
|
+
}
|
|
1746
|
+
function nnFilter(s, nFeatures, nFrames, aggregate = "mean", k = 7, width = 1) {
|
|
1747
|
+
if (!module) {
|
|
1748
|
+
throw new Error("Module not initialized. Call init() first.");
|
|
1749
|
+
}
|
|
1750
|
+
return module.nnFilter(s, nFeatures, nFrames, aggregate, k, width);
|
|
1751
|
+
}
|
|
1752
|
+
function remix(samples, intervals, sampleRate = 22050, alignZeros = false) {
|
|
1753
|
+
if (!module) {
|
|
1754
|
+
throw new Error("Module not initialized. Call init() first.");
|
|
1755
|
+
}
|
|
1756
|
+
const intervalsI32 = intervals instanceof Int32Array ? intervals : Int32Array.from(intervals, (v) => Math.trunc(v));
|
|
1757
|
+
return module.remix(samples, intervalsI32, sampleRate, alignZeros);
|
|
1758
|
+
}
|
|
1759
|
+
function phaseVocoder(samples, rate, sampleRate = 22050, nFft = 2048, hopLength = 512) {
|
|
1760
|
+
if (!module) {
|
|
1761
|
+
throw new Error("Module not initialized. Call init() first.");
|
|
1762
|
+
}
|
|
1763
|
+
return module.phaseVocoder(samples, sampleRate, rate, nFft, hopLength);
|
|
1764
|
+
}
|
|
1765
|
+
function hpssWithResidual(samples, sampleRate = 22050, kernelHarmonic = 31, kernelPercussive = 31) {
|
|
1766
|
+
if (!module) {
|
|
1767
|
+
throw new Error("Module not initialized. Call init() first.");
|
|
1768
|
+
}
|
|
1769
|
+
return module.hpssWithResidual(samples, sampleRate, kernelHarmonic, kernelPercussive);
|
|
1770
|
+
}
|
|
1771
|
+
function lufsInterleaved(samples, channels, sampleRate = 22050) {
|
|
1772
|
+
if (!module) {
|
|
1773
|
+
throw new Error("Module not initialized. Call init() first.");
|
|
1774
|
+
}
|
|
1775
|
+
return module.lufsInterleaved(samples, channels, sampleRate);
|
|
1776
|
+
}
|
|
1777
|
+
function ebur128LoudnessRange(samples, sampleRate = 22050) {
|
|
1778
|
+
if (!module) {
|
|
1779
|
+
throw new Error("Module not initialized. Call init() first.");
|
|
1780
|
+
}
|
|
1781
|
+
return module.ebur128LoudnessRange(samples, sampleRate);
|
|
1782
|
+
}
|
|
1783
|
+
function spectralBandwidth(samples, sampleRate = 22050, nFft = 2048, hopLength = 512) {
|
|
1321
1784
|
if (!module) {
|
|
1322
1785
|
throw new Error("Module not initialized. Call init() first.");
|
|
1323
1786
|
}
|
|
1324
1787
|
return module.spectralBandwidth(samples, sampleRate, nFft, hopLength);
|
|
1325
1788
|
}
|
|
1326
|
-
function spectralRolloff(samples, sampleRate, nFft = 2048, hopLength = 512, rollPercent = 0.85) {
|
|
1789
|
+
function spectralRolloff(samples, sampleRate = 22050, nFft = 2048, hopLength = 512, rollPercent = 0.85) {
|
|
1327
1790
|
if (!module) {
|
|
1328
1791
|
throw new Error("Module not initialized. Call init() first.");
|
|
1329
1792
|
}
|
|
1330
1793
|
return module.spectralRolloff(samples, sampleRate, nFft, hopLength, rollPercent);
|
|
1331
1794
|
}
|
|
1332
|
-
function spectralFlatness(samples, sampleRate, nFft = 2048, hopLength = 512) {
|
|
1795
|
+
function spectralFlatness(samples, sampleRate = 22050, nFft = 2048, hopLength = 512) {
|
|
1333
1796
|
if (!module) {
|
|
1334
1797
|
throw new Error("Module not initialized. Call init() first.");
|
|
1335
1798
|
}
|
|
1336
1799
|
return module.spectralFlatness(samples, sampleRate, nFft, hopLength);
|
|
1337
1800
|
}
|
|
1338
|
-
function zeroCrossingRate(samples, sampleRate, frameLength = 2048, hopLength = 512) {
|
|
1801
|
+
function zeroCrossingRate(samples, sampleRate = 22050, frameLength = 2048, hopLength = 512) {
|
|
1339
1802
|
if (!module) {
|
|
1340
1803
|
throw new Error("Module not initialized. Call init() first.");
|
|
1341
1804
|
}
|
|
1342
1805
|
return module.zeroCrossingRate(samples, sampleRate, frameLength, hopLength);
|
|
1343
1806
|
}
|
|
1344
|
-
function rmsEnergy(samples, sampleRate, frameLength = 2048, hopLength = 512) {
|
|
1807
|
+
function rmsEnergy(samples, sampleRate = 22050, frameLength = 2048, hopLength = 512) {
|
|
1345
1808
|
if (!module) {
|
|
1346
1809
|
throw new Error("Module not initialized. Call init() first.");
|
|
1347
1810
|
}
|
|
1348
1811
|
return module.rmsEnergy(samples, sampleRate, frameLength, hopLength);
|
|
1349
1812
|
}
|
|
1350
|
-
function pitchYin(samples, sampleRate, frameLength = 2048, hopLength = 512, fmin = 65, fmax = 2093, threshold = 0.3) {
|
|
1813
|
+
function pitchYin(samples, sampleRate = 22050, frameLength = 2048, hopLength = 512, fmin = 65, fmax = 2093, threshold = 0.3, fillNa = false) {
|
|
1351
1814
|
if (!module) {
|
|
1352
1815
|
throw new Error("Module not initialized. Call init() first.");
|
|
1353
1816
|
}
|
|
1354
|
-
return module.pitchYin(
|
|
1817
|
+
return module.pitchYin(
|
|
1818
|
+
samples,
|
|
1819
|
+
sampleRate,
|
|
1820
|
+
frameLength,
|
|
1821
|
+
hopLength,
|
|
1822
|
+
fmin,
|
|
1823
|
+
fmax,
|
|
1824
|
+
threshold,
|
|
1825
|
+
fillNa
|
|
1826
|
+
);
|
|
1355
1827
|
}
|
|
1356
|
-
function pitchPyin(samples, sampleRate, frameLength = 2048, hopLength = 512, fmin = 65, fmax = 2093, threshold = 0.3) {
|
|
1828
|
+
function pitchPyin(samples, sampleRate = 22050, frameLength = 2048, hopLength = 512, fmin = 65, fmax = 2093, threshold = 0.3, fillNa = false) {
|
|
1357
1829
|
if (!module) {
|
|
1358
1830
|
throw new Error("Module not initialized. Call init() first.");
|
|
1359
1831
|
}
|
|
1360
|
-
return module.pitchPyin(
|
|
1832
|
+
return module.pitchPyin(
|
|
1833
|
+
samples,
|
|
1834
|
+
sampleRate,
|
|
1835
|
+
frameLength,
|
|
1836
|
+
hopLength,
|
|
1837
|
+
fmin,
|
|
1838
|
+
fmax,
|
|
1839
|
+
threshold,
|
|
1840
|
+
fillNa
|
|
1841
|
+
);
|
|
1361
1842
|
}
|
|
1362
1843
|
function hzToMel(hz) {
|
|
1363
1844
|
if (!module) {
|
|
@@ -1395,13 +1876,13 @@ function noteToHz(note) {
|
|
|
1395
1876
|
}
|
|
1396
1877
|
return module.noteToHz(note);
|
|
1397
1878
|
}
|
|
1398
|
-
function framesToTime(frames, sr, hopLength) {
|
|
1879
|
+
function framesToTime(frames, sr = 22050, hopLength = 512) {
|
|
1399
1880
|
if (!module) {
|
|
1400
1881
|
throw new Error("Module not initialized. Call init() first.");
|
|
1401
1882
|
}
|
|
1402
1883
|
return module.framesToTime(frames, sr, hopLength);
|
|
1403
1884
|
}
|
|
1404
|
-
function timeToFrames(time, sr, hopLength) {
|
|
1885
|
+
function timeToFrames(time, sr = 22050, hopLength = 512) {
|
|
1405
1886
|
if (!module) {
|
|
1406
1887
|
throw new Error("Module not initialized. Call init() first.");
|
|
1407
1888
|
}
|
|
@@ -1473,17 +1954,17 @@ function frameSignal(samples, frameLength, hopLength) {
|
|
|
1473
1954
|
}
|
|
1474
1955
|
return module.frameSignal(samples, frameLength, hopLength);
|
|
1475
1956
|
}
|
|
1476
|
-
function padCenter(values,
|
|
1957
|
+
function padCenter(values, targetSize, padValue = 0) {
|
|
1477
1958
|
if (!module) {
|
|
1478
1959
|
throw new Error("Module not initialized. Call init() first.");
|
|
1479
1960
|
}
|
|
1480
|
-
return module.padCenter(values,
|
|
1961
|
+
return module.padCenter(values, targetSize, padValue);
|
|
1481
1962
|
}
|
|
1482
|
-
function fixLength(values,
|
|
1963
|
+
function fixLength(values, targetSize, padValue = 0) {
|
|
1483
1964
|
if (!module) {
|
|
1484
1965
|
throw new Error("Module not initialized. Call init() first.");
|
|
1485
1966
|
}
|
|
1486
|
-
return module.fixLength(values,
|
|
1967
|
+
return module.fixLength(values, targetSize, padValue);
|
|
1487
1968
|
}
|
|
1488
1969
|
function fixFrames(frames, xMin = 0, xMax = -1, pad = true) {
|
|
1489
1970
|
if (!module) {
|
|
@@ -1497,7 +1978,7 @@ function peakPick(values, preMax, postMax, preAvg, postAvg, delta, wait) {
|
|
|
1497
1978
|
}
|
|
1498
1979
|
return module.peakPick(values, preMax, postMax, preAvg, postAvg, delta, wait);
|
|
1499
1980
|
}
|
|
1500
|
-
function vectorNormalize(values, normType = 0, threshold =
|
|
1981
|
+
function vectorNormalize(values, normType = 0, threshold = 0) {
|
|
1501
1982
|
if (!module) {
|
|
1502
1983
|
throw new Error("Module not initialized. Call init() first.");
|
|
1503
1984
|
}
|
|
@@ -1515,19 +1996,19 @@ function tonnetz(chromagram, nChroma, nFrames) {
|
|
|
1515
1996
|
}
|
|
1516
1997
|
return module.tonnetz(chromagram, nChroma, nFrames);
|
|
1517
1998
|
}
|
|
1518
|
-
function tempogram(onsetEnvelope2, sampleRate, hopLength = 512, winLength = 384, mode = "autocorrelation") {
|
|
1999
|
+
function tempogram(onsetEnvelope2, sampleRate = 22050, hopLength = 512, winLength = 384, mode = "autocorrelation") {
|
|
1519
2000
|
if (!module) {
|
|
1520
2001
|
throw new Error("Module not initialized. Call init() first.");
|
|
1521
2002
|
}
|
|
1522
2003
|
return module.tempogram(onsetEnvelope2, sampleRate, hopLength, winLength, mode);
|
|
1523
2004
|
}
|
|
1524
|
-
function cyclicTempogram(onsetEnvelope2, sampleRate, hopLength = 512, winLength = 384, bpmMin = 60, nBins = 60) {
|
|
2005
|
+
function cyclicTempogram(onsetEnvelope2, sampleRate = 22050, hopLength = 512, winLength = 384, bpmMin = 60, nBins = 60) {
|
|
1525
2006
|
if (!module) {
|
|
1526
2007
|
throw new Error("Module not initialized. Call init() first.");
|
|
1527
2008
|
}
|
|
1528
2009
|
return module.cyclicTempogram(onsetEnvelope2, sampleRate, hopLength, winLength, bpmMin, nBins);
|
|
1529
2010
|
}
|
|
1530
|
-
function plp(onsetEnvelope2, sampleRate, hopLength = 512, tempoMin = 30, tempoMax = 300, winLength = 384) {
|
|
2011
|
+
function plp(onsetEnvelope2, sampleRate = 22050, hopLength = 512, tempoMin = 30, tempoMax = 300, winLength = 384) {
|
|
1531
2012
|
if (!module) {
|
|
1532
2013
|
throw new Error("Module not initialized. Call init() first.");
|
|
1533
2014
|
}
|
|
@@ -1551,13 +2032,13 @@ function vqt(samples, sampleRate = 22050, hopLength = 512, fmin = 32.70319566257
|
|
|
1551
2032
|
}
|
|
1552
2033
|
return module.vqt(samples, sampleRate, hopLength, fmin, nBins, binsPerOctave, gamma);
|
|
1553
2034
|
}
|
|
1554
|
-
function analyzeSections(samples, sampleRate = 22050, nFft = 2048, hopLength = 512, minSectionSec =
|
|
2035
|
+
function analyzeSections(samples, sampleRate = 22050, nFft = 2048, hopLength = 512, minSectionSec = 4) {
|
|
1555
2036
|
if (!module) {
|
|
1556
2037
|
throw new Error("Module not initialized. Call init() first.");
|
|
1557
2038
|
}
|
|
1558
2039
|
return module.analyzeSections(samples, sampleRate, nFft, hopLength, minSectionSec).map((s) => ({ ...s, type: s.type }));
|
|
1559
2040
|
}
|
|
1560
|
-
function analyzeMelody(samples, sampleRate = 22050, fmin = 65, fmax = 2093, frameLength = 2048, hopLength =
|
|
2041
|
+
function analyzeMelody(samples, sampleRate = 22050, fmin = 65, fmax = 2093, frameLength = 2048, hopLength = 256, threshold = 0.1) {
|
|
1561
2042
|
if (!module) {
|
|
1562
2043
|
throw new Error("Module not initialized. Call init() first.");
|
|
1563
2044
|
}
|
|
@@ -1581,24 +2062,110 @@ function tempogramRatio(tempogramData, winLength = 384, sampleRate = 22050, hopL
|
|
|
1581
2062
|
}
|
|
1582
2063
|
return module.tempogramRatio(tempogramData, winLength, sampleRate, hopLength);
|
|
1583
2064
|
}
|
|
1584
|
-
function lufs(samples, sampleRate = 22050) {
|
|
2065
|
+
function lufs(samples, sampleRate = 22050, options = {}) {
|
|
1585
2066
|
if (!module) {
|
|
1586
2067
|
throw new Error("Module not initialized. Call init() first.");
|
|
1587
2068
|
}
|
|
2069
|
+
assertSamples("lufs", samples, options.validate !== false);
|
|
1588
2070
|
return module.lufs(samples, sampleRate);
|
|
1589
2071
|
}
|
|
1590
|
-
function momentaryLufs(samples, sampleRate = 22050) {
|
|
2072
|
+
function momentaryLufs(samples, sampleRate = 22050, options = {}) {
|
|
1591
2073
|
if (!module) {
|
|
1592
2074
|
throw new Error("Module not initialized. Call init() first.");
|
|
1593
2075
|
}
|
|
2076
|
+
assertSamples("momentaryLufs", samples, options.validate !== false);
|
|
1594
2077
|
return module.momentaryLufs(samples, sampleRate);
|
|
1595
2078
|
}
|
|
1596
|
-
function shortTermLufs(samples, sampleRate = 22050) {
|
|
2079
|
+
function shortTermLufs(samples, sampleRate = 22050, options = {}) {
|
|
1597
2080
|
if (!module) {
|
|
1598
2081
|
throw new Error("Module not initialized. Call init() first.");
|
|
1599
2082
|
}
|
|
2083
|
+
assertSamples("shortTermLufs", samples, options.validate !== false);
|
|
1600
2084
|
return module.shortTermLufs(samples, sampleRate);
|
|
1601
2085
|
}
|
|
2086
|
+
function requireModule() {
|
|
2087
|
+
if (!module) {
|
|
2088
|
+
throw new Error("Module not initialized. Call init() first.");
|
|
2089
|
+
}
|
|
2090
|
+
return module;
|
|
2091
|
+
}
|
|
2092
|
+
function meteringPeakDb(samples, sampleRate = 22050, options = {}) {
|
|
2093
|
+
assertSamples("meteringPeakDb", samples, options.validate !== false);
|
|
2094
|
+
return requireModule().meteringPeakDb(samples, sampleRate);
|
|
2095
|
+
}
|
|
2096
|
+
function meteringRmsDb(samples, sampleRate = 22050, options = {}) {
|
|
2097
|
+
assertSamples("meteringRmsDb", samples, options.validate !== false);
|
|
2098
|
+
return requireModule().meteringRmsDb(samples, sampleRate);
|
|
2099
|
+
}
|
|
2100
|
+
function meteringCrestFactorDb(samples, sampleRate = 22050, options = {}) {
|
|
2101
|
+
assertSamples("meteringCrestFactorDb", samples, options.validate !== false);
|
|
2102
|
+
return requireModule().meteringCrestFactorDb(samples, sampleRate);
|
|
2103
|
+
}
|
|
2104
|
+
function meteringDcOffset(samples, sampleRate = 22050, options = {}) {
|
|
2105
|
+
assertSamples("meteringDcOffset", samples, options.validate !== false);
|
|
2106
|
+
return requireModule().meteringDcOffset(samples, sampleRate);
|
|
2107
|
+
}
|
|
2108
|
+
function meteringTruePeakDb(samples, sampleRate = 22050, oversampleFactor = 4, options = {}) {
|
|
2109
|
+
assertSamples("meteringTruePeakDb", samples, options.validate !== false);
|
|
2110
|
+
return requireModule().meteringTruePeakDb(samples, sampleRate, oversampleFactor);
|
|
2111
|
+
}
|
|
2112
|
+
function meteringDetectClipping(samples, sampleRate = 22050, threshold = 0.999, minRegionSamples = 1, options = {}) {
|
|
2113
|
+
assertSamples("meteringDetectClipping", samples, options.validate !== false);
|
|
2114
|
+
return requireModule().meteringDetectClipping(samples, sampleRate, threshold, minRegionSamples);
|
|
2115
|
+
}
|
|
2116
|
+
function meteringDynamicRange(samples, sampleRate = 22050, windowSec = 0, hopSec = 0, lowPercentile = 0, highPercentile = 0, options = {}) {
|
|
2117
|
+
assertSamples("meteringDynamicRange", samples, options.validate !== false);
|
|
2118
|
+
return requireModule().meteringDynamicRange(
|
|
2119
|
+
samples,
|
|
2120
|
+
sampleRate,
|
|
2121
|
+
windowSec,
|
|
2122
|
+
hopSec,
|
|
2123
|
+
lowPercentile,
|
|
2124
|
+
highPercentile
|
|
2125
|
+
);
|
|
2126
|
+
}
|
|
2127
|
+
function meteringStereoCorrelation(left, right, sampleRate = 22050, options = {}) {
|
|
2128
|
+
const validate = options.validate !== false;
|
|
2129
|
+
assertSamples("meteringStereoCorrelation", left, validate, "left");
|
|
2130
|
+
assertSamples("meteringStereoCorrelation", right, validate, "right");
|
|
2131
|
+
return requireModule().meteringStereoCorrelation(left, right, sampleRate);
|
|
2132
|
+
}
|
|
2133
|
+
function meteringStereoWidth(left, right, sampleRate = 22050, options = {}) {
|
|
2134
|
+
const validate = options.validate !== false;
|
|
2135
|
+
assertSamples("meteringStereoWidth", left, validate, "left");
|
|
2136
|
+
assertSamples("meteringStereoWidth", right, validate, "right");
|
|
2137
|
+
return requireModule().meteringStereoWidth(left, right, sampleRate);
|
|
2138
|
+
}
|
|
2139
|
+
function meteringVectorscope(left, right, sampleRate = 22050, options = {}) {
|
|
2140
|
+
const validate = options.validate !== false;
|
|
2141
|
+
assertSamples("meteringVectorscope", left, validate, "left");
|
|
2142
|
+
assertSamples("meteringVectorscope", right, validate, "right");
|
|
2143
|
+
return requireModule().meteringVectorscope(left, right, sampleRate);
|
|
2144
|
+
}
|
|
2145
|
+
function meteringPhaseScope(left, right, sampleRate = 22050, options = {}) {
|
|
2146
|
+
const validate = options.validate !== false;
|
|
2147
|
+
assertSamples("meteringPhaseScope", left, validate, "left");
|
|
2148
|
+
assertSamples("meteringPhaseScope", right, validate, "right");
|
|
2149
|
+
return requireModule().meteringPhaseScope(left, right, sampleRate);
|
|
2150
|
+
}
|
|
2151
|
+
function meteringSpectrum(samples, sampleRate = 22050, options) {
|
|
2152
|
+
const validate = options?.validate !== false;
|
|
2153
|
+
assertSamples("meteringSpectrum", samples, validate);
|
|
2154
|
+
return requireModule().meteringSpectrum(samples, sampleRate, options ?? {});
|
|
2155
|
+
}
|
|
2156
|
+
function scaleQuantizeMidi(root, modeMask, midi, referenceMidi = 0) {
|
|
2157
|
+
assertFiniteScalar("scaleQuantizeMidi", midi, "midi");
|
|
2158
|
+
assertFiniteScalar("scaleQuantizeMidi", referenceMidi, "referenceMidi");
|
|
2159
|
+
return requireModule().scaleQuantizeMidi(root, modeMask, midi, referenceMidi);
|
|
2160
|
+
}
|
|
2161
|
+
function scaleCorrectionSemitones(root, modeMask, midi, referenceMidi = 0) {
|
|
2162
|
+
assertFiniteScalar("scaleCorrectionSemitones", midi, "midi");
|
|
2163
|
+
assertFiniteScalar("scaleCorrectionSemitones", referenceMidi, "referenceMidi");
|
|
2164
|
+
return requireModule().scaleCorrectionSemitones(root, modeMask, midi, referenceMidi);
|
|
2165
|
+
}
|
|
2166
|
+
function scalePitchClassEnabled(root, modeMask, pitchClass) {
|
|
2167
|
+
return requireModule().scalePitchClassEnabled(root, modeMask, pitchClass);
|
|
2168
|
+
}
|
|
1602
2169
|
function resample(samples, srcSr, targetSr) {
|
|
1603
2170
|
if (!module) {
|
|
1604
2171
|
throw new Error("Module not initialized. Call init() first.");
|
|
@@ -1674,13 +2241,13 @@ var Audio = class _Audio {
|
|
|
1674
2241
|
pitchShift(semitones) {
|
|
1675
2242
|
return pitchShift(this._samples, this._sampleRate, semitones);
|
|
1676
2243
|
}
|
|
1677
|
-
pitchCorrectToMidi(currentMidi, targetMidi) {
|
|
2244
|
+
pitchCorrectToMidi(currentMidi = 69, targetMidi = 69) {
|
|
1678
2245
|
return pitchCorrectToMidi(this._samples, this._sampleRate, currentMidi, targetMidi);
|
|
1679
2246
|
}
|
|
1680
|
-
noteStretch(onsetSample, offsetSample, stretchRatio) {
|
|
2247
|
+
noteStretch(onsetSample = 0, offsetSample = 0, stretchRatio = 1) {
|
|
1681
2248
|
return noteStretch(this._samples, this._sampleRate, onsetSample, offsetSample, stretchRatio);
|
|
1682
2249
|
}
|
|
1683
|
-
voiceChange(pitchSemitones, formantFactor) {
|
|
2250
|
+
voiceChange(pitchSemitones = 0, formantFactor = 1) {
|
|
1684
2251
|
return voiceChange(this._samples, this._sampleRate, pitchSemitones, formantFactor);
|
|
1685
2252
|
}
|
|
1686
2253
|
normalize(targetDb = 0) {
|
|
@@ -1711,7 +2278,7 @@ var Audio = class _Audio {
|
|
|
1711
2278
|
melSpectrogram(nFft = 2048, hopLength = 512, nMels = 128) {
|
|
1712
2279
|
return melSpectrogram(this._samples, this._sampleRate, nFft, hopLength, nMels);
|
|
1713
2280
|
}
|
|
1714
|
-
mfcc(nFft = 2048, hopLength = 512, nMels = 128, nMfcc =
|
|
2281
|
+
mfcc(nFft = 2048, hopLength = 512, nMels = 128, nMfcc = 20) {
|
|
1715
2282
|
return mfcc(this._samples, this._sampleRate, nFft, hopLength, nMels, nMfcc);
|
|
1716
2283
|
}
|
|
1717
2284
|
chroma(nFft = 2048, hopLength = 512) {
|
|
@@ -1750,10 +2317,19 @@ var Audio = class _Audio {
|
|
|
1750
2317
|
rmsEnergy(frameLength = 2048, hopLength = 512) {
|
|
1751
2318
|
return rmsEnergy(this._samples, this._sampleRate, frameLength, hopLength);
|
|
1752
2319
|
}
|
|
1753
|
-
pitchYin(frameLength = 2048, hopLength = 512, fmin = 65, fmax = 2093, threshold = 0.3) {
|
|
1754
|
-
return pitchYin(
|
|
2320
|
+
pitchYin(frameLength = 2048, hopLength = 512, fmin = 65, fmax = 2093, threshold = 0.3, fillNa = false) {
|
|
2321
|
+
return pitchYin(
|
|
2322
|
+
this._samples,
|
|
2323
|
+
this._sampleRate,
|
|
2324
|
+
frameLength,
|
|
2325
|
+
hopLength,
|
|
2326
|
+
fmin,
|
|
2327
|
+
fmax,
|
|
2328
|
+
threshold,
|
|
2329
|
+
fillNa
|
|
2330
|
+
);
|
|
1755
2331
|
}
|
|
1756
|
-
pitchPyin(frameLength = 2048, hopLength = 512, fmin = 65, fmax = 2093, threshold = 0.3) {
|
|
2332
|
+
pitchPyin(frameLength = 2048, hopLength = 512, fmin = 65, fmax = 2093, threshold = 0.3, fillNa = false) {
|
|
1757
2333
|
return pitchPyin(
|
|
1758
2334
|
this._samples,
|
|
1759
2335
|
this._sampleRate,
|
|
@@ -1761,7 +2337,8 @@ var Audio = class _Audio {
|
|
|
1761
2337
|
hopLength,
|
|
1762
2338
|
fmin,
|
|
1763
2339
|
fmax,
|
|
1764
|
-
threshold
|
|
2340
|
+
threshold,
|
|
2341
|
+
fillNa
|
|
1765
2342
|
);
|
|
1766
2343
|
}
|
|
1767
2344
|
resample(targetSr) {
|
|
@@ -1778,8 +2355,7 @@ var StreamAnalyzer = class {
|
|
|
1778
2355
|
if (!module) {
|
|
1779
2356
|
throw new Error("Module not initialized. Call init() first.");
|
|
1780
2357
|
}
|
|
1781
|
-
|
|
1782
|
-
const args = [
|
|
2358
|
+
this.analyzer = new module.StreamAnalyzer(
|
|
1783
2359
|
config.sampleRate,
|
|
1784
2360
|
config.nFft ?? 2048,
|
|
1785
2361
|
config.hopLength ?? 512,
|
|
@@ -1798,44 +2374,7 @@ var StreamAnalyzer = class {
|
|
|
1798
2374
|
config.bpmUpdateIntervalSec ?? 10,
|
|
1799
2375
|
config.window ?? 0,
|
|
1800
2376
|
config.outputFormat ?? 0
|
|
1801
|
-
|
|
1802
|
-
const isArityError = (error) => {
|
|
1803
|
-
const message = String(error?.message ?? error);
|
|
1804
|
-
return message.includes("invalid number of parameters");
|
|
1805
|
-
};
|
|
1806
|
-
const createLegacy = () => {
|
|
1807
|
-
const LegacyStreamAnalyzer = wasmModule.StreamAnalyzer;
|
|
1808
|
-
return new LegacyStreamAnalyzer(
|
|
1809
|
-
args[0],
|
|
1810
|
-
args[1],
|
|
1811
|
-
args[2],
|
|
1812
|
-
args[3],
|
|
1813
|
-
args[8],
|
|
1814
|
-
args[9],
|
|
1815
|
-
args[10],
|
|
1816
|
-
args[12]
|
|
1817
|
-
);
|
|
1818
|
-
};
|
|
1819
|
-
const hasExtendedConfig = config.fmin !== void 0 || config.fmax !== void 0 || config.tuningRefHz !== void 0 || config.computeMagnitude !== void 0 || config.computeSpectral !== void 0 || config.magnitudeDownsample !== void 0 || config.keyUpdateIntervalSec !== void 0 || config.bpmUpdateIntervalSec !== void 0 || config.window !== void 0 || config.outputFormat !== void 0;
|
|
1820
|
-
if (hasExtendedConfig) {
|
|
1821
|
-
try {
|
|
1822
|
-
this.analyzer = new wasmModule.StreamAnalyzer(...args);
|
|
1823
|
-
} catch (error) {
|
|
1824
|
-
if (!isArityError(error)) {
|
|
1825
|
-
throw error;
|
|
1826
|
-
}
|
|
1827
|
-
this.analyzer = createLegacy();
|
|
1828
|
-
}
|
|
1829
|
-
} else {
|
|
1830
|
-
try {
|
|
1831
|
-
this.analyzer = createLegacy();
|
|
1832
|
-
} catch (error) {
|
|
1833
|
-
if (!isArityError(error)) {
|
|
1834
|
-
throw error;
|
|
1835
|
-
}
|
|
1836
|
-
this.analyzer = new wasmModule.StreamAnalyzer(...args);
|
|
1837
|
-
}
|
|
1838
|
-
}
|
|
2377
|
+
);
|
|
1839
2378
|
}
|
|
1840
2379
|
/**
|
|
1841
2380
|
* Process audio samples.
|
|
@@ -2004,21 +2543,28 @@ export {
|
|
|
2004
2543
|
PitchClass as Pitch,
|
|
2005
2544
|
PitchClass,
|
|
2006
2545
|
RealtimeEngine,
|
|
2546
|
+
RealtimeVoiceChanger,
|
|
2007
2547
|
SectionType,
|
|
2008
2548
|
StreamAnalyzer,
|
|
2009
2549
|
StreamingEqualizer,
|
|
2010
2550
|
StreamingMasteringChain,
|
|
2551
|
+
StreamingRetune,
|
|
2011
2552
|
amplitudeToDb,
|
|
2012
2553
|
analyze,
|
|
2554
|
+
analyzeBpm,
|
|
2555
|
+
analyzeDynamics,
|
|
2013
2556
|
analyzeImpulseResponse,
|
|
2014
2557
|
analyzeMelody,
|
|
2558
|
+
analyzeRhythm,
|
|
2015
2559
|
analyzeSections,
|
|
2560
|
+
analyzeTimbre,
|
|
2016
2561
|
analyzeWithProgress,
|
|
2017
2562
|
chroma,
|
|
2018
2563
|
cqt,
|
|
2019
2564
|
cyclicTempogram,
|
|
2020
2565
|
dbToAmplitude,
|
|
2021
2566
|
dbToPower,
|
|
2567
|
+
decompose,
|
|
2022
2568
|
deemphasis,
|
|
2023
2569
|
detectAcoustic,
|
|
2024
2570
|
detectBeats,
|
|
@@ -2028,8 +2574,10 @@ export {
|
|
|
2028
2574
|
detectKey,
|
|
2029
2575
|
detectKeyCandidates,
|
|
2030
2576
|
detectOnsets,
|
|
2577
|
+
ebur128LoudnessRange,
|
|
2031
2578
|
engineAbiVersion,
|
|
2032
2579
|
engineCapabilities,
|
|
2580
|
+
estimateTuning,
|
|
2033
2581
|
fixFrames,
|
|
2034
2582
|
fixLength,
|
|
2035
2583
|
fourierTempogram,
|
|
@@ -2037,15 +2585,20 @@ export {
|
|
|
2037
2585
|
framesToSamples,
|
|
2038
2586
|
framesToTime,
|
|
2039
2587
|
harmonic,
|
|
2588
|
+
hasFfmpegSupport,
|
|
2040
2589
|
hpss,
|
|
2590
|
+
hpssWithResidual,
|
|
2041
2591
|
hzToMel,
|
|
2042
2592
|
hzToMidi,
|
|
2043
2593
|
hzToNote,
|
|
2044
2594
|
init,
|
|
2045
2595
|
isInitialized,
|
|
2046
2596
|
lufs,
|
|
2597
|
+
lufsInterleaved,
|
|
2047
2598
|
masterAudio,
|
|
2048
2599
|
masterAudioStereo,
|
|
2600
|
+
masterAudioStereoWithProgress,
|
|
2601
|
+
masterAudioWithProgress,
|
|
2049
2602
|
mastering,
|
|
2050
2603
|
masteringAssistantSuggest,
|
|
2051
2604
|
masteringAudioProfile,
|
|
@@ -2053,6 +2606,9 @@ export {
|
|
|
2053
2606
|
masteringChainStereo,
|
|
2054
2607
|
masteringChainStereoWithProgress,
|
|
2055
2608
|
masteringChainWithProgress,
|
|
2609
|
+
masteringDynamicsCompressor,
|
|
2610
|
+
masteringDynamicsGate,
|
|
2611
|
+
masteringDynamicsTransientShaper,
|
|
2056
2612
|
masteringPairAnalysisNames,
|
|
2057
2613
|
masteringPairAnalyze,
|
|
2058
2614
|
masteringPairProcess,
|
|
@@ -2061,6 +2617,13 @@ export {
|
|
|
2061
2617
|
masteringProcess,
|
|
2062
2618
|
masteringProcessStereo,
|
|
2063
2619
|
masteringProcessorNames,
|
|
2620
|
+
masteringRepairDeclick,
|
|
2621
|
+
masteringRepairDeclip,
|
|
2622
|
+
masteringRepairDecrackle,
|
|
2623
|
+
masteringRepairDehum,
|
|
2624
|
+
masteringRepairDenoiseClassical,
|
|
2625
|
+
masteringRepairDereverbClassical,
|
|
2626
|
+
masteringRepairTrimSilence,
|
|
2064
2627
|
masteringStereoAnalysisNames,
|
|
2065
2628
|
masteringStereoAnalyze,
|
|
2066
2629
|
masteringStreamingPreview,
|
|
@@ -2068,15 +2631,27 @@ export {
|
|
|
2068
2631
|
melToAudio,
|
|
2069
2632
|
melToHz,
|
|
2070
2633
|
melToStft,
|
|
2634
|
+
meteringCrestFactorDb,
|
|
2635
|
+
meteringDcOffset,
|
|
2636
|
+
meteringDetectClipping,
|
|
2637
|
+
meteringDynamicRange,
|
|
2638
|
+
meteringPeakDb,
|
|
2639
|
+
meteringPhaseScope,
|
|
2640
|
+
meteringRmsDb,
|
|
2641
|
+
meteringSpectrum,
|
|
2642
|
+
meteringStereoCorrelation,
|
|
2643
|
+
meteringStereoWidth,
|
|
2644
|
+
meteringTruePeakDb,
|
|
2645
|
+
meteringVectorscope,
|
|
2071
2646
|
mfcc,
|
|
2072
2647
|
mfccToAudio,
|
|
2073
2648
|
mfccToMel,
|
|
2074
2649
|
midiToHz,
|
|
2075
2650
|
mixStereo,
|
|
2076
|
-
mixerScenePresetJson,
|
|
2077
2651
|
mixingScenePresetJson,
|
|
2078
2652
|
mixingScenePresetNames,
|
|
2079
2653
|
momentaryLufs,
|
|
2654
|
+
nnFilter,
|
|
2080
2655
|
nnlsChroma,
|
|
2081
2656
|
normalize,
|
|
2082
2657
|
noteStretch,
|
|
@@ -2086,19 +2661,30 @@ export {
|
|
|
2086
2661
|
pcen,
|
|
2087
2662
|
peakPick,
|
|
2088
2663
|
percussive,
|
|
2664
|
+
phaseVocoder,
|
|
2089
2665
|
pitchCorrectToMidi,
|
|
2090
2666
|
pitchPyin,
|
|
2091
2667
|
pitchShift,
|
|
2668
|
+
pitchTuning,
|
|
2092
2669
|
pitchYin,
|
|
2093
2670
|
plp,
|
|
2671
|
+
polyFeatures,
|
|
2094
2672
|
powerToDb,
|
|
2095
2673
|
preemphasis,
|
|
2674
|
+
realtimeVoiceChangerPresetConfig,
|
|
2675
|
+
realtimeVoiceChangerPresetJson,
|
|
2676
|
+
realtimeVoiceChangerPresetNames,
|
|
2677
|
+
remix,
|
|
2096
2678
|
resample,
|
|
2097
2679
|
rmsEnergy,
|
|
2098
2680
|
samplesToFrames,
|
|
2681
|
+
scaleCorrectionSemitones,
|
|
2682
|
+
scalePitchClassEnabled,
|
|
2683
|
+
scaleQuantizeMidi,
|
|
2099
2684
|
shortTermLufs,
|
|
2100
2685
|
spectralBandwidth,
|
|
2101
2686
|
spectralCentroid,
|
|
2687
|
+
spectralContrast,
|
|
2102
2688
|
spectralFlatness,
|
|
2103
2689
|
spectralRolloff,
|
|
2104
2690
|
splitSilence,
|
|
@@ -2111,10 +2697,14 @@ export {
|
|
|
2111
2697
|
tonnetz,
|
|
2112
2698
|
trim,
|
|
2113
2699
|
trimSilence,
|
|
2700
|
+
validateRealtimeVoiceChangerPresetJson,
|
|
2114
2701
|
vectorNormalize,
|
|
2115
2702
|
version,
|
|
2116
2703
|
voiceChange,
|
|
2704
|
+
voiceChangerAbiVersion,
|
|
2705
|
+
voiceCharacterPresetId,
|
|
2117
2706
|
vqt,
|
|
2118
|
-
zeroCrossingRate
|
|
2707
|
+
zeroCrossingRate,
|
|
2708
|
+
zeroCrossings
|
|
2119
2709
|
};
|
|
2120
2710
|
//# sourceMappingURL=index.js.map
|