@libraz/libsonare 1.7.2 → 1.8.0
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/NOTICE +178 -0
- package/README.md +26 -203
- package/dist/_chain_config.d.ts +14 -0
- package/dist/_chain_config.d.ts.map +1 -0
- package/dist/_effects_common.d.ts +6 -0
- package/dist/_effects_common.d.ts.map +1 -0
- package/dist/_feature_validation.d.ts +8 -0
- package/dist/_feature_validation.d.ts.map +1 -0
- package/dist/_fft_options.d.ts +24 -0
- package/dist/_fft_options.d.ts.map +1 -0
- package/dist/align_take.d.ts +50 -0
- package/dist/align_take.d.ts.map +1 -0
- package/dist/analysis.d.ts +29 -5840
- package/dist/analysis.d.ts.map +1 -0
- package/dist/analysis.js +873 -722
- package/dist/analysis.js.map +1 -1
- package/dist/analysis_helpers.d.ts +9 -0
- package/dist/analysis_helpers.d.ts.map +1 -0
- package/dist/audio.d.ts +163 -0
- package/dist/audio.d.ts.map +1 -0
- package/dist/clip_page_streamer.d.ts +133 -0
- package/dist/clip_page_streamer.d.ts.map +1 -0
- package/dist/codes.d.ts +44 -0
- package/dist/codes.d.ts.map +1 -0
- package/dist/effects_mastering.d.ts +23 -0
- package/dist/effects_mastering.d.ts.map +1 -0
- package/dist/effects_note_ops.d.ts +477 -0
- package/dist/effects_note_ops.d.ts.map +1 -0
- package/dist/effects_percussive.d.ts +185 -0
- package/dist/effects_percussive.d.ts.map +1 -0
- package/dist/effects_separation.d.ts +65 -0
- package/dist/effects_separation.d.ts.map +1 -0
- package/dist/effects_spectral.d.ts +28 -0
- package/dist/effects_spectral.d.ts.map +1 -0
- package/dist/effects_timepitch.d.ts +129 -0
- package/dist/effects_timepitch.d.ts.map +1 -0
- package/dist/effects_voice_change.d.ts +53 -0
- package/dist/effects_voice_change.d.ts.map +1 -0
- package/dist/errors.d.ts +51 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/feature_core.d.ts +341 -0
- package/dist/feature_core.d.ts.map +1 -0
- package/dist/feature_decompose.d.ts +278 -0
- package/dist/feature_decompose.d.ts.map +1 -0
- package/dist/feature_inverse.d.ts +128 -0
- package/dist/feature_inverse.d.ts.map +1 -0
- package/dist/feature_loudness.d.ts +66 -0
- package/dist/feature_loudness.d.ts.map +1 -0
- package/dist/feature_music.d.ts +307 -0
- package/dist/feature_music.d.ts.map +1 -0
- package/dist/feature_pitch.d.ts +108 -0
- package/dist/feature_pitch.d.ts.map +1 -0
- package/dist/feature_resample.d.ts +16 -0
- package/dist/feature_resample.d.ts.map +1 -0
- package/dist/feature_spectral.d.ts +137 -0
- package/dist/feature_spectral.d.ts.map +1 -0
- package/dist/feature_spectrogram.d.ts +198 -0
- package/dist/feature_spectrogram.d.ts.map +1 -0
- package/dist/features.d.ts +10 -0
- package/dist/features.d.ts.map +1 -0
- package/dist/hrtf/default.shrf +0 -0
- package/dist/index.d.ts +74 -7431
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3758 -1362
- package/dist/index.js.map +1 -1
- package/dist/instrument_types.d.ts +517 -0
- package/dist/instrument_types.d.ts.map +1 -0
- package/dist/live_audio.d.ts +35 -0
- package/dist/live_audio.d.ts.map +1 -0
- package/dist/mastering_chain.d.ts +213 -0
- package/dist/mastering_chain.d.ts.map +1 -0
- package/dist/mastering_core.d.ts +457 -0
- package/dist/mastering_core.d.ts.map +1 -0
- package/dist/mastering_dynamics.d.ts +80 -0
- package/dist/mastering_dynamics.d.ts.map +1 -0
- package/dist/metering.d.ts +287 -0
- package/dist/metering.d.ts.map +1 -0
- package/dist/mixer.d.ts +464 -0
- package/dist/mixer.d.ts.map +1 -0
- package/dist/mixing_assistant.d.ts +62 -0
- package/dist/mixing_assistant.d.ts.map +1 -0
- package/dist/mixing_oneshot.d.ts +40 -0
- package/dist/mixing_oneshot.d.ts.map +1 -0
- package/dist/module_state.d.ts +15 -0
- package/dist/module_state.d.ts.map +1 -0
- package/dist/opfs_clip_pages.d.ts +28 -0
- package/dist/opfs_clip_pages.d.ts.map +1 -0
- package/dist/playback_renderer.d.ts +128 -0
- package/dist/playback_renderer.d.ts.map +1 -0
- package/dist/polyphony.d.ts +202 -0
- package/dist/polyphony.d.ts.map +1 -0
- package/dist/project.d.ts +8 -0
- package/dist/project.d.ts.map +1 -0
- package/dist/project_class.d.ts +562 -0
- package/dist/project_class.d.ts.map +1 -0
- package/dist/project_internal.d.ts +194 -0
- package/dist/project_internal.d.ts.map +1 -0
- package/dist/project_synth.d.ts +74 -0
- package/dist/project_synth.d.ts.map +1 -0
- package/dist/project_types.d.ts +652 -0
- package/dist/project_types.d.ts.map +1 -0
- package/dist/public_types.d.ts +185 -0
- package/dist/public_types.d.ts.map +1 -0
- package/dist/public_types_acoustic.d.ts +215 -0
- package/dist/public_types_acoustic.d.ts.map +1 -0
- package/dist/public_types_mastering.d.ts +510 -0
- package/dist/public_types_mastering.d.ts.map +1 -0
- package/dist/public_types_mixing.d.ts +436 -0
- package/dist/public_types_mixing.d.ts.map +1 -0
- package/dist/public_types_music.d.ts +619 -0
- package/dist/public_types_music.d.ts.map +1 -0
- package/dist/public_types_playback.d.ts +164 -0
- package/dist/public_types_playback.d.ts.map +1 -0
- package/dist/public_types_realtime.d.ts +174 -0
- package/dist/public_types_realtime.d.ts.map +1 -0
- package/dist/public_types_repair.d.ts +424 -0
- package/dist/public_types_repair.d.ts.map +1 -0
- package/dist/public_types_spectral.d.ts +697 -0
- package/dist/public_types_spectral.d.ts.map +1 -0
- package/dist/quick_analysis.d.ts +445 -0
- package/dist/quick_analysis.d.ts.map +1 -0
- package/dist/realtime_engine.d.ts +850 -0
- package/dist/realtime_engine.d.ts.map +1 -0
- package/dist/realtime_voice_changer.d.ts +158 -0
- package/dist/realtime_voice_changer.d.ts.map +1 -0
- package/dist/repair_dereverb.d.ts +187 -0
- package/dist/repair_dereverb.d.ts.map +1 -0
- package/dist/repair_impulsive.d.ts +186 -0
- package/dist/repair_impulsive.d.ts.map +1 -0
- package/dist/repair_noise.d.ts +239 -0
- package/dist/repair_noise.d.ts.map +1 -0
- package/dist/repair_trim.d.ts +123 -0
- package/dist/repair_trim.d.ts.map +1 -0
- package/dist/sample_bank.d.ts +84 -0
- package/dist/sample_bank.d.ts.map +1 -0
- package/dist/scale.d.ts +10 -0
- package/dist/scale.d.ts.map +1 -0
- package/dist/schemas/mixer-scene.schema.json +393 -0
- package/dist/schemas/playback-renderer-config.schema.json +392 -0
- package/dist/sonare-analysis.d.ts +8 -0
- package/dist/sonare-analysis.js +2 -2
- package/dist/sonare-analysis.wasm +0 -0
- package/dist/sonare.d.ts +3909 -0
- package/dist/sonare.js +2 -2
- package/dist/sonare.wasm +0 -0
- package/dist/stream_analyzer.d.ts +163 -0
- package/dist/stream_analyzer.d.ts.map +1 -0
- package/dist/stream_types.d.ts +214 -0
- package/dist/stream_types.d.ts.map +1 -0
- package/dist/streaming_mixing.d.ts +6 -0
- package/dist/streaming_mixing.d.ts.map +1 -0
- package/dist/streaming_processors.d.ts +335 -0
- package/dist/streaming_processors.d.ts.map +1 -0
- package/dist/transcribe.d.ts +77 -0
- package/dist/transcribe.d.ts.map +1 -0
- package/dist/validation.d.ts +140 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/web_midi.d.ts +77 -0
- package/dist/web_midi.d.ts.map +1 -0
- package/dist/worker.d.ts +5 -48
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +94 -41
- package/dist/worker.js.map +1 -1
- package/dist/worker_client.d.ts +96 -0
- package/dist/worker_client.d.ts.map +1 -0
- package/dist/worker_protocol.d.ts +43 -0
- package/dist/worker_protocol.d.ts.map +1 -0
- package/dist/worklet/audio_types.d.ts +21 -0
- package/dist/worklet/audio_types.d.ts.map +1 -0
- package/dist/worklet/engine-automation.d.ts +29 -0
- package/dist/worklet/engine-automation.d.ts.map +1 -0
- package/dist/worklet/engine-capture-facade.d.ts +35 -0
- package/dist/worklet/engine-capture-facade.d.ts.map +1 -0
- package/dist/worklet/engine-clips.d.ts +23 -0
- package/dist/worklet/engine-clips.d.ts.map +1 -0
- package/dist/worklet/engine-markers.d.ts +40 -0
- package/dist/worklet/engine-markers.d.ts.map +1 -0
- package/dist/worklet/engine-mixer-facade.d.ts +128 -0
- package/dist/worklet/engine-mixer-facade.d.ts.map +1 -0
- package/dist/worklet/engine-node.d.ts +81 -0
- package/dist/worklet/engine-node.d.ts.map +1 -0
- package/dist/worklet/engine-offline.d.ts +81 -0
- package/dist/worklet/engine-offline.d.ts.map +1 -0
- package/dist/worklet/engine-options.d.ts +12 -0
- package/dist/worklet/engine-options.d.ts.map +1 -0
- package/dist/worklet/engine-parameter-facade.d.ts +106 -0
- package/dist/worklet/engine-parameter-facade.d.ts.map +1 -0
- package/dist/worklet/engine-processor.d.ts +68 -0
- package/dist/worklet/engine-processor.d.ts.map +1 -0
- package/dist/worklet/engine-register.d.ts +2 -0
- package/dist/worklet/engine-register.d.ts.map +1 -0
- package/dist/worklet/engine-strips.d.ts +73 -0
- package/dist/worklet/engine-strips.d.ts.map +1 -0
- package/dist/worklet/engine-sync.d.ts +37 -0
- package/dist/worklet/engine-sync.d.ts.map +1 -0
- package/dist/worklet/engine-tempo-facade.d.ts +48 -0
- package/dist/worklet/engine-tempo-facade.d.ts.map +1 -0
- package/dist/worklet/engine.d.ts +397 -0
- package/dist/worklet/engine.d.ts.map +1 -0
- package/dist/worklet/guards.d.ts +47 -0
- package/dist/worklet/guards.d.ts.map +1 -0
- package/dist/worklet/messages.d.ts +710 -0
- package/dist/worklet/messages.d.ts.map +1 -0
- package/dist/worklet/mixer-processor.d.ts +46 -0
- package/dist/worklet/mixer-processor.d.ts.map +1 -0
- package/dist/worklet/playback-processor.d.ts +62 -0
- package/dist/worklet/playback-processor.d.ts.map +1 -0
- package/dist/worklet/protocol.d.ts +323 -0
- package/dist/worklet/protocol.d.ts.map +1 -0
- package/dist/worklet/voice-changer-processor.d.ts +41 -0
- package/dist/worklet/voice-changer-processor.d.ts.map +1 -0
- package/dist/worklet.d.ts +16 -2515
- package/dist/worklet.d.ts.map +1 -0
- package/dist/worklet.js +2763 -501
- package/dist/worklet.js.map +1 -1
- package/package.json +23 -12
- package/src/_effects_common.ts +17 -0
- package/src/_feature_validation.ts +34 -0
- package/src/_fft_options.ts +39 -0
- package/src/align_take.ts +64 -0
- package/src/analysis.ts +56 -3
- package/src/analysis_helpers.ts +7 -0
- package/src/audio.ts +106 -3
- package/src/codes.ts +39 -2
- package/src/effects_mastering.ts +97 -22
- package/src/effects_note_ops.ts +635 -0
- package/src/effects_percussive.ts +217 -0
- package/src/effects_separation.ts +150 -0
- package/src/effects_spectral.ts +60 -0
- package/src/effects_timepitch.ts +377 -0
- package/src/errors.ts +23 -1
- package/src/feature_core.ts +127 -2
- package/src/feature_decompose.ts +633 -0
- package/src/feature_inverse.ts +454 -0
- package/src/feature_loudness.ts +125 -0
- package/src/feature_music.ts +107 -14
- package/src/feature_pitch.ts +96 -1
- package/src/feature_spectral.ts +16 -611
- package/src/feature_spectrogram.ts +63 -450
- package/src/features.ts +36 -22
- package/src/index.ts +282 -30
- package/src/instrument_types.ts +645 -0
- package/src/live_audio.ts +27 -1
- package/src/mastering_chain.ts +184 -0
- package/src/mastering_core.ts +346 -32
- package/src/mastering_dynamics.ts +22 -11
- package/src/metering.ts +67 -24
- package/src/mixer.ts +212 -3
- package/src/mixing_assistant.ts +138 -0
- package/src/mixing_oneshot.ts +10 -5
- package/src/module_state.ts +24 -2
- package/src/playback_renderer.ts +252 -0
- package/src/polyphony.ts +279 -0
- package/src/project.ts +61 -24
- package/src/project_class.ts +450 -27
- package/src/project_internal.ts +149 -42
- package/src/project_synth.ts +67 -1
- package/src/project_types.ts +268 -270
- package/src/public_types.ts +122 -3
- package/src/public_types_acoustic.ts +112 -3
- package/src/public_types_mastering.ts +254 -73
- package/src/public_types_mixing.ts +363 -1
- package/src/public_types_music.ts +312 -2
- package/src/public_types_playback.ts +195 -0
- package/src/public_types_realtime.ts +39 -7
- package/src/public_types_repair.ts +446 -0
- package/src/public_types_spectral.ts +487 -1
- package/src/quick_analysis.ts +203 -26
- package/src/realtime_engine.ts +711 -28
- package/src/realtime_voice_changer.ts +55 -1
- package/src/repair_dereverb.ts +299 -0
- package/src/repair_impulsive.ts +395 -0
- package/src/repair_noise.ts +425 -0
- package/src/repair_trim.ts +226 -0
- package/src/sample_bank.ts +113 -0
- package/src/sonare.js.d.ts +1122 -30
- package/src/stream_analyzer.ts +36 -4
- package/src/stream_types.ts +37 -0
- package/src/streaming_mixing.ts +1 -1
- package/src/streaming_processors.ts +194 -10
- package/src/transcribe.ts +89 -0
- package/src/validation.ts +285 -11
- package/src/web_midi.ts +1 -6
- package/src/worker.ts +18 -2
- package/src/worklet/audio_types.ts +37 -0
- package/src/worklet/engine-mixer-facade.ts +444 -10
- package/src/worklet/engine-node.ts +78 -26
- package/src/worklet/engine-offline.ts +14 -8
- package/src/worklet/engine-parameter-facade.ts +21 -0
- package/src/worklet/engine-processor.ts +272 -83
- package/src/worklet/engine-register.ts +32 -18
- package/src/worklet/engine-strips.ts +280 -9
- package/src/worklet/engine-sync.ts +14 -6
- package/src/worklet/engine.ts +365 -31
- package/src/worklet/guards.ts +140 -44
- package/src/worklet/messages.ts +227 -2
- package/src/worklet/mixer-processor.ts +109 -47
- package/src/worklet/playback-processor.ts +300 -0
- package/src/worklet/protocol.ts +53 -3
- package/src/worklet/voice-changer-processor.ts +17 -11
- package/src/worklet.ts +17 -0
- package/src/effects_transform.ts +0 -718
- package/src/mastering_repair.ts +0 -273
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import type { TempogramMode } from './public_types';
|
|
2
|
+
import type { WasmCyclicTempogramResult, WasmFrameResult, WasmTempogramResult, WasmTrimResult } from './sonare.js';
|
|
3
|
+
export declare function tone(request?: ToneRequest): Float32Array;
|
|
4
|
+
export declare function tone(frequency?: number, sampleRate?: number, duration?: number, phase?: number, amplitude?: number): Float32Array;
|
|
5
|
+
export declare function chirp(request?: ChirpRequest): Float32Array;
|
|
6
|
+
export declare function chirp(fmin?: number, fmax?: number, sampleRate?: number, duration?: number, linear?: boolean): Float32Array;
|
|
7
|
+
export declare function clicks(request: ClicksRequest): Float32Array;
|
|
8
|
+
export declare function clicks(times: Float32Array, sampleRate?: number, length?: number, frequency?: number, clickDuration?: number): Float32Array;
|
|
9
|
+
export interface DbConversionRequest {
|
|
10
|
+
values: Float32Array;
|
|
11
|
+
ref?: number;
|
|
12
|
+
amin?: number;
|
|
13
|
+
topDb?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface SilenceRequest {
|
|
16
|
+
samples: Float32Array;
|
|
17
|
+
topDb?: number;
|
|
18
|
+
frameLength?: number;
|
|
19
|
+
hopLength?: number;
|
|
20
|
+
}
|
|
21
|
+
/** Canonical request form for the common-silence union of several signals. */
|
|
22
|
+
export interface SplitSilenceCommonRequest {
|
|
23
|
+
signals: Float32Array[];
|
|
24
|
+
topDb?: number;
|
|
25
|
+
frameLength?: number;
|
|
26
|
+
hopLength?: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Why {@link splitSilenceCommonWithReport} found the gaps it did.
|
|
30
|
+
*
|
|
31
|
+
* One interval covering everything is the answer to three different situations
|
|
32
|
+
* and the interval list cannot separate them: no take has a quiet moment at all,
|
|
33
|
+
* the takes each have one but not in the same place, or `topDb` was set too loose
|
|
34
|
+
* to see the ones they have.
|
|
35
|
+
*
|
|
36
|
+
* **Read {@link silenceCeilingDb} against the `topDb` that was passed**, which is
|
|
37
|
+
* the whole decision:
|
|
38
|
+
*
|
|
39
|
+
* - ceiling near 0 — a take is sounding continuously. No threshold helps, and a
|
|
40
|
+
* cut point has to come from somewhere other than silence.
|
|
41
|
+
* - ceiling below `topDb` — the threshold was too loose to see the quiet these
|
|
42
|
+
* takes do have. A `topDb` under the reported ceiling finds it.
|
|
43
|
+
* - ceiling at or above `topDb`, and still one interval — every take shows silence
|
|
44
|
+
* at this setting and they do not share any of it. That is the alignment case,
|
|
45
|
+
* and it is what {@link alignTakeToReference} is for.
|
|
46
|
+
*
|
|
47
|
+
* The figures come from the same RMS pass the intervals do, so they can never
|
|
48
|
+
* describe a different measurement.
|
|
49
|
+
*/
|
|
50
|
+
export interface SilenceCommonReport {
|
|
51
|
+
/**
|
|
52
|
+
* The largest `topDb` at which EVERY signal still shows silence.
|
|
53
|
+
*
|
|
54
|
+
* A frame counts as silent when it sits at least `topDb` under its own signal's
|
|
55
|
+
* peak RMS, so each signal's deepest dip decides whether any threshold can find
|
|
56
|
+
* silence in it, and the union needs all of them quiet at once — hence the
|
|
57
|
+
* minimum across the signals. 0 for an all-silent signal, where the peak is 0
|
|
58
|
+
* and the ratio has no value; 120 is the floor the dB conversion clamps at,
|
|
59
|
+
* reported for a signal holding a zero-valued frame.
|
|
60
|
+
*/
|
|
61
|
+
silenceCeilingDb: number;
|
|
62
|
+
/**
|
|
63
|
+
* How many intervals the most fragmented signal produced alone, counted before
|
|
64
|
+
* the union merges anything.
|
|
65
|
+
*
|
|
66
|
+
* A measure of shape rather than of cause: 1 is a take that sounds once and
|
|
67
|
+
* stops, so a take that is loud then silent counts 1 exactly as a take with no
|
|
68
|
+
* silence does. Use {@link silenceCeilingDb} to tell those apart; use these two
|
|
69
|
+
* to see whether any take has an interior gap at all (`>= 2`) and whether the
|
|
70
|
+
* takes differ in how broken up they are (`maxSignalIntervals !==
|
|
71
|
+
* minSignalIntervals`).
|
|
72
|
+
*/
|
|
73
|
+
maxSignalIntervals: number;
|
|
74
|
+
/** How many intervals the least fragmented signal produced alone. */
|
|
75
|
+
minSignalIntervals: number;
|
|
76
|
+
}
|
|
77
|
+
/** Result of {@link splitSilenceCommonWithReport}. */
|
|
78
|
+
export interface SplitSilenceCommonWithReportResult {
|
|
79
|
+
/** Exactly what {@link splitSilenceCommon} returns for the same arguments. */
|
|
80
|
+
intervals: Int32Array;
|
|
81
|
+
/** Why those are the intervals. */
|
|
82
|
+
report: SilenceCommonReport;
|
|
83
|
+
}
|
|
84
|
+
export interface FrameSignalRequest {
|
|
85
|
+
samples: Float32Array;
|
|
86
|
+
frameLength: number;
|
|
87
|
+
hopLength: number;
|
|
88
|
+
}
|
|
89
|
+
export interface ToneRequest {
|
|
90
|
+
frequency?: number;
|
|
91
|
+
sampleRate?: number;
|
|
92
|
+
duration?: number;
|
|
93
|
+
phase?: number;
|
|
94
|
+
amplitude?: number;
|
|
95
|
+
}
|
|
96
|
+
export interface ChirpRequest {
|
|
97
|
+
fmin?: number;
|
|
98
|
+
fmax?: number;
|
|
99
|
+
sampleRate?: number;
|
|
100
|
+
duration?: number;
|
|
101
|
+
linear?: boolean;
|
|
102
|
+
}
|
|
103
|
+
export interface ClicksRequest {
|
|
104
|
+
times: Float32Array;
|
|
105
|
+
sampleRate?: number;
|
|
106
|
+
length?: number;
|
|
107
|
+
frequency?: number;
|
|
108
|
+
clickDuration?: number;
|
|
109
|
+
}
|
|
110
|
+
/** Canonical request form for pre/de-emphasis filters. */
|
|
111
|
+
export interface EmphasisRequest {
|
|
112
|
+
samples: Float32Array;
|
|
113
|
+
coef?: number;
|
|
114
|
+
zi?: number;
|
|
115
|
+
}
|
|
116
|
+
/** Canonical request form for centering or extending a vector. */
|
|
117
|
+
export interface PadCenterRequest {
|
|
118
|
+
values: Float32Array;
|
|
119
|
+
targetSize: number;
|
|
120
|
+
padValue?: number;
|
|
121
|
+
}
|
|
122
|
+
/** Canonical request form for resizing a vector. */
|
|
123
|
+
export interface FixLengthRequest {
|
|
124
|
+
values: Float32Array;
|
|
125
|
+
targetSize: number;
|
|
126
|
+
padValue?: number;
|
|
127
|
+
}
|
|
128
|
+
/** Canonical request form for bounding a frame-index vector. */
|
|
129
|
+
export interface FixFramesRequest {
|
|
130
|
+
frames: Int32Array;
|
|
131
|
+
xMin?: number;
|
|
132
|
+
xMax?: number;
|
|
133
|
+
pad?: boolean;
|
|
134
|
+
}
|
|
135
|
+
export interface OnsetBacktrackRequest {
|
|
136
|
+
events: Int32Array;
|
|
137
|
+
energy: Float32Array;
|
|
138
|
+
}
|
|
139
|
+
/** Canonical request form for peak selection. */
|
|
140
|
+
export interface PeakPickRequest {
|
|
141
|
+
values: Float32Array;
|
|
142
|
+
preMax: number;
|
|
143
|
+
postMax: number;
|
|
144
|
+
preAvg: number;
|
|
145
|
+
postAvg: number;
|
|
146
|
+
delta: number;
|
|
147
|
+
wait: number;
|
|
148
|
+
}
|
|
149
|
+
/** Canonical request form for vector normalization. */
|
|
150
|
+
export interface VectorNormalizeRequest {
|
|
151
|
+
values: Float32Array;
|
|
152
|
+
normType?: number;
|
|
153
|
+
threshold?: number;
|
|
154
|
+
}
|
|
155
|
+
/** Canonical request form for tonal centroid projection. */
|
|
156
|
+
export interface TonnetzRequest {
|
|
157
|
+
chromagram: Float32Array;
|
|
158
|
+
nChroma: number;
|
|
159
|
+
nFrames: number;
|
|
160
|
+
}
|
|
161
|
+
export interface PcenRequest {
|
|
162
|
+
values: Float32Array;
|
|
163
|
+
nBins: number;
|
|
164
|
+
nFrames: number;
|
|
165
|
+
sampleRate?: number;
|
|
166
|
+
hopLength?: number;
|
|
167
|
+
timeConstant?: number;
|
|
168
|
+
gain?: number;
|
|
169
|
+
bias?: number;
|
|
170
|
+
power?: number;
|
|
171
|
+
eps?: number;
|
|
172
|
+
/** @deprecated Put PCEN fields directly on the request object. */
|
|
173
|
+
options?: Record<string, number>;
|
|
174
|
+
}
|
|
175
|
+
export interface TempogramRequest {
|
|
176
|
+
onsetEnvelope: Float32Array;
|
|
177
|
+
sampleRate?: number;
|
|
178
|
+
hopLength?: number;
|
|
179
|
+
winLength?: number;
|
|
180
|
+
mode?: TempogramMode;
|
|
181
|
+
center?: boolean;
|
|
182
|
+
norm?: boolean;
|
|
183
|
+
}
|
|
184
|
+
export interface CyclicTempogramRequest {
|
|
185
|
+
onsetEnvelope: Float32Array;
|
|
186
|
+
sampleRate?: number;
|
|
187
|
+
hopLength?: number;
|
|
188
|
+
winLength?: number;
|
|
189
|
+
bpmMin?: number;
|
|
190
|
+
nBins?: number;
|
|
191
|
+
}
|
|
192
|
+
export interface PlpRequest {
|
|
193
|
+
onsetEnvelope: Float32Array;
|
|
194
|
+
sampleRate?: number;
|
|
195
|
+
hopLength?: number;
|
|
196
|
+
tempoMin?: number;
|
|
197
|
+
tempoMax?: number;
|
|
198
|
+
winLength?: number;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Convert frequency in Hz to Mel scale.
|
|
202
|
+
*
|
|
203
|
+
* A total function, matching the C ABI and librosa: a non-finite `hz`
|
|
204
|
+
* propagates rather than throwing, and a magnitude past the 32-bit float range
|
|
205
|
+
* saturates to an infinity the same way the C conversion does. Out-of-audio
|
|
206
|
+
* frequencies are not refused either — the mapping is defined over the whole
|
|
207
|
+
* real line.
|
|
208
|
+
*
|
|
209
|
+
* @param hz - Frequency in Hz
|
|
210
|
+
* @returns Mel frequency
|
|
211
|
+
*/
|
|
212
|
+
export declare function hzToMel(hz: number): number;
|
|
213
|
+
/**
|
|
214
|
+
* Convert Mel scale to frequency in Hz. Total over the same domain as
|
|
215
|
+
* {@link hzToMel}.
|
|
216
|
+
*
|
|
217
|
+
* @param mel - Mel frequency
|
|
218
|
+
* @returns Frequency in Hz
|
|
219
|
+
*/
|
|
220
|
+
export declare function melToHz(mel: number): number;
|
|
221
|
+
/**
|
|
222
|
+
* Convert frequency in Hz to MIDI note number.
|
|
223
|
+
*
|
|
224
|
+
* Total, like {@link hzToMel}. A non-positive `hz` returns `-Infinity`, the log2
|
|
225
|
+
* limit, and {@link midiToHz} maps that back to 0. A NaN propagates, which is
|
|
226
|
+
* what makes a default `pitchPyin` track — whose unvoiced frames are NaN — safe
|
|
227
|
+
* to map through.
|
|
228
|
+
*
|
|
229
|
+
* @param hz - Frequency in Hz
|
|
230
|
+
* @returns MIDI note number (A4 = 440 Hz = 69)
|
|
231
|
+
*/
|
|
232
|
+
export declare function hzToMidi(hz: number): number;
|
|
233
|
+
/**
|
|
234
|
+
* Convert MIDI note number to frequency in Hz. Total, like {@link hzToMel};
|
|
235
|
+
* `-Infinity` bottoms out at 0 rather than propagating its sign.
|
|
236
|
+
*
|
|
237
|
+
* @param midi - MIDI note number
|
|
238
|
+
* @returns Frequency in Hz
|
|
239
|
+
*/
|
|
240
|
+
export declare function midiToHz(midi: number): number;
|
|
241
|
+
/**
|
|
242
|
+
* Convert frequency in Hz to note name.
|
|
243
|
+
*
|
|
244
|
+
* Every frequency with no note answers `"?"` rather than throwing: zero,
|
|
245
|
+
* negative, past the representable MIDI range, and non-finite alike. A default
|
|
246
|
+
* `pitchPyin` track fills unvoiced frames with NaN, so mapping one through this
|
|
247
|
+
* yields `"?"` at those frames.
|
|
248
|
+
*
|
|
249
|
+
* @param hz - Frequency in Hz
|
|
250
|
+
* @returns Note name (e.g., "A4", "C#5")
|
|
251
|
+
*/
|
|
252
|
+
export declare function hzToNote(hz: number): string;
|
|
253
|
+
/**
|
|
254
|
+
* Convert note name to frequency in Hz.
|
|
255
|
+
*
|
|
256
|
+
* @param note - Note name (e.g., "A4", "C#5")
|
|
257
|
+
* @returns Frequency in Hz
|
|
258
|
+
*/
|
|
259
|
+
export declare function noteToHz(note: string): number;
|
|
260
|
+
/**
|
|
261
|
+
* Convert frame index to time in seconds.
|
|
262
|
+
*
|
|
263
|
+
* @param frames - Frame index
|
|
264
|
+
* @param sr - Sample rate in Hz (default: 22050)
|
|
265
|
+
* @param hopLength - Hop length in samples (default: 512)
|
|
266
|
+
* @returns Time in seconds
|
|
267
|
+
*/
|
|
268
|
+
export declare function framesToTime(frames: number, sr?: number, hopLength?: number): number;
|
|
269
|
+
/**
|
|
270
|
+
* Convert time in seconds to frame index.
|
|
271
|
+
*
|
|
272
|
+
* @param time - Time in seconds
|
|
273
|
+
* @param sr - Sample rate in Hz (default: 22050)
|
|
274
|
+
* @param hopLength - Hop length in samples (default: 512)
|
|
275
|
+
* @returns Frame index
|
|
276
|
+
*/
|
|
277
|
+
export declare function timeToFrames(time: number, sr?: number, hopLength?: number): number;
|
|
278
|
+
export declare function framesToSamples(frames: number, hopLength?: number, nFft?: number): number;
|
|
279
|
+
export declare function samplesToFrames(samples: number, hopLength?: number, nFft?: number): number;
|
|
280
|
+
export declare function powerToDb(request: DbConversionRequest): Float32Array;
|
|
281
|
+
export declare function powerToDb(values: Float32Array, ref?: number, amin?: number, topDb?: number): Float32Array;
|
|
282
|
+
export declare function amplitudeToDb(request: DbConversionRequest): Float32Array;
|
|
283
|
+
export declare function amplitudeToDb(values: Float32Array, ref?: number, amin?: number, topDb?: number): Float32Array;
|
|
284
|
+
export declare function dbToPower(values: Float32Array, ref?: number): Float32Array;
|
|
285
|
+
export declare function dbToAmplitude(values: Float32Array, ref?: number): Float32Array;
|
|
286
|
+
export declare function preemphasis(request: EmphasisRequest): Float32Array;
|
|
287
|
+
export declare function preemphasis(samples: Float32Array, coef?: number, zi?: number): Float32Array;
|
|
288
|
+
export declare function deemphasis(request: EmphasisRequest): Float32Array;
|
|
289
|
+
export declare function deemphasis(samples: Float32Array, coef?: number, zi?: number): Float32Array;
|
|
290
|
+
export declare function trimSilence(request: SilenceRequest): WasmTrimResult;
|
|
291
|
+
export declare function trimSilence(samples: Float32Array, topDb?: number, frameLength?: number, hopLength?: number): WasmTrimResult;
|
|
292
|
+
export declare function splitSilence(request: SilenceRequest): Int32Array;
|
|
293
|
+
export declare function splitSilence(samples: Float32Array, topDb?: number, frameLength?: number, hopLength?: number): Int32Array;
|
|
294
|
+
/**
|
|
295
|
+
* Lists the intervals where ANY of `signals` is sounding, so every gap
|
|
296
|
+
* between them is silent in all of them -- what several takes of one part
|
|
297
|
+
* share is their silence, not their sound.
|
|
298
|
+
*
|
|
299
|
+
* @returns The union of {@link splitSilence}'s per-signal intervals, merged
|
|
300
|
+
* where they touch. A single signal returns exactly what `splitSilence`
|
|
301
|
+
* does for it.
|
|
302
|
+
*/
|
|
303
|
+
export declare function splitSilenceCommon(request: SplitSilenceCommonRequest): Int32Array;
|
|
304
|
+
/**
|
|
305
|
+
* {@link splitSilenceCommon} plus the report that says why those are the
|
|
306
|
+
* intervals.
|
|
307
|
+
*
|
|
308
|
+
* Identical intervals, identical refusals, identical defaults; the only
|
|
309
|
+
* difference is the second field. The plain entry point stays because a caller
|
|
310
|
+
* cutting takes has no use for the diagnosis, and one interval covering
|
|
311
|
+
* everything is the answer to three different situations the interval list cannot
|
|
312
|
+
* separate — see {@link SilenceCommonReport} for reading them apart.
|
|
313
|
+
*
|
|
314
|
+
* @returns The union intervals and the report measured on the same RMS pass
|
|
315
|
+
*/
|
|
316
|
+
export declare function splitSilenceCommonWithReport(request: SplitSilenceCommonRequest): SplitSilenceCommonWithReportResult;
|
|
317
|
+
export declare function frameSignal(request: FrameSignalRequest): WasmFrameResult;
|
|
318
|
+
export declare function frameSignal(samples: Float32Array, frameLength: number, hopLength: number): WasmFrameResult;
|
|
319
|
+
export declare function padCenter(request: PadCenterRequest): Float32Array;
|
|
320
|
+
export declare function padCenter(values: Float32Array, targetSize: number, padValue?: number): Float32Array;
|
|
321
|
+
export declare function fixLength(request: FixLengthRequest): Float32Array;
|
|
322
|
+
export declare function fixLength(values: Float32Array, targetSize: number, padValue?: number): Float32Array;
|
|
323
|
+
export declare function fixFrames(request: FixFramesRequest): Int32Array;
|
|
324
|
+
export declare function fixFrames(frames: Int32Array, xMin?: number, xMax?: number, pad?: boolean): Int32Array;
|
|
325
|
+
export declare function onsetBacktrack(request: OnsetBacktrackRequest): Int32Array;
|
|
326
|
+
export declare function onsetBacktrack(events: Int32Array, energy: Float32Array): Int32Array;
|
|
327
|
+
export declare function peakPick(request: PeakPickRequest): Int32Array;
|
|
328
|
+
export declare function peakPick(values: Float32Array, preMax: number, postMax: number, preAvg: number, postAvg: number, delta: number, wait: number): Int32Array;
|
|
329
|
+
export declare function vectorNormalize(request: VectorNormalizeRequest): Float32Array;
|
|
330
|
+
export declare function vectorNormalize(values: Float32Array, normType?: number, threshold?: number): Float32Array;
|
|
331
|
+
export declare function pcen(request: PcenRequest): Float32Array;
|
|
332
|
+
export declare function pcen(values: Float32Array, nBins: number, nFrames: number, options?: Record<string, number>): Float32Array;
|
|
333
|
+
export declare function tonnetz(request: TonnetzRequest): Float32Array;
|
|
334
|
+
export declare function tonnetz(chromagram: Float32Array, nChroma: number, nFrames: number): Float32Array;
|
|
335
|
+
export declare function tempogram(request: TempogramRequest): WasmTempogramResult;
|
|
336
|
+
export declare function tempogram(onsetEnvelope: Float32Array, sampleRate?: number, hopLength?: number, winLength?: number, mode?: TempogramMode, center?: boolean, norm?: boolean): WasmTempogramResult;
|
|
337
|
+
export declare function cyclicTempogram(request: CyclicTempogramRequest): WasmCyclicTempogramResult;
|
|
338
|
+
export declare function cyclicTempogram(onsetEnvelope: Float32Array, sampleRate?: number, hopLength?: number, winLength?: number, bpmMin?: number, nBins?: number): WasmCyclicTempogramResult;
|
|
339
|
+
export declare function plp(request: PlpRequest): Float32Array;
|
|
340
|
+
export declare function plp(onsetEnvelope: Float32Array, sampleRate?: number, hopLength?: number, tempoMin?: number, tempoMax?: number, winLength?: number): Float32Array;
|
|
341
|
+
//# sourceMappingURL=feature_core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature_core.d.ts","sourceRoot":"","sources":["../src/feature_core.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EACV,yBAAyB,EACzB,eAAe,EACf,mBAAmB,EACnB,cAAc,EACf,MAAM,aAAa,CAAC;AAMrB,wBAAgB,IAAI,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,YAAY,CAAC;AAC1D,wBAAgB,IAAI,CAClB,SAAS,CAAC,EAAE,MAAM,EAClB,UAAU,CAAC,EAAE,MAAM,EACnB,QAAQ,CAAC,EAAE,MAAM,EACjB,KAAK,CAAC,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,MAAM,GACjB,YAAY,CAAC;AAqBhB,wBAAgB,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,YAAY,CAAC;AAC5D,wBAA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C;AAwBhB,wBAAgB,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,YAAY,CAAC;AAC/D,wBAAgB,OAAO,CAAC,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,YAAY,CAAC;AAYlG,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,mBAAmB,CAAC;AAC1E,wBAAgB,SAAS,CACvB,aAAa,EAAE,YAAY,EAC3B,UAAU,CAAC,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE,aAAa,EACpB,MAAM,CAAC,EAAE,OAAO,EAChB,IAAI,CAAC,EAAE,OAAO,GACb,mBAAmB,CAAC;AAiCvB,wBAAgB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,yBAAyB,CAAC;AAC5F,wBAAgB,eAAe,CAC7B,aAAa,EAAE,YAAY,EAC3B,UAAU,CAAC,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,MAAM,GACb,yBAAyB,CAAC;AA8B7B,wBAAgB,GAAG,CAAC,OAAO,EAAE,UAAU,GAAG,YAAY,CAAC;AACvD,wBAAgB,GAAG,CACjB,aAAa,EAAE,YAAY,EAC3B,UAAU,CAAC,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,MAAM,GACjB,YAAY,CAAC"}
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Source decomposition and self-similarity segmentation: NMF factorisation and
|
|
3
|
+
* the masks built over it, and the recurrence structure of a track.
|
|
4
|
+
*/
|
|
5
|
+
import type { SegmentMatrix } from './public_types';
|
|
6
|
+
import type { WasmDecomposeResult, WasmHpssWithResidualResult, WasmMatrix2dResult } from './sonare.js';
|
|
7
|
+
export interface DecomposeRequest {
|
|
8
|
+
s: Float32Array;
|
|
9
|
+
nFeatures: number;
|
|
10
|
+
nFrames: number;
|
|
11
|
+
nComponents: number;
|
|
12
|
+
nIter?: number;
|
|
13
|
+
beta?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface DecomposeWithInitRequest extends DecomposeRequest {
|
|
16
|
+
init?: 'random' | 'nndsvd';
|
|
17
|
+
}
|
|
18
|
+
export interface NnFilterRequest {
|
|
19
|
+
s: Float32Array;
|
|
20
|
+
nFeatures: number;
|
|
21
|
+
nFrames: number;
|
|
22
|
+
aggregate?: string;
|
|
23
|
+
k?: number;
|
|
24
|
+
width?: number;
|
|
25
|
+
}
|
|
26
|
+
export interface SegmentCrossSimilarityRequest {
|
|
27
|
+
x: Float32Array;
|
|
28
|
+
xRows: number;
|
|
29
|
+
xCols: number;
|
|
30
|
+
y: Float32Array;
|
|
31
|
+
yRows: number;
|
|
32
|
+
yCols: number;
|
|
33
|
+
k?: number;
|
|
34
|
+
metric?: 'cosine' | 'euclidean';
|
|
35
|
+
mode?: 'connectivity' | 'affinity';
|
|
36
|
+
}
|
|
37
|
+
export interface SegmentRecurrenceMatrixRequest {
|
|
38
|
+
data: Float32Array;
|
|
39
|
+
rows: number;
|
|
40
|
+
cols: number;
|
|
41
|
+
k?: number;
|
|
42
|
+
width?: number;
|
|
43
|
+
sym?: boolean;
|
|
44
|
+
metric?: 'cosine' | 'euclidean';
|
|
45
|
+
mode?: 'connectivity' | 'affinity';
|
|
46
|
+
}
|
|
47
|
+
export interface SegmentRecurrenceToLagRequest {
|
|
48
|
+
recurrence: Float32Array;
|
|
49
|
+
n: number;
|
|
50
|
+
pad?: boolean;
|
|
51
|
+
}
|
|
52
|
+
export interface SegmentLagToRecurrenceRequest {
|
|
53
|
+
lag: Float32Array;
|
|
54
|
+
rows: number;
|
|
55
|
+
lags: number;
|
|
56
|
+
}
|
|
57
|
+
export interface SegmentSubsegmentRequest {
|
|
58
|
+
data: Float32Array;
|
|
59
|
+
rows: number;
|
|
60
|
+
cols: number;
|
|
61
|
+
boundaries: Int32Array;
|
|
62
|
+
nSegments?: number;
|
|
63
|
+
}
|
|
64
|
+
export interface SegmentAgglomerativeRequest {
|
|
65
|
+
data: Float32Array;
|
|
66
|
+
rows: number;
|
|
67
|
+
cols: number;
|
|
68
|
+
k: number;
|
|
69
|
+
linkage?: 'average' | 'single' | 'complete' | 'ward';
|
|
70
|
+
}
|
|
71
|
+
export interface SegmentPathEnhanceRequest {
|
|
72
|
+
recurrence: Float32Array;
|
|
73
|
+
n: number;
|
|
74
|
+
win: number;
|
|
75
|
+
maxRatio?: number;
|
|
76
|
+
minRatio?: number;
|
|
77
|
+
nFilters?: number;
|
|
78
|
+
}
|
|
79
|
+
export interface RemixRequest {
|
|
80
|
+
samples: Float32Array;
|
|
81
|
+
intervals: Int32Array | ArrayLike<number>;
|
|
82
|
+
sampleRate?: number;
|
|
83
|
+
alignZeros?: boolean;
|
|
84
|
+
}
|
|
85
|
+
export interface HpssWithResidualRequest {
|
|
86
|
+
samples: Float32Array;
|
|
87
|
+
sampleRate?: number;
|
|
88
|
+
/**
|
|
89
|
+
* Horizontal median filter size, in STFT frames: a positive odd integer at
|
|
90
|
+
* most 524287. Default 31. The ceiling is 524288 and an even kernel is
|
|
91
|
+
* refused, so 524287 is the largest legal value.
|
|
92
|
+
*/
|
|
93
|
+
kernelHarmonic?: number;
|
|
94
|
+
/** Vertical median filter size, in STFT bins, under the same rule. Default 31. */
|
|
95
|
+
kernelPercussive?: number;
|
|
96
|
+
nFft?: number;
|
|
97
|
+
hopLength?: number;
|
|
98
|
+
hardMask?: boolean;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Non-negative matrix factorisation of a flattened [nFeatures x nFrames]
|
|
102
|
+
* spectrogram (librosa.decompose.decompose). Returns the W and H factors.
|
|
103
|
+
*/
|
|
104
|
+
export declare function decompose(request: DecomposeRequest): WasmDecomposeResult;
|
|
105
|
+
export declare function decompose(s: Float32Array, nFeatures: number, nFrames: number, nComponents: number, nIter?: number, beta?: number): WasmDecomposeResult;
|
|
106
|
+
/**
|
|
107
|
+
* Non-negative matrix factorisation with a selectable initialiser
|
|
108
|
+
* (librosa.decompose.decompose, `init`). Identical to {@link decompose} but
|
|
109
|
+
* exposes the initialisation strategy: `'random'` (default, deterministic seed)
|
|
110
|
+
* or `'nndsvd'` (SVD-based warm start, which tends to converge in fewer
|
|
111
|
+
* iterations). Returns the W and H factors.
|
|
112
|
+
*/
|
|
113
|
+
export declare function decomposeWithInit(request: DecomposeWithInitRequest): WasmDecomposeResult;
|
|
114
|
+
export declare function decomposeWithInit(s: Float32Array, nFeatures: number, nFrames: number, nComponents: number, nIter?: number, beta?: number, init?: 'random' | 'nndsvd'): WasmDecomposeResult;
|
|
115
|
+
/** Options for {@link decomposeStems}. */
|
|
116
|
+
export interface DecomposeStemsRequest {
|
|
117
|
+
samples: Float32Array;
|
|
118
|
+
sampleRate: number;
|
|
119
|
+
/** Number of NMF components (default 4). */
|
|
120
|
+
nComponents?: number;
|
|
121
|
+
/** STFT size (default 2048). */
|
|
122
|
+
nFft?: number;
|
|
123
|
+
/** STFT hop (default 512). */
|
|
124
|
+
hopLength?: number;
|
|
125
|
+
/** NMF multiplicative-update iterations (default 100). */
|
|
126
|
+
nIter?: number;
|
|
127
|
+
/** Beta divergence: 2 = Frobenius (default), 1 = Kullback-Leibler. */
|
|
128
|
+
beta?: number;
|
|
129
|
+
/** NMF initialisation (default `'random'`). */
|
|
130
|
+
init?: 'random' | 'nndsvd';
|
|
131
|
+
/**
|
|
132
|
+
* Soft-mask exponent (default 1). 1 keeps the magnitude ratio; 2 is the
|
|
133
|
+
* Wiener-style power ratio, which separates harder at the cost of more
|
|
134
|
+
* artefacts on overlapping partials. Must be >= 1.
|
|
135
|
+
*/
|
|
136
|
+
maskPower?: number;
|
|
137
|
+
}
|
|
138
|
+
/** One time-domain signal per NMF component, plus the factorisation. */
|
|
139
|
+
export interface DecomposeStemsResult {
|
|
140
|
+
/** Component signals, each the length of the input. */
|
|
141
|
+
components: Float32Array[];
|
|
142
|
+
/** Component matrix [nBins x nComponents], row-major. */
|
|
143
|
+
w: Float32Array;
|
|
144
|
+
/** Activation matrix [nComponents x nFrames], row-major. */
|
|
145
|
+
h: Float32Array;
|
|
146
|
+
sampleRate: number;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* NMF separation that **carries the original phase**, so each component is
|
|
150
|
+
* directly listenable.
|
|
151
|
+
*
|
|
152
|
+
* {@link decompose} returns the W/H factors of a magnitude spectrogram, which
|
|
153
|
+
* have no phase; reconstructing from them needs a phase estimator
|
|
154
|
+
* ({@link griffinLim}), and an estimated phase does not hold up as a stem. This
|
|
155
|
+
* instead builds a per-component soft mask from the factorisation and applies
|
|
156
|
+
* it to the original complex spectrogram. The masks sum to one wherever the
|
|
157
|
+
* model has energy and the inverse STFT is linear, so the components sum back
|
|
158
|
+
* to the input.
|
|
159
|
+
*/
|
|
160
|
+
export declare function decomposeStems(request: DecomposeStemsRequest): DecomposeStemsResult;
|
|
161
|
+
/** Request form of {@link decomposeStemsLinked}. */
|
|
162
|
+
export interface DecomposeStemsLinkedRequest {
|
|
163
|
+
/** At least one channel; all the same length. */
|
|
164
|
+
channels: Float32Array[];
|
|
165
|
+
sampleRate?: number;
|
|
166
|
+
/** Number of NMF components (default 4). */
|
|
167
|
+
nComponents?: number;
|
|
168
|
+
/** STFT size (default 2048). */
|
|
169
|
+
nFft?: number;
|
|
170
|
+
/** STFT hop (default 512). */
|
|
171
|
+
hopLength?: number;
|
|
172
|
+
/** NMF multiplicative-update iterations (default 100). */
|
|
173
|
+
nIter?: number;
|
|
174
|
+
/** Beta divergence: 2 = Frobenius (default), 1 = Kullback-Leibler. */
|
|
175
|
+
beta?: number;
|
|
176
|
+
/** NMF initialisation (default `'random'`). */
|
|
177
|
+
init?: 'random' | 'nndsvd';
|
|
178
|
+
/** Soft-mask exponent (default 1); see {@link DecomposeStemsRequest.maskPower}. */
|
|
179
|
+
maskPower?: number;
|
|
180
|
+
}
|
|
181
|
+
/** One time-domain signal per (component, channel), plus the factorisation. */
|
|
182
|
+
export interface DecomposeStemsLinkedResult {
|
|
183
|
+
/**
|
|
184
|
+
* Component signals: `components[k][c]` is component `k`'s signal on
|
|
185
|
+
* channel `c`, each the length of the input.
|
|
186
|
+
*/
|
|
187
|
+
components: Float32Array[][];
|
|
188
|
+
/** Component matrix [nBins x nComponents], row-major. */
|
|
189
|
+
w: Float32Array;
|
|
190
|
+
/** Activation matrix [nComponents x nFrames], row-major. */
|
|
191
|
+
h: Float32Array;
|
|
192
|
+
sampleRate: number;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Multi-channel form of {@link decomposeStems}: one NMF model and one soft
|
|
196
|
+
* mask shared across every channel, built from the channels' averaged
|
|
197
|
+
* magnitude spectrogram and applied UNCHANGED to each channel's own complex
|
|
198
|
+
* spectrum, so no interchannel level or phase difference moves. A single
|
|
199
|
+
* channel reproduces {@link decomposeStems} bit for bit.
|
|
200
|
+
*
|
|
201
|
+
* @throws On a null/empty channel set, mismatched channel lengths, a channel
|
|
202
|
+
* count above the core's ceiling, or an invalid option.
|
|
203
|
+
*/
|
|
204
|
+
export declare function decomposeStemsLinked(request: DecomposeStemsLinkedRequest): DecomposeStemsLinkedResult;
|
|
205
|
+
/**
|
|
206
|
+
* Nearest-neighbour filtering of a flattened [nFeatures x nFrames] spectrogram
|
|
207
|
+
* (librosa.decompose.nn_filter).
|
|
208
|
+
*/
|
|
209
|
+
export declare function nnFilter(request: NnFilterRequest): WasmMatrix2dResult;
|
|
210
|
+
export declare function nnFilter(s: Float32Array, nFeatures: number, nFrames: number, aggregate?: string, k?: number, width?: number): WasmMatrix2dResult;
|
|
211
|
+
/**
|
|
212
|
+
* Reorder/concatenate a signal by interval slices (librosa.effects.remix).
|
|
213
|
+
*
|
|
214
|
+
* With `alignZeros` the boundaries snap to the signal's zero-crossings. That is
|
|
215
|
+
* a per-signal decision, so calling this per channel snaps each channel to a
|
|
216
|
+
* different frame and drifts a stereo take apart; resolve one cut set with
|
|
217
|
+
* {@link remixAlignedIntervals} and apply it to every channel instead.
|
|
218
|
+
*
|
|
219
|
+
* @param intervals - Flat (start, end) sample pairs (even length).
|
|
220
|
+
*/
|
|
221
|
+
export declare function remix(request: RemixRequest): Float32Array;
|
|
222
|
+
export declare function remix(samples: Float32Array, intervals: Int32Array | ArrayLike<number>, sampleRate?: number, alignZeros?: boolean): Float32Array;
|
|
223
|
+
/**
|
|
224
|
+
* Resolve the cut points {@link remix} would use, without cutting.
|
|
225
|
+
*
|
|
226
|
+
* Returns a flat `Int32Array` of one clamped `(start, end)` pair per input
|
|
227
|
+
* interval. With `alignZeros` each boundary snaps to the nearest zero-crossing,
|
|
228
|
+
* with two guards that stop a slice from vanishing: a signal with no sign
|
|
229
|
+
* change at all (silence, a DC offset, any constant) is not snapped, and a
|
|
230
|
+
* slice that had content but collapses to empty after snapping keeps its
|
|
231
|
+
* unsnapped boundaries.
|
|
232
|
+
*
|
|
233
|
+
* Use this to cut a multichannel take on one common frame set: resolve once
|
|
234
|
+
* from one channel, then slice every channel with the returned pairs.
|
|
235
|
+
*
|
|
236
|
+
* @param intervals - Flat (start, end) sample pairs (even length).
|
|
237
|
+
*/
|
|
238
|
+
export declare function remixAlignedIntervals(request: RemixRequest): Int32Array;
|
|
239
|
+
export declare function remixAlignedIntervals(samples: Float32Array, intervals: Int32Array | ArrayLike<number>, sampleRate?: number, alignZeros?: boolean): Int32Array;
|
|
240
|
+
/**
|
|
241
|
+
* HPSS into harmonic / percussive / residual signals.
|
|
242
|
+
*
|
|
243
|
+
* The three outputs always add back up to the input. `residual` is silent under
|
|
244
|
+
* the default soft mask, whose two masks sum to one, so `harmonic` and
|
|
245
|
+
* `percussive` already carry everything; it is returned anyway so the result
|
|
246
|
+
* shape does not change with the mask. Pass `hardMask: true` for a residual that
|
|
247
|
+
* holds signal — its thresholded masks leave the band where neither component
|
|
248
|
+
* dominates, measured at 3 % of the input energy on a voice-plus-kick signal.
|
|
249
|
+
*
|
|
250
|
+
* @example
|
|
251
|
+
* ```ts
|
|
252
|
+
* const soft = hpssWithResidual({ samples, sampleRate });
|
|
253
|
+
* // soft.residual is silence
|
|
254
|
+
* const hard = hpssWithResidual({ samples, sampleRate, hardMask: true });
|
|
255
|
+
* // hard.residual carries what neither component claimed
|
|
256
|
+
* ```
|
|
257
|
+
*
|
|
258
|
+
* @throws SonareError (`InvalidParameter`) on a kernel that is not an integer
|
|
259
|
+
* within the signed 32-bit range, or one the core rejects as even,
|
|
260
|
+
* non-positive or above its ceiling
|
|
261
|
+
*/
|
|
262
|
+
export declare function hpssWithResidual(request: HpssWithResidualRequest): WasmHpssWithResidualResult;
|
|
263
|
+
export declare function hpssWithResidual(samples: Float32Array, sampleRate?: number, kernelHarmonic?: number, kernelPercussive?: number, nFft?: number, hopLength?: number, hardMask?: boolean): WasmHpssWithResidualResult;
|
|
264
|
+
/** Column-wise cross-similarity (librosa.segment.cross_similarity). */
|
|
265
|
+
export declare function segmentCrossSimilarity(request: SegmentCrossSimilarityRequest): SegmentMatrix;
|
|
266
|
+
/** Self-similarity recurrence matrix (librosa.segment.recurrence_matrix). */
|
|
267
|
+
export declare function segmentRecurrenceMatrix(request: SegmentRecurrenceMatrixRequest): SegmentMatrix;
|
|
268
|
+
/** Convert an `n × n` recurrence matrix to a lag matrix. */
|
|
269
|
+
export declare function segmentRecurrenceToLag(request: SegmentRecurrenceToLagRequest): SegmentMatrix;
|
|
270
|
+
/** Convert a lag matrix back to an `n × n` recurrence matrix. */
|
|
271
|
+
export declare function segmentLagToRecurrence(request: SegmentLagToRecurrenceRequest): SegmentMatrix;
|
|
272
|
+
/** Refine frame boundaries by clustering within each parent segment. */
|
|
273
|
+
export declare function segmentSubsegment(request: SegmentSubsegmentRequest): Int32Array;
|
|
274
|
+
/** Cluster feature columns and return one label per column. */
|
|
275
|
+
export declare function segmentAgglomerative(request: SegmentAgglomerativeRequest): Int32Array;
|
|
276
|
+
/** Enhance diagonal paths in an `n × n` recurrence matrix. */
|
|
277
|
+
export declare function segmentPathEnhance(request: SegmentPathEnhanceRequest): SegmentMatrix;
|
|
278
|
+
//# sourceMappingURL=feature_decompose.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature_decompose.d.ts","sourceRoot":"","sources":["../src/feature_decompose.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EACV,mBAAmB,EACnB,0BAA0B,EAC1B,kBAAkB,EACnB,MAAM,aAAa,CAAC;AAuBrB,MAAM,WAAW,gBAAgB;IAC/B,CAAC,EAAE,YAAY,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,wBAAyB,SAAQ,gBAAgB;IAChE,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC5B;AAED,MAAM,WAAW,eAAe;IAC9B,CAAC,EAAE,YAAY,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,6BAA6B;IAC5C,CAAC,EAAE,YAAY,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,EAAE,YAAY,CAAC;IAChB,KAAK,EAAE,MAAM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