@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,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inverse transforms: reconstructing a linear spectrogram or audio from a mel
|
|
3
|
+
* or MFCC representation, and the phase reconstruction they share.
|
|
4
|
+
*/
|
|
5
|
+
import type { GuardedOptions } from './_feature_validation';
|
|
6
|
+
import type { SpectralFrameRequest } from './feature_spectral';
|
|
7
|
+
import type { MelPowerResult, StftPowerResult } from './public_types';
|
|
8
|
+
export interface MfccToMelRequest extends GuardedOptions {
|
|
9
|
+
mfccCoefficients: Float32Array;
|
|
10
|
+
nMfcc: number;
|
|
11
|
+
nFrames: number;
|
|
12
|
+
nMels?: number;
|
|
13
|
+
/** Lifter used by the forward MFCC transform; zero means no liftering. */
|
|
14
|
+
lifter?: number;
|
|
15
|
+
}
|
|
16
|
+
/** Canonical request form for reconstruction from a Mel power spectrogram. */
|
|
17
|
+
export interface MelToStftRequest extends GuardedOptions {
|
|
18
|
+
melPower: Float32Array;
|
|
19
|
+
nMels: number;
|
|
20
|
+
nFrames: number;
|
|
21
|
+
sampleRate?: number;
|
|
22
|
+
nFft?: number;
|
|
23
|
+
fmin?: number;
|
|
24
|
+
fmax?: number;
|
|
25
|
+
htk?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** Canonical request form for Griffin-Lim reconstruction from Mel power. */
|
|
28
|
+
export interface MelToAudioRequest extends MelToStftRequest {
|
|
29
|
+
hopLength?: number;
|
|
30
|
+
nIter?: number;
|
|
31
|
+
}
|
|
32
|
+
export interface GriffinLimRequest extends GuardedOptions {
|
|
33
|
+
magnitude: Float32Array;
|
|
34
|
+
nBins: number;
|
|
35
|
+
nFrames: number;
|
|
36
|
+
sampleRate?: number;
|
|
37
|
+
nFft?: number;
|
|
38
|
+
hopLength?: number;
|
|
39
|
+
nIter?: number;
|
|
40
|
+
momentum?: number;
|
|
41
|
+
}
|
|
42
|
+
/** Canonical request form for Griffin-Lim reconstruction from MFCCs. */
|
|
43
|
+
export interface MfccToAudioRequest extends MfccToMelRequest {
|
|
44
|
+
sampleRate?: number;
|
|
45
|
+
nFft?: number;
|
|
46
|
+
hopLength?: number;
|
|
47
|
+
fmin?: number;
|
|
48
|
+
fmax?: number;
|
|
49
|
+
nIter?: number;
|
|
50
|
+
htk?: boolean;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Approximate inverse of a Mel filterbank: Mel power spectrogram -> STFT power
|
|
54
|
+
* spectrogram. Mirrors `feature::mel_to_stft`.
|
|
55
|
+
*
|
|
56
|
+
* @param melPower - Mel power spectrogram [nMels x nFrames] row-major
|
|
57
|
+
* @param nMels - Number of Mel bands
|
|
58
|
+
* @param nFrames - Number of time frames
|
|
59
|
+
* @param sampleRate - Sample rate in Hz
|
|
60
|
+
* @param nFft - FFT size (default: 2048)
|
|
61
|
+
* @param fmin - Lower Mel band edge in Hz (default: 0)
|
|
62
|
+
* @param fmax - Upper Mel band edge in Hz (default: sr/2 when 0)
|
|
63
|
+
* @param htk - Use the HTK Mel formula instead of Slaney (default: false)
|
|
64
|
+
* @returns STFT power spectrogram result
|
|
65
|
+
*/
|
|
66
|
+
export declare function melToStft(request: MelToStftRequest): StftPowerResult;
|
|
67
|
+
export declare function melToStft(melPower: Float32Array, nMels: number, nFrames: number, sampleRate?: number, nFft?: number, fmin?: number, fmax?: number, htk?: boolean, options?: GuardedOptions): StftPowerResult;
|
|
68
|
+
/**
|
|
69
|
+
* Reconstruct audio from a Mel power spectrogram via Griffin-Lim. Mirrors
|
|
70
|
+
* `feature::mel_to_audio`.
|
|
71
|
+
*
|
|
72
|
+
* @param melPower - Mel power spectrogram [nMels x nFrames] row-major
|
|
73
|
+
* @param nMels - Number of Mel bands
|
|
74
|
+
* @param nFrames - Number of time frames
|
|
75
|
+
* @param sampleRate - Sample rate in Hz
|
|
76
|
+
* @param nFft - FFT size (default: 2048)
|
|
77
|
+
* @param hopLength - Hop length (default: 512)
|
|
78
|
+
* @param fmin - Minimum Mel frequency in Hz (default: 0)
|
|
79
|
+
* @param fmax - Maximum Mel frequency in Hz (default: 0 = sr/2)
|
|
80
|
+
* @param nIter - Griffin-Lim iterations (default: 32)
|
|
81
|
+
* @param htk - Use the HTK Mel formula instead of Slaney (default: false)
|
|
82
|
+
* @returns Reconstructed audio samples (mono, float32)
|
|
83
|
+
*/
|
|
84
|
+
export declare function melToAudio(request: MelToAudioRequest): Float32Array;
|
|
85
|
+
export declare function melToAudio(melPower: Float32Array, nMels: number, nFrames: number, sampleRate?: number, nFft?: number, hopLength?: number, fmin?: number, fmax?: number, nIter?: number, htk?: boolean, options?: GuardedOptions): Float32Array;
|
|
86
|
+
/** Reconstruct audio from an STFT magnitude matrix via Griffin-Lim. */
|
|
87
|
+
export declare function griffinLim(request: GriffinLimRequest): Float32Array;
|
|
88
|
+
export declare function griffinLim(magnitude: Float32Array, nBins: number, nFrames: number, sampleRate?: number, nFft?: number, hopLength?: number, nIter?: number, momentum?: number, options?: GuardedOptions): Float32Array;
|
|
89
|
+
/**
|
|
90
|
+
* Invert MFCC coefficients back to a Mel power spectrogram. Mirrors
|
|
91
|
+
* `feature::mfcc_to_mel`.
|
|
92
|
+
*
|
|
93
|
+
* @param mfccCoefficients - MFCC matrix [nMfcc x nFrames] row-major
|
|
94
|
+
* @param nMfcc - Number of MFCC coefficients
|
|
95
|
+
* @param nFrames - Number of time frames
|
|
96
|
+
* @param nMels - Number of Mel bins to reconstruct (default: 128)
|
|
97
|
+
* @returns Mel power spectrogram result
|
|
98
|
+
*/
|
|
99
|
+
export declare function mfccToMel(request: MfccToMelRequest): MelPowerResult;
|
|
100
|
+
export declare function mfccToMel(mfccCoefficients: Float32Array, nMfcc: number, nFrames: number, nMels?: number, lifter?: number, options?: GuardedOptions): MelPowerResult;
|
|
101
|
+
/**
|
|
102
|
+
* Reconstruct audio directly from MFCC coefficients via Griffin-Lim. Mirrors
|
|
103
|
+
* `feature::mfcc_to_audio`.
|
|
104
|
+
*
|
|
105
|
+
* @param mfccCoefficients - MFCC matrix [nMfcc x nFrames] row-major
|
|
106
|
+
* @param nMfcc - Number of MFCC coefficients
|
|
107
|
+
* @param nFrames - Number of time frames
|
|
108
|
+
* @param nMels - Number of Mel bins (default: 128)
|
|
109
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
110
|
+
* @param nFft - FFT size (default: 2048)
|
|
111
|
+
* @param hopLength - Hop length (default: 512)
|
|
112
|
+
* @param fmin - Minimum Mel frequency in Hz (default: 0)
|
|
113
|
+
* @param fmax - Maximum Mel frequency in Hz (default: 0 = sr/2)
|
|
114
|
+
* @param nIter - Griffin-Lim iterations (default: 32)
|
|
115
|
+
* @param htk - Use the HTK Mel formula instead of Slaney (default: false)
|
|
116
|
+
* @returns Reconstructed audio samples (mono, float32)
|
|
117
|
+
*/
|
|
118
|
+
export declare function mfccToAudio(request: MfccToAudioRequest): Float32Array;
|
|
119
|
+
export declare function mfccToAudio(mfccCoefficients: Float32Array, nMfcc: number, nFrames: number, nMels?: number, sampleRate?: number, nFft?: number, hopLength?: number, fmin?: number, fmax?: number, nIter?: number, htk?: boolean, lifter?: number, options?: GuardedOptions): Float32Array;
|
|
120
|
+
export interface PhaseVocoderRequest extends SpectralFrameRequest {
|
|
121
|
+
rate: number;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Phase-vocoder time-scale modification (rate > 1 faster, < 1 slower).
|
|
125
|
+
*/
|
|
126
|
+
export declare function phaseVocoder(request: PhaseVocoderRequest): Float32Array;
|
|
127
|
+
export declare function phaseVocoder(samples: Float32Array, sampleRate: number, rate: number, nFft?: number, hopLength?: number): Float32Array;
|
|
128
|
+
//# sourceMappingURL=feature_inverse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature_inverse.d.ts","sourceRoot":"","sources":["../src/feature_inverse.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAOtE,MAAM,WAAW,gBAAiB,SAAQ,cAAc;IACtD,gBAAgB,EAAE,YAAY,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;A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,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,cAAc,GACvB,cAAc,CAAC;AAiClB;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,YAAY,CAAC;AACvE,wBAAgB,WAAW,CACzB,gBAAgB,EAAE,YAAY,EAC9B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,MAAM,EACb,SAAS,CAAC,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE,MAAM,EACb,IAAI,CAAC,EAAE,MAAM,EACb,KAAK,CAAC,EAAE,MAAM,EACd,GAAG,CAAC,EAAE,OAAO,EACb,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,cAAc,GACvB,YAAY,CAAC;AA+DhB,MAAM,WAAW,mBAAoB,SAAQ,oBAAoB;IAC/D,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,YAAY,CAAC;AACzE,wBAAgB,YAAY,CAC1B,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,MAAM,EACb,SAAS,CAAC,EAAE,MAAM,GACjB,YAAY,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Programme loudness over interleaved audio, as the broadcast standards define
|
|
3
|
+
* it.
|
|
4
|
+
*/
|
|
5
|
+
import type { WasmLufsResult, WasmLufsSeriesResult } from './sonare.js';
|
|
6
|
+
import type { ValidateOptions } from './validation';
|
|
7
|
+
export interface LufsInterleavedRequest extends ValidateOptions {
|
|
8
|
+
samples: Float32Array;
|
|
9
|
+
channels: number;
|
|
10
|
+
sampleRate?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface LufsSeriesInterleavedRequest extends ValidateOptions {
|
|
13
|
+
samples: Float32Array;
|
|
14
|
+
channels: number;
|
|
15
|
+
sampleRate?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface Ebur128LoudnessRangeRequest extends ValidateOptions {
|
|
18
|
+
samples: Float32Array;
|
|
19
|
+
sampleRate?: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Channel-weighted multichannel integrated loudness + LRA (ITU-R BS.1770 /
|
|
23
|
+
* EBU R128) from an interleaved buffer of `frames * channels` samples. The
|
|
24
|
+
* per-channel frame count is derived from the buffer length and `channels`.
|
|
25
|
+
*
|
|
26
|
+
* Pass the buffer's actual `sampleRate`: the default (22050) is non-standard for
|
|
27
|
+
* audio, and K-weighting is sample-rate dependent, so a wrong rate yields wrong
|
|
28
|
+
* loudness.
|
|
29
|
+
*/
|
|
30
|
+
export declare function lufsInterleaved(request: LufsInterleavedRequest): WasmLufsResult;
|
|
31
|
+
export declare function lufsInterleaved(samples: Float32Array, channels: number, sampleRate?: number, options?: ValidateOptions): WasmLufsResult;
|
|
32
|
+
/**
|
|
33
|
+
* Per-block momentary (400 ms) and short-term (3 s) LUFS series for an
|
|
34
|
+
* interleaved buffer of `frames * channels` samples, measured with ITU-R
|
|
35
|
+
* BS.1770-4 channel summing. The per-channel frame count is derived from the
|
|
36
|
+
* buffer length and `channels`.
|
|
37
|
+
*
|
|
38
|
+
* This is not recoverable from `momentaryLufs` / `shortTermLufs`: those measure
|
|
39
|
+
* one channel each, and the standard sums the K-weighted per-channel block
|
|
40
|
+
* energies rather than mixing per-channel loudness in dB. Both series come out
|
|
41
|
+
* of one K-weighting pass. For `channels === 1` they match the mono meters
|
|
42
|
+
* element for element.
|
|
43
|
+
*
|
|
44
|
+
* Pass the buffer's actual `sampleRate`: the default (22050) is non-standard for
|
|
45
|
+
* audio, and K-weighting is sample-rate dependent, so a wrong rate yields wrong
|
|
46
|
+
* loudness.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* const { momentary, shortTerm } = lufsSeriesInterleaved({
|
|
51
|
+
* samples: interleavedStereo,
|
|
52
|
+
* channels: 2,
|
|
53
|
+
* sampleRate: 48000,
|
|
54
|
+
* });
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare function lufsSeriesInterleaved(request: LufsSeriesInterleavedRequest): WasmLufsSeriesResult;
|
|
58
|
+
export declare function lufsSeriesInterleaved(samples: Float32Array, channels: number, sampleRate?: number, options?: ValidateOptions): WasmLufsSeriesResult;
|
|
59
|
+
/**
|
|
60
|
+
* Standards-compliant EBU R128 loudness range (LRA) in LU. Pass the buffer's
|
|
61
|
+
* actual `sampleRate`: the default (22050) is non-standard and K-weighting is
|
|
62
|
+
* sample-rate dependent.
|
|
63
|
+
*/
|
|
64
|
+
export declare function ebur128LoudnessRange(request: Ebur128LoudnessRangeRequest): number;
|
|
65
|
+
export declare function ebur128LoudnessRange(samples: Float32Array, sampleRate?: number): number;
|
|
66
|
+
//# sourceMappingURL=feature_loudness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature_loudness.d.ts","sourceRoot":"","sources":["../src/feature_loudness.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAOpD,MAAM,WAAW,sBAAuB,SAAQ,eAAe;IAC7D,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,4BAA6B,SAAQ,eAAe;IACnE,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,2BAA4B,SAAQ,eAAe;IAClE,OAAO,EAAE,YAAY,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,cAAc,CAAC;AACjF,wBAAgB,eAAe,CAC7B,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,eAAe,GACxB,cAAc,CAAC;AAgBlB;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,4BAA4B,GAAG,oBAAoB,CAAC;AACnG,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,eAAe,GACxB,oBAAoB,CAAC;AAgBxB;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,MAAM,CAAC;AACnF,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,YAAY,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import type { AnalyzeSectionsOptions, BoundaryOptions, BoundaryResult, CqtResult, LufsResult, MelodyResult, OnsetStrengthMultiResult, Section } from './public_types';
|
|
2
|
+
import type { WasmFourierTempogramResult, WasmNnlsChromaResult } from './sonare.js';
|
|
3
|
+
import type { ValidateOptions } from './validation';
|
|
4
|
+
type GuardedOptions = ValidateOptions;
|
|
5
|
+
type AnalyzeSectionsGuardedOptions = AnalyzeSectionsOptions & ValidateOptions;
|
|
6
|
+
type BoundaryGuardedOptions = BoundaryOptions & ValidateOptions;
|
|
7
|
+
type MelodyGuardedOptions = MelodyOptions & ValidateOptions;
|
|
8
|
+
/** Canonical request form shared by the Constant-Q transform variants. */
|
|
9
|
+
export interface CqtRequest extends GuardedOptions {
|
|
10
|
+
samples: Float32Array;
|
|
11
|
+
sampleRate?: number;
|
|
12
|
+
hopLength?: number;
|
|
13
|
+
fmin?: number;
|
|
14
|
+
nBins?: number;
|
|
15
|
+
binsPerOctave?: number;
|
|
16
|
+
}
|
|
17
|
+
/** Canonical request form for {@link vqt}. */
|
|
18
|
+
export interface VqtRequest extends CqtRequest {
|
|
19
|
+
gamma?: number;
|
|
20
|
+
}
|
|
21
|
+
export interface OnsetEnvelopeRequest extends GuardedOptions {
|
|
22
|
+
samples: Float32Array;
|
|
23
|
+
sampleRate?: number;
|
|
24
|
+
nFft?: number;
|
|
25
|
+
hopLength?: number;
|
|
26
|
+
nMels?: number;
|
|
27
|
+
}
|
|
28
|
+
export interface OnsetStrengthMultiRequest extends OnsetEnvelopeRequest {
|
|
29
|
+
nBands?: number;
|
|
30
|
+
}
|
|
31
|
+
export interface FourierTempogramRequest extends GuardedOptions {
|
|
32
|
+
onsetEnvelope: Float32Array;
|
|
33
|
+
sampleRate?: number;
|
|
34
|
+
hopLength?: number;
|
|
35
|
+
winLength?: number;
|
|
36
|
+
center?: boolean;
|
|
37
|
+
norm?: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface TempogramRatioRequest extends GuardedOptions {
|
|
40
|
+
tempogramData: Float32Array;
|
|
41
|
+
winLength?: number;
|
|
42
|
+
sampleRate?: number;
|
|
43
|
+
hopLength?: number;
|
|
44
|
+
factors?: Float32Array | number[];
|
|
45
|
+
}
|
|
46
|
+
export interface CqtToAudioRequest extends GuardedOptions {
|
|
47
|
+
magnitude: Float32Array;
|
|
48
|
+
nBins: number;
|
|
49
|
+
nFrames: number;
|
|
50
|
+
sampleRate?: number;
|
|
51
|
+
hopLength?: number;
|
|
52
|
+
fmin?: number;
|
|
53
|
+
binsPerOctave?: number;
|
|
54
|
+
nIter?: number;
|
|
55
|
+
}
|
|
56
|
+
export interface VqtToAudioRequest extends CqtToAudioRequest {
|
|
57
|
+
gamma?: number;
|
|
58
|
+
}
|
|
59
|
+
export interface AnalyzeSectionsRequest extends AnalyzeSectionsGuardedOptions {
|
|
60
|
+
samples: Float32Array;
|
|
61
|
+
sampleRate?: number;
|
|
62
|
+
}
|
|
63
|
+
/** Canonical (and only) call form for {@link detectBoundaries}. */
|
|
64
|
+
export interface DetectBoundariesRequest extends BoundaryGuardedOptions {
|
|
65
|
+
samples: Float32Array;
|
|
66
|
+
sampleRate?: number;
|
|
67
|
+
}
|
|
68
|
+
export interface AnalyzeMelodyRequest extends MelodyGuardedOptions {
|
|
69
|
+
samples: Float32Array;
|
|
70
|
+
sampleRate?: number;
|
|
71
|
+
}
|
|
72
|
+
export interface LufsRequest extends ValidateOptions {
|
|
73
|
+
samples: Float32Array;
|
|
74
|
+
sampleRate?: number;
|
|
75
|
+
}
|
|
76
|
+
export interface NnlsChromaRequest extends GuardedOptions {
|
|
77
|
+
samples: Float32Array;
|
|
78
|
+
sampleRate?: number;
|
|
79
|
+
enableStftBlend?: boolean;
|
|
80
|
+
stftBlendWeight?: number;
|
|
81
|
+
stftBlendNFft?: number;
|
|
82
|
+
hopLength?: number;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Compute NNLS (non-negative least squares) chromagram.
|
|
86
|
+
*
|
|
87
|
+
* @param samples - Audio samples (mono, float32)
|
|
88
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
89
|
+
* @returns NNLS chroma result
|
|
90
|
+
*/
|
|
91
|
+
export declare function nnlsChroma(request: NnlsChromaRequest): WasmNnlsChromaResult;
|
|
92
|
+
export declare function nnlsChroma(samples: Float32Array, sampleRate?: number, options?: Omit<NnlsChromaRequest, 'samples' | 'sampleRate'>): WasmNnlsChromaResult;
|
|
93
|
+
/**
|
|
94
|
+
* Compute the Constant-Q Transform magnitude.
|
|
95
|
+
*
|
|
96
|
+
* @param samples - Audio samples (mono, float32)
|
|
97
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
98
|
+
* @param hopLength - Hop length (default: 512)
|
|
99
|
+
* @param fmin - Minimum frequency in Hz (default: 32.70319566257483, C1)
|
|
100
|
+
* @param nBins - Number of frequency bins (default: 84)
|
|
101
|
+
* @param binsPerOctave - Bins per octave (default: 12)
|
|
102
|
+
* @returns CQT magnitude result
|
|
103
|
+
*/
|
|
104
|
+
export declare function cqt(request: CqtRequest): CqtResult;
|
|
105
|
+
export declare function cqt(samples: Float32Array, sampleRate?: number, hopLength?: number, fmin?: number, nBins?: number, binsPerOctave?: number, options?: GuardedOptions): CqtResult;
|
|
106
|
+
/**
|
|
107
|
+
* Compute the pseudo Constant-Q Transform magnitude.
|
|
108
|
+
*
|
|
109
|
+
* @param samples - Audio samples (mono, float32)
|
|
110
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
111
|
+
* @param hopLength - Hop length (default: 512)
|
|
112
|
+
* @param fmin - Minimum frequency in Hz (default: 32.70319566257483, C1)
|
|
113
|
+
* @param nBins - Number of frequency bins (default: 84)
|
|
114
|
+
* @param binsPerOctave - Bins per octave (default: 12)
|
|
115
|
+
* @returns CQT magnitude result
|
|
116
|
+
*/
|
|
117
|
+
export declare function pseudoCqt(request: CqtRequest): CqtResult;
|
|
118
|
+
export declare function pseudoCqt(samples: Float32Array, sampleRate?: number, hopLength?: number, fmin?: number, nBins?: number, binsPerOctave?: number, options?: GuardedOptions): CqtResult;
|
|
119
|
+
/**
|
|
120
|
+
* Compute the hybrid Constant-Q Transform magnitude.
|
|
121
|
+
*
|
|
122
|
+
* @param samples - Audio samples (mono, float32)
|
|
123
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
124
|
+
* @param hopLength - Hop length (default: 512)
|
|
125
|
+
* @param fmin - Minimum frequency in Hz (default: 32.70319566257483, C1)
|
|
126
|
+
* @param nBins - Number of frequency bins (default: 84)
|
|
127
|
+
* @param binsPerOctave - Bins per octave (default: 12)
|
|
128
|
+
* @returns CQT magnitude result
|
|
129
|
+
*/
|
|
130
|
+
export declare function hybridCqt(request: CqtRequest): CqtResult;
|
|
131
|
+
export declare function hybridCqt(samples: Float32Array, sampleRate?: number, hopLength?: number, fmin?: number, nBins?: number, binsPerOctave?: number, options?: GuardedOptions): CqtResult;
|
|
132
|
+
/**
|
|
133
|
+
* Compute the Variable-Q Transform magnitude (gamma controls Q).
|
|
134
|
+
*
|
|
135
|
+
* @param samples - Audio samples (mono, float32)
|
|
136
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
137
|
+
* @param hopLength - Hop length (default: 512)
|
|
138
|
+
* @param fmin - Minimum frequency in Hz (default: 32.70319566257483, C1)
|
|
139
|
+
* @param nBins - Number of frequency bins (default: 84)
|
|
140
|
+
* @param binsPerOctave - Bins per octave (default: 12)
|
|
141
|
+
* @param gamma - Bandwidth offset; a negative value or NaN selects the automatic
|
|
142
|
+
* ERB-derived value, while 0 is equivalent to CQT (default: -1)
|
|
143
|
+
* @returns VQT magnitude result (same shape as CQT)
|
|
144
|
+
*/
|
|
145
|
+
export declare function vqt(request: VqtRequest): CqtResult;
|
|
146
|
+
export declare function vqt(samples: Float32Array, sampleRate?: number, hopLength?: number, fmin?: number, nBins?: number, binsPerOctave?: number, gamma?: number, options?: GuardedOptions): CqtResult;
|
|
147
|
+
/** Reconstruct mono audio from row-major CQT magnitude via Griffin-Lim. */
|
|
148
|
+
export declare function cqtToAudio(request: CqtToAudioRequest): Float32Array;
|
|
149
|
+
export declare function cqtToAudio(magnitude: Float32Array, nBins: number, nFrames: number, sampleRate?: number, hopLength?: number, fmin?: number, binsPerOctave?: number, nIter?: number, options?: GuardedOptions): Float32Array;
|
|
150
|
+
/** Reconstruct mono audio from row-major VQT magnitude via Griffin-Lim. */
|
|
151
|
+
export declare function vqtToAudio(request: VqtToAudioRequest): Float32Array;
|
|
152
|
+
export declare function vqtToAudio(magnitude: Float32Array, nBins: number, nFrames: number, sampleRate?: number, hopLength?: number, fmin?: number, binsPerOctave?: number, gamma?: number, nIter?: number, options?: GuardedOptions): Float32Array;
|
|
153
|
+
/**
|
|
154
|
+
* Detect song-structure sections (intro/verse/chorus/...).
|
|
155
|
+
*
|
|
156
|
+
* @param samples - Audio samples (mono, float32)
|
|
157
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
158
|
+
* @param nFft - FFT size (default: 2048)
|
|
159
|
+
* @param hopLength - Hop length (default: 512)
|
|
160
|
+
* @param minSectionSec - Minimum section duration in seconds (default: 4.0)
|
|
161
|
+
* @returns Array of detected sections
|
|
162
|
+
*/
|
|
163
|
+
export declare function analyzeSections(request: AnalyzeSectionsRequest): Section[];
|
|
164
|
+
export declare function analyzeSections(samples: Float32Array, sampleRate?: number, options?: AnalyzeSectionsGuardedOptions): Section[];
|
|
165
|
+
/**
|
|
166
|
+
* Detect structural boundaries and return the novelty curve behind them.
|
|
167
|
+
*
|
|
168
|
+
* This is the unlabelled layer {@link analyzeSections} is built on, not a
|
|
169
|
+
* coarser view of its output: sections are labelled spans, these are the
|
|
170
|
+
* transitions plus the continuous curve they were picked from, so a caller
|
|
171
|
+
* applying its own threshold needs this and cannot derive it from a section
|
|
172
|
+
* list.
|
|
173
|
+
*
|
|
174
|
+
* @param request - Samples, sample rate and {@link BoundaryOptions}
|
|
175
|
+
* @returns The boundaries, the novelty curve, and the analysis grid they live on
|
|
176
|
+
* @throws {@link SonareError} with `InvalidParameter` when both `useMfcc` and
|
|
177
|
+
* `useChroma` are `false`: the two feature streams are combined frame-for-frame,
|
|
178
|
+
* so with neither enabled there is nothing to combine.
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* ```ts
|
|
182
|
+
* const { boundaries, noveltyCurve, noveltyPeak } = detectBoundaries({
|
|
183
|
+
* samples,
|
|
184
|
+
* sampleRate: 44100,
|
|
185
|
+
* absoluteThreshold: 0.01,
|
|
186
|
+
* });
|
|
187
|
+
* // `noveltyCurve` is scaled by its own maximum; recover the raw response with
|
|
188
|
+
* // `noveltyCurve[i] * noveltyPeak`.
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
export declare function detectBoundaries(request: DetectBoundariesRequest): BoundaryResult;
|
|
192
|
+
/** Options for {@link analyzeMelody}. All fields are optional. */
|
|
193
|
+
export interface MelodyOptions {
|
|
194
|
+
/** Lowest f0 (Hz) the tracker will consider. Default 65 (≈ C2). */
|
|
195
|
+
fmin?: number;
|
|
196
|
+
/** Highest f0 (Hz) the tracker will consider. Default 2093 (≈ C7). */
|
|
197
|
+
fmax?: number;
|
|
198
|
+
/** Analysis frame length in samples. Default 2048. */
|
|
199
|
+
frameLength?: number;
|
|
200
|
+
/** Hop length between frames in samples. Default 256. */
|
|
201
|
+
hopLength?: number;
|
|
202
|
+
/** Voicing confidence threshold in [0,1]; frames below are unvoiced. Default 0.1. */
|
|
203
|
+
threshold?: number;
|
|
204
|
+
/**
|
|
205
|
+
* Use the pYIN tracker (Viterbi-smoothed) instead of plain per-frame YIN.
|
|
206
|
+
* Produces a less octave-jumpy contour. Defaults to `false`.
|
|
207
|
+
*/
|
|
208
|
+
usePyin?: boolean;
|
|
209
|
+
/**
|
|
210
|
+
* When {@link usePyin} is `true`, zero-pad by `frameLength / 2` so frame
|
|
211
|
+
* `i` is centered at `i * hopLength` (matches `librosa.pyin(center=True)`).
|
|
212
|
+
* Ignored by the plain-YIN path. Defaults to `true`.
|
|
213
|
+
*/
|
|
214
|
+
center?: boolean;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Extract the melody contour from monophonic audio via YIN (or pYIN).
|
|
218
|
+
*
|
|
219
|
+
* @param samples - Audio samples (mono, float32)
|
|
220
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
221
|
+
* @param options - Tracker + tuning options ({@link MelodyOptions})
|
|
222
|
+
* @returns Melody contour with per-frame pitch points and summary stats
|
|
223
|
+
*/
|
|
224
|
+
export declare function analyzeMelody(request: AnalyzeMelodyRequest): MelodyResult;
|
|
225
|
+
export declare function analyzeMelody(samples: Float32Array, sampleRate?: number, options?: MelodyGuardedOptions): MelodyResult;
|
|
226
|
+
/**
|
|
227
|
+
* Compute the onset strength envelope.
|
|
228
|
+
*
|
|
229
|
+
* @param samples - Audio samples (mono, float32)
|
|
230
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
231
|
+
* @param nFft - FFT size (default: 2048)
|
|
232
|
+
* @param hopLength - Hop length (default: 512)
|
|
233
|
+
* @param nMels - Number of Mel bands (default: 128)
|
|
234
|
+
* @returns Onset envelope for each frame
|
|
235
|
+
*/
|
|
236
|
+
export declare function onsetEnvelope(request: OnsetEnvelopeRequest): Float32Array;
|
|
237
|
+
export declare function onsetEnvelope(samples: Float32Array, sampleRate?: number, nFft?: number, hopLength?: number, nMels?: number, options?: GuardedOptions): Float32Array;
|
|
238
|
+
/**
|
|
239
|
+
* Compute multi-band onset strength envelopes.
|
|
240
|
+
*
|
|
241
|
+
* @param samples - Audio samples (mono, float32)
|
|
242
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
243
|
+
* @param nFft - FFT size (default: 2048)
|
|
244
|
+
* @param hopLength - Hop length (default: 512)
|
|
245
|
+
* @param nMels - Number of Mel bands (default: 128)
|
|
246
|
+
* @param nBands - Number of onset bands (default: 3)
|
|
247
|
+
* @returns Multi-band onset matrix
|
|
248
|
+
*/
|
|
249
|
+
export declare function onsetStrengthMulti(request: OnsetStrengthMultiRequest): OnsetStrengthMultiResult;
|
|
250
|
+
export declare function onsetStrengthMulti(samples: Float32Array, sampleRate?: number, nFft?: number, hopLength?: number, nMels?: number, nBands?: number, options?: GuardedOptions): OnsetStrengthMultiResult;
|
|
251
|
+
/**
|
|
252
|
+
* Compute the Fourier tempogram from an onset envelope.
|
|
253
|
+
*
|
|
254
|
+
* @param onsetEnvelope - Onset strength envelope (float32)
|
|
255
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
256
|
+
* @param hopLength - Hop length (default: 512)
|
|
257
|
+
* @param winLength - Window length in frames (default: 384)
|
|
258
|
+
* @returns Fourier tempogram result
|
|
259
|
+
*/
|
|
260
|
+
export declare function fourierTempogram(request: FourierTempogramRequest): WasmFourierTempogramResult;
|
|
261
|
+
export declare function fourierTempogram(onsetEnvelope: Float32Array, sampleRate?: number, hopLength?: number, winLength?: number, center?: boolean, norm?: boolean, options?: GuardedOptions): WasmFourierTempogramResult;
|
|
262
|
+
/**
|
|
263
|
+
* Compute tempogram ratio features.
|
|
264
|
+
*
|
|
265
|
+
* @param tempogramData - Tempogram data (float32)
|
|
266
|
+
* @param winLength - Window length in frames (default: 384)
|
|
267
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
268
|
+
* @param hopLength - Hop length (default: 512)
|
|
269
|
+
* @param factors - Lag ratios to evaluate. When omitted or empty, the library
|
|
270
|
+
* default {0.5, 1, 2, 3, 4} is used.
|
|
271
|
+
* @returns Tempogram ratio features (one value per factor)
|
|
272
|
+
*/
|
|
273
|
+
export declare function tempogramRatio(request: TempogramRatioRequest): Float32Array;
|
|
274
|
+
export declare function tempogramRatio(tempogramData: Float32Array, winLength?: number, sampleRate?: number, hopLength?: number, factors?: Float32Array | number[], options?: GuardedOptions): Float32Array;
|
|
275
|
+
/**
|
|
276
|
+
* Measure loudness (EBU R128 / ITU-R BS.1770).
|
|
277
|
+
*
|
|
278
|
+
* @param samples - Audio samples (mono, float32)
|
|
279
|
+
* @param sampleRate - Sample rate in Hz. The default (22050) is non-standard for
|
|
280
|
+
* audio; pass the buffer's actual rate, as K-weighting is sample-rate
|
|
281
|
+
* dependent and a wrong rate yields wrong loudness.
|
|
282
|
+
* @returns Loudness measurement result
|
|
283
|
+
*/
|
|
284
|
+
export declare function lufs(request: LufsRequest): LufsResult;
|
|
285
|
+
export declare function lufs(samples: Float32Array, sampleRate?: number, options?: ValidateOptions): LufsResult;
|
|
286
|
+
/**
|
|
287
|
+
* Compute the momentary loudness (LUFS) over time.
|
|
288
|
+
*
|
|
289
|
+
* @param samples - Audio samples (mono, float32)
|
|
290
|
+
* @param sampleRate - Sample rate in Hz. The default (22050) is non-standard and
|
|
291
|
+
* K-weighting is sample-rate dependent; pass the buffer's actual rate.
|
|
292
|
+
* @returns Momentary LUFS values over time
|
|
293
|
+
*/
|
|
294
|
+
export declare function momentaryLufs(request: LufsRequest): Float32Array;
|
|
295
|
+
export declare function momentaryLufs(samples: Float32Array, sampleRate?: number, options?: ValidateOptions): Float32Array;
|
|
296
|
+
/**
|
|
297
|
+
* Compute the short-term loudness (LUFS) over time.
|
|
298
|
+
*
|
|
299
|
+
* @param samples - Audio samples (mono, float32)
|
|
300
|
+
* @param sampleRate - Sample rate in Hz. The default (22050) is non-standard and
|
|
301
|
+
* K-weighting is sample-rate dependent; pass the buffer's actual rate.
|
|
302
|
+
* @returns Short-term LUFS values over time
|
|
303
|
+
*/
|
|
304
|
+
export declare function shortTermLufs(request: LufsRequest): Float32Array;
|
|
305
|
+
export declare function shortTermLufs(samples: Float32Array, sampleRate?: number, options?: ValidateOptions): Float32Array;
|
|
306
|
+
export {};
|
|
307
|
+
//# sourceMappingURL=feature_music.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature_music.d.ts","sourceRoot":"","sources":["../src/feature_music.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,sBAAsB,EACtB,eAAe,EACf,cAAc,EACd,SAAS,EACT,UAAU,EACV,YAAY,EACZ,wBAAwB,EACxB,OAAO,EAER,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAapD,KAAK,cAAc,GAAG,eAAe,CAAC;AACtC,KAAK,6BAA6B,GAAG,sBAAsB,GAAG,eAAe,CAAC;AAC9E,KAAK,sBAAsB,GAAG,eAAe,GAAG,eAAe,CAAC;AAChE,KAAK,oBAAoB,GAAG,aAAa,GAAG,eAAe,CAAC;AAE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,aAAa,CAC3B,OAAO,EAAE,YAAY,EACrB,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,eAAe,GACxB,YAAY,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { SpectralFrameRequest } from './feature_spectral';
|
|
2
|
+
import type { NoteSegment, PiptrackResult, PitchResult } from './public_types';
|
|
3
|
+
/**
|
|
4
|
+
* Detect pitch using YIN algorithm.
|
|
5
|
+
*
|
|
6
|
+
* @param samples - Audio samples (mono, float32)
|
|
7
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
8
|
+
* @param frameLength - Frame length (default: 2048)
|
|
9
|
+
* @param hopLength - Hop length (default: 512)
|
|
10
|
+
* @param fmin - Minimum frequency in Hz (default: 65)
|
|
11
|
+
* @param fmax - Maximum frequency in Hz (default: 2093)
|
|
12
|
+
* @param threshold - YIN threshold (default: 0.1)
|
|
13
|
+
* @param fillNa - Retained for compatibility; YIN always returns a finite per-frame estimate.
|
|
14
|
+
* @returns Pitch detection result
|
|
15
|
+
*/
|
|
16
|
+
export interface PitchYinRequest {
|
|
17
|
+
samples: Float32Array;
|
|
18
|
+
sampleRate?: number;
|
|
19
|
+
frameLength?: number;
|
|
20
|
+
hopLength?: number;
|
|
21
|
+
fmin?: number;
|
|
22
|
+
fmax?: number;
|
|
23
|
+
threshold?: number;
|
|
24
|
+
fillNa?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface PiptrackRequest {
|
|
27
|
+
samples: Float32Array;
|
|
28
|
+
sampleRate?: number;
|
|
29
|
+
nFft?: number;
|
|
30
|
+
hopLength?: number;
|
|
31
|
+
fmin?: number;
|
|
32
|
+
fmax?: number;
|
|
33
|
+
threshold?: number;
|
|
34
|
+
}
|
|
35
|
+
/** Per-bin spectral pitch candidates and peak magnitudes (librosa.piptrack). */
|
|
36
|
+
export declare function piptrack(request: PiptrackRequest): PiptrackResult;
|
|
37
|
+
export declare function piptrack(samples: Float32Array, sampleRate?: number, nFft?: number, hopLength?: number, fmin?: number, fmax?: number, threshold?: number): PiptrackResult;
|
|
38
|
+
export declare function pitchYin(request: PitchYinRequest): PitchResult;
|
|
39
|
+
export declare function pitchYin(samples: Float32Array, sampleRate?: number, frameLength?: number, hopLength?: number, fmin?: number, fmax?: number, threshold?: number, fillNa?: boolean): PitchResult;
|
|
40
|
+
/**
|
|
41
|
+
* Detect pitch using pYIN algorithm (probabilistic YIN with HMM smoothing).
|
|
42
|
+
*
|
|
43
|
+
* @param samples - Audio samples (mono, float32)
|
|
44
|
+
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
45
|
+
* @param frameLength - Frame length (default: 2048)
|
|
46
|
+
* @param hopLength - Hop length (default: 512)
|
|
47
|
+
* @param fmin - Minimum frequency in Hz (default: 65)
|
|
48
|
+
* @param fmax - Maximum frequency in Hz (default: 2093)
|
|
49
|
+
* @param threshold - YIN threshold (default: 0.1)
|
|
50
|
+
* @param fillNa - If true, return 0 for unvoiced f0 frames; otherwise keep NaN (default: false)
|
|
51
|
+
* @returns Pitch detection result
|
|
52
|
+
*/
|
|
53
|
+
export interface PitchPyinRequest extends PitchYinRequest {
|
|
54
|
+
}
|
|
55
|
+
export declare function pitchPyin(request: PitchPyinRequest): PitchResult;
|
|
56
|
+
export declare function pitchPyin(samples: Float32Array, sampleRate?: number, frameLength?: number, hopLength?: number, fmin?: number, fmax?: number, threshold?: number, fillNa?: boolean): PitchResult;
|
|
57
|
+
/** Parameters for segmenting an F0 track into stable monophonic notes. */
|
|
58
|
+
export interface NoteSegmentsRequest {
|
|
59
|
+
f0Hz: Float32Array;
|
|
60
|
+
/**
|
|
61
|
+
* Per-frame voicing values in `[0, 1]`; anything below `voicedThreshold` is
|
|
62
|
+
* unvoiced.
|
|
63
|
+
*
|
|
64
|
+
* Pass {@link PitchResult.voicedFlag} converted to `0`/`1`. Do **not** pass
|
|
65
|
+
* {@link pitchPyin}'s `voicedProb`: that value is the frame's voiced
|
|
66
|
+
* observation mass and rises with F0 for a fixed `frameLength`, so a fixed
|
|
67
|
+
* threshold silently returns no segments at all for low-register material
|
|
68
|
+
* (a steady tone below roughly C5 never reaches 0.5).
|
|
69
|
+
*/
|
|
70
|
+
voicedProb: Float32Array;
|
|
71
|
+
frameRate: number;
|
|
72
|
+
/** Cents of pitch change that start a new segment. Default 50. */
|
|
73
|
+
segmentationThresholdCents?: number;
|
|
74
|
+
/** Shortest segment kept, in ms. Default 30. */
|
|
75
|
+
minNoteMs?: number;
|
|
76
|
+
/** Reference pitch each segment's cents are measured against. Default 440. */
|
|
77
|
+
referenceHz?: number;
|
|
78
|
+
/** Voicing threshold applied to `voicedProb`; defaults to `0.5`. */
|
|
79
|
+
voicedThreshold?: number;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Segment a caller-supplied monophonic F0 track into stable note regions.
|
|
83
|
+
*
|
|
84
|
+
* `f0Hz` and `voicedProb` must have the same non-zero length. Zero-Hz frames
|
|
85
|
+
* and values below `voicedThreshold` (default `0.5`) are treated as unvoiced.
|
|
86
|
+
*/
|
|
87
|
+
export declare function noteSegments(request: NoteSegmentsRequest): NoteSegment[];
|
|
88
|
+
export interface PitchTuningRequest {
|
|
89
|
+
frequencies: Float32Array;
|
|
90
|
+
resolution?: number;
|
|
91
|
+
binsPerOctave?: number;
|
|
92
|
+
}
|
|
93
|
+
export interface EstimateTuningRequest extends SpectralFrameRequest {
|
|
94
|
+
resolution?: number;
|
|
95
|
+
binsPerOctave?: number;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Estimate the global tuning offset from a set of frequencies
|
|
99
|
+
* (librosa.pitch_tuning). Returns a deviation in fractions of a bin.
|
|
100
|
+
*/
|
|
101
|
+
export declare function pitchTuning(request: PitchTuningRequest): number;
|
|
102
|
+
export declare function pitchTuning(frequencies: Float32Array, resolution?: number, binsPerOctave?: number): number;
|
|
103
|
+
/**
|
|
104
|
+
* Estimate the tuning offset of an audio signal (librosa.estimate_tuning).
|
|
105
|
+
*/
|
|
106
|
+
export declare function estimateTuning(request: EstimateTuningRequest): number;
|
|
107
|
+
export declare function estimateTuning(samples: Float32Array, sampleRate?: number, nFft?: number, hopLength?: number, resolution?: number, binsPerOctave?: number): number;
|
|
108
|
+
//# sourceMappingURL=feature_pitch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature_pitch.d.ts","sourceRoot":"","sources":["../src/feature_pitch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAU/E;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,YAAY,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,YAAY,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,gFAAgF;AAChF,wBAAgB,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,cAAc,CAAC;AACnE,wBAAgB,QAAQ,CACtB,OAAO,EAAE,YAAY,EACrB,UAAU,CAAC,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,MAAM,EACb,SA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C1B;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,WAAW,EAAE,CAOxE;AAMD,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,YAAY,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,CAAC;AACjE,wBAAgB,WAAW,CACzB,WAAW,EAAE,YAAY,EACzB,UAAU,CAAC,EAAE,MAAM,EACnB,aAAa,CAAC,EAAE,MAAM,GACrB,MAAM,CAAC;AAaV;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,MAAM,CAAC;AACvE,wBAAgB,cAAc,CAC5B,OAAO,EAAE,YAAY,EACrB,UAAU,CAAC,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,MAAM,EACb,SAAS,CAAC,EAAE,MAAM,EAClB,UAAU,CAAC,EAAE,MAAM,EACnB,aAAa,CAAC,EAAE,MAAM,GACrB,MAAM,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resample audio to a different sample rate.
|
|
3
|
+
*
|
|
4
|
+
* @param samples - Audio samples (mono, float32)
|
|
5
|
+
* @param srcSr - Source sample rate in Hz
|
|
6
|
+
* @param targetSr - Target sample rate in Hz
|
|
7
|
+
* @returns Resampled audio
|
|
8
|
+
*/
|
|
9
|
+
export interface ResampleRequest {
|
|
10
|
+
samples: Float32Array;
|
|
11
|
+
srcSr: number;
|
|
12
|
+
targetSr: number;
|
|
13
|
+
}
|
|
14
|
+
export declare function resample(request: ResampleRequest): Float32Array;
|
|
15
|
+
export declare function resample(samples: Float32Array, srcSr: number, targetSr: number): Float32Array;
|
|
16
|
+
//# sourceMappingURL=feature_resample.d.ts.map
|