@libraz/libsonare 1.2.1 → 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 +691 -287
- package/dist/index.js +669 -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 +1605 -309
- package/src/public_types.ts +61 -0
- package/src/sonare.js.d.ts +496 -79
- package/src/worklet.ts +295 -9
- package/src/wasm_types.ts +0 -1259
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
|
*/
|
|
@@ -660,6 +663,57 @@ interface StreamingRetuneConfig {
|
|
|
660
663
|
/** Grain size in samples. Use 0/omit to derive it from the sample rate. */
|
|
661
664
|
grainSize?: number;
|
|
662
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
|
+
}
|
|
663
717
|
/** Options for {@link StreamingEqualizer.match}. */
|
|
664
718
|
interface EqMatchOptions {
|
|
665
719
|
sampleRate?: number;
|
|
@@ -790,180 +844,6 @@ interface StreamConfig {
|
|
|
790
844
|
outputFormat?: number;
|
|
791
845
|
}
|
|
792
846
|
|
|
793
|
-
type ProgressCallback = (progress: number, stage: string) => void;
|
|
794
|
-
interface WasmTrimResult {
|
|
795
|
-
audio: Float32Array;
|
|
796
|
-
startSample: number;
|
|
797
|
-
endSample: number;
|
|
798
|
-
}
|
|
799
|
-
interface WasmFrameResult {
|
|
800
|
-
nFrames: number;
|
|
801
|
-
frames: Float32Array;
|
|
802
|
-
}
|
|
803
|
-
interface WasmTempogramResult {
|
|
804
|
-
nFrames: number;
|
|
805
|
-
winLength: number;
|
|
806
|
-
data: Float32Array;
|
|
807
|
-
}
|
|
808
|
-
interface WasmCyclicTempogramResult {
|
|
809
|
-
nFrames: number;
|
|
810
|
-
nBins: number;
|
|
811
|
-
data: Float32Array;
|
|
812
|
-
}
|
|
813
|
-
interface WasmFourierTempogramResult {
|
|
814
|
-
nBins: number;
|
|
815
|
-
nFrames: number;
|
|
816
|
-
data: Float32Array;
|
|
817
|
-
}
|
|
818
|
-
interface WasmNnlsChromaResult {
|
|
819
|
-
nChroma: number;
|
|
820
|
-
nFrames: number;
|
|
821
|
-
data: Float32Array;
|
|
822
|
-
}
|
|
823
|
-
interface WasmEngineClip {
|
|
824
|
-
id?: number;
|
|
825
|
-
channels: Float32Array[];
|
|
826
|
-
startPpq: number;
|
|
827
|
-
lengthSamples?: number;
|
|
828
|
-
clipOffsetSamples?: number;
|
|
829
|
-
loop?: boolean;
|
|
830
|
-
gain?: number;
|
|
831
|
-
fadeInSamples?: number;
|
|
832
|
-
fadeOutSamples?: number;
|
|
833
|
-
}
|
|
834
|
-
interface WasmEngineParameterInfo {
|
|
835
|
-
id: number;
|
|
836
|
-
name: string;
|
|
837
|
-
unit: string;
|
|
838
|
-
minValue: number;
|
|
839
|
-
maxValue: number;
|
|
840
|
-
defaultValue: number;
|
|
841
|
-
rtSafe: boolean;
|
|
842
|
-
defaultCurve: number;
|
|
843
|
-
}
|
|
844
|
-
interface WasmEngineAutomationPoint {
|
|
845
|
-
ppq: number;
|
|
846
|
-
value: number;
|
|
847
|
-
curveToNext?: number;
|
|
848
|
-
}
|
|
849
|
-
interface WasmEngineMarker {
|
|
850
|
-
id: number;
|
|
851
|
-
ppq: number;
|
|
852
|
-
name?: string;
|
|
853
|
-
}
|
|
854
|
-
interface WasmEngineMetronomeConfig {
|
|
855
|
-
enabled: boolean;
|
|
856
|
-
beatGain?: number;
|
|
857
|
-
accentGain?: number;
|
|
858
|
-
clickSamples?: number;
|
|
859
|
-
}
|
|
860
|
-
interface WasmEngineGraphNode {
|
|
861
|
-
id: string;
|
|
862
|
-
type?: number;
|
|
863
|
-
gainDb?: number;
|
|
864
|
-
numPorts?: number;
|
|
865
|
-
}
|
|
866
|
-
interface WasmEngineGraphConnection {
|
|
867
|
-
sourceNode: string;
|
|
868
|
-
sourcePort: number;
|
|
869
|
-
destNode: string;
|
|
870
|
-
destPort: number;
|
|
871
|
-
mix?: number;
|
|
872
|
-
}
|
|
873
|
-
interface WasmEngineGraphParameterBinding {
|
|
874
|
-
paramId: number;
|
|
875
|
-
nodeId: string;
|
|
876
|
-
}
|
|
877
|
-
interface WasmEngineGraphSpec {
|
|
878
|
-
nodes: WasmEngineGraphNode[];
|
|
879
|
-
connections: WasmEngineGraphConnection[];
|
|
880
|
-
inputNode: string;
|
|
881
|
-
outputNode: string;
|
|
882
|
-
numChannels: number;
|
|
883
|
-
parameterBindings?: WasmEngineGraphParameterBinding[];
|
|
884
|
-
}
|
|
885
|
-
interface WasmEngineTelemetry {
|
|
886
|
-
type: number;
|
|
887
|
-
error: number;
|
|
888
|
-
renderFrame: number;
|
|
889
|
-
timelineSample: number;
|
|
890
|
-
audibleTimelineSample: number;
|
|
891
|
-
graphLatencySamplesQ8: number;
|
|
892
|
-
value: number;
|
|
893
|
-
}
|
|
894
|
-
interface WasmEngineMeterTelemetry {
|
|
895
|
-
targetId: number;
|
|
896
|
-
renderFrame: number;
|
|
897
|
-
seq: number;
|
|
898
|
-
peakDbL: number;
|
|
899
|
-
peakDbR: number;
|
|
900
|
-
rmsDbL: number;
|
|
901
|
-
rmsDbR: number;
|
|
902
|
-
truePeakDbL: number;
|
|
903
|
-
truePeakDbR: number;
|
|
904
|
-
maxTruePeakDb: number;
|
|
905
|
-
correlation: number;
|
|
906
|
-
monoCompatWidth: number;
|
|
907
|
-
momentaryLufs: number;
|
|
908
|
-
shortTermLufs: number;
|
|
909
|
-
integratedLufs: number;
|
|
910
|
-
gainReductionDb: number;
|
|
911
|
-
droppedRecords: number;
|
|
912
|
-
}
|
|
913
|
-
interface WasmEngineCaptureStatus {
|
|
914
|
-
capturedFrames: number;
|
|
915
|
-
overflowCount: number;
|
|
916
|
-
armed: boolean;
|
|
917
|
-
punchEnabled: boolean;
|
|
918
|
-
}
|
|
919
|
-
interface WasmEngineTransportState {
|
|
920
|
-
playing: boolean;
|
|
921
|
-
looping: boolean;
|
|
922
|
-
renderFrame: number;
|
|
923
|
-
samplePosition: number;
|
|
924
|
-
ppq: number;
|
|
925
|
-
bpm: number;
|
|
926
|
-
loopStartPpq: number;
|
|
927
|
-
loopEndPpq: number;
|
|
928
|
-
sampleRate: number;
|
|
929
|
-
}
|
|
930
|
-
interface WasmEngineBounceOptions {
|
|
931
|
-
totalFrames: number;
|
|
932
|
-
blockSize?: number;
|
|
933
|
-
numChannels?: number;
|
|
934
|
-
targetSampleRate?: number;
|
|
935
|
-
sourceSampleRate?: number;
|
|
936
|
-
normalizeLufs?: boolean;
|
|
937
|
-
targetLufs?: number;
|
|
938
|
-
dither?: 0 | 1 | 2 | 3;
|
|
939
|
-
ditherBits?: number;
|
|
940
|
-
ditherSeed?: number;
|
|
941
|
-
}
|
|
942
|
-
interface WasmEngineBounceResult {
|
|
943
|
-
interleaved: Float32Array;
|
|
944
|
-
frames: number;
|
|
945
|
-
numChannels: number;
|
|
946
|
-
sampleRate: number;
|
|
947
|
-
integratedLufs: number;
|
|
948
|
-
}
|
|
949
|
-
interface WasmEngineFreezeOptions {
|
|
950
|
-
totalFrames: number;
|
|
951
|
-
blockSize?: number;
|
|
952
|
-
numChannels?: number;
|
|
953
|
-
clipId?: number;
|
|
954
|
-
startPpq?: number;
|
|
955
|
-
gain?: number;
|
|
956
|
-
}
|
|
957
|
-
interface WasmEngineFreezeResult {
|
|
958
|
-
clipId: number;
|
|
959
|
-
frames: number;
|
|
960
|
-
numChannels: number;
|
|
961
|
-
}
|
|
962
|
-
interface WasmEngineProcessWithMonitorResult {
|
|
963
|
-
output: Float32Array[];
|
|
964
|
-
monitor: Float32Array[];
|
|
965
|
-
}
|
|
966
|
-
|
|
967
847
|
/**
|
|
968
848
|
* sonare - Audio Analysis Library
|
|
969
849
|
*
|
|
@@ -998,6 +878,12 @@ type EngineFreezeResult = WasmEngineFreezeResult;
|
|
|
998
878
|
type EngineTelemetry = WasmEngineTelemetry;
|
|
999
879
|
type EngineMeterTelemetry = WasmEngineMeterTelemetry;
|
|
1000
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;
|
|
1001
887
|
declare const EXPECTED_ENGINE_ABI_VERSION = 2;
|
|
1002
888
|
interface EngineCapabilities {
|
|
1003
889
|
engineAbiVersion: number;
|
|
@@ -1015,6 +901,48 @@ interface MixerRealtimeBuffer {
|
|
|
1015
901
|
outRight: Float32Array;
|
|
1016
902
|
process: (numSamples?: number) => void;
|
|
1017
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
|
+
}
|
|
1018
946
|
/**
|
|
1019
947
|
* Initialize the WASM module.
|
|
1020
948
|
* Must be called before using any analysis functions.
|
|
@@ -1034,6 +962,18 @@ declare function isInitialized(): boolean;
|
|
|
1034
962
|
*/
|
|
1035
963
|
declare function version(): string;
|
|
1036
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;
|
|
1037
977
|
declare function engineCapabilities(): EngineCapabilities;
|
|
1038
978
|
declare class RealtimeEngine {
|
|
1039
979
|
private native;
|
|
@@ -1091,81 +1031,157 @@ declare class RealtimeEngine {
|
|
|
1091
1031
|
* Detect BPM from audio samples.
|
|
1092
1032
|
*
|
|
1093
1033
|
* @param samples - Audio samples (mono, float32)
|
|
1094
|
-
* @param sampleRate - Sample rate in Hz
|
|
1034
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1095
1035
|
* @returns Detected BPM
|
|
1096
1036
|
*/
|
|
1097
|
-
declare function detectBpm(samples: Float32Array, sampleRate
|
|
1037
|
+
declare function detectBpm(samples: Float32Array, sampleRate?: number): number;
|
|
1098
1038
|
/**
|
|
1099
1039
|
* Detect musical key from audio samples.
|
|
1100
1040
|
*
|
|
1101
1041
|
* @param samples - Audio samples (mono, float32)
|
|
1102
|
-
* @param sampleRate - Sample rate in Hz
|
|
1042
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1103
1043
|
* @returns Detected key
|
|
1104
1044
|
*/
|
|
1105
|
-
declare function detectKey(samples: Float32Array, sampleRate
|
|
1106
|
-
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[];
|
|
1107
1047
|
/**
|
|
1108
1048
|
* Detect onset times from audio samples.
|
|
1109
1049
|
*
|
|
1110
1050
|
* @param samples - Audio samples (mono, float32)
|
|
1111
|
-
* @param sampleRate - Sample rate in Hz
|
|
1051
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1112
1052
|
* @returns Array of onset times in seconds
|
|
1113
1053
|
*/
|
|
1114
|
-
declare function detectOnsets(samples: Float32Array, sampleRate
|
|
1054
|
+
declare function detectOnsets(samples: Float32Array, sampleRate?: number): Float32Array;
|
|
1115
1055
|
/**
|
|
1116
1056
|
* Detect beat times from audio samples.
|
|
1117
1057
|
*
|
|
1118
1058
|
* @param samples - Audio samples (mono, float32)
|
|
1119
|
-
* @param sampleRate - Sample rate in Hz
|
|
1059
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1120
1060
|
* @returns Array of beat times in seconds
|
|
1121
1061
|
*/
|
|
1122
|
-
declare function detectBeats(samples: Float32Array, sampleRate
|
|
1062
|
+
declare function detectBeats(samples: Float32Array, sampleRate?: number): Float32Array;
|
|
1123
1063
|
/**
|
|
1124
1064
|
* Detect downbeat times from audio samples.
|
|
1125
1065
|
*
|
|
1126
1066
|
* @param samples - Audio samples (mono, float32)
|
|
1127
|
-
* @param sampleRate - Sample rate in Hz
|
|
1067
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1128
1068
|
* @returns Array of downbeat times in seconds
|
|
1129
1069
|
*/
|
|
1130
|
-
declare function detectDownbeats(samples: Float32Array, sampleRate
|
|
1070
|
+
declare function detectDownbeats(samples: Float32Array, sampleRate?: number): Float32Array;
|
|
1131
1071
|
/**
|
|
1132
1072
|
* Detect chords from audio samples.
|
|
1133
1073
|
*
|
|
1134
1074
|
* @param samples - Audio samples (mono, float32)
|
|
1135
|
-
* @param sampleRate - Sample rate in Hz
|
|
1075
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1136
1076
|
* @param options - Optional chord detection settings
|
|
1137
1077
|
* @returns Detected chord segments
|
|
1138
1078
|
*/
|
|
1139
|
-
declare function detectChords(samples: Float32Array, sampleRate
|
|
1079
|
+
declare function detectChords(samples: Float32Array, sampleRate?: number, options?: ChordDetectionOptions): ChordAnalysisResult;
|
|
1140
1080
|
/**
|
|
1141
1081
|
* Perform complete music analysis.
|
|
1142
1082
|
*
|
|
1143
1083
|
* @param samples - Audio samples (mono, float32)
|
|
1144
|
-
* @param sampleRate - Sample rate in Hz
|
|
1084
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1145
1085
|
* @returns Complete analysis result
|
|
1146
1086
|
*/
|
|
1147
|
-
declare function analyze(samples: Float32Array, sampleRate
|
|
1148
|
-
declare function analyzeImpulseResponse(samples: Float32Array, sampleRate
|
|
1149
|
-
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;
|
|
1150
1090
|
/**
|
|
1151
1091
|
* Perform complete music analysis with progress reporting.
|
|
1152
1092
|
*
|
|
1153
1093
|
* @param samples - Audio samples (mono, float32)
|
|
1154
|
-
* @param sampleRate - Sample rate in Hz
|
|
1094
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1155
1095
|
* @param onProgress - Progress callback (progress: 0-1, stage: string)
|
|
1156
1096
|
* @returns Complete analysis result
|
|
1157
1097
|
*/
|
|
1158
|
-
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;
|
|
1159
1175
|
/**
|
|
1160
1176
|
* Perform Harmonic-Percussive Source Separation (HPSS).
|
|
1161
1177
|
*
|
|
1162
1178
|
* @param samples - Audio samples (mono, float32)
|
|
1163
|
-
* @param sampleRate - Sample rate in Hz
|
|
1179
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1164
1180
|
* @param kernelHarmonic - Horizontal median filter size for harmonic (default: 31)
|
|
1165
1181
|
* @param kernelPercussive - Vertical median filter size for percussive (default: 31)
|
|
1166
1182
|
* @returns Separated harmonic and percussive components
|
|
1167
1183
|
*/
|
|
1168
|
-
declare function hpss(samples: Float32Array, sampleRate
|
|
1184
|
+
declare function hpss(samples: Float32Array, sampleRate?: number, kernelHarmonic?: number, kernelPercussive?: number): HpssResult;
|
|
1169
1185
|
/**
|
|
1170
1186
|
* Extract harmonic component from audio.
|
|
1171
1187
|
*
|
|
@@ -1209,7 +1225,7 @@ declare function pitchShift(samples: Float32Array, sampleRate: number, semitones
|
|
|
1209
1225
|
* @param targetMidi - Desired MIDI note number
|
|
1210
1226
|
* @returns Pitch-corrected audio
|
|
1211
1227
|
*/
|
|
1212
|
-
declare function pitchCorrectToMidi(samples: Float32Array, sampleRate
|
|
1228
|
+
declare function pitchCorrectToMidi(samples: Float32Array, sampleRate?: number, currentMidi?: number, targetMidi?: number): Float32Array;
|
|
1213
1229
|
/**
|
|
1214
1230
|
* Time-stretch a note region between two sample offsets without changing pitch.
|
|
1215
1231
|
*
|
|
@@ -1220,7 +1236,7 @@ declare function pitchCorrectToMidi(samples: Float32Array, sampleRate: number, c
|
|
|
1220
1236
|
* @param stretchRatio - Stretch ratio (0.5 = double duration, 2.0 = half duration)
|
|
1221
1237
|
* @returns Audio with the note region stretched
|
|
1222
1238
|
*/
|
|
1223
|
-
declare function noteStretch(samples: Float32Array, sampleRate
|
|
1239
|
+
declare function noteStretch(samples: Float32Array, sampleRate?: number, onsetSample?: number, offsetSample?: number, stretchRatio?: number): Float32Array;
|
|
1224
1240
|
/**
|
|
1225
1241
|
* Apply a voice change by shifting pitch and formants independently.
|
|
1226
1242
|
*
|
|
@@ -1230,7 +1246,7 @@ declare function noteStretch(samples: Float32Array, sampleRate: number, onsetSam
|
|
|
1230
1246
|
* @param formantFactor - Formant scaling factor (1.0 = unchanged)
|
|
1231
1247
|
* @returns Voice-changed audio
|
|
1232
1248
|
*/
|
|
1233
|
-
declare function voiceChange(samples: Float32Array, sampleRate
|
|
1249
|
+
declare function voiceChange(samples: Float32Array, sampleRate?: number, pitchSemitones?: number, formantFactor?: number, options?: ValidateOptions): Float32Array;
|
|
1234
1250
|
/**
|
|
1235
1251
|
* Normalize audio to target peak level.
|
|
1236
1252
|
*
|
|
@@ -1244,34 +1260,176 @@ declare function normalize(samples: Float32Array, sampleRate: number, targetDb?:
|
|
|
1244
1260
|
* Apply mastering loudness normalization with a true-peak ceiling.
|
|
1245
1261
|
*
|
|
1246
1262
|
* @param samples - Audio samples (mono, float32)
|
|
1247
|
-
* @param sampleRate - Sample rate in Hz
|
|
1263
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1248
1264
|
* @param targetLufs - Target integrated LUFS (default: -14)
|
|
1249
1265
|
* @param ceilingDb - True/sample peak ceiling in dBFS (default: -1)
|
|
1250
1266
|
* @param truePeakOversample - Oversampling factor used for peak estimation
|
|
1251
1267
|
* @returns Processed audio and loudness metadata
|
|
1252
1268
|
*/
|
|
1253
|
-
declare function mastering(samples: Float32Array, sampleRate
|
|
1269
|
+
declare function mastering(samples: Float32Array, sampleRate?: number, targetLufs?: number, ceilingDb?: number, truePeakOversample?: number): MasteringResult;
|
|
1254
1270
|
declare function masteringProcessorNames(): SoloProcessor[];
|
|
1255
1271
|
declare function masteringPairProcessorNames(): PairProcessor[];
|
|
1256
1272
|
declare function masteringPairAnalysisNames(): PairAnalysis[];
|
|
1257
1273
|
declare function masteringStereoAnalysisNames(): StereoAnalysis[];
|
|
1258
|
-
declare function masteringProcess(processorName: SoloProcessor, samples: Float32Array, sampleRate
|
|
1259
|
-
declare function masteringProcessStereo(processorName: SoloProcessor, left: Float32Array, right: Float32Array, sampleRate
|
|
1260
|
-
declare function masteringPairProcess(processorName: PairProcessor, source: Float32Array, reference: Float32Array, sampleRate
|
|
1261
|
-
declare function masteringPairAnalyze(analysisName: PairAnalysis, source: Float32Array, reference: Float32Array, sampleRate
|
|
1262
|
-
declare function masteringStereoAnalyze(analysisName: StereoAnalysis, left: Float32Array, right: Float32Array, sampleRate
|
|
1263
|
-
declare function masteringAssistantSuggest(samples: Float32Array, sampleRate
|
|
1264
|
-
declare function masteringAudioProfile(samples: Float32Array, sampleRate
|
|
1265
|
-
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;
|
|
1266
1424
|
/**
|
|
1267
1425
|
* Apply a configurable mastering chain in WASM.
|
|
1268
1426
|
*
|
|
1269
1427
|
* @param samples - Audio samples (mono, float32)
|
|
1270
|
-
* @param sampleRate - Sample rate in Hz
|
|
1428
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1271
1429
|
* @param config - Chain stage configuration
|
|
1272
1430
|
* @returns Processed audio, loudness metadata, and applied stage names
|
|
1273
1431
|
*/
|
|
1274
|
-
declare function masteringChain(samples: Float32Array, sampleRate: number, config: MasteringChainConfig): MasteringChainResult;
|
|
1432
|
+
declare function masteringChain(samples: Float32Array, sampleRate: number | undefined, config: MasteringChainConfig): MasteringChainResult;
|
|
1275
1433
|
/**
|
|
1276
1434
|
* Apply a configurable stereo mastering chain in WASM.
|
|
1277
1435
|
*
|
|
@@ -1281,17 +1439,17 @@ declare function masteringChain(samples: Float32Array, sampleRate: number, confi
|
|
|
1281
1439
|
* @param config - Chain stage configuration
|
|
1282
1440
|
* @returns Processed stereo audio, loudness metadata, and applied stage names
|
|
1283
1441
|
*/
|
|
1284
|
-
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;
|
|
1285
1443
|
/**
|
|
1286
1444
|
* Apply a configurable mastering chain in WASM with progress reporting.
|
|
1287
1445
|
*
|
|
1288
1446
|
* @param samples - Audio samples (mono, float32)
|
|
1289
|
-
* @param sampleRate - Sample rate in Hz
|
|
1447
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1290
1448
|
* @param config - Chain stage configuration
|
|
1291
1449
|
* @param onProgress - Progress callback (progress: 0-1, stage: string)
|
|
1292
1450
|
* @returns Processed audio, loudness metadata, and applied stage names
|
|
1293
1451
|
*/
|
|
1294
|
-
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;
|
|
1295
1453
|
/**
|
|
1296
1454
|
* Apply a configurable stereo mastering chain in WASM with progress reporting.
|
|
1297
1455
|
*
|
|
@@ -1302,7 +1460,7 @@ declare function masteringChainWithProgress(samples: Float32Array, sampleRate: n
|
|
|
1302
1460
|
* @param onProgress - Progress callback (progress: 0-1, stage: string)
|
|
1303
1461
|
* @returns Processed stereo audio, loudness metadata, and applied stage names
|
|
1304
1462
|
*/
|
|
1305
|
-
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;
|
|
1306
1464
|
/**
|
|
1307
1465
|
* List built-in mastering preset identifiers.
|
|
1308
1466
|
*
|
|
@@ -1313,12 +1471,12 @@ declare function masteringPresetNames(): MasteringPreset[];
|
|
|
1313
1471
|
* Apply a named mastering preset chain to mono audio.
|
|
1314
1472
|
*
|
|
1315
1473
|
* @param samples - Audio samples (mono, float32)
|
|
1316
|
-
* @param sampleRate - Sample rate in Hz
|
|
1474
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1317
1475
|
* @param presetName - Preset identifier from {@link masteringPresetNames}
|
|
1318
1476
|
* @param overrides - Optional flat overrides (dot-notation, e.g. `'loudness.targetLufs'`) applied on top of the preset. Pass `null` for preset defaults.
|
|
1319
1477
|
* @returns Processed audio, loudness metadata, and applied stage names
|
|
1320
1478
|
*/
|
|
1321
|
-
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;
|
|
1322
1480
|
/**
|
|
1323
1481
|
* Apply a named mastering preset chain to stereo audio.
|
|
1324
1482
|
*
|
|
@@ -1329,17 +1487,26 @@ declare function masterAudio(samples: Float32Array, sampleRate: number, presetNa
|
|
|
1329
1487
|
* @param overrides - Optional flat overrides (dot-notation, e.g. `'loudness.targetLufs'`) applied on top of the preset. Pass `null` for preset defaults.
|
|
1330
1488
|
* @returns Processed stereo audio, loudness metadata, and applied stage names
|
|
1331
1489
|
*/
|
|
1332
|
-
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;
|
|
1333
1500
|
declare function mixingScenePresetNames(): string[];
|
|
1334
1501
|
/**
|
|
1335
1502
|
* Get a built-in mixing scene preset serialized as JSON. This is the canonical
|
|
1336
1503
|
* name shared with the Node and Python bindings; the returned JSON loads
|
|
1337
1504
|
* directly into a {@link Mixer} via {@link Mixer.fromSceneJson}.
|
|
1338
1505
|
*
|
|
1339
|
-
* @param
|
|
1506
|
+
* @param presetName - Preset name (see {@link mixingScenePresetNames})
|
|
1340
1507
|
* @returns Scene JSON string
|
|
1341
1508
|
*/
|
|
1342
|
-
declare function mixingScenePresetJson(
|
|
1509
|
+
declare function mixingScenePresetJson(presetName: string): string;
|
|
1343
1510
|
declare function mixStereo(leftChannels: Float32Array[], rightChannels: Float32Array[], sampleRate?: number, options?: MixOptions): MixResult;
|
|
1344
1511
|
/**
|
|
1345
1512
|
* Block-by-block streaming variant of {@link masteringChain}.
|
|
@@ -1508,23 +1675,86 @@ declare class StreamingRetune {
|
|
|
1508
1675
|
/** Release the underlying WASM object. Safe to call only once. */
|
|
1509
1676
|
delete(): void;
|
|
1510
1677
|
}
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
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
|
+
};
|
|
1524
1754
|
/**
|
|
1525
1755
|
* Persistent, scene-based stereo mixer.
|
|
1526
1756
|
*
|
|
1527
|
-
* Build one from a scene JSON string (e.g. {@link
|
|
1757
|
+
* Build one from a scene JSON string (e.g. {@link mixingScenePresetJson} or a
|
|
1528
1758
|
* hand-authored scene), then feed per-strip stereo blocks through
|
|
1529
1759
|
* {@link processStereo} to get the routed stereo master. Strips, sends, buses,
|
|
1530
1760
|
* and inserts are described entirely by the scene; the routing graph is
|
|
@@ -1536,7 +1766,7 @@ declare function mixerScenePresetJson(preset: string): string;
|
|
|
1536
1766
|
*
|
|
1537
1767
|
* @example
|
|
1538
1768
|
* ```typescript
|
|
1539
|
-
* const mixer = Mixer.fromSceneJson(
|
|
1769
|
+
* const mixer = Mixer.fromSceneJson(mixingScenePresetJson('basicStereo'), 48000, 512);
|
|
1540
1770
|
* try {
|
|
1541
1771
|
* const out = mixer.processStereo([stripL], [stripR]);
|
|
1542
1772
|
* } finally {
|
|
@@ -1623,6 +1853,16 @@ declare class Mixer {
|
|
|
1623
1853
|
removeVcaGroup(id: string): void;
|
|
1624
1854
|
/** Number of VCA groups in the mixer topology. */
|
|
1625
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;
|
|
1626
1866
|
/**
|
|
1627
1867
|
* Set a strip's solo state. Takes effect on the next process without a
|
|
1628
1868
|
* graph recompile.
|
|
@@ -1736,22 +1976,22 @@ declare function trim(samples: Float32Array, sampleRate: number, thresholdDb?: n
|
|
|
1736
1976
|
* Compute Short-Time Fourier Transform (STFT).
|
|
1737
1977
|
*
|
|
1738
1978
|
* @param samples - Audio samples (mono, float32)
|
|
1739
|
-
* @param sampleRate - Sample rate in Hz
|
|
1979
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1740
1980
|
* @param nFft - FFT size (default: 2048)
|
|
1741
1981
|
* @param hopLength - Hop length (default: 512)
|
|
1742
1982
|
* @returns STFT result with magnitude and power spectrograms
|
|
1743
1983
|
*/
|
|
1744
|
-
declare function stft(samples: Float32Array, sampleRate
|
|
1984
|
+
declare function stft(samples: Float32Array, sampleRate?: number, nFft?: number, hopLength?: number): StftResult;
|
|
1745
1985
|
/**
|
|
1746
1986
|
* Compute STFT and return magnitude in decibels.
|
|
1747
1987
|
*
|
|
1748
1988
|
* @param samples - Audio samples (mono, float32)
|
|
1749
|
-
* @param sampleRate - Sample rate in Hz
|
|
1989
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1750
1990
|
* @param nFft - FFT size (default: 2048)
|
|
1751
1991
|
* @param hopLength - Hop length (default: 512)
|
|
1752
1992
|
* @returns STFT result with dB values
|
|
1753
1993
|
*/
|
|
1754
|
-
declare function stftDb(samples: Float32Array, sampleRate
|
|
1994
|
+
declare function stftDb(samples: Float32Array, sampleRate?: number, nFft?: number, hopLength?: number): {
|
|
1755
1995
|
nBins: number;
|
|
1756
1996
|
nFrames: number;
|
|
1757
1997
|
db: Float32Array;
|
|
@@ -1760,25 +2000,25 @@ declare function stftDb(samples: Float32Array, sampleRate: number, nFft?: number
|
|
|
1760
2000
|
* Compute Mel spectrogram.
|
|
1761
2001
|
*
|
|
1762
2002
|
* @param samples - Audio samples (mono, float32)
|
|
1763
|
-
* @param sampleRate - Sample rate in Hz
|
|
2003
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1764
2004
|
* @param nFft - FFT size (default: 2048)
|
|
1765
2005
|
* @param hopLength - Hop length (default: 512)
|
|
1766
2006
|
* @param nMels - Number of Mel bands (default: 128)
|
|
1767
2007
|
* @returns Mel spectrogram result
|
|
1768
2008
|
*/
|
|
1769
|
-
declare function melSpectrogram(samples: Float32Array, sampleRate
|
|
2009
|
+
declare function melSpectrogram(samples: Float32Array, sampleRate?: number, nFft?: number, hopLength?: number, nMels?: number): MelSpectrogramResult;
|
|
1770
2010
|
/**
|
|
1771
2011
|
* Compute MFCC (Mel-Frequency Cepstral Coefficients).
|
|
1772
2012
|
*
|
|
1773
2013
|
* @param samples - Audio samples (mono, float32)
|
|
1774
|
-
* @param sampleRate - Sample rate in Hz
|
|
2014
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1775
2015
|
* @param nFft - FFT size (default: 2048)
|
|
1776
2016
|
* @param hopLength - Hop length (default: 512)
|
|
1777
2017
|
* @param nMels - Number of Mel bands (default: 128)
|
|
1778
|
-
* @param nMfcc - Number of MFCC coefficients (default:
|
|
2018
|
+
* @param nMfcc - Number of MFCC coefficients (default: 20)
|
|
1779
2019
|
* @returns MFCC result
|
|
1780
2020
|
*/
|
|
1781
|
-
declare function mfcc(samples: Float32Array, sampleRate
|
|
2021
|
+
declare function mfcc(samples: Float32Array, sampleRate?: number, nFft?: number, hopLength?: number, nMels?: number, nMfcc?: number): MfccResult;
|
|
1782
2022
|
/**
|
|
1783
2023
|
* Approximate inverse of a Mel filterbank: Mel power spectrogram -> STFT power
|
|
1784
2024
|
* spectrogram. Mirrors `feature::mel_to_stft`.
|
|
@@ -1788,10 +2028,11 @@ declare function mfcc(samples: Float32Array, sampleRate: number, nFft?: number,
|
|
|
1788
2028
|
* @param nFrames - Number of time frames
|
|
1789
2029
|
* @param sampleRate - Sample rate in Hz
|
|
1790
2030
|
* @param nFft - FFT size (default: 2048)
|
|
1791
|
-
* @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)
|
|
1792
2033
|
* @returns STFT power spectrogram result
|
|
1793
2034
|
*/
|
|
1794
|
-
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;
|
|
1795
2036
|
/**
|
|
1796
2037
|
* Reconstruct audio from a Mel power spectrogram via Griffin-Lim. Mirrors
|
|
1797
2038
|
* `feature::mel_to_audio`.
|
|
@@ -1802,10 +2043,12 @@ declare function melToStft(melPower: Float32Array, nMels: number, nFrames: numbe
|
|
|
1802
2043
|
* @param sampleRate - Sample rate in Hz
|
|
1803
2044
|
* @param nFft - FFT size (default: 2048)
|
|
1804
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)
|
|
1805
2048
|
* @param nIter - Griffin-Lim iterations (default: 32)
|
|
1806
2049
|
* @returns Reconstructed audio samples (mono, float32)
|
|
1807
2050
|
*/
|
|
1808
|
-
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;
|
|
1809
2052
|
/**
|
|
1810
2053
|
* Invert MFCC coefficients back to a Mel power spectrogram. Mirrors
|
|
1811
2054
|
* `feature::mfcc_to_mel`.
|
|
@@ -1825,110 +2068,173 @@ declare function mfccToMel(mfccCoefficients: Float32Array, nMfcc: number, nFrame
|
|
|
1825
2068
|
* @param nMfcc - Number of MFCC coefficients
|
|
1826
2069
|
* @param nFrames - Number of time frames
|
|
1827
2070
|
* @param nMels - Number of Mel bins (default: 128)
|
|
1828
|
-
* @param sampleRate - Sample rate in Hz
|
|
2071
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1829
2072
|
* @param nFft - FFT size (default: 2048)
|
|
1830
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)
|
|
1831
2076
|
* @param nIter - Griffin-Lim iterations (default: 32)
|
|
1832
2077
|
* @returns Reconstructed audio samples (mono, float32)
|
|
1833
2078
|
*/
|
|
1834
|
-
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;
|
|
1835
2080
|
/**
|
|
1836
2081
|
* Compute chromagram (pitch class distribution).
|
|
1837
2082
|
*
|
|
1838
2083
|
* @param samples - Audio samples (mono, float32)
|
|
1839
|
-
* @param sampleRate - Sample rate in Hz
|
|
2084
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1840
2085
|
* @param nFft - FFT size (default: 2048)
|
|
1841
2086
|
* @param hopLength - Hop length (default: 512)
|
|
1842
2087
|
* @returns Chroma features result
|
|
1843
2088
|
*/
|
|
1844
|
-
declare function chroma(samples: Float32Array, sampleRate
|
|
2089
|
+
declare function chroma(samples: Float32Array, sampleRate?: number, nFft?: number, hopLength?: number): ChromaResult;
|
|
1845
2090
|
/**
|
|
1846
2091
|
* Compute spectral centroid (center of mass of spectrum).
|
|
1847
2092
|
*
|
|
1848
2093
|
* @param samples - Audio samples (mono, float32)
|
|
1849
|
-
* @param sampleRate - Sample rate in Hz
|
|
2094
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1850
2095
|
* @param nFft - FFT size (default: 2048)
|
|
1851
2096
|
* @param hopLength - Hop length (default: 512)
|
|
1852
2097
|
* @returns Spectral centroid in Hz for each frame
|
|
1853
2098
|
*/
|
|
1854
|
-
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;
|
|
1855
2159
|
/**
|
|
1856
2160
|
* Compute spectral bandwidth.
|
|
1857
2161
|
*
|
|
1858
2162
|
* @param samples - Audio samples (mono, float32)
|
|
1859
|
-
* @param sampleRate - Sample rate in Hz
|
|
2163
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1860
2164
|
* @param nFft - FFT size (default: 2048)
|
|
1861
2165
|
* @param hopLength - Hop length (default: 512)
|
|
1862
2166
|
* @returns Spectral bandwidth in Hz for each frame
|
|
1863
2167
|
*/
|
|
1864
|
-
declare function spectralBandwidth(samples: Float32Array, sampleRate
|
|
2168
|
+
declare function spectralBandwidth(samples: Float32Array, sampleRate?: number, nFft?: number, hopLength?: number): Float32Array;
|
|
1865
2169
|
/**
|
|
1866
2170
|
* Compute spectral rolloff frequency.
|
|
1867
2171
|
*
|
|
1868
2172
|
* @param samples - Audio samples (mono, float32)
|
|
1869
|
-
* @param sampleRate - Sample rate in Hz
|
|
2173
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1870
2174
|
* @param nFft - FFT size (default: 2048)
|
|
1871
2175
|
* @param hopLength - Hop length (default: 512)
|
|
1872
2176
|
* @param rollPercent - Percentage threshold (default: 0.85)
|
|
1873
2177
|
* @returns Rolloff frequency in Hz for each frame
|
|
1874
2178
|
*/
|
|
1875
|
-
declare function spectralRolloff(samples: Float32Array, sampleRate
|
|
2179
|
+
declare function spectralRolloff(samples: Float32Array, sampleRate?: number, nFft?: number, hopLength?: number, rollPercent?: number): Float32Array;
|
|
1876
2180
|
/**
|
|
1877
2181
|
* Compute spectral flatness.
|
|
1878
2182
|
*
|
|
1879
2183
|
* @param samples - Audio samples (mono, float32)
|
|
1880
|
-
* @param sampleRate - Sample rate in Hz
|
|
2184
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1881
2185
|
* @param nFft - FFT size (default: 2048)
|
|
1882
2186
|
* @param hopLength - Hop length (default: 512)
|
|
1883
2187
|
* @returns Spectral flatness for each frame (0 = tonal, 1 = noise-like)
|
|
1884
2188
|
*/
|
|
1885
|
-
declare function spectralFlatness(samples: Float32Array, sampleRate
|
|
2189
|
+
declare function spectralFlatness(samples: Float32Array, sampleRate?: number, nFft?: number, hopLength?: number): Float32Array;
|
|
1886
2190
|
/**
|
|
1887
2191
|
* Compute zero crossing rate.
|
|
1888
2192
|
*
|
|
1889
2193
|
* @param samples - Audio samples (mono, float32)
|
|
1890
|
-
* @param sampleRate - Sample rate in Hz
|
|
2194
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1891
2195
|
* @param frameLength - Frame length (default: 2048)
|
|
1892
2196
|
* @param hopLength - Hop length (default: 512)
|
|
1893
2197
|
* @returns Zero crossing rate for each frame
|
|
1894
2198
|
*/
|
|
1895
|
-
declare function zeroCrossingRate(samples: Float32Array, sampleRate
|
|
2199
|
+
declare function zeroCrossingRate(samples: Float32Array, sampleRate?: number, frameLength?: number, hopLength?: number): Float32Array;
|
|
1896
2200
|
/**
|
|
1897
2201
|
* Compute RMS energy.
|
|
1898
2202
|
*
|
|
1899
2203
|
* @param samples - Audio samples (mono, float32)
|
|
1900
|
-
* @param sampleRate - Sample rate in Hz
|
|
2204
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1901
2205
|
* @param frameLength - Frame length (default: 2048)
|
|
1902
2206
|
* @param hopLength - Hop length (default: 512)
|
|
1903
2207
|
* @returns RMS energy for each frame
|
|
1904
2208
|
*/
|
|
1905
|
-
declare function rmsEnergy(samples: Float32Array, sampleRate
|
|
2209
|
+
declare function rmsEnergy(samples: Float32Array, sampleRate?: number, frameLength?: number, hopLength?: number): Float32Array;
|
|
1906
2210
|
/**
|
|
1907
2211
|
* Detect pitch using YIN algorithm.
|
|
1908
2212
|
*
|
|
1909
2213
|
* @param samples - Audio samples (mono, float32)
|
|
1910
|
-
* @param sampleRate - Sample rate in Hz
|
|
2214
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1911
2215
|
* @param frameLength - Frame length (default: 2048)
|
|
1912
2216
|
* @param hopLength - Hop length (default: 512)
|
|
1913
2217
|
* @param fmin - Minimum frequency in Hz (default: 65)
|
|
1914
2218
|
* @param fmax - Maximum frequency in Hz (default: 2093)
|
|
1915
2219
|
* @param threshold - YIN threshold (default: 0.3)
|
|
2220
|
+
* @param fillNa - If true, return 0 for unvoiced f0 frames; otherwise keep NaN (default: false)
|
|
1916
2221
|
* @returns Pitch detection result
|
|
1917
2222
|
*/
|
|
1918
|
-
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;
|
|
1919
2224
|
/**
|
|
1920
2225
|
* Detect pitch using pYIN algorithm (probabilistic YIN with HMM smoothing).
|
|
1921
2226
|
*
|
|
1922
2227
|
* @param samples - Audio samples (mono, float32)
|
|
1923
|
-
* @param sampleRate - Sample rate in Hz
|
|
2228
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
1924
2229
|
* @param frameLength - Frame length (default: 2048)
|
|
1925
2230
|
* @param hopLength - Hop length (default: 512)
|
|
1926
2231
|
* @param fmin - Minimum frequency in Hz (default: 65)
|
|
1927
2232
|
* @param fmax - Maximum frequency in Hz (default: 2093)
|
|
1928
2233
|
* @param threshold - YIN threshold (default: 0.3)
|
|
2234
|
+
* @param fillNa - If true, return 0 for unvoiced f0 frames; otherwise keep NaN (default: false)
|
|
1929
2235
|
* @returns Pitch detection result
|
|
1930
2236
|
*/
|
|
1931
|
-
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;
|
|
1932
2238
|
/**
|
|
1933
2239
|
* Convert frequency in Hz to Mel scale.
|
|
1934
2240
|
*
|
|
@@ -1975,20 +2281,20 @@ declare function noteToHz(note: string): number;
|
|
|
1975
2281
|
* Convert frame index to time in seconds.
|
|
1976
2282
|
*
|
|
1977
2283
|
* @param frames - Frame index
|
|
1978
|
-
* @param sr - Sample rate in Hz
|
|
1979
|
-
* @param hopLength - Hop length in samples
|
|
2284
|
+
* @param sr - Sample rate in Hz (default: 22050)
|
|
2285
|
+
* @param hopLength - Hop length in samples (default: 512)
|
|
1980
2286
|
* @returns Time in seconds
|
|
1981
2287
|
*/
|
|
1982
|
-
declare function framesToTime(frames: number, sr
|
|
2288
|
+
declare function framesToTime(frames: number, sr?: number, hopLength?: number): number;
|
|
1983
2289
|
/**
|
|
1984
2290
|
* Convert time in seconds to frame index.
|
|
1985
2291
|
*
|
|
1986
2292
|
* @param time - Time in seconds
|
|
1987
|
-
* @param sr - Sample rate in Hz
|
|
1988
|
-
* @param hopLength - Hop length in samples
|
|
2293
|
+
* @param sr - Sample rate in Hz (default: 22050)
|
|
2294
|
+
* @param hopLength - Hop length in samples (default: 512)
|
|
1989
2295
|
* @returns Frame index
|
|
1990
2296
|
*/
|
|
1991
|
-
declare function timeToFrames(time: number, sr
|
|
2297
|
+
declare function timeToFrames(time: number, sr?: number, hopLength?: number): number;
|
|
1992
2298
|
declare function framesToSamples(frames: number, hopLength?: number, nFft?: number): number;
|
|
1993
2299
|
declare function samplesToFrames(samples: number, hopLength?: number, nFft?: number): number;
|
|
1994
2300
|
declare function powerToDb(values: Float32Array, ref?: number, amin?: number, topDb?: number): Float32Array;
|
|
@@ -2000,16 +2306,16 @@ declare function deemphasis(samples: Float32Array, coef?: number, zi?: number):
|
|
|
2000
2306
|
declare function trimSilence(samples: Float32Array, topDb?: number, frameLength?: number, hopLength?: number): WasmTrimResult;
|
|
2001
2307
|
declare function splitSilence(samples: Float32Array, topDb?: number, frameLength?: number, hopLength?: number): Int32Array;
|
|
2002
2308
|
declare function frameSignal(samples: Float32Array, frameLength: number, hopLength: number): WasmFrameResult;
|
|
2003
|
-
declare function padCenter(values: Float32Array,
|
|
2004
|
-
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;
|
|
2005
2311
|
declare function fixFrames(frames: Int32Array, xMin?: number, xMax?: number, pad?: boolean): Int32Array;
|
|
2006
2312
|
declare function peakPick(values: Float32Array, preMax: number, postMax: number, preAvg: number, postAvg: number, delta: number, wait: number): Int32Array;
|
|
2007
2313
|
declare function vectorNormalize(values: Float32Array, normType?: number, threshold?: number): Float32Array;
|
|
2008
2314
|
declare function pcen(values: Float32Array, nBins: number, nFrames: number, options?: Record<string, number>): Float32Array;
|
|
2009
2315
|
declare function tonnetz(chromagram: Float32Array, nChroma: number, nFrames: number): Float32Array;
|
|
2010
|
-
declare function tempogram(onsetEnvelope: Float32Array, sampleRate
|
|
2011
|
-
declare function cyclicTempogram(onsetEnvelope: Float32Array, sampleRate
|
|
2012
|
-
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;
|
|
2013
2319
|
/**
|
|
2014
2320
|
* Compute NNLS (non-negative least squares) chromagram.
|
|
2015
2321
|
*
|
|
@@ -2050,7 +2356,7 @@ declare function vqt(samples: Float32Array, sampleRate?: number, hopLength?: num
|
|
|
2050
2356
|
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
2051
2357
|
* @param nFft - FFT size (default: 2048)
|
|
2052
2358
|
* @param hopLength - Hop length (default: 512)
|
|
2053
|
-
* @param minSectionSec - Minimum section duration in seconds (default:
|
|
2359
|
+
* @param minSectionSec - Minimum section duration in seconds (default: 4.0)
|
|
2054
2360
|
* @returns Array of detected sections
|
|
2055
2361
|
*/
|
|
2056
2362
|
declare function analyzeSections(samples: Float32Array, sampleRate?: number, nFft?: number, hopLength?: number, minSectionSec?: number): Section[];
|
|
@@ -2105,7 +2411,7 @@ declare function tempogramRatio(tempogramData: Float32Array, winLength?: number,
|
|
|
2105
2411
|
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
2106
2412
|
* @returns Loudness measurement result
|
|
2107
2413
|
*/
|
|
2108
|
-
declare function lufs(samples: Float32Array, sampleRate?: number): LufsResult;
|
|
2414
|
+
declare function lufs(samples: Float32Array, sampleRate?: number, options?: ValidateOptions): LufsResult;
|
|
2109
2415
|
/**
|
|
2110
2416
|
* Compute the momentary loudness (LUFS) over time.
|
|
2111
2417
|
*
|
|
@@ -2113,7 +2419,7 @@ declare function lufs(samples: Float32Array, sampleRate?: number): LufsResult;
|
|
|
2113
2419
|
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
2114
2420
|
* @returns Momentary LUFS values over time
|
|
2115
2421
|
*/
|
|
2116
|
-
declare function momentaryLufs(samples: Float32Array, sampleRate?: number): Float32Array;
|
|
2422
|
+
declare function momentaryLufs(samples: Float32Array, sampleRate?: number, options?: ValidateOptions): Float32Array;
|
|
2117
2423
|
/**
|
|
2118
2424
|
* Compute the short-term loudness (LUFS) over time.
|
|
2119
2425
|
*
|
|
@@ -2121,7 +2427,105 @@ declare function momentaryLufs(samples: Float32Array, sampleRate?: number): Floa
|
|
|
2121
2427
|
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
2122
2428
|
* @returns Short-term LUFS values over time
|
|
2123
2429
|
*/
|
|
2124
|
-
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;
|
|
2125
2529
|
/**
|
|
2126
2530
|
* Resample audio to a different sample rate.
|
|
2127
2531
|
*
|
|
@@ -2175,9 +2579,9 @@ declare class Audio {
|
|
|
2175
2579
|
percussive(): Float32Array;
|
|
2176
2580
|
timeStretch(rate: number): Float32Array;
|
|
2177
2581
|
pitchShift(semitones: number): Float32Array;
|
|
2178
|
-
pitchCorrectToMidi(currentMidi
|
|
2179
|
-
noteStretch(onsetSample
|
|
2180
|
-
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;
|
|
2181
2585
|
normalize(targetDb?: number): Float32Array;
|
|
2182
2586
|
mastering(targetLufs?: number, ceilingDb?: number, truePeakOversample?: number): MasteringResult;
|
|
2183
2587
|
masteringChain(config: MasteringChainConfig): MasteringChainResult;
|
|
@@ -2204,8 +2608,8 @@ declare class Audio {
|
|
|
2204
2608
|
spectralFlatness(nFft?: number, hopLength?: number): Float32Array;
|
|
2205
2609
|
zeroCrossingRate(frameLength?: number, hopLength?: number): Float32Array;
|
|
2206
2610
|
rmsEnergy(frameLength?: number, hopLength?: number): Float32Array;
|
|
2207
|
-
pitchYin(frameLength?: number, hopLength?: number, fmin?: number, fmax?: number, threshold?: number): PitchResult;
|
|
2208
|
-
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;
|
|
2209
2613
|
resample(targetSr: number): Float32Array;
|
|
2210
2614
|
}
|
|
2211
2615
|
/**
|
|
@@ -2316,4 +2720,4 @@ declare class StreamAnalyzer {
|
|
|
2316
2720
|
dispose(): void;
|
|
2317
2721
|
}
|
|
2318
2722
|
|
|
2319
|
-
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 };
|