@libraz/libsonare 1.5.1 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -3
- package/dist/index.d.ts +1165 -178
- package/dist/index.js +4830 -3871
- package/dist/index.js.map +1 -1
- package/dist/sonare.js +1 -1
- package/dist/sonare.wasm +0 -0
- package/dist/worklet.d.ts +29 -1
- package/dist/worklet.js +1068 -974
- package/dist/worklet.js.map +1 -1
- package/package.json +2 -1
- package/src/_chain_config.ts +46 -0
- package/src/audio.ts +24 -4
- package/src/effects_mastering.ts +25 -1
- package/src/effects_transform.ts +283 -43
- package/src/effects_voice_change.ts +46 -53
- package/src/feature_core.ts +316 -12
- package/src/feature_music.ts +462 -0
- package/src/feature_pitch.ts +61 -0
- package/src/feature_resample.ts +17 -2
- package/src/feature_spectral.ts +349 -2
- package/src/feature_spectrogram.ts +336 -0
- package/src/features.ts +2 -0
- package/src/index.ts +133 -1
- package/src/mastering_chain.ts +305 -50
- package/src/mastering_core.ts +242 -16
- package/src/mastering_dynamics.ts +66 -10
- package/src/mastering_repair.ts +119 -7
- package/src/metering.ts +366 -81
- package/src/mixer.ts +10 -3
- package/src/mixing_oneshot.ts +25 -5
- package/src/module_state.ts +1 -1
- package/src/project_class.ts +17 -6
- package/src/project_internal.ts +10 -2
- package/src/project_types.ts +25 -2
- package/src/public_types_mastering.ts +114 -4
- package/src/public_types_music.ts +1 -0
- package/src/public_types_spectral.ts +7 -0
- package/src/quick_analysis.ts +325 -117
- package/src/realtime_engine.ts +8 -0
- package/src/sonare.js.d.ts +56 -0
- package/src/stream_analyzer.ts +25 -2
- package/src/stream_types.ts +16 -1
- package/src/validation.ts +17 -2
- package/src/worklet/engine-clips.ts +67 -2
- package/src/worklet/engine-processor.ts +33 -5
- package/src/worklet/engine.ts +7 -3
- package/src/worklet/guards.ts +3 -0
- package/src/worklet/messages.ts +27 -0
package/src/feature_pitch.ts
CHANGED
|
@@ -22,8 +22,30 @@ function requireModule() {
|
|
|
22
22
|
* @param fillNa - If true, return 0 for unvoiced f0 frames; otherwise keep NaN (default: false)
|
|
23
23
|
* @returns Pitch detection result
|
|
24
24
|
*/
|
|
25
|
+
export interface PitchYinRequest {
|
|
26
|
+
samples: Float32Array;
|
|
27
|
+
sampleRate?: number;
|
|
28
|
+
frameLength?: number;
|
|
29
|
+
hopLength?: number;
|
|
30
|
+
fmin?: number;
|
|
31
|
+
fmax?: number;
|
|
32
|
+
threshold?: number;
|
|
33
|
+
fillNa?: boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function pitchYin(request: PitchYinRequest): PitchResult;
|
|
25
37
|
export function pitchYin(
|
|
26
38
|
samples: Float32Array,
|
|
39
|
+
sampleRate?: number,
|
|
40
|
+
frameLength?: number,
|
|
41
|
+
hopLength?: number,
|
|
42
|
+
fmin?: number,
|
|
43
|
+
fmax?: number,
|
|
44
|
+
threshold?: number,
|
|
45
|
+
fillNa?: boolean,
|
|
46
|
+
): PitchResult;
|
|
47
|
+
export function pitchYin(
|
|
48
|
+
samples: Float32Array | PitchYinRequest,
|
|
27
49
|
sampleRate = 22050,
|
|
28
50
|
frameLength = 2048,
|
|
29
51
|
hopLength = 512,
|
|
@@ -32,6 +54,19 @@ export function pitchYin(
|
|
|
32
54
|
threshold = 0.3,
|
|
33
55
|
fillNa = false,
|
|
34
56
|
): PitchResult {
|
|
57
|
+
if (!(samples instanceof Float32Array)) {
|
|
58
|
+
const request = samples;
|
|
59
|
+
return pitchYin(
|
|
60
|
+
request.samples,
|
|
61
|
+
request.sampleRate,
|
|
62
|
+
request.frameLength,
|
|
63
|
+
request.hopLength,
|
|
64
|
+
request.fmin,
|
|
65
|
+
request.fmax,
|
|
66
|
+
request.threshold,
|
|
67
|
+
request.fillNa,
|
|
68
|
+
);
|
|
69
|
+
}
|
|
35
70
|
return requireModule().pitchYin(
|
|
36
71
|
samples,
|
|
37
72
|
sampleRate,
|
|
@@ -57,8 +92,21 @@ export function pitchYin(
|
|
|
57
92
|
* @param fillNa - If true, return 0 for unvoiced f0 frames; otherwise keep NaN (default: false)
|
|
58
93
|
* @returns Pitch detection result
|
|
59
94
|
*/
|
|
95
|
+
export interface PitchPyinRequest extends PitchYinRequest {}
|
|
96
|
+
|
|
97
|
+
export function pitchPyin(request: PitchPyinRequest): PitchResult;
|
|
60
98
|
export function pitchPyin(
|
|
61
99
|
samples: Float32Array,
|
|
100
|
+
sampleRate?: number,
|
|
101
|
+
frameLength?: number,
|
|
102
|
+
hopLength?: number,
|
|
103
|
+
fmin?: number,
|
|
104
|
+
fmax?: number,
|
|
105
|
+
threshold?: number,
|
|
106
|
+
fillNa?: boolean,
|
|
107
|
+
): PitchResult;
|
|
108
|
+
export function pitchPyin(
|
|
109
|
+
samples: Float32Array | PitchPyinRequest,
|
|
62
110
|
sampleRate = 22050,
|
|
63
111
|
frameLength = 2048,
|
|
64
112
|
hopLength = 512,
|
|
@@ -67,6 +115,19 @@ export function pitchPyin(
|
|
|
67
115
|
threshold = 0.3,
|
|
68
116
|
fillNa = false,
|
|
69
117
|
): PitchResult {
|
|
118
|
+
if (!(samples instanceof Float32Array)) {
|
|
119
|
+
const request = samples;
|
|
120
|
+
return pitchPyin(
|
|
121
|
+
request.samples,
|
|
122
|
+
request.sampleRate,
|
|
123
|
+
request.frameLength,
|
|
124
|
+
request.hopLength,
|
|
125
|
+
request.fmin,
|
|
126
|
+
request.fmax,
|
|
127
|
+
request.threshold,
|
|
128
|
+
request.fillNa,
|
|
129
|
+
);
|
|
130
|
+
}
|
|
70
131
|
return requireModule().pitchPyin(
|
|
71
132
|
samples,
|
|
72
133
|
sampleRate,
|
package/src/feature_resample.ts
CHANGED
|
@@ -16,6 +16,21 @@ function requireModule() {
|
|
|
16
16
|
* @param targetSr - Target sample rate in Hz
|
|
17
17
|
* @returns Resampled audio
|
|
18
18
|
*/
|
|
19
|
-
export
|
|
20
|
-
|
|
19
|
+
export interface ResampleRequest {
|
|
20
|
+
samples: Float32Array;
|
|
21
|
+
srcSr: number;
|
|
22
|
+
targetSr: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function resample(request: ResampleRequest): Float32Array;
|
|
26
|
+
export function resample(samples: Float32Array, srcSr: number, targetSr: number): Float32Array;
|
|
27
|
+
export function resample(
|
|
28
|
+
samples: Float32Array | ResampleRequest,
|
|
29
|
+
srcSr?: number,
|
|
30
|
+
targetSr?: number,
|
|
31
|
+
): Float32Array {
|
|
32
|
+
if (!(samples instanceof Float32Array)) {
|
|
33
|
+
return resample(samples.samples, samples.srcSr, samples.targetSr);
|
|
34
|
+
}
|
|
35
|
+
return requireModule().resample(samples, srcSr as number, targetSr as number);
|
|
21
36
|
}
|