@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.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { ProgressCallback, WasmNnlsChromaResult, WasmDecomposeResult, WasmEngineAutomationPoint, WasmEngineBounceOptions, WasmEngineBounceResult, WasmEngineCaptureStatus, WasmEngineClip, WasmEngineFreezeOptions, WasmEngineFreezeResult, WasmEngineGraphSpec, WasmEngineMarker, WasmEngineMeterTelemetry, WasmEngineMetronomeConfig, WasmEngineParameterInfo, WasmEngineTelemetry, WasmEngineTransportState, WasmHpssWithResidualResult, WasmMatrix2dResult, WasmEngineProcessWithMonitorResult, WasmCyclicTempogramResult, WasmFourierTempogramResult, WasmFrameResult, WasmLufsResult, WasmTempogramResult, WasmTrimResult } from './sonare.js';
|
|
2
|
+
export { ProgressCallback } from './sonare.js';
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
5
|
* Pitch class enum (C=0, C#=1, ..., B=11)
|
|
3
6
|
*/
|
|
@@ -651,6 +654,66 @@ interface StreamingEqualizerConfig {
|
|
|
651
654
|
sampleRate?: number;
|
|
652
655
|
maxBlockSize?: number;
|
|
653
656
|
}
|
|
657
|
+
/** Configuration for {@link StreamingRetune}. */
|
|
658
|
+
interface StreamingRetuneConfig {
|
|
659
|
+
/** Pitch shift in semitones, clamped by the native processor to +/-24. */
|
|
660
|
+
semitones?: number;
|
|
661
|
+
/** Wet/dry mix, clamped by the native processor to 0..1. */
|
|
662
|
+
mix?: number;
|
|
663
|
+
/** Grain size in samples. Use 0/omit to derive it from the sample rate. */
|
|
664
|
+
grainSize?: number;
|
|
665
|
+
}
|
|
666
|
+
type VoicePresetId = 'neutral-monitor' | 'bright-idol' | 'soft-whisper' | 'deep-narrator' | 'robot-mascot' | 'dark-villain';
|
|
667
|
+
interface RealtimeVoiceChangerPreset {
|
|
668
|
+
schemaVersion: 1;
|
|
669
|
+
id?: string;
|
|
670
|
+
name?: string;
|
|
671
|
+
description?: string;
|
|
672
|
+
macros?: Record<string, number>;
|
|
673
|
+
dsp?: Record<string, unknown>;
|
|
674
|
+
}
|
|
675
|
+
type RealtimeVoiceChangerConfigInput = VoicePresetId | RealtimeVoiceChangerPreset;
|
|
676
|
+
/**
|
|
677
|
+
* Flat (POD) realtime voice-changer configuration. Field names mirror the
|
|
678
|
+
* C ABI `SonareRealtimeVoiceChangerConfig` / Python POD exactly (snake_case),
|
|
679
|
+
* so a config can be round-tripped across bindings without renaming.
|
|
680
|
+
*/
|
|
681
|
+
interface RealtimeVoiceChangerPodConfig {
|
|
682
|
+
input_gain_db: number;
|
|
683
|
+
output_gain_db: number;
|
|
684
|
+
wet_mix: number;
|
|
685
|
+
retune_semitones: number;
|
|
686
|
+
retune_mix: number;
|
|
687
|
+
retune_grain_size: number;
|
|
688
|
+
formant_factor: number;
|
|
689
|
+
formant_amount: number;
|
|
690
|
+
formant_body: number;
|
|
691
|
+
formant_brightness: number;
|
|
692
|
+
formant_nasal: number;
|
|
693
|
+
eq_highpass_hz: number;
|
|
694
|
+
eq_body_db: number;
|
|
695
|
+
eq_presence_db: number;
|
|
696
|
+
eq_air_db: number;
|
|
697
|
+
gate_threshold_db: number;
|
|
698
|
+
gate_attack_ms: number;
|
|
699
|
+
gate_release_ms: number;
|
|
700
|
+
gate_range_db: number;
|
|
701
|
+
compressor_threshold_db: number;
|
|
702
|
+
compressor_ratio: number;
|
|
703
|
+
compressor_attack_ms: number;
|
|
704
|
+
compressor_release_ms: number;
|
|
705
|
+
compressor_makeup_gain_db: number;
|
|
706
|
+
deesser_frequency_hz: number;
|
|
707
|
+
deesser_threshold_db: number;
|
|
708
|
+
deesser_ratio: number;
|
|
709
|
+
deesser_range_db: number;
|
|
710
|
+
reverb_mix: number;
|
|
711
|
+
reverb_time_ms: number;
|
|
712
|
+
reverb_damping: number;
|
|
713
|
+
reverb_seed: number;
|
|
714
|
+
limiter_ceiling_db: number;
|
|
715
|
+
limiter_release_ms: number;
|
|
716
|
+
}
|
|
654
717
|
/** Options for {@link StreamingEqualizer.match}. */
|
|
655
718
|
interface EqMatchOptions {
|
|
656
719
|
sampleRate?: number;
|
|
@@ -781,180 +844,6 @@ interface StreamConfig {
|
|
|
781
844
|
outputFormat?: number;
|
|
782
845
|
}
|
|
783
846
|
|
|
784
|
-
type ProgressCallback = (progress: number, stage: string) => void;
|
|
785
|
-
interface WasmTrimResult {
|
|
786
|
-
audio: Float32Array;
|
|
787
|
-
startSample: number;
|
|
788
|
-
endSample: number;
|
|
789
|
-
}
|
|
790
|
-
interface WasmFrameResult {
|
|
791
|
-
nFrames: number;
|
|
792
|
-
frames: Float32Array;
|
|
793
|
-
}
|
|
794
|
-
interface WasmTempogramResult {
|
|
795
|
-
nFrames: number;
|
|
796
|
-
winLength: number;
|
|
797
|
-
data: Float32Array;
|
|
798
|
-
}
|
|
799
|
-
interface WasmCyclicTempogramResult {
|
|
800
|
-
nFrames: number;
|
|
801
|
-
nBins: number;
|
|
802
|
-
data: Float32Array;
|
|
803
|
-
}
|
|
804
|
-
interface WasmFourierTempogramResult {
|
|
805
|
-
nBins: number;
|
|
806
|
-
nFrames: number;
|
|
807
|
-
data: Float32Array;
|
|
808
|
-
}
|
|
809
|
-
interface WasmNnlsChromaResult {
|
|
810
|
-
nChroma: number;
|
|
811
|
-
nFrames: number;
|
|
812
|
-
data: Float32Array;
|
|
813
|
-
}
|
|
814
|
-
interface WasmEngineClip {
|
|
815
|
-
id?: number;
|
|
816
|
-
channels: Float32Array[];
|
|
817
|
-
startPpq: number;
|
|
818
|
-
lengthSamples?: number;
|
|
819
|
-
clipOffsetSamples?: number;
|
|
820
|
-
loop?: boolean;
|
|
821
|
-
gain?: number;
|
|
822
|
-
fadeInSamples?: number;
|
|
823
|
-
fadeOutSamples?: number;
|
|
824
|
-
}
|
|
825
|
-
interface WasmEngineParameterInfo {
|
|
826
|
-
id: number;
|
|
827
|
-
name: string;
|
|
828
|
-
unit: string;
|
|
829
|
-
minValue: number;
|
|
830
|
-
maxValue: number;
|
|
831
|
-
defaultValue: number;
|
|
832
|
-
rtSafe: boolean;
|
|
833
|
-
defaultCurve: number;
|
|
834
|
-
}
|
|
835
|
-
interface WasmEngineAutomationPoint {
|
|
836
|
-
ppq: number;
|
|
837
|
-
value: number;
|
|
838
|
-
curveToNext?: number;
|
|
839
|
-
}
|
|
840
|
-
interface WasmEngineMarker {
|
|
841
|
-
id: number;
|
|
842
|
-
ppq: number;
|
|
843
|
-
name?: string;
|
|
844
|
-
}
|
|
845
|
-
interface WasmEngineMetronomeConfig {
|
|
846
|
-
enabled: boolean;
|
|
847
|
-
beatGain?: number;
|
|
848
|
-
accentGain?: number;
|
|
849
|
-
clickSamples?: number;
|
|
850
|
-
}
|
|
851
|
-
interface WasmEngineGraphNode {
|
|
852
|
-
id: string;
|
|
853
|
-
type?: number;
|
|
854
|
-
gainDb?: number;
|
|
855
|
-
numPorts?: number;
|
|
856
|
-
}
|
|
857
|
-
interface WasmEngineGraphConnection {
|
|
858
|
-
sourceNode: string;
|
|
859
|
-
sourcePort: number;
|
|
860
|
-
destNode: string;
|
|
861
|
-
destPort: number;
|
|
862
|
-
mix?: number;
|
|
863
|
-
}
|
|
864
|
-
interface WasmEngineGraphParameterBinding {
|
|
865
|
-
paramId: number;
|
|
866
|
-
nodeId: string;
|
|
867
|
-
}
|
|
868
|
-
interface WasmEngineGraphSpec {
|
|
869
|
-
nodes: WasmEngineGraphNode[];
|
|
870
|
-
connections: WasmEngineGraphConnection[];
|
|
871
|
-
inputNode: string;
|
|
872
|
-
outputNode: string;
|
|
873
|
-
numChannels: number;
|
|
874
|
-
parameterBindings?: WasmEngineGraphParameterBinding[];
|
|
875
|
-
}
|
|
876
|
-
interface WasmEngineTelemetry {
|
|
877
|
-
type: number;
|
|
878
|
-
error: number;
|
|
879
|
-
renderFrame: number;
|
|
880
|
-
timelineSample: number;
|
|
881
|
-
audibleTimelineSample: number;
|
|
882
|
-
graphLatencySamplesQ8: number;
|
|
883
|
-
value: number;
|
|
884
|
-
}
|
|
885
|
-
interface WasmEngineMeterTelemetry {
|
|
886
|
-
targetId: number;
|
|
887
|
-
renderFrame: number;
|
|
888
|
-
seq: number;
|
|
889
|
-
peakDbL: number;
|
|
890
|
-
peakDbR: number;
|
|
891
|
-
rmsDbL: number;
|
|
892
|
-
rmsDbR: number;
|
|
893
|
-
truePeakDbL: number;
|
|
894
|
-
truePeakDbR: number;
|
|
895
|
-
maxTruePeakDb: number;
|
|
896
|
-
correlation: number;
|
|
897
|
-
monoCompatWidth: number;
|
|
898
|
-
momentaryLufs: number;
|
|
899
|
-
shortTermLufs: number;
|
|
900
|
-
integratedLufs: number;
|
|
901
|
-
gainReductionDb: number;
|
|
902
|
-
droppedRecords: number;
|
|
903
|
-
}
|
|
904
|
-
interface WasmEngineCaptureStatus {
|
|
905
|
-
capturedFrames: number;
|
|
906
|
-
overflowCount: number;
|
|
907
|
-
armed: boolean;
|
|
908
|
-
punchEnabled: boolean;
|
|
909
|
-
}
|
|
910
|
-
interface WasmEngineTransportState {
|
|
911
|
-
playing: boolean;
|
|
912
|
-
looping: boolean;
|
|
913
|
-
renderFrame: number;
|
|
914
|
-
samplePosition: number;
|
|
915
|
-
ppq: number;
|
|
916
|
-
bpm: number;
|
|
917
|
-
loopStartPpq: number;
|
|
918
|
-
loopEndPpq: number;
|
|
919
|
-
sampleRate: number;
|
|
920
|
-
}
|
|
921
|
-
interface WasmEngineBounceOptions {
|
|
922
|
-
totalFrames: number;
|
|
923
|
-
blockSize?: number;
|
|
924
|
-
numChannels?: number;
|
|
925
|
-
targetSampleRate?: number;
|
|
926
|
-
sourceSampleRate?: number;
|
|
927
|
-
normalizeLufs?: boolean;
|
|
928
|
-
targetLufs?: number;
|
|
929
|
-
dither?: 0 | 1 | 2 | 3;
|
|
930
|
-
ditherBits?: number;
|
|
931
|
-
ditherSeed?: number;
|
|
932
|
-
}
|
|
933
|
-
interface WasmEngineBounceResult {
|
|
934
|
-
interleaved: Float32Array;
|
|
935
|
-
frames: number;
|
|
936
|
-
numChannels: number;
|
|
937
|
-
sampleRate: number;
|
|
938
|
-
integratedLufs: number;
|
|
939
|
-
}
|
|
940
|
-
interface WasmEngineFreezeOptions {
|
|
941
|
-
totalFrames: number;
|
|
942
|
-
blockSize?: number;
|
|
943
|
-
numChannels?: number;
|
|
944
|
-
clipId?: number;
|
|
945
|
-
startPpq?: number;
|
|
946
|
-
gain?: number;
|
|
947
|
-
}
|
|
948
|
-
interface WasmEngineFreezeResult {
|
|
949
|
-
clipId: number;
|
|
950
|
-
frames: number;
|
|
951
|
-
numChannels: number;
|
|
952
|
-
}
|
|
953
|
-
interface WasmEngineProcessWithMonitorResult {
|
|
954
|
-
output: Float32Array[];
|
|
955
|
-
monitor: Float32Array[];
|
|
956
|
-
}
|
|
957
|
-
|
|
958
847
|
/**
|
|
959
848
|
* sonare - Audio Analysis Library
|
|
960
849
|
*
|
|
@@ -989,6 +878,12 @@ type EngineFreezeResult = WasmEngineFreezeResult;
|
|
|
989
878
|
type EngineTelemetry = WasmEngineTelemetry;
|
|
990
879
|
type EngineMeterTelemetry = WasmEngineMeterTelemetry;
|
|
991
880
|
type EngineTransportState = WasmEngineTransportState;
|
|
881
|
+
/** Row-major 2-D matrix as a flat buffer plus its dimensions. */
|
|
882
|
+
type Matrix2dResult = WasmMatrix2dResult;
|
|
883
|
+
/** NMF factor matrices { w, h } from {@link decompose}. */
|
|
884
|
+
type DecomposeResult = WasmDecomposeResult;
|
|
885
|
+
/** Harmonic / percussive / residual signals from {@link hpssWithResidual}. */
|
|
886
|
+
type HpssWithResidualResult = WasmHpssWithResidualResult;
|
|
992
887
|
declare const EXPECTED_ENGINE_ABI_VERSION = 2;
|
|
993
888
|
interface EngineCapabilities {
|
|
994
889
|
engineAbiVersion: number;
|
|
@@ -1006,6 +901,48 @@ interface MixerRealtimeBuffer {
|
|
|
1006
901
|
outRight: Float32Array;
|
|
1007
902
|
process: (numSamples?: number) => void;
|
|
1008
903
|
}
|
|
904
|
+
/**
|
|
905
|
+
* Zero-copy realtime buffer pair for {@link RealtimeVoiceChanger} mono
|
|
906
|
+
* processing. The `input` / `output` `Float32Array`s are typed-memory views
|
|
907
|
+
* onto the WASM heap — write samples into `input`, call `process()`, then
|
|
908
|
+
* read from `output`. The views are owned by the {@link RealtimeVoiceChanger}
|
|
909
|
+
* and remain valid until `delete()` is called on it.
|
|
910
|
+
*/
|
|
911
|
+
interface RealtimeVoiceChangerMonoBuffer {
|
|
912
|
+
input: Float32Array;
|
|
913
|
+
output: Float32Array;
|
|
914
|
+
process: () => void;
|
|
915
|
+
}
|
|
916
|
+
/**
|
|
917
|
+
* Zero-copy realtime buffer pair for {@link RealtimeVoiceChanger} interleaved
|
|
918
|
+
* multi-channel processing. Layout is L0,R0,L1,R1,... for stereo. The views
|
|
919
|
+
* are owned by the {@link RealtimeVoiceChanger}.
|
|
920
|
+
*/
|
|
921
|
+
interface RealtimeVoiceChangerInterleavedBuffer {
|
|
922
|
+
input: Float32Array;
|
|
923
|
+
output: Float32Array;
|
|
924
|
+
channels: number;
|
|
925
|
+
process: () => void;
|
|
926
|
+
}
|
|
927
|
+
/**
|
|
928
|
+
* Zero-copy realtime buffer for {@link RealtimeVoiceChanger} planar stereo
|
|
929
|
+
* processing. Each entry in `channels` is a heap-backed `Float32Array` for one
|
|
930
|
+
* channel (matching AudioWorklet's native layout). Process happens in place:
|
|
931
|
+
* write samples into each channel view, call `process()`, then read back from
|
|
932
|
+
* the same views.
|
|
933
|
+
*/
|
|
934
|
+
interface RealtimeVoiceChangerPlanarBuffer {
|
|
935
|
+
channels: Float32Array[];
|
|
936
|
+
process: () => void;
|
|
937
|
+
}
|
|
938
|
+
/**
|
|
939
|
+
* Per-call validation options accepted by guarded wrappers. Empty-buffer
|
|
940
|
+
* checks are always performed; pass `{ validate: false }` to opt out of the
|
|
941
|
+
* O(n) NaN/Inf scan on hot paths.
|
|
942
|
+
*/
|
|
943
|
+
interface ValidateOptions {
|
|
944
|
+
validate?: boolean;
|
|
945
|
+
}
|
|
1009
946
|
/**
|
|
1010
947
|
* Initialize the WASM module.
|
|
1011
948
|
* Must be called before using any analysis functions.
|
|
@@ -1025,6 +962,18 @@ declare function isInitialized(): boolean;
|
|
|
1025
962
|
*/
|
|
1026
963
|
declare function version(): string;
|
|
1027
964
|
declare function engineAbiVersion(): number;
|
|
965
|
+
declare function voiceChangerAbiVersion(): number;
|
|
966
|
+
/**
|
|
967
|
+
* Map a voice-character preset ordinal (or canonical id) to its canonical id
|
|
968
|
+
* string (e.g. `'bright-idol'`). Returns `null` for an out-of-range ordinal.
|
|
969
|
+
*/
|
|
970
|
+
declare function voiceCharacterPresetId(preset: VoicePresetId | number): string | null;
|
|
971
|
+
/**
|
|
972
|
+
* Return the canonical (normalized) flat POD config for a built-in voice
|
|
973
|
+
* preset, skipping the JSON round-trip. Accepts a canonical preset id or its
|
|
974
|
+
* integer ordinal. Returns `null` for an out-of-range ordinal.
|
|
975
|
+
*/
|
|
976
|
+
declare function realtimeVoiceChangerPresetConfig(preset: VoicePresetId | number): RealtimeVoiceChangerPodConfig | null;
|
|
1028
977
|
declare function engineCapabilities(): EngineCapabilities;
|
|
1029
978
|
declare class RealtimeEngine {
|
|
1030
979
|
private native;
|
|
@@ -1082,81 +1031,157 @@ declare class RealtimeEngine {
|
|
|
1082
1031
|
* Detect BPM from audio samples.
|
|
1083
1032
|
*
|
|
1084
1033
|
* @param samples - Audio samples (mono, float32)
|
|
1085
|
-
* @param sampleRate - Sample rate in Hz
|
|
1034
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1086
1035
|
* @returns Detected BPM
|
|
1087
1036
|
*/
|
|
1088
|
-
declare function detectBpm(samples: Float32Array, sampleRate
|
|
1037
|
+
declare function detectBpm(samples: Float32Array, sampleRate?: number): number;
|
|
1089
1038
|
/**
|
|
1090
1039
|
* Detect musical key from audio samples.
|
|
1091
1040
|
*
|
|
1092
1041
|
* @param samples - Audio samples (mono, float32)
|
|
1093
|
-
* @param sampleRate - Sample rate in Hz
|
|
1042
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1094
1043
|
* @returns Detected key
|
|
1095
1044
|
*/
|
|
1096
|
-
declare function detectKey(samples: Float32Array, sampleRate
|
|
1097
|
-
declare function detectKeyCandidates(samples: Float32Array, sampleRate
|
|
1045
|
+
declare function detectKey(samples: Float32Array, sampleRate?: number, options?: KeyDetectionOptions): Key;
|
|
1046
|
+
declare function detectKeyCandidates(samples: Float32Array, sampleRate?: number, options?: KeyDetectionOptions): KeyCandidate[];
|
|
1098
1047
|
/**
|
|
1099
1048
|
* Detect onset times from audio samples.
|
|
1100
1049
|
*
|
|
1101
1050
|
* @param samples - Audio samples (mono, float32)
|
|
1102
|
-
* @param sampleRate - Sample rate in Hz
|
|
1051
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1103
1052
|
* @returns Array of onset times in seconds
|
|
1104
1053
|
*/
|
|
1105
|
-
declare function detectOnsets(samples: Float32Array, sampleRate
|
|
1054
|
+
declare function detectOnsets(samples: Float32Array, sampleRate?: number): Float32Array;
|
|
1106
1055
|
/**
|
|
1107
1056
|
* Detect beat times from audio samples.
|
|
1108
1057
|
*
|
|
1109
1058
|
* @param samples - Audio samples (mono, float32)
|
|
1110
|
-
* @param sampleRate - Sample rate in Hz
|
|
1059
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1111
1060
|
* @returns Array of beat times in seconds
|
|
1112
1061
|
*/
|
|
1113
|
-
declare function detectBeats(samples: Float32Array, sampleRate
|
|
1062
|
+
declare function detectBeats(samples: Float32Array, sampleRate?: number): Float32Array;
|
|
1114
1063
|
/**
|
|
1115
1064
|
* Detect downbeat times from audio samples.
|
|
1116
1065
|
*
|
|
1117
1066
|
* @param samples - Audio samples (mono, float32)
|
|
1118
|
-
* @param sampleRate - Sample rate in Hz
|
|
1067
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1119
1068
|
* @returns Array of downbeat times in seconds
|
|
1120
1069
|
*/
|
|
1121
|
-
declare function detectDownbeats(samples: Float32Array, sampleRate
|
|
1070
|
+
declare function detectDownbeats(samples: Float32Array, sampleRate?: number): Float32Array;
|
|
1122
1071
|
/**
|
|
1123
1072
|
* Detect chords from audio samples.
|
|
1124
1073
|
*
|
|
1125
1074
|
* @param samples - Audio samples (mono, float32)
|
|
1126
|
-
* @param sampleRate - Sample rate in Hz
|
|
1075
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1127
1076
|
* @param options - Optional chord detection settings
|
|
1128
1077
|
* @returns Detected chord segments
|
|
1129
1078
|
*/
|
|
1130
|
-
declare function detectChords(samples: Float32Array, sampleRate
|
|
1079
|
+
declare function detectChords(samples: Float32Array, sampleRate?: number, options?: ChordDetectionOptions): ChordAnalysisResult;
|
|
1131
1080
|
/**
|
|
1132
1081
|
* Perform complete music analysis.
|
|
1133
1082
|
*
|
|
1134
1083
|
* @param samples - Audio samples (mono, float32)
|
|
1135
|
-
* @param sampleRate - Sample rate in Hz
|
|
1084
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1136
1085
|
* @returns Complete analysis result
|
|
1137
1086
|
*/
|
|
1138
|
-
declare function analyze(samples: Float32Array, sampleRate
|
|
1139
|
-
declare function analyzeImpulseResponse(samples: Float32Array, sampleRate
|
|
1140
|
-
declare function detectAcoustic(samples: Float32Array, sampleRate
|
|
1087
|
+
declare function analyze(samples: Float32Array, sampleRate?: number): AnalysisResult;
|
|
1088
|
+
declare function analyzeImpulseResponse(samples: Float32Array, sampleRate?: number, nOctaveBands?: number): AcousticResult;
|
|
1089
|
+
declare function detectAcoustic(samples: Float32Array, sampleRate?: number, nOctaveBands?: number, nThirdOctaveSubbands?: number, minDecayDb?: number, noiseFloorMarginDb?: number): AcousticResult;
|
|
1141
1090
|
/**
|
|
1142
1091
|
* Perform complete music analysis with progress reporting.
|
|
1143
1092
|
*
|
|
1144
1093
|
* @param samples - Audio samples (mono, float32)
|
|
1145
|
-
* @param sampleRate - Sample rate in Hz
|
|
1094
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1146
1095
|
* @param onProgress - Progress callback (progress: 0-1, stage: string)
|
|
1147
1096
|
* @returns Complete analysis result
|
|
1148
1097
|
*/
|
|
1149
|
-
declare function analyzeWithProgress(samples: Float32Array, sampleRate: number, onProgress: ProgressCallback): AnalysisResult;
|
|
1098
|
+
declare function analyzeWithProgress(samples: Float32Array, sampleRate: number | undefined, onProgress: ProgressCallback): AnalysisResult;
|
|
1099
|
+
interface BpmCandidate {
|
|
1100
|
+
bpm: number;
|
|
1101
|
+
confidence: number;
|
|
1102
|
+
}
|
|
1103
|
+
interface BpmAnalysisResult {
|
|
1104
|
+
bpm: number;
|
|
1105
|
+
confidence: number;
|
|
1106
|
+
candidates: BpmCandidate[];
|
|
1107
|
+
autocorrelation: Float32Array;
|
|
1108
|
+
tempogram: Float32Array;
|
|
1109
|
+
}
|
|
1110
|
+
interface RhythmAnalysisResult {
|
|
1111
|
+
timeSignature: {
|
|
1112
|
+
numerator: number;
|
|
1113
|
+
denominator: number;
|
|
1114
|
+
confidence: number;
|
|
1115
|
+
};
|
|
1116
|
+
syncopation: number;
|
|
1117
|
+
grooveType: string;
|
|
1118
|
+
patternRegularity: number;
|
|
1119
|
+
tempoStability: number;
|
|
1120
|
+
bpm: number;
|
|
1121
|
+
beatIntervals: Float32Array;
|
|
1122
|
+
}
|
|
1123
|
+
interface DynamicsAnalysisResult {
|
|
1124
|
+
dynamicRangeDb: number;
|
|
1125
|
+
peakDb: number;
|
|
1126
|
+
rmsDb: number;
|
|
1127
|
+
crestFactor: number;
|
|
1128
|
+
loudnessRangeDb: number;
|
|
1129
|
+
isCompressed: boolean;
|
|
1130
|
+
/** Loudness curve timestamps (seconds), parallel to {@link loudnessRmsDb}. */
|
|
1131
|
+
loudnessTimes: Float32Array;
|
|
1132
|
+
/** Loudness curve RMS values (dB), parallel to {@link loudnessTimes}. */
|
|
1133
|
+
loudnessRmsDb: Float32Array;
|
|
1134
|
+
}
|
|
1135
|
+
/** Timbre metrics for one analysis window. Entries are ordered by time in `timbreOverTime`. */
|
|
1136
|
+
interface TimbreFrame {
|
|
1137
|
+
brightness: number;
|
|
1138
|
+
warmth: number;
|
|
1139
|
+
density: number;
|
|
1140
|
+
roughness: number;
|
|
1141
|
+
complexity: number;
|
|
1142
|
+
}
|
|
1143
|
+
interface TimbreAnalysisResult extends TimbreFrame {
|
|
1144
|
+
spectralCentroid: Float32Array;
|
|
1145
|
+
spectralFlatness: Float32Array;
|
|
1146
|
+
spectralRolloff: Float32Array;
|
|
1147
|
+
/** Time-varying timbre metrics, one entry per analysis window. */
|
|
1148
|
+
timbreOverTime: TimbreFrame[];
|
|
1149
|
+
}
|
|
1150
|
+
/**
|
|
1151
|
+
* Detailed BPM analysis (BPM, confidence, alternate candidates, autocorrelation,
|
|
1152
|
+
* tempogram). Matches the Node `analyzeBpm` / Python `analyze_bpm` surface.
|
|
1153
|
+
*/
|
|
1154
|
+
declare function analyzeBpm(samples: Float32Array, sampleRate?: number, bpmMin?: number, bpmMax?: number, startBpm?: number, nFft?: number, hopLength?: number, maxCandidates?: number): BpmAnalysisResult;
|
|
1155
|
+
/**
|
|
1156
|
+
* Detailed rhythm analysis (time signature, groove, syncopation, beat intervals).
|
|
1157
|
+
*/
|
|
1158
|
+
declare function analyzeRhythm(samples: Float32Array, sampleRate?: number, bpmMin?: number, bpmMax?: number, startBpm?: number, nFft?: number, hopLength?: number): RhythmAnalysisResult;
|
|
1159
|
+
/**
|
|
1160
|
+
* Dynamics analysis (RMS, peak, crest factor, LRA, loudness curve).
|
|
1161
|
+
*/
|
|
1162
|
+
declare function analyzeDynamics(samples: Float32Array, sampleRate?: number, windowSec?: number, hopLength?: number, compressionThreshold?: number): DynamicsAnalysisResult;
|
|
1163
|
+
/**
|
|
1164
|
+
* Timbre analysis (brightness/warmth/density/roughness/complexity plus spectral
|
|
1165
|
+
* features and per-window timbre frames).
|
|
1166
|
+
*/
|
|
1167
|
+
declare function analyzeTimbre(samples: Float32Array, sampleRate?: number, nFft?: number, hopLength?: number, nMels?: number, nMfcc?: number, windowSec?: number): TimbreAnalysisResult;
|
|
1168
|
+
/**
|
|
1169
|
+
* Whether this WASM build was compiled with FFmpeg support. Mirrors Node /
|
|
1170
|
+
* Python `hasFfmpegSupport`. In the published WASM binding this currently
|
|
1171
|
+
* always returns `false` (FFmpeg is not bundled into the .wasm), but the API
|
|
1172
|
+
* exists so caller code can branch on capabilities portably.
|
|
1173
|
+
*/
|
|
1174
|
+
declare function hasFfmpegSupport(): boolean;
|
|
1150
1175
|
/**
|
|
1151
1176
|
* Perform Harmonic-Percussive Source Separation (HPSS).
|
|
1152
1177
|
*
|
|
1153
1178
|
* @param samples - Audio samples (mono, float32)
|
|
1154
|
-
* @param sampleRate - Sample rate in Hz
|
|
1179
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1155
1180
|
* @param kernelHarmonic - Horizontal median filter size for harmonic (default: 31)
|
|
1156
1181
|
* @param kernelPercussive - Vertical median filter size for percussive (default: 31)
|
|
1157
1182
|
* @returns Separated harmonic and percussive components
|
|
1158
1183
|
*/
|
|
1159
|
-
declare function hpss(samples: Float32Array, sampleRate
|
|
1184
|
+
declare function hpss(samples: Float32Array, sampleRate?: number, kernelHarmonic?: number, kernelPercussive?: number): HpssResult;
|
|
1160
1185
|
/**
|
|
1161
1186
|
* Extract harmonic component from audio.
|
|
1162
1187
|
*
|
|
@@ -1200,7 +1225,7 @@ declare function pitchShift(samples: Float32Array, sampleRate: number, semitones
|
|
|
1200
1225
|
* @param targetMidi - Desired MIDI note number
|
|
1201
1226
|
* @returns Pitch-corrected audio
|
|
1202
1227
|
*/
|
|
1203
|
-
declare function pitchCorrectToMidi(samples: Float32Array, sampleRate
|
|
1228
|
+
declare function pitchCorrectToMidi(samples: Float32Array, sampleRate?: number, currentMidi?: number, targetMidi?: number): Float32Array;
|
|
1204
1229
|
/**
|
|
1205
1230
|
* Time-stretch a note region between two sample offsets without changing pitch.
|
|
1206
1231
|
*
|
|
@@ -1211,7 +1236,7 @@ declare function pitchCorrectToMidi(samples: Float32Array, sampleRate: number, c
|
|
|
1211
1236
|
* @param stretchRatio - Stretch ratio (0.5 = double duration, 2.0 = half duration)
|
|
1212
1237
|
* @returns Audio with the note region stretched
|
|
1213
1238
|
*/
|
|
1214
|
-
declare function noteStretch(samples: Float32Array, sampleRate
|
|
1239
|
+
declare function noteStretch(samples: Float32Array, sampleRate?: number, onsetSample?: number, offsetSample?: number, stretchRatio?: number): Float32Array;
|
|
1215
1240
|
/**
|
|
1216
1241
|
* Apply a voice change by shifting pitch and formants independently.
|
|
1217
1242
|
*
|
|
@@ -1221,7 +1246,7 @@ declare function noteStretch(samples: Float32Array, sampleRate: number, onsetSam
|
|
|
1221
1246
|
* @param formantFactor - Formant scaling factor (1.0 = unchanged)
|
|
1222
1247
|
* @returns Voice-changed audio
|
|
1223
1248
|
*/
|
|
1224
|
-
declare function voiceChange(samples: Float32Array, sampleRate
|
|
1249
|
+
declare function voiceChange(samples: Float32Array, sampleRate?: number, pitchSemitones?: number, formantFactor?: number, options?: ValidateOptions): Float32Array;
|
|
1225
1250
|
/**
|
|
1226
1251
|
* Normalize audio to target peak level.
|
|
1227
1252
|
*
|
|
@@ -1235,34 +1260,176 @@ declare function normalize(samples: Float32Array, sampleRate: number, targetDb?:
|
|
|
1235
1260
|
* Apply mastering loudness normalization with a true-peak ceiling.
|
|
1236
1261
|
*
|
|
1237
1262
|
* @param samples - Audio samples (mono, float32)
|
|
1238
|
-
* @param sampleRate - Sample rate in Hz
|
|
1263
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1239
1264
|
* @param targetLufs - Target integrated LUFS (default: -14)
|
|
1240
1265
|
* @param ceilingDb - True/sample peak ceiling in dBFS (default: -1)
|
|
1241
1266
|
* @param truePeakOversample - Oversampling factor used for peak estimation
|
|
1242
1267
|
* @returns Processed audio and loudness metadata
|
|
1243
1268
|
*/
|
|
1244
|
-
declare function mastering(samples: Float32Array, sampleRate
|
|
1269
|
+
declare function mastering(samples: Float32Array, sampleRate?: number, targetLufs?: number, ceilingDb?: number, truePeakOversample?: number): MasteringResult;
|
|
1245
1270
|
declare function masteringProcessorNames(): SoloProcessor[];
|
|
1246
1271
|
declare function masteringPairProcessorNames(): PairProcessor[];
|
|
1247
1272
|
declare function masteringPairAnalysisNames(): PairAnalysis[];
|
|
1248
1273
|
declare function masteringStereoAnalysisNames(): StereoAnalysis[];
|
|
1249
|
-
declare function masteringProcess(processorName: SoloProcessor, samples: Float32Array, sampleRate
|
|
1250
|
-
declare function masteringProcessStereo(processorName: SoloProcessor, left: Float32Array, right: Float32Array, sampleRate
|
|
1251
|
-
declare function masteringPairProcess(processorName: PairProcessor, source: Float32Array, reference: Float32Array, sampleRate
|
|
1252
|
-
declare function masteringPairAnalyze(analysisName: PairAnalysis, source: Float32Array, reference: Float32Array, sampleRate
|
|
1253
|
-
declare function masteringStereoAnalyze(analysisName: StereoAnalysis, left: Float32Array, right: Float32Array, sampleRate
|
|
1254
|
-
declare function masteringAssistantSuggest(samples: Float32Array, sampleRate
|
|
1255
|
-
declare function masteringAudioProfile(samples: Float32Array, sampleRate
|
|
1256
|
-
declare function masteringStreamingPreview(samples: Float32Array, sampleRate
|
|
1274
|
+
declare function masteringProcess(processorName: SoloProcessor, samples: Float32Array, sampleRate?: number, params?: MasteringProcessorParams): MasteringResult;
|
|
1275
|
+
declare function masteringProcessStereo(processorName: SoloProcessor, left: Float32Array, right: Float32Array, sampleRate?: number, params?: MasteringProcessorParams): MasteringStereoResult;
|
|
1276
|
+
declare function masteringPairProcess(processorName: PairProcessor, source: Float32Array, reference: Float32Array, sampleRate?: number, params?: MasteringProcessorParams): MasteringResult;
|
|
1277
|
+
declare function masteringPairAnalyze(analysisName: PairAnalysis, source: Float32Array, reference: Float32Array, sampleRate?: number, params?: MasteringProcessorParams): string;
|
|
1278
|
+
declare function masteringStereoAnalyze(analysisName: StereoAnalysis, left: Float32Array, right: Float32Array, sampleRate?: number, params?: MasteringProcessorParams): string;
|
|
1279
|
+
declare function masteringAssistantSuggest(samples: Float32Array, sampleRate?: number, params?: MasteringProcessorParams): string;
|
|
1280
|
+
declare function masteringAudioProfile(samples: Float32Array, sampleRate?: number, params?: MasteringProcessorParams): string;
|
|
1281
|
+
declare function masteringStreamingPreview(samples: Float32Array, sampleRate?: number, platforms?: StreamingPlatform[]): string;
|
|
1282
|
+
/** Options for `masteringRepairDeclick`. */
|
|
1283
|
+
interface DeclickOptions {
|
|
1284
|
+
threshold?: number;
|
|
1285
|
+
neighborRatio?: number;
|
|
1286
|
+
maxClickSamples?: number;
|
|
1287
|
+
lpcOrder?: number;
|
|
1288
|
+
residualRatio?: number;
|
|
1289
|
+
}
|
|
1290
|
+
/** Algorithms accepted by `masteringRepairDenoiseClassical`. */
|
|
1291
|
+
type DenoiseClassicalMode = 'logMmse' | 'mmseStsa' | 'spectralSubtraction';
|
|
1292
|
+
/** Noise PSD estimators accepted by `masteringRepairDenoiseClassical`. */
|
|
1293
|
+
type DenoiseClassicalNoiseEstimator = 'quantile' | 'mcra' | 'imcra';
|
|
1294
|
+
/** Options for `masteringRepairDenoiseClassical`. */
|
|
1295
|
+
interface DenoiseClassicalOptions {
|
|
1296
|
+
mode?: DenoiseClassicalMode;
|
|
1297
|
+
noiseEstimator?: DenoiseClassicalNoiseEstimator;
|
|
1298
|
+
nFft?: number;
|
|
1299
|
+
hopLength?: number;
|
|
1300
|
+
ddAlpha?: number;
|
|
1301
|
+
gainFloor?: number;
|
|
1302
|
+
overSubtraction?: number;
|
|
1303
|
+
spectralFloor?: number;
|
|
1304
|
+
noiseEstimationQuantile?: number;
|
|
1305
|
+
speechPresenceGain?: boolean;
|
|
1306
|
+
gainSmoothing?: boolean;
|
|
1307
|
+
}
|
|
1308
|
+
/** Offline LPC-based declicker. */
|
|
1309
|
+
declare function masteringRepairDeclick(samples: Float32Array, sampleRate: number, options?: DeclickOptions): Float32Array;
|
|
1310
|
+
/** Offline STFT-domain classical denoiser (LogMMSE / MMSE-STSA / SpectralSubtraction). */
|
|
1311
|
+
declare function masteringRepairDenoiseClassical(samples: Float32Array, sampleRate: number, options?: DenoiseClassicalOptions): Float32Array;
|
|
1312
|
+
/** Options for `masteringRepairDeclip`. */
|
|
1313
|
+
interface DeclipOptions {
|
|
1314
|
+
clipThreshold?: number;
|
|
1315
|
+
lpcOrder?: number;
|
|
1316
|
+
iterations?: number;
|
|
1317
|
+
lpcBlend?: number;
|
|
1318
|
+
}
|
|
1319
|
+
/** Algorithms accepted by `masteringRepairDecrackle`. */
|
|
1320
|
+
type DecrackleMode = 'median' | 'waveletShrinkage';
|
|
1321
|
+
/** Options for `masteringRepairDecrackle`. */
|
|
1322
|
+
interface DecrackleOptions {
|
|
1323
|
+
threshold?: number;
|
|
1324
|
+
mode?: DecrackleMode;
|
|
1325
|
+
levels?: number;
|
|
1326
|
+
}
|
|
1327
|
+
/** Options for `masteringRepairDehum`. */
|
|
1328
|
+
interface DehumOptions {
|
|
1329
|
+
fundamentalHz?: number;
|
|
1330
|
+
harmonics?: number;
|
|
1331
|
+
q?: number;
|
|
1332
|
+
adaptive?: boolean;
|
|
1333
|
+
searchRangeHz?: number;
|
|
1334
|
+
adaptation?: number;
|
|
1335
|
+
frameSize?: number;
|
|
1336
|
+
pllBandwidth?: number;
|
|
1337
|
+
}
|
|
1338
|
+
/** Options for `masteringRepairDereverbClassical`. */
|
|
1339
|
+
interface DereverbClassicalOptions {
|
|
1340
|
+
threshold?: number;
|
|
1341
|
+
attenuation?: number;
|
|
1342
|
+
nFft?: number;
|
|
1343
|
+
hopLength?: number;
|
|
1344
|
+
t60Sec?: number;
|
|
1345
|
+
lateDelayMs?: number;
|
|
1346
|
+
overSubtraction?: number;
|
|
1347
|
+
spectralFloor?: number;
|
|
1348
|
+
wpeEnabled?: boolean;
|
|
1349
|
+
wpeIterations?: number;
|
|
1350
|
+
wpeTaps?: number;
|
|
1351
|
+
wpeStrength?: number;
|
|
1352
|
+
}
|
|
1353
|
+
/** Trimming modes accepted by `masteringRepairTrimSilence`. */
|
|
1354
|
+
type TrimSilenceMode = 'peak' | 'lufsGated';
|
|
1355
|
+
/** Options for `masteringRepairTrimSilence`. */
|
|
1356
|
+
interface TrimSilenceOptions {
|
|
1357
|
+
threshold?: number;
|
|
1358
|
+
paddingSamples?: number;
|
|
1359
|
+
mode?: TrimSilenceMode;
|
|
1360
|
+
gateLufs?: number;
|
|
1361
|
+
windowMs?: number;
|
|
1362
|
+
}
|
|
1363
|
+
/** Offline LPC-based declipper. */
|
|
1364
|
+
declare function masteringRepairDeclip(samples: Float32Array, sampleRate: number, options?: DeclipOptions): Float32Array;
|
|
1365
|
+
/** Offline crackle suppressor (median or wavelet-shrinkage). */
|
|
1366
|
+
declare function masteringRepairDecrackle(samples: Float32Array, sampleRate: number, options?: DecrackleOptions): Float32Array;
|
|
1367
|
+
/** Offline mains-hum remover. */
|
|
1368
|
+
declare function masteringRepairDehum(samples: Float32Array, sampleRate: number, options?: DehumOptions): Float32Array;
|
|
1369
|
+
/** Offline classical dereverberator (spectral subtraction + optional WPE). */
|
|
1370
|
+
declare function masteringRepairDereverbClassical(samples: Float32Array, sampleRate: number, options?: DereverbClassicalOptions): Float32Array;
|
|
1371
|
+
/** Offline silence trimmer (peak threshold or LUFS-gated). */
|
|
1372
|
+
declare function masteringRepairTrimSilence(samples: Float32Array, sampleRate: number, options?: TrimSilenceOptions): Float32Array;
|
|
1373
|
+
/** Compressor sidechain detector mode. */
|
|
1374
|
+
type CompressorDetector = 'peak' | 'rms' | 'log_rms';
|
|
1375
|
+
/** Options for `masteringDynamicsCompressor`. */
|
|
1376
|
+
interface CompressorOptions extends ValidateOptions {
|
|
1377
|
+
thresholdDb?: number;
|
|
1378
|
+
ratio?: number;
|
|
1379
|
+
attackMs?: number;
|
|
1380
|
+
releaseMs?: number;
|
|
1381
|
+
kneeDb?: number;
|
|
1382
|
+
makeupGainDb?: number;
|
|
1383
|
+
autoMakeup?: boolean;
|
|
1384
|
+
detector?: CompressorDetector | number;
|
|
1385
|
+
sidechainHpfEnabled?: boolean;
|
|
1386
|
+
sidechainHpfHz?: number;
|
|
1387
|
+
pdrTimeMs?: number;
|
|
1388
|
+
pdrReleaseScale?: number;
|
|
1389
|
+
}
|
|
1390
|
+
/** Options for `masteringDynamicsGate`. */
|
|
1391
|
+
interface GateOptions extends ValidateOptions {
|
|
1392
|
+
thresholdDb?: number;
|
|
1393
|
+
attackMs?: number;
|
|
1394
|
+
releaseMs?: number;
|
|
1395
|
+
rangeDb?: number;
|
|
1396
|
+
holdMs?: number;
|
|
1397
|
+
closeThresholdDb?: number;
|
|
1398
|
+
keyHpfHz?: number;
|
|
1399
|
+
}
|
|
1400
|
+
/** Options for `masteringDynamicsTransientShaper`. */
|
|
1401
|
+
interface TransientShaperOptions extends ValidateOptions {
|
|
1402
|
+
attackGainDb?: number;
|
|
1403
|
+
sustainGainDb?: number;
|
|
1404
|
+
fastAttackMs?: number;
|
|
1405
|
+
fastReleaseMs?: number;
|
|
1406
|
+
slowAttackMs?: number;
|
|
1407
|
+
slowReleaseMs?: number;
|
|
1408
|
+
sensitivity?: number;
|
|
1409
|
+
maxGainDb?: number;
|
|
1410
|
+
gainSmoothingMs?: number;
|
|
1411
|
+
lookaheadMs?: number;
|
|
1412
|
+
}
|
|
1413
|
+
/** Result envelope returned by offline mastering dynamics processors. */
|
|
1414
|
+
interface DynamicsResult {
|
|
1415
|
+
samples: Float32Array;
|
|
1416
|
+
latencySamples: number;
|
|
1417
|
+
}
|
|
1418
|
+
/** Offline feed-forward compressor (soft knee, optional auto-makeup / sidechain HPF). */
|
|
1419
|
+
declare function masteringDynamicsCompressor(samples: Float32Array, sampleRate: number, options?: CompressorOptions): DynamicsResult;
|
|
1420
|
+
/** Offline noise gate (hysteresis, hold, optional key HPF). */
|
|
1421
|
+
declare function masteringDynamicsGate(samples: Float32Array, sampleRate: number, options?: GateOptions): DynamicsResult;
|
|
1422
|
+
/** Offline transient shaper (envelope-difference attack/sustain control). */
|
|
1423
|
+
declare function masteringDynamicsTransientShaper(samples: Float32Array, sampleRate: number, options?: TransientShaperOptions): DynamicsResult;
|
|
1257
1424
|
/**
|
|
1258
1425
|
* Apply a configurable mastering chain in WASM.
|
|
1259
1426
|
*
|
|
1260
1427
|
* @param samples - Audio samples (mono, float32)
|
|
1261
|
-
* @param sampleRate - Sample rate in Hz
|
|
1428
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1262
1429
|
* @param config - Chain stage configuration
|
|
1263
1430
|
* @returns Processed audio, loudness metadata, and applied stage names
|
|
1264
1431
|
*/
|
|
1265
|
-
declare function masteringChain(samples: Float32Array, sampleRate: number, config: MasteringChainConfig): MasteringChainResult;
|
|
1432
|
+
declare function masteringChain(samples: Float32Array, sampleRate: number | undefined, config: MasteringChainConfig): MasteringChainResult;
|
|
1266
1433
|
/**
|
|
1267
1434
|
* Apply a configurable stereo mastering chain in WASM.
|
|
1268
1435
|
*
|
|
@@ -1272,17 +1439,17 @@ declare function masteringChain(samples: Float32Array, sampleRate: number, confi
|
|
|
1272
1439
|
* @param config - Chain stage configuration
|
|
1273
1440
|
* @returns Processed stereo audio, loudness metadata, and applied stage names
|
|
1274
1441
|
*/
|
|
1275
|
-
declare function masteringChainStereo(left: Float32Array, right: Float32Array, sampleRate: number, config: MasteringChainConfig): MasteringStereoChainResult;
|
|
1442
|
+
declare function masteringChainStereo(left: Float32Array, right: Float32Array, sampleRate: number | undefined, config: MasteringChainConfig): MasteringStereoChainResult;
|
|
1276
1443
|
/**
|
|
1277
1444
|
* Apply a configurable mastering chain in WASM with progress reporting.
|
|
1278
1445
|
*
|
|
1279
1446
|
* @param samples - Audio samples (mono, float32)
|
|
1280
|
-
* @param sampleRate - Sample rate in Hz
|
|
1447
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1281
1448
|
* @param config - Chain stage configuration
|
|
1282
1449
|
* @param onProgress - Progress callback (progress: 0-1, stage: string)
|
|
1283
1450
|
* @returns Processed audio, loudness metadata, and applied stage names
|
|
1284
1451
|
*/
|
|
1285
|
-
declare function masteringChainWithProgress(samples: Float32Array, sampleRate: number, config: MasteringChainConfig, onProgress: ProgressCallback): MasteringChainResult;
|
|
1452
|
+
declare function masteringChainWithProgress(samples: Float32Array, sampleRate: number | undefined, config: MasteringChainConfig, onProgress: ProgressCallback): MasteringChainResult;
|
|
1286
1453
|
/**
|
|
1287
1454
|
* Apply a configurable stereo mastering chain in WASM with progress reporting.
|
|
1288
1455
|
*
|
|
@@ -1293,7 +1460,7 @@ declare function masteringChainWithProgress(samples: Float32Array, sampleRate: n
|
|
|
1293
1460
|
* @param onProgress - Progress callback (progress: 0-1, stage: string)
|
|
1294
1461
|
* @returns Processed stereo audio, loudness metadata, and applied stage names
|
|
1295
1462
|
*/
|
|
1296
|
-
declare function masteringChainStereoWithProgress(left: Float32Array, right: Float32Array, sampleRate: number, config: MasteringChainConfig, onProgress: ProgressCallback): MasteringStereoChainResult;
|
|
1463
|
+
declare function masteringChainStereoWithProgress(left: Float32Array, right: Float32Array, sampleRate: number | undefined, config: MasteringChainConfig, onProgress: ProgressCallback): MasteringStereoChainResult;
|
|
1297
1464
|
/**
|
|
1298
1465
|
* List built-in mastering preset identifiers.
|
|
1299
1466
|
*
|
|
@@ -1304,12 +1471,12 @@ declare function masteringPresetNames(): MasteringPreset[];
|
|
|
1304
1471
|
* Apply a named mastering preset chain to mono audio.
|
|
1305
1472
|
*
|
|
1306
1473
|
* @param samples - Audio samples (mono, float32)
|
|
1307
|
-
* @param sampleRate - Sample rate in Hz
|
|
1474
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1308
1475
|
* @param presetName - Preset identifier from {@link masteringPresetNames}
|
|
1309
1476
|
* @param overrides - Optional flat overrides (dot-notation, e.g. `'loudness.targetLufs'`) applied on top of the preset. Pass `null` for preset defaults.
|
|
1310
1477
|
* @returns Processed audio, loudness metadata, and applied stage names
|
|
1311
1478
|
*/
|
|
1312
|
-
declare function masterAudio(samples: Float32Array, sampleRate: number, presetName: MasteringPreset, overrides?: Record<string, number | boolean> | null): MasteringChainResult;
|
|
1479
|
+
declare function masterAudio(samples: Float32Array, sampleRate: number | undefined, presetName: MasteringPreset, overrides?: Record<string, number | boolean> | null): MasteringChainResult;
|
|
1313
1480
|
/**
|
|
1314
1481
|
* Apply a named mastering preset chain to stereo audio.
|
|
1315
1482
|
*
|
|
@@ -1320,17 +1487,26 @@ declare function masterAudio(samples: Float32Array, sampleRate: number, presetNa
|
|
|
1320
1487
|
* @param overrides - Optional flat overrides (dot-notation, e.g. `'loudness.targetLufs'`) applied on top of the preset. Pass `null` for preset defaults.
|
|
1321
1488
|
* @returns Processed stereo audio, loudness metadata, and applied stage names
|
|
1322
1489
|
*/
|
|
1323
|
-
declare function masterAudioStereo(left: Float32Array, right: Float32Array, sampleRate: number, presetName: MasteringPreset, overrides?: Record<string, number | boolean> | null): MasteringStereoChainResult;
|
|
1490
|
+
declare function masterAudioStereo(left: Float32Array, right: Float32Array, sampleRate: number | undefined, presetName: MasteringPreset, overrides?: Record<string, number | boolean> | null): MasteringStereoChainResult;
|
|
1491
|
+
/**
|
|
1492
|
+
* Mono `masterAudio` with per-stage progress reporting. `onProgress` is invoked
|
|
1493
|
+
* with `(progress, stage)` between each chain stage (progress is in [0,1]).
|
|
1494
|
+
*/
|
|
1495
|
+
declare function masterAudioWithProgress(samples: Float32Array, sampleRate: number | undefined, presetName: MasteringPreset, onProgress: ProgressCallback, overrides?: Record<string, number | boolean> | null): MasteringChainResult;
|
|
1496
|
+
/**
|
|
1497
|
+
* Stereo `masterAudio` with per-stage progress reporting.
|
|
1498
|
+
*/
|
|
1499
|
+
declare function masterAudioStereoWithProgress(left: Float32Array, right: Float32Array, sampleRate: number | undefined, presetName: MasteringPreset, onProgress: ProgressCallback, overrides?: Record<string, number | boolean> | null): MasteringStereoChainResult;
|
|
1324
1500
|
declare function mixingScenePresetNames(): string[];
|
|
1325
1501
|
/**
|
|
1326
1502
|
* Get a built-in mixing scene preset serialized as JSON. This is the canonical
|
|
1327
1503
|
* name shared with the Node and Python bindings; the returned JSON loads
|
|
1328
1504
|
* directly into a {@link Mixer} via {@link Mixer.fromSceneJson}.
|
|
1329
1505
|
*
|
|
1330
|
-
* @param
|
|
1506
|
+
* @param presetName - Preset name (see {@link mixingScenePresetNames})
|
|
1331
1507
|
* @returns Scene JSON string
|
|
1332
1508
|
*/
|
|
1333
|
-
declare function mixingScenePresetJson(
|
|
1509
|
+
declare function mixingScenePresetJson(presetName: string): string;
|
|
1334
1510
|
declare function mixStereo(leftChannels: Float32Array[], rightChannels: Float32Array[], sampleRate?: number, options?: MixOptions): MixResult;
|
|
1335
1511
|
/**
|
|
1336
1512
|
* Block-by-block streaming variant of {@link masteringChain}.
|
|
@@ -1469,22 +1645,116 @@ declare class StreamingEqualizer {
|
|
|
1469
1645
|
delete(): void;
|
|
1470
1646
|
}
|
|
1471
1647
|
/**
|
|
1472
|
-
*
|
|
1473
|
-
* C mixer API (the same path {@link Mixer.fromSceneJson} uses to load it).
|
|
1474
|
-
*
|
|
1475
|
-
* @deprecated Use {@link mixingScenePresetJson}, the canonical name shared with
|
|
1476
|
-
* the Node and Python bindings. This alias is retained for backwards
|
|
1477
|
-
* compatibility and may be removed in a future release. Both functions return a
|
|
1478
|
-
* scene JSON string that loads cleanly into a {@link Mixer}.
|
|
1648
|
+
* Block-by-block mono voice retune / pitch shifter.
|
|
1479
1649
|
*
|
|
1480
|
-
*
|
|
1481
|
-
* @
|
|
1650
|
+
* State is maintained across {@link processMono} calls. Call {@link prepare}
|
|
1651
|
+
* before processing, and call {@link delete} (or use `try/finally`) to release
|
|
1652
|
+
* the underlying WASM object.
|
|
1482
1653
|
*/
|
|
1483
|
-
declare
|
|
1654
|
+
declare class StreamingRetune {
|
|
1655
|
+
private retune;
|
|
1656
|
+
constructor(config?: StreamingRetuneConfig);
|
|
1657
|
+
/**
|
|
1658
|
+
* Allocate and initialize native state for the given sample rate and maximum
|
|
1659
|
+
* process block size.
|
|
1660
|
+
*/
|
|
1661
|
+
prepare(sampleRate: number, maxBlockSize: number): void;
|
|
1662
|
+
/** Reset delay, grain, and overlap-add state without changing config. */
|
|
1663
|
+
reset(): void;
|
|
1664
|
+
/**
|
|
1665
|
+
* Update retune settings. Changing `grainSize` takes effect after the next
|
|
1666
|
+
* {@link prepare} call.
|
|
1667
|
+
*/
|
|
1668
|
+
setConfig(config: StreamingRetuneConfig): void;
|
|
1669
|
+
/** Current native config. */
|
|
1670
|
+
config(): Required<StreamingRetuneConfig>;
|
|
1671
|
+
/** Resolved grain size in samples after {@link prepare}. */
|
|
1672
|
+
grainSize(): number;
|
|
1673
|
+
/** Process one mono block, returning the shifted samples (same length). */
|
|
1674
|
+
processMono(samples: Float32Array): Float32Array;
|
|
1675
|
+
/** Release the underlying WASM object. Safe to call only once. */
|
|
1676
|
+
delete(): void;
|
|
1677
|
+
}
|
|
1678
|
+
declare class RealtimeVoiceChanger {
|
|
1679
|
+
private changer;
|
|
1680
|
+
constructor(config?: RealtimeVoiceChangerConfigInput);
|
|
1681
|
+
prepare(sampleRate: number, maxBlockSize?: number, channels?: number): void;
|
|
1682
|
+
reset(): void;
|
|
1683
|
+
setConfig(config: RealtimeVoiceChangerConfigInput): void;
|
|
1684
|
+
configJson(): string;
|
|
1685
|
+
latencySamples(): number;
|
|
1686
|
+
processMono(samples: Float32Array): Float32Array;
|
|
1687
|
+
processMonoInto(samples: Float32Array, output: Float32Array): void;
|
|
1688
|
+
processInterleaved(samples: Float32Array, channels: number): Float32Array;
|
|
1689
|
+
processInterleavedInto(samples: Float32Array, channels: number, output: Float32Array): void;
|
|
1690
|
+
/**
|
|
1691
|
+
* Acquire a typed-memory view onto the WASM heap for mono input.
|
|
1692
|
+
*
|
|
1693
|
+
* Write your input samples into the returned `Float32Array` directly (e.g.
|
|
1694
|
+
* via `input.set(source)`); no copy crosses the JS↔C++ bridge until
|
|
1695
|
+
* {@link processPreparedMono} is called. The view is owned by this
|
|
1696
|
+
* RealtimeVoiceChanger and becomes invalid after {@link delete}; it may
|
|
1697
|
+
* also be invalidated if you later call this method with a larger
|
|
1698
|
+
* `numSamples` value (the underlying buffer may be reallocated).
|
|
1699
|
+
*/
|
|
1700
|
+
getMonoInputBuffer(numSamples: number): Float32Array;
|
|
1701
|
+
/** Mono output view counterpart to {@link getMonoInputBuffer}. */
|
|
1702
|
+
getMonoOutputBuffer(numSamples: number): Float32Array;
|
|
1703
|
+
/**
|
|
1704
|
+
* Process the previously-acquired mono input buffer in place. The output
|
|
1705
|
+
* appears in the buffer returned by {@link getMonoOutputBuffer}. No JS↔C++
|
|
1706
|
+
* sample-level crossings happen on this call — it just hands control to
|
|
1707
|
+
* the underlying DSP on already-on-heap data.
|
|
1708
|
+
*/
|
|
1709
|
+
processPreparedMono(numSamples: number): void;
|
|
1710
|
+
/** Interleaved input view (layout L0,R0,L1,R1,...). */
|
|
1711
|
+
getInterleavedInputBuffer(numFrames: number, numChannels: number): Float32Array;
|
|
1712
|
+
/** Interleaved output view counterpart. */
|
|
1713
|
+
getInterleavedOutputBuffer(numFrames: number, numChannels: number): Float32Array;
|
|
1714
|
+
/**
|
|
1715
|
+
* Process the previously-acquired interleaved buffer in place. Output
|
|
1716
|
+
* appears in the buffer returned by {@link getInterleavedOutputBuffer}.
|
|
1717
|
+
*/
|
|
1718
|
+
processPreparedInterleaved(numFrames: number, numChannels: number): void;
|
|
1719
|
+
/**
|
|
1720
|
+
* Planar-channel input/output view (one Float32Array per channel). Matches
|
|
1721
|
+
* AudioWorklet's native layout; processing happens in place.
|
|
1722
|
+
*/
|
|
1723
|
+
getPlanarChannelBuffer(channel: number, numFrames: number): Float32Array;
|
|
1724
|
+
/**
|
|
1725
|
+
* Process the previously-acquired planar channel buffers in place. Each
|
|
1726
|
+
* channel must have been obtained from {@link getPlanarChannelBuffer}
|
|
1727
|
+
* with the same `numFrames`. Output replaces input in the same buffers.
|
|
1728
|
+
*/
|
|
1729
|
+
processPreparedPlanar(numFrames: number): void;
|
|
1730
|
+
/**
|
|
1731
|
+
* Convenience factory for the mono zero-copy path: returns the input/output
|
|
1732
|
+
* heap views plus a `process()` thunk wired to the same `numSamples`. The
|
|
1733
|
+
* views are reused across calls and become invalid after {@link delete}.
|
|
1734
|
+
*/
|
|
1735
|
+
createRealtimeMonoBuffer(numSamples: number): RealtimeVoiceChangerMonoBuffer;
|
|
1736
|
+
/** Same as {@link createRealtimeMonoBuffer} but for interleaved I/O. */
|
|
1737
|
+
createRealtimeInterleavedBuffer(numFrames: number, numChannels: number): RealtimeVoiceChangerInterleavedBuffer;
|
|
1738
|
+
/**
|
|
1739
|
+
* Convenience factory for the planar zero-copy path. Acquires one
|
|
1740
|
+
* heap-backed Float32Array per channel and returns a `process()` thunk
|
|
1741
|
+
* wired to the same `numFrames`. Buffers are reused across calls and
|
|
1742
|
+
* become invalid after {@link delete}.
|
|
1743
|
+
*/
|
|
1744
|
+
createRealtimePlanarBuffer(numFrames: number, numChannels: number): RealtimeVoiceChangerPlanarBuffer;
|
|
1745
|
+
delete(): void;
|
|
1746
|
+
}
|
|
1747
|
+
declare function realtimeVoiceChangerPresetNames(): VoicePresetId[];
|
|
1748
|
+
declare function realtimeVoiceChangerPresetJson(name: VoicePresetId): string;
|
|
1749
|
+
declare function validateRealtimeVoiceChangerPresetJson(json: string): {
|
|
1750
|
+
ok: boolean;
|
|
1751
|
+
normalizedJson?: string;
|
|
1752
|
+
error?: string;
|
|
1753
|
+
};
|
|
1484
1754
|
/**
|
|
1485
1755
|
* Persistent, scene-based stereo mixer.
|
|
1486
1756
|
*
|
|
1487
|
-
* Build one from a scene JSON string (e.g. {@link
|
|
1757
|
+
* Build one from a scene JSON string (e.g. {@link mixingScenePresetJson} or a
|
|
1488
1758
|
* hand-authored scene), then feed per-strip stereo blocks through
|
|
1489
1759
|
* {@link processStereo} to get the routed stereo master. Strips, sends, buses,
|
|
1490
1760
|
* and inserts are described entirely by the scene; the routing graph is
|
|
@@ -1496,7 +1766,7 @@ declare function mixerScenePresetJson(preset: string): string;
|
|
|
1496
1766
|
*
|
|
1497
1767
|
* @example
|
|
1498
1768
|
* ```typescript
|
|
1499
|
-
* const mixer = Mixer.fromSceneJson(
|
|
1769
|
+
* const mixer = Mixer.fromSceneJson(mixingScenePresetJson('basicStereo'), 48000, 512);
|
|
1500
1770
|
* try {
|
|
1501
1771
|
* const out = mixer.processStereo([stripL], [stripR]);
|
|
1502
1772
|
* } finally {
|
|
@@ -1583,6 +1853,16 @@ declare class Mixer {
|
|
|
1583
1853
|
removeVcaGroup(id: string): void;
|
|
1584
1854
|
/** Number of VCA groups in the mixer topology. */
|
|
1585
1855
|
vcaGroupCount(): number;
|
|
1856
|
+
/** Set the strip's input trim in dB. */
|
|
1857
|
+
setInputTrimDb(stripIndex: number, db: number): void;
|
|
1858
|
+
/** Set the strip's fader level in dB. */
|
|
1859
|
+
setFaderDb(stripIndex: number, db: number): void;
|
|
1860
|
+
/** Set the strip's pan position. */
|
|
1861
|
+
setPan(stripIndex: number, pan: number, panMode?: PanMode | number): void;
|
|
1862
|
+
/** Set the strip's stereo width. */
|
|
1863
|
+
setWidth(stripIndex: number, width: number): void;
|
|
1864
|
+
/** Set the strip's mute state. */
|
|
1865
|
+
setMuted(stripIndex: number, muted: boolean): void;
|
|
1586
1866
|
/**
|
|
1587
1867
|
* Set a strip's solo state. Takes effect on the next process without a
|
|
1588
1868
|
* graph recompile.
|
|
@@ -1696,22 +1976,22 @@ declare function trim(samples: Float32Array, sampleRate: number, thresholdDb?: n
|
|
|
1696
1976
|
* Compute Short-Time Fourier Transform (STFT).
|
|
1697
1977
|
*
|
|
1698
1978
|
* @param samples - Audio samples (mono, float32)
|
|
1699
|
-
* @param sampleRate - Sample rate in Hz
|
|
1979
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1700
1980
|
* @param nFft - FFT size (default: 2048)
|
|
1701
1981
|
* @param hopLength - Hop length (default: 512)
|
|
1702
1982
|
* @returns STFT result with magnitude and power spectrograms
|
|
1703
1983
|
*/
|
|
1704
|
-
declare function stft(samples: Float32Array, sampleRate
|
|
1984
|
+
declare function stft(samples: Float32Array, sampleRate?: number, nFft?: number, hopLength?: number): StftResult;
|
|
1705
1985
|
/**
|
|
1706
1986
|
* Compute STFT and return magnitude in decibels.
|
|
1707
1987
|
*
|
|
1708
1988
|
* @param samples - Audio samples (mono, float32)
|
|
1709
|
-
* @param sampleRate - Sample rate in Hz
|
|
1989
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1710
1990
|
* @param nFft - FFT size (default: 2048)
|
|
1711
1991
|
* @param hopLength - Hop length (default: 512)
|
|
1712
1992
|
* @returns STFT result with dB values
|
|
1713
1993
|
*/
|
|
1714
|
-
declare function stftDb(samples: Float32Array, sampleRate
|
|
1994
|
+
declare function stftDb(samples: Float32Array, sampleRate?: number, nFft?: number, hopLength?: number): {
|
|
1715
1995
|
nBins: number;
|
|
1716
1996
|
nFrames: number;
|
|
1717
1997
|
db: Float32Array;
|
|
@@ -1720,25 +2000,25 @@ declare function stftDb(samples: Float32Array, sampleRate: number, nFft?: number
|
|
|
1720
2000
|
* Compute Mel spectrogram.
|
|
1721
2001
|
*
|
|
1722
2002
|
* @param samples - Audio samples (mono, float32)
|
|
1723
|
-
* @param sampleRate - Sample rate in Hz
|
|
2003
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1724
2004
|
* @param nFft - FFT size (default: 2048)
|
|
1725
2005
|
* @param hopLength - Hop length (default: 512)
|
|
1726
2006
|
* @param nMels - Number of Mel bands (default: 128)
|
|
1727
2007
|
* @returns Mel spectrogram result
|
|
1728
2008
|
*/
|
|
1729
|
-
declare function melSpectrogram(samples: Float32Array, sampleRate
|
|
2009
|
+
declare function melSpectrogram(samples: Float32Array, sampleRate?: number, nFft?: number, hopLength?: number, nMels?: number): MelSpectrogramResult;
|
|
1730
2010
|
/**
|
|
1731
2011
|
* Compute MFCC (Mel-Frequency Cepstral Coefficients).
|
|
1732
2012
|
*
|
|
1733
2013
|
* @param samples - Audio samples (mono, float32)
|
|
1734
|
-
* @param sampleRate - Sample rate in Hz
|
|
2014
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1735
2015
|
* @param nFft - FFT size (default: 2048)
|
|
1736
2016
|
* @param hopLength - Hop length (default: 512)
|
|
1737
2017
|
* @param nMels - Number of Mel bands (default: 128)
|
|
1738
|
-
* @param nMfcc - Number of MFCC coefficients (default:
|
|
2018
|
+
* @param nMfcc - Number of MFCC coefficients (default: 20)
|
|
1739
2019
|
* @returns MFCC result
|
|
1740
2020
|
*/
|
|
1741
|
-
declare function mfcc(samples: Float32Array, sampleRate
|
|
2021
|
+
declare function mfcc(samples: Float32Array, sampleRate?: number, nFft?: number, hopLength?: number, nMels?: number, nMfcc?: number): MfccResult;
|
|
1742
2022
|
/**
|
|
1743
2023
|
* Approximate inverse of a Mel filterbank: Mel power spectrogram -> STFT power
|
|
1744
2024
|
* spectrogram. Mirrors `feature::mel_to_stft`.
|
|
@@ -1748,10 +2028,11 @@ declare function mfcc(samples: Float32Array, sampleRate: number, nFft?: number,
|
|
|
1748
2028
|
* @param nFrames - Number of time frames
|
|
1749
2029
|
* @param sampleRate - Sample rate in Hz
|
|
1750
2030
|
* @param nFft - FFT size (default: 2048)
|
|
1751
|
-
* @param
|
|
2031
|
+
* @param fmin - Lower Mel band edge in Hz (default: 0)
|
|
2032
|
+
* @param fmax - Upper Mel band edge in Hz (default: sr/2 when 0)
|
|
1752
2033
|
* @returns STFT power spectrogram result
|
|
1753
2034
|
*/
|
|
1754
|
-
declare function melToStft(melPower: Float32Array, nMels: number, nFrames: number, sampleRate
|
|
2035
|
+
declare function melToStft(melPower: Float32Array, nMels: number, nFrames: number, sampleRate?: number, nFft?: number, fmin?: number, fmax?: number): StftPowerResult;
|
|
1755
2036
|
/**
|
|
1756
2037
|
* Reconstruct audio from a Mel power spectrogram via Griffin-Lim. Mirrors
|
|
1757
2038
|
* `feature::mel_to_audio`.
|
|
@@ -1762,10 +2043,12 @@ declare function melToStft(melPower: Float32Array, nMels: number, nFrames: numbe
|
|
|
1762
2043
|
* @param sampleRate - Sample rate in Hz
|
|
1763
2044
|
* @param nFft - FFT size (default: 2048)
|
|
1764
2045
|
* @param hopLength - Hop length (default: 512)
|
|
2046
|
+
* @param fmin - Minimum Mel frequency in Hz (default: 0)
|
|
2047
|
+
* @param fmax - Maximum Mel frequency in Hz (default: 0 = sr/2)
|
|
1765
2048
|
* @param nIter - Griffin-Lim iterations (default: 32)
|
|
1766
2049
|
* @returns Reconstructed audio samples (mono, float32)
|
|
1767
2050
|
*/
|
|
1768
|
-
declare function melToAudio(melPower: Float32Array, nMels: number, nFrames: number, sampleRate
|
|
2051
|
+
declare function melToAudio(melPower: Float32Array, nMels: number, nFrames: number, sampleRate?: number, nFft?: number, hopLength?: number, fmin?: number, fmax?: number, nIter?: number): Float32Array;
|
|
1769
2052
|
/**
|
|
1770
2053
|
* Invert MFCC coefficients back to a Mel power spectrogram. Mirrors
|
|
1771
2054
|
* `feature::mfcc_to_mel`.
|
|
@@ -1785,110 +2068,173 @@ declare function mfccToMel(mfccCoefficients: Float32Array, nMfcc: number, nFrame
|
|
|
1785
2068
|
* @param nMfcc - Number of MFCC coefficients
|
|
1786
2069
|
* @param nFrames - Number of time frames
|
|
1787
2070
|
* @param nMels - Number of Mel bins (default: 128)
|
|
1788
|
-
* @param sampleRate - Sample rate in Hz
|
|
2071
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1789
2072
|
* @param nFft - FFT size (default: 2048)
|
|
1790
2073
|
* @param hopLength - Hop length (default: 512)
|
|
2074
|
+
* @param fmin - Minimum Mel frequency in Hz (default: 0)
|
|
2075
|
+
* @param fmax - Maximum Mel frequency in Hz (default: 0 = sr/2)
|
|
1791
2076
|
* @param nIter - Griffin-Lim iterations (default: 32)
|
|
1792
2077
|
* @returns Reconstructed audio samples (mono, float32)
|
|
1793
2078
|
*/
|
|
1794
|
-
declare function mfccToAudio(mfccCoefficients: Float32Array, nMfcc: number, nFrames: number, nMels
|
|
2079
|
+
declare function mfccToAudio(mfccCoefficients: Float32Array, nMfcc: number, nFrames: number, nMels?: number, sampleRate?: number, nFft?: number, hopLength?: number, fmin?: number, fmax?: number, nIter?: number): Float32Array;
|
|
1795
2080
|
/**
|
|
1796
2081
|
* Compute chromagram (pitch class distribution).
|
|
1797
2082
|
*
|
|
1798
2083
|
* @param samples - Audio samples (mono, float32)
|
|
1799
|
-
* @param sampleRate - Sample rate in Hz
|
|
2084
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1800
2085
|
* @param nFft - FFT size (default: 2048)
|
|
1801
2086
|
* @param hopLength - Hop length (default: 512)
|
|
1802
2087
|
* @returns Chroma features result
|
|
1803
2088
|
*/
|
|
1804
|
-
declare function chroma(samples: Float32Array, sampleRate
|
|
2089
|
+
declare function chroma(samples: Float32Array, sampleRate?: number, nFft?: number, hopLength?: number): ChromaResult;
|
|
1805
2090
|
/**
|
|
1806
2091
|
* Compute spectral centroid (center of mass of spectrum).
|
|
1807
2092
|
*
|
|
1808
2093
|
* @param samples - Audio samples (mono, float32)
|
|
1809
|
-
* @param sampleRate - Sample rate in Hz
|
|
2094
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1810
2095
|
* @param nFft - FFT size (default: 2048)
|
|
1811
2096
|
* @param hopLength - Hop length (default: 512)
|
|
1812
2097
|
* @returns Spectral centroid in Hz for each frame
|
|
1813
2098
|
*/
|
|
1814
|
-
declare function spectralCentroid(samples: Float32Array, sampleRate
|
|
2099
|
+
declare function spectralCentroid(samples: Float32Array, sampleRate?: number, nFft?: number, hopLength?: number): Float32Array;
|
|
2100
|
+
/**
|
|
2101
|
+
* Compute spectral contrast (librosa.feature.spectral_contrast).
|
|
2102
|
+
*
|
|
2103
|
+
* @returns Matrix2d of shape (nBands + 1) x nFrames.
|
|
2104
|
+
*/
|
|
2105
|
+
declare function spectralContrast(samples: Float32Array, sampleRate?: number, nFft?: number, hopLength?: number, nBands?: number, fmin?: number, quantile?: number): WasmMatrix2dResult;
|
|
2106
|
+
/**
|
|
2107
|
+
* Fit per-frame polynomial coefficients (librosa.feature.poly_features).
|
|
2108
|
+
*
|
|
2109
|
+
* @returns Matrix2d of shape (order + 1) x nFrames.
|
|
2110
|
+
*/
|
|
2111
|
+
declare function polyFeatures(samples: Float32Array, sampleRate?: number, nFft?: number, hopLength?: number, order?: number): WasmMatrix2dResult;
|
|
2112
|
+
/**
|
|
2113
|
+
* Locate zero-crossing indices of a signal (librosa.zero_crossings).
|
|
2114
|
+
*/
|
|
2115
|
+
declare function zeroCrossings(samples: Float32Array, threshold?: number, refMagnitude?: boolean, pad?: boolean, zeroPos?: boolean): Int32Array;
|
|
2116
|
+
/**
|
|
2117
|
+
* Estimate the global tuning offset from a set of frequencies
|
|
2118
|
+
* (librosa.pitch_tuning). Returns a deviation in fractions of a bin.
|
|
2119
|
+
*/
|
|
2120
|
+
declare function pitchTuning(frequencies: Float32Array, resolution?: number, binsPerOctave?: number): number;
|
|
2121
|
+
/**
|
|
2122
|
+
* Estimate the tuning offset of an audio signal (librosa.estimate_tuning).
|
|
2123
|
+
*/
|
|
2124
|
+
declare function estimateTuning(samples: Float32Array, sampleRate?: number, nFft?: number, hopLength?: number, resolution?: number, binsPerOctave?: number): number;
|
|
2125
|
+
/**
|
|
2126
|
+
* Non-negative matrix factorisation of a flattened [nFeatures x nFrames]
|
|
2127
|
+
* spectrogram (librosa.decompose.decompose). Returns the W and H factors.
|
|
2128
|
+
*/
|
|
2129
|
+
declare function decompose(s: Float32Array, nFeatures: number, nFrames: number, nComponents: number, nIter?: number, beta?: number): WasmDecomposeResult;
|
|
2130
|
+
/**
|
|
2131
|
+
* Nearest-neighbour filtering of a flattened [nFeatures x nFrames] spectrogram
|
|
2132
|
+
* (librosa.decompose.nn_filter).
|
|
2133
|
+
*/
|
|
2134
|
+
declare function nnFilter(s: Float32Array, nFeatures: number, nFrames: number, aggregate?: string, k?: number, width?: number): WasmMatrix2dResult;
|
|
2135
|
+
/**
|
|
2136
|
+
* Reorder/concatenate a signal by interval slices (librosa.effects.remix).
|
|
2137
|
+
*
|
|
2138
|
+
* @param intervals - Flat (start, end) sample pairs (even length).
|
|
2139
|
+
*/
|
|
2140
|
+
declare function remix(samples: Float32Array, intervals: Int32Array | ArrayLike<number>, sampleRate?: number, alignZeros?: boolean): Float32Array;
|
|
2141
|
+
/**
|
|
2142
|
+
* Phase-vocoder time-scale modification (rate > 1 faster, < 1 slower).
|
|
2143
|
+
*/
|
|
2144
|
+
declare function phaseVocoder(samples: Float32Array, rate: number, sampleRate?: number, nFft?: number, hopLength?: number): Float32Array;
|
|
2145
|
+
/**
|
|
2146
|
+
* HPSS into harmonic / percussive / residual signals.
|
|
2147
|
+
*/
|
|
2148
|
+
declare function hpssWithResidual(samples: Float32Array, sampleRate?: number, kernelHarmonic?: number, kernelPercussive?: number): WasmHpssWithResidualResult;
|
|
2149
|
+
/**
|
|
2150
|
+
* Channel-weighted multichannel integrated loudness + LRA (ITU-R BS.1770 /
|
|
2151
|
+
* EBU R128) from an interleaved buffer of `frames * channels` samples. The
|
|
2152
|
+
* per-channel frame count is derived from the buffer length and `channels`.
|
|
2153
|
+
*/
|
|
2154
|
+
declare function lufsInterleaved(samples: Float32Array, channels: number, sampleRate?: number): WasmLufsResult;
|
|
2155
|
+
/**
|
|
2156
|
+
* Standards-compliant EBU R128 loudness range (LRA) in LU.
|
|
2157
|
+
*/
|
|
2158
|
+
declare function ebur128LoudnessRange(samples: Float32Array, sampleRate?: number): number;
|
|
1815
2159
|
/**
|
|
1816
2160
|
* Compute spectral bandwidth.
|
|
1817
2161
|
*
|
|
1818
2162
|
* @param samples - Audio samples (mono, float32)
|
|
1819
|
-
* @param sampleRate - Sample rate in Hz
|
|
2163
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1820
2164
|
* @param nFft - FFT size (default: 2048)
|
|
1821
2165
|
* @param hopLength - Hop length (default: 512)
|
|
1822
2166
|
* @returns Spectral bandwidth in Hz for each frame
|
|
1823
2167
|
*/
|
|
1824
|
-
declare function spectralBandwidth(samples: Float32Array, sampleRate
|
|
2168
|
+
declare function spectralBandwidth(samples: Float32Array, sampleRate?: number, nFft?: number, hopLength?: number): Float32Array;
|
|
1825
2169
|
/**
|
|
1826
2170
|
* Compute spectral rolloff frequency.
|
|
1827
2171
|
*
|
|
1828
2172
|
* @param samples - Audio samples (mono, float32)
|
|
1829
|
-
* @param sampleRate - Sample rate in Hz
|
|
2173
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1830
2174
|
* @param nFft - FFT size (default: 2048)
|
|
1831
2175
|
* @param hopLength - Hop length (default: 512)
|
|
1832
2176
|
* @param rollPercent - Percentage threshold (default: 0.85)
|
|
1833
2177
|
* @returns Rolloff frequency in Hz for each frame
|
|
1834
2178
|
*/
|
|
1835
|
-
declare function spectralRolloff(samples: Float32Array, sampleRate
|
|
2179
|
+
declare function spectralRolloff(samples: Float32Array, sampleRate?: number, nFft?: number, hopLength?: number, rollPercent?: number): Float32Array;
|
|
1836
2180
|
/**
|
|
1837
2181
|
* Compute spectral flatness.
|
|
1838
2182
|
*
|
|
1839
2183
|
* @param samples - Audio samples (mono, float32)
|
|
1840
|
-
* @param sampleRate - Sample rate in Hz
|
|
2184
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1841
2185
|
* @param nFft - FFT size (default: 2048)
|
|
1842
2186
|
* @param hopLength - Hop length (default: 512)
|
|
1843
2187
|
* @returns Spectral flatness for each frame (0 = tonal, 1 = noise-like)
|
|
1844
2188
|
*/
|
|
1845
|
-
declare function spectralFlatness(samples: Float32Array, sampleRate
|
|
2189
|
+
declare function spectralFlatness(samples: Float32Array, sampleRate?: number, nFft?: number, hopLength?: number): Float32Array;
|
|
1846
2190
|
/**
|
|
1847
2191
|
* Compute zero crossing rate.
|
|
1848
2192
|
*
|
|
1849
2193
|
* @param samples - Audio samples (mono, float32)
|
|
1850
|
-
* @param sampleRate - Sample rate in Hz
|
|
2194
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1851
2195
|
* @param frameLength - Frame length (default: 2048)
|
|
1852
2196
|
* @param hopLength - Hop length (default: 512)
|
|
1853
2197
|
* @returns Zero crossing rate for each frame
|
|
1854
2198
|
*/
|
|
1855
|
-
declare function zeroCrossingRate(samples: Float32Array, sampleRate
|
|
2199
|
+
declare function zeroCrossingRate(samples: Float32Array, sampleRate?: number, frameLength?: number, hopLength?: number): Float32Array;
|
|
1856
2200
|
/**
|
|
1857
2201
|
* Compute RMS energy.
|
|
1858
2202
|
*
|
|
1859
2203
|
* @param samples - Audio samples (mono, float32)
|
|
1860
|
-
* @param sampleRate - Sample rate in Hz
|
|
2204
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1861
2205
|
* @param frameLength - Frame length (default: 2048)
|
|
1862
2206
|
* @param hopLength - Hop length (default: 512)
|
|
1863
2207
|
* @returns RMS energy for each frame
|
|
1864
2208
|
*/
|
|
1865
|
-
declare function rmsEnergy(samples: Float32Array, sampleRate
|
|
2209
|
+
declare function rmsEnergy(samples: Float32Array, sampleRate?: number, frameLength?: number, hopLength?: number): Float32Array;
|
|
1866
2210
|
/**
|
|
1867
2211
|
* Detect pitch using YIN algorithm.
|
|
1868
2212
|
*
|
|
1869
2213
|
* @param samples - Audio samples (mono, float32)
|
|
1870
|
-
* @param sampleRate - Sample rate in Hz
|
|
2214
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1871
2215
|
* @param frameLength - Frame length (default: 2048)
|
|
1872
2216
|
* @param hopLength - Hop length (default: 512)
|
|
1873
2217
|
* @param fmin - Minimum frequency in Hz (default: 65)
|
|
1874
2218
|
* @param fmax - Maximum frequency in Hz (default: 2093)
|
|
1875
2219
|
* @param threshold - YIN threshold (default: 0.3)
|
|
2220
|
+
* @param fillNa - If true, return 0 for unvoiced f0 frames; otherwise keep NaN (default: false)
|
|
1876
2221
|
* @returns Pitch detection result
|
|
1877
2222
|
*/
|
|
1878
|
-
declare function pitchYin(samples: Float32Array, sampleRate
|
|
2223
|
+
declare function pitchYin(samples: Float32Array, sampleRate?: number, frameLength?: number, hopLength?: number, fmin?: number, fmax?: number, threshold?: number, fillNa?: boolean): PitchResult;
|
|
1879
2224
|
/**
|
|
1880
2225
|
* Detect pitch using pYIN algorithm (probabilistic YIN with HMM smoothing).
|
|
1881
2226
|
*
|
|
1882
2227
|
* @param samples - Audio samples (mono, float32)
|
|
1883
|
-
* @param sampleRate - Sample rate in Hz
|
|
2228
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1884
2229
|
* @param frameLength - Frame length (default: 2048)
|
|
1885
2230
|
* @param hopLength - Hop length (default: 512)
|
|
1886
2231
|
* @param fmin - Minimum frequency in Hz (default: 65)
|
|
1887
2232
|
* @param fmax - Maximum frequency in Hz (default: 2093)
|
|
1888
2233
|
* @param threshold - YIN threshold (default: 0.3)
|
|
2234
|
+
* @param fillNa - If true, return 0 for unvoiced f0 frames; otherwise keep NaN (default: false)
|
|
1889
2235
|
* @returns Pitch detection result
|
|
1890
2236
|
*/
|
|
1891
|
-
declare function pitchPyin(samples: Float32Array, sampleRate
|
|
2237
|
+
declare function pitchPyin(samples: Float32Array, sampleRate?: number, frameLength?: number, hopLength?: number, fmin?: number, fmax?: number, threshold?: number, fillNa?: boolean): PitchResult;
|
|
1892
2238
|
/**
|
|
1893
2239
|
* Convert frequency in Hz to Mel scale.
|
|
1894
2240
|
*
|
|
@@ -1935,20 +2281,20 @@ declare function noteToHz(note: string): number;
|
|
|
1935
2281
|
* Convert frame index to time in seconds.
|
|
1936
2282
|
*
|
|
1937
2283
|
* @param frames - Frame index
|
|
1938
|
-
* @param sr - Sample rate in Hz
|
|
1939
|
-
* @param hopLength - Hop length in samples
|
|
2284
|
+
* @param sr - Sample rate in Hz (default: 22050)
|
|
2285
|
+
* @param hopLength - Hop length in samples (default: 512)
|
|
1940
2286
|
* @returns Time in seconds
|
|
1941
2287
|
*/
|
|
1942
|
-
declare function framesToTime(frames: number, sr
|
|
2288
|
+
declare function framesToTime(frames: number, sr?: number, hopLength?: number): number;
|
|
1943
2289
|
/**
|
|
1944
2290
|
* Convert time in seconds to frame index.
|
|
1945
2291
|
*
|
|
1946
2292
|
* @param time - Time in seconds
|
|
1947
|
-
* @param sr - Sample rate in Hz
|
|
1948
|
-
* @param hopLength - Hop length in samples
|
|
2293
|
+
* @param sr - Sample rate in Hz (default: 22050)
|
|
2294
|
+
* @param hopLength - Hop length in samples (default: 512)
|
|
1949
2295
|
* @returns Frame index
|
|
1950
2296
|
*/
|
|
1951
|
-
declare function timeToFrames(time: number, sr
|
|
2297
|
+
declare function timeToFrames(time: number, sr?: number, hopLength?: number): number;
|
|
1952
2298
|
declare function framesToSamples(frames: number, hopLength?: number, nFft?: number): number;
|
|
1953
2299
|
declare function samplesToFrames(samples: number, hopLength?: number, nFft?: number): number;
|
|
1954
2300
|
declare function powerToDb(values: Float32Array, ref?: number, amin?: number, topDb?: number): Float32Array;
|
|
@@ -1960,16 +2306,16 @@ declare function deemphasis(samples: Float32Array, coef?: number, zi?: number):
|
|
|
1960
2306
|
declare function trimSilence(samples: Float32Array, topDb?: number, frameLength?: number, hopLength?: number): WasmTrimResult;
|
|
1961
2307
|
declare function splitSilence(samples: Float32Array, topDb?: number, frameLength?: number, hopLength?: number): Int32Array;
|
|
1962
2308
|
declare function frameSignal(samples: Float32Array, frameLength: number, hopLength: number): WasmFrameResult;
|
|
1963
|
-
declare function padCenter(values: Float32Array,
|
|
1964
|
-
declare function fixLength(values: Float32Array,
|
|
2309
|
+
declare function padCenter(values: Float32Array, targetSize: number, padValue?: number): Float32Array;
|
|
2310
|
+
declare function fixLength(values: Float32Array, targetSize: number, padValue?: number): Float32Array;
|
|
1965
2311
|
declare function fixFrames(frames: Int32Array, xMin?: number, xMax?: number, pad?: boolean): Int32Array;
|
|
1966
2312
|
declare function peakPick(values: Float32Array, preMax: number, postMax: number, preAvg: number, postAvg: number, delta: number, wait: number): Int32Array;
|
|
1967
2313
|
declare function vectorNormalize(values: Float32Array, normType?: number, threshold?: number): Float32Array;
|
|
1968
2314
|
declare function pcen(values: Float32Array, nBins: number, nFrames: number, options?: Record<string, number>): Float32Array;
|
|
1969
2315
|
declare function tonnetz(chromagram: Float32Array, nChroma: number, nFrames: number): Float32Array;
|
|
1970
|
-
declare function tempogram(onsetEnvelope: Float32Array, sampleRate
|
|
1971
|
-
declare function cyclicTempogram(onsetEnvelope: Float32Array, sampleRate
|
|
1972
|
-
declare function plp(onsetEnvelope: Float32Array, sampleRate
|
|
2316
|
+
declare function tempogram(onsetEnvelope: Float32Array, sampleRate?: number, hopLength?: number, winLength?: number, mode?: TempogramMode): WasmTempogramResult;
|
|
2317
|
+
declare function cyclicTempogram(onsetEnvelope: Float32Array, sampleRate?: number, hopLength?: number, winLength?: number, bpmMin?: number, nBins?: number): WasmCyclicTempogramResult;
|
|
2318
|
+
declare function plp(onsetEnvelope: Float32Array, sampleRate?: number, hopLength?: number, tempoMin?: number, tempoMax?: number, winLength?: number): Float32Array;
|
|
1973
2319
|
/**
|
|
1974
2320
|
* Compute NNLS (non-negative least squares) chromagram.
|
|
1975
2321
|
*
|
|
@@ -2010,7 +2356,7 @@ declare function vqt(samples: Float32Array, sampleRate?: number, hopLength?: num
|
|
|
2010
2356
|
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
2011
2357
|
* @param nFft - FFT size (default: 2048)
|
|
2012
2358
|
* @param hopLength - Hop length (default: 512)
|
|
2013
|
-
* @param minSectionSec - Minimum section duration in seconds (default:
|
|
2359
|
+
* @param minSectionSec - Minimum section duration in seconds (default: 4.0)
|
|
2014
2360
|
* @returns Array of detected sections
|
|
2015
2361
|
*/
|
|
2016
2362
|
declare function analyzeSections(samples: Float32Array, sampleRate?: number, nFft?: number, hopLength?: number, minSectionSec?: number): Section[];
|
|
@@ -2065,7 +2411,7 @@ declare function tempogramRatio(tempogramData: Float32Array, winLength?: number,
|
|
|
2065
2411
|
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
2066
2412
|
* @returns Loudness measurement result
|
|
2067
2413
|
*/
|
|
2068
|
-
declare function lufs(samples: Float32Array, sampleRate?: number): LufsResult;
|
|
2414
|
+
declare function lufs(samples: Float32Array, sampleRate?: number, options?: ValidateOptions): LufsResult;
|
|
2069
2415
|
/**
|
|
2070
2416
|
* Compute the momentary loudness (LUFS) over time.
|
|
2071
2417
|
*
|
|
@@ -2073,7 +2419,7 @@ declare function lufs(samples: Float32Array, sampleRate?: number): LufsResult;
|
|
|
2073
2419
|
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
2074
2420
|
* @returns Momentary LUFS values over time
|
|
2075
2421
|
*/
|
|
2076
|
-
declare function momentaryLufs(samples: Float32Array, sampleRate?: number): Float32Array;
|
|
2422
|
+
declare function momentaryLufs(samples: Float32Array, sampleRate?: number, options?: ValidateOptions): Float32Array;
|
|
2077
2423
|
/**
|
|
2078
2424
|
* Compute the short-term loudness (LUFS) over time.
|
|
2079
2425
|
*
|
|
@@ -2081,7 +2427,105 @@ declare function momentaryLufs(samples: Float32Array, sampleRate?: number): Floa
|
|
|
2081
2427
|
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
2082
2428
|
* @returns Short-term LUFS values over time
|
|
2083
2429
|
*/
|
|
2084
|
-
declare function shortTermLufs(samples: Float32Array, sampleRate?: number): Float32Array;
|
|
2430
|
+
declare function shortTermLufs(samples: Float32Array, sampleRate?: number, options?: ValidateOptions): Float32Array;
|
|
2431
|
+
/** One contiguous run of clipped samples reported by `meteringDetectClipping`. */
|
|
2432
|
+
interface ClippingRegion {
|
|
2433
|
+
startSample: number;
|
|
2434
|
+
endSample: number;
|
|
2435
|
+
length: number;
|
|
2436
|
+
peak: number;
|
|
2437
|
+
}
|
|
2438
|
+
/** Aggregated clipping report. */
|
|
2439
|
+
interface ClippingReport {
|
|
2440
|
+
clippedSamples: number;
|
|
2441
|
+
clippingRatio: number;
|
|
2442
|
+
maxClippedPeak: number;
|
|
2443
|
+
regions: ClippingRegion[];
|
|
2444
|
+
}
|
|
2445
|
+
/** Sliding-window dynamic range report. */
|
|
2446
|
+
interface DynamicRangeReport {
|
|
2447
|
+
dynamicRangeDb: number;
|
|
2448
|
+
lowPercentileDb: number;
|
|
2449
|
+
highPercentileDb: number;
|
|
2450
|
+
windowRmsDb: Float32Array;
|
|
2451
|
+
}
|
|
2452
|
+
declare function meteringPeakDb(samples: Float32Array, sampleRate?: number, options?: ValidateOptions): number;
|
|
2453
|
+
declare function meteringRmsDb(samples: Float32Array, sampleRate?: number, options?: ValidateOptions): number;
|
|
2454
|
+
declare function meteringCrestFactorDb(samples: Float32Array, sampleRate?: number, options?: ValidateOptions): number;
|
|
2455
|
+
declare function meteringDcOffset(samples: Float32Array, sampleRate?: number, options?: ValidateOptions): number;
|
|
2456
|
+
/**
|
|
2457
|
+
* Inter-sample (true) peak in dBFS. `oversampleFactor` must be a power of two
|
|
2458
|
+
* in [1, 16]; pass 0 to use the library default (4).
|
|
2459
|
+
*/
|
|
2460
|
+
declare function meteringTruePeakDb(samples: Float32Array, sampleRate?: number, oversampleFactor?: number, options?: ValidateOptions): number;
|
|
2461
|
+
/**
|
|
2462
|
+
* Detect contiguous runs of clipped samples.
|
|
2463
|
+
*
|
|
2464
|
+
* @param threshold Linear absolute threshold (default 0.999).
|
|
2465
|
+
* @param minRegionSamples Minimum run length to report (default 1).
|
|
2466
|
+
*/
|
|
2467
|
+
declare function meteringDetectClipping(samples: Float32Array, sampleRate?: number, threshold?: number, minRegionSamples?: number, options?: ValidateOptions): ClippingReport;
|
|
2468
|
+
/**
|
|
2469
|
+
* Sliding-window dynamic range. Pass 0 for any parameter to use the library
|
|
2470
|
+
* default (window=3 s, hop=1 s, low=0.10, high=0.95).
|
|
2471
|
+
*/
|
|
2472
|
+
declare function meteringDynamicRange(samples: Float32Array, sampleRate?: number, windowSec?: number, hopSec?: number, lowPercentile?: number, highPercentile?: number, options?: ValidateOptions): DynamicRangeReport;
|
|
2473
|
+
/** Mid/side vectorscope point series for a (left, right) stereo pair. */
|
|
2474
|
+
interface VectorscopeReport {
|
|
2475
|
+
mid: Float32Array;
|
|
2476
|
+
side: Float32Array;
|
|
2477
|
+
}
|
|
2478
|
+
/** Phase-scope (Lissajous) point series plus summary stats. */
|
|
2479
|
+
interface PhaseScopeReport {
|
|
2480
|
+
mid: Float32Array;
|
|
2481
|
+
side: Float32Array;
|
|
2482
|
+
radius: Float32Array;
|
|
2483
|
+
angleRad: Float32Array;
|
|
2484
|
+
correlation: number;
|
|
2485
|
+
averageAbsAngleRad: number;
|
|
2486
|
+
maxRadius: number;
|
|
2487
|
+
}
|
|
2488
|
+
/** Options for `meteringSpectrum`. */
|
|
2489
|
+
interface SpectrumOptions {
|
|
2490
|
+
/** FFT size. Pass 0 / omit for the library default (2048). */
|
|
2491
|
+
nFft?: number;
|
|
2492
|
+
/** Apply fractional-octave smoothing to magnitude. */
|
|
2493
|
+
applyOctaveSmoothing?: boolean;
|
|
2494
|
+
/** Smoothing fraction (e.g. 3 = 1/3-octave). 0 / omit = library default (3). */
|
|
2495
|
+
octaveFraction?: number;
|
|
2496
|
+
/** Linear reference for the dB conversion. 0 / omit = 1.0. */
|
|
2497
|
+
dbRef?: number;
|
|
2498
|
+
/** Linear floor used to avoid log(0). 0 / omit = library default. */
|
|
2499
|
+
dbAmin?: number;
|
|
2500
|
+
}
|
|
2501
|
+
/** Single-frame magnitude / power / dB spectrum returned by `meteringSpectrum`. */
|
|
2502
|
+
interface SpectrumReport {
|
|
2503
|
+
frequencies: Float32Array;
|
|
2504
|
+
magnitude: Float32Array;
|
|
2505
|
+
power: Float32Array;
|
|
2506
|
+
db: Float32Array;
|
|
2507
|
+
nFft: number;
|
|
2508
|
+
sampleRate: number;
|
|
2509
|
+
}
|
|
2510
|
+
/** Pearson correlation in [-1, 1] between two equal-length channels. */
|
|
2511
|
+
declare function meteringStereoCorrelation(left: Float32Array, right: Float32Array, sampleRate?: number, options?: ValidateOptions): number;
|
|
2512
|
+
/** Side / mid energy ratio: 0 = pure mono, ~1 = wide stereo. */
|
|
2513
|
+
declare function meteringStereoWidth(left: Float32Array, right: Float32Array, sampleRate?: number, options?: ValidateOptions): number;
|
|
2514
|
+
/** Per-sample mid/side point series (one entry per input frame). */
|
|
2515
|
+
declare function meteringVectorscope(left: Float32Array, right: Float32Array, sampleRate?: number, options?: ValidateOptions): VectorscopeReport;
|
|
2516
|
+
/** Phase-scope point series plus summary stats. */
|
|
2517
|
+
declare function meteringPhaseScope(left: Float32Array, right: Float32Array, sampleRate?: number, options?: ValidateOptions): PhaseScopeReport;
|
|
2518
|
+
/** Single-frame spectrum view (uses the first `nFft` samples of `samples`). */
|
|
2519
|
+
declare function meteringSpectrum(samples: Float32Array, sampleRate?: number, options?: SpectrumOptions & ValidateOptions): SpectrumReport;
|
|
2520
|
+
/**
|
|
2521
|
+
* Snap a MIDI value to the nearest pitch class enabled by `modeMask`.
|
|
2522
|
+
*
|
|
2523
|
+
* `modeMask` is a 12-bit mask. For natural C major use `0b101010110101`.
|
|
2524
|
+
* `referenceMidi` defaults to A4 (69) when passed as 0.
|
|
2525
|
+
*/
|
|
2526
|
+
declare function scaleQuantizeMidi(root: number, modeMask: number, midi: number, referenceMidi?: number): number;
|
|
2527
|
+
declare function scaleCorrectionSemitones(root: number, modeMask: number, midi: number, referenceMidi?: number): number;
|
|
2528
|
+
declare function scalePitchClassEnabled(root: number, modeMask: number, pitchClass: number): boolean;
|
|
2085
2529
|
/**
|
|
2086
2530
|
* Resample audio to a different sample rate.
|
|
2087
2531
|
*
|
|
@@ -2135,9 +2579,9 @@ declare class Audio {
|
|
|
2135
2579
|
percussive(): Float32Array;
|
|
2136
2580
|
timeStretch(rate: number): Float32Array;
|
|
2137
2581
|
pitchShift(semitones: number): Float32Array;
|
|
2138
|
-
pitchCorrectToMidi(currentMidi
|
|
2139
|
-
noteStretch(onsetSample
|
|
2140
|
-
voiceChange(pitchSemitones
|
|
2582
|
+
pitchCorrectToMidi(currentMidi?: number, targetMidi?: number): Float32Array;
|
|
2583
|
+
noteStretch(onsetSample?: number, offsetSample?: number, stretchRatio?: number): Float32Array;
|
|
2584
|
+
voiceChange(pitchSemitones?: number, formantFactor?: number): Float32Array;
|
|
2141
2585
|
normalize(targetDb?: number): Float32Array;
|
|
2142
2586
|
mastering(targetLufs?: number, ceilingDb?: number, truePeakOversample?: number): MasteringResult;
|
|
2143
2587
|
masteringChain(config: MasteringChainConfig): MasteringChainResult;
|
|
@@ -2164,8 +2608,8 @@ declare class Audio {
|
|
|
2164
2608
|
spectralFlatness(nFft?: number, hopLength?: number): Float32Array;
|
|
2165
2609
|
zeroCrossingRate(frameLength?: number, hopLength?: number): Float32Array;
|
|
2166
2610
|
rmsEnergy(frameLength?: number, hopLength?: number): Float32Array;
|
|
2167
|
-
pitchYin(frameLength?: number, hopLength?: number, fmin?: number, fmax?: number, threshold?: number): PitchResult;
|
|
2168
|
-
pitchPyin(frameLength?: number, hopLength?: number, fmin?: number, fmax?: number, threshold?: number): PitchResult;
|
|
2611
|
+
pitchYin(frameLength?: number, hopLength?: number, fmin?: number, fmax?: number, threshold?: number, fillNa?: boolean): PitchResult;
|
|
2612
|
+
pitchPyin(frameLength?: number, hopLength?: number, fmin?: number, fmax?: number, threshold?: number, fillNa?: boolean): PitchResult;
|
|
2169
2613
|
resample(targetSr: number): Float32Array;
|
|
2170
2614
|
}
|
|
2171
2615
|
/**
|
|
@@ -2276,4 +2720,4 @@ declare class StreamAnalyzer {
|
|
|
2276
2720
|
dispose(): void;
|
|
2277
2721
|
}
|
|
2278
2722
|
|
|
2279
|
-
export { type AcousticResult, type AnalysisResult, type AnalyzerStats, Audio, type AutomationCurve, type BarChord, type Beat, type Chord, type ChordAnalysisResult, type ChordChange, type ChordDetectionOptions, ChordQuality, type ChromaResult, type CqtResult, type Dynamics, EXPECTED_ENGINE_ABI_VERSION, type EngineAutomationPoint, type EngineBounceOptions, type EngineBounceResult, type EngineCapabilities, type EngineCaptureStatus, type EngineClip, type EngineFreezeOptions, type EngineFreezeResult, type EngineGraphSpec, type EngineMarker, type EngineMeterTelemetry, type EngineMetronomeConfig, type EngineParameterInfo, type EngineTelemetry, type EngineTransportState, type EqBand, type EqBandPhase, type EqBandType, type EqCoeffMode, type EqMatchOptions, type EqSpectrumSnapshot, type EqStereoPlacement, type FrameBuffer, type GoniometerPoint, type HpssResult, type Key, type KeyCandidate, type KeyDetectionOptions, KeyProfile, type KeyProfileName, type LufsResult, type MasteringChainConfig, type MasteringChainResult, type MasteringPreset, type MasteringProcessorParams, type MasteringResult, type MasteringStereoChainResult, type MasteringStereoResult, type MelSpectrogramResult, type MelodyPoint, type MelodyResult, type MeterTap, type MfccResult, type MixMeterSnapshot, type MixOptions, type MixResult, Mixer, type MixerProcessResult, type MixerRealtimeBuffer, Mode, type PairAnalysis, type PairProcessor, type PanLaw, type PanMode, type PatternScore, PitchClass as Pitch, PitchClass, type PitchResult, type
|
|
2723
|
+
export { type AcousticResult, type AnalysisResult, type AnalyzerStats, Audio, type AutomationCurve, type BarChord, type Beat, type BpmAnalysisResult, type BpmCandidate, type Chord, type ChordAnalysisResult, type ChordChange, type ChordDetectionOptions, ChordQuality, type ChromaResult, type ClippingRegion, type ClippingReport, type CompressorDetector, type CompressorOptions, type CqtResult, type DeclickOptions, type DeclipOptions, type DecomposeResult, type DecrackleMode, type DecrackleOptions, type DehumOptions, type DenoiseClassicalMode, type DenoiseClassicalNoiseEstimator, type DenoiseClassicalOptions, type DereverbClassicalOptions, type DynamicRangeReport, type Dynamics, type DynamicsAnalysisResult, type DynamicsResult, EXPECTED_ENGINE_ABI_VERSION, type EngineAutomationPoint, type EngineBounceOptions, type EngineBounceResult, type EngineCapabilities, type EngineCaptureStatus, type EngineClip, type EngineFreezeOptions, type EngineFreezeResult, type EngineGraphSpec, type EngineMarker, type EngineMeterTelemetry, type EngineMetronomeConfig, type EngineParameterInfo, type EngineTelemetry, type EngineTransportState, type EqBand, type EqBandPhase, type EqBandType, type EqCoeffMode, type EqMatchOptions, type EqSpectrumSnapshot, type EqStereoPlacement, type FrameBuffer, type GateOptions, type GoniometerPoint, type HpssResult, type HpssWithResidualResult, type Key, type KeyCandidate, type KeyDetectionOptions, KeyProfile, type KeyProfileName, type LufsResult, type MasteringChainConfig, type MasteringChainResult, type MasteringPreset, type MasteringProcessorParams, type MasteringResult, type MasteringStereoChainResult, type MasteringStereoResult, type Matrix2dResult, type MelSpectrogramResult, type MelodyPoint, type MelodyResult, type MeterTap, type MfccResult, type MixMeterSnapshot, type MixOptions, type MixResult, Mixer, type MixerProcessResult, type MixerRealtimeBuffer, Mode, type PairAnalysis, type PairProcessor, type PanLaw, type PanMode, type PatternScore, type PhaseScopeReport, PitchClass as Pitch, PitchClass, type PitchResult, type ProgressiveEstimate, RealtimeEngine, RealtimeVoiceChanger, type RealtimeVoiceChangerConfigInput, type RealtimeVoiceChangerInterleavedBuffer, type RealtimeVoiceChangerMonoBuffer, type RealtimeVoiceChangerPlanarBuffer, type RhythmAnalysisResult, type RhythmFeatures, type Section, SectionType, type SendTiming, type SoloProcessor, type SpectrumOptions, type SpectrumReport, type StereoAnalysis, type StftResult, StreamAnalyzer, type StreamConfig, type StreamFramesI16, type StreamFramesU8, StreamingEqualizer, type StreamingEqualizerConfig, StreamingMasteringChain, type StreamingPlatform, StreamingRetune, type StreamingRetuneConfig, type Timbre, type TimbreAnalysisResult, type TimbreFrame, type TimeSignature, type TransientShaperOptions, type TrimSilenceMode, type TrimSilenceOptions, type ValidateOptions, type VectorscopeReport, type VoicePresetId, amplitudeToDb, analyze, analyzeBpm, analyzeDynamics, analyzeImpulseResponse, analyzeMelody, analyzeRhythm, analyzeSections, analyzeTimbre, analyzeWithProgress, chroma, cqt, cyclicTempogram, dbToAmplitude, dbToPower, decompose, deemphasis, detectAcoustic, detectBeats, detectBpm, detectChords, detectDownbeats, detectKey, detectKeyCandidates, detectOnsets, ebur128LoudnessRange, engineAbiVersion, engineCapabilities, estimateTuning, fixFrames, fixLength, fourierTempogram, frameSignal, framesToSamples, framesToTime, harmonic, hasFfmpegSupport, hpss, hpssWithResidual, hzToMel, hzToMidi, hzToNote, init, isInitialized, lufs, lufsInterleaved, masterAudio, masterAudioStereo, masterAudioStereoWithProgress, masterAudioWithProgress, mastering, masteringAssistantSuggest, masteringAudioProfile, masteringChain, masteringChainStereo, masteringChainStereoWithProgress, masteringChainWithProgress, masteringDynamicsCompressor, masteringDynamicsGate, masteringDynamicsTransientShaper, masteringPairAnalysisNames, masteringPairAnalyze, masteringPairProcess, masteringPairProcessorNames, masteringPresetNames, masteringProcess, masteringProcessStereo, masteringProcessorNames, masteringRepairDeclick, masteringRepairDeclip, masteringRepairDecrackle, masteringRepairDehum, masteringRepairDenoiseClassical, masteringRepairDereverbClassical, masteringRepairTrimSilence, masteringStereoAnalysisNames, masteringStereoAnalyze, masteringStreamingPreview, melSpectrogram, melToAudio, melToHz, melToStft, meteringCrestFactorDb, meteringDcOffset, meteringDetectClipping, meteringDynamicRange, meteringPeakDb, meteringPhaseScope, meteringRmsDb, meteringSpectrum, meteringStereoCorrelation, meteringStereoWidth, meteringTruePeakDb, meteringVectorscope, mfcc, mfccToAudio, mfccToMel, midiToHz, mixStereo, mixingScenePresetJson, mixingScenePresetNames, momentaryLufs, nnFilter, nnlsChroma, normalize, noteStretch, noteToHz, onsetEnvelope, padCenter, pcen, peakPick, percussive, phaseVocoder, pitchCorrectToMidi, pitchPyin, pitchShift, pitchTuning, pitchYin, plp, polyFeatures, powerToDb, preemphasis, realtimeVoiceChangerPresetConfig, realtimeVoiceChangerPresetJson, realtimeVoiceChangerPresetNames, remix, resample, rmsEnergy, samplesToFrames, scaleCorrectionSemitones, scalePitchClassEnabled, scaleQuantizeMidi, shortTermLufs, spectralBandwidth, spectralCentroid, spectralContrast, spectralFlatness, spectralRolloff, splitSilence, stft, stftDb, tempogram, tempogramRatio, timeStretch, timeToFrames, tonnetz, trim, trimSilence, validateRealtimeVoiceChangerPresetJson, vectorNormalize, version, voiceChange, voiceChangerAbiVersion, voiceCharacterPresetId, vqt, zeroCrossingRate, zeroCrossings };
|