@libraz/libsonare 1.6.0 → 1.7.1
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 +2 -2
- package/dist/analysis.d.ts +139 -11
- package/dist/analysis.js +162 -42
- package/dist/analysis.js.map +1 -1
- package/dist/index.d.ts +211 -39
- package/dist/index.js +501 -142
- package/dist/index.js.map +1 -1
- package/dist/schemas/realtime-voice-changer-preset.schema.json +2 -2
- package/dist/sonare-analysis.js +1 -1
- package/dist/sonare-analysis.wasm +0 -0
- package/dist/sonare.js +1 -1
- package/dist/sonare.wasm +0 -0
- package/dist/worker.js +56 -29
- package/dist/worker.js.map +1 -1
- package/dist/worklet.d.ts +67 -18
- package/dist/worklet.js +193 -42
- package/dist/worklet.js.map +1 -1
- package/package.json +3 -3
- package/src/_chain_config.ts +6 -1
- package/src/analysis_helpers.ts +34 -29
- package/src/audio.ts +7 -2
- package/src/codes.ts +47 -11
- package/src/effects_mastering.ts +5 -0
- package/src/effects_transform.ts +202 -22
- package/src/feature_music.ts +8 -1
- package/src/feature_spectral.ts +64 -2
- package/src/feature_spectrogram.ts +44 -3
- package/src/index.ts +28 -3
- package/src/mastering_core.ts +70 -0
- package/src/metering.ts +18 -0
- package/src/mixer.ts +3 -3
- package/src/project.ts +6 -0
- package/src/project_class.ts +143 -16
- package/src/project_internal.ts +14 -5
- package/src/project_types.ts +50 -9
- package/src/public_types_mastering.ts +9 -0
- package/src/public_types_mixing.ts +16 -0
- package/src/public_types_realtime.ts +23 -5
- package/src/public_types_spectral.ts +16 -2
- package/src/quick_analysis.ts +21 -3
- package/src/realtime_engine.ts +14 -3
- package/src/sonare.js.d.ts +87 -0
- package/src/stream_analyzer.ts +6 -1
- package/src/web_midi.ts +10 -7
- package/src/worklet/engine-node.ts +54 -19
- package/src/worklet/engine-parameter-facade.ts +30 -1
- package/src/worklet/engine-processor.ts +52 -20
- package/src/worklet/engine-register.ts +1 -1
- package/src/worklet/engine-strips.ts +2 -2
- package/src/worklet/engine.ts +10 -0
- package/src/worklet/guards.ts +99 -7
- package/src/worklet/messages.ts +41 -1
- package/src/worklet/protocol.ts +4 -0
package/dist/worker.js
CHANGED
|
@@ -284,6 +284,36 @@ function masterAudioStereo(left, right = void 0, sampleRate = 22050, presetName
|
|
|
284
284
|
);
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
+
// src/codes.ts
|
|
288
|
+
function resolveOrdinalInRange(value, min, max, enumName) {
|
|
289
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < min || value > max) {
|
|
290
|
+
throw new RangeError(`Invalid ${enumName}: ${String(value)}`);
|
|
291
|
+
}
|
|
292
|
+
return value;
|
|
293
|
+
}
|
|
294
|
+
function resolveEnumOrdinal(value, values, enumName) {
|
|
295
|
+
if (typeof value === "number") {
|
|
296
|
+
const ordinals = Object.values(values);
|
|
297
|
+
const ordinal = resolveOrdinalInRange(
|
|
298
|
+
value,
|
|
299
|
+
Math.min(...ordinals),
|
|
300
|
+
Math.max(...ordinals),
|
|
301
|
+
enumName
|
|
302
|
+
);
|
|
303
|
+
if (!ordinals.includes(ordinal)) {
|
|
304
|
+
throw new RangeError(`Invalid ${enumName}: ${String(value)}`);
|
|
305
|
+
}
|
|
306
|
+
return ordinal;
|
|
307
|
+
}
|
|
308
|
+
if (typeof value === "string") {
|
|
309
|
+
const ordinal = values[value];
|
|
310
|
+
if (ordinal !== void 0) {
|
|
311
|
+
return ordinal;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
throw new RangeError(`Invalid ${enumName}: ${String(value)}`);
|
|
315
|
+
}
|
|
316
|
+
|
|
287
317
|
// src/public_types_music.ts
|
|
288
318
|
var PitchClass = {
|
|
289
319
|
C: 0,
|
|
@@ -336,6 +366,30 @@ var PITCH_CLASS_NAMES = [
|
|
|
336
366
|
function pitchClassName(value) {
|
|
337
367
|
return PITCH_CLASS_NAMES[value] ?? "C";
|
|
338
368
|
}
|
|
369
|
+
var KEY_MODE_VALUES = {
|
|
370
|
+
major: Mode.Major,
|
|
371
|
+
minor: Mode.Minor,
|
|
372
|
+
dorian: Mode.Dorian,
|
|
373
|
+
phrygian: Mode.Phrygian,
|
|
374
|
+
lydian: Mode.Lydian,
|
|
375
|
+
mixolydian: Mode.Mixolydian,
|
|
376
|
+
locrian: Mode.Locrian
|
|
377
|
+
};
|
|
378
|
+
var KEY_PROFILE_VALUES = {
|
|
379
|
+
ks: KeyProfile.KrumhanslSchmuckler,
|
|
380
|
+
krumhansl: KeyProfile.KrumhanslSchmuckler,
|
|
381
|
+
temperley: KeyProfile.Temperley,
|
|
382
|
+
shaath: KeyProfile.Shaath,
|
|
383
|
+
keyfinder: KeyProfile.Shaath,
|
|
384
|
+
"faraldo-edmt": KeyProfile.FaraldoEDMT,
|
|
385
|
+
edmt: KeyProfile.FaraldoEDMT,
|
|
386
|
+
"faraldo-edma": KeyProfile.FaraldoEDMA,
|
|
387
|
+
edma: KeyProfile.FaraldoEDMA,
|
|
388
|
+
"faraldo-edmm": KeyProfile.FaraldoEDMM,
|
|
389
|
+
edmm: KeyProfile.FaraldoEDMM,
|
|
390
|
+
"bellman-budge": KeyProfile.BellmanBudge,
|
|
391
|
+
bellman: KeyProfile.BellmanBudge
|
|
392
|
+
};
|
|
339
393
|
function keyModeValues(modes) {
|
|
340
394
|
if (!modes) {
|
|
341
395
|
return [];
|
|
@@ -354,40 +408,13 @@ function keyModeValues(modes) {
|
|
|
354
408
|
Mode.Locrian
|
|
355
409
|
];
|
|
356
410
|
}
|
|
357
|
-
|
|
358
|
-
major: Mode.Major,
|
|
359
|
-
minor: Mode.Minor,
|
|
360
|
-
dorian: Mode.Dorian,
|
|
361
|
-
phrygian: Mode.Phrygian,
|
|
362
|
-
lydian: Mode.Lydian,
|
|
363
|
-
mixolydian: Mode.Mixolydian,
|
|
364
|
-
locrian: Mode.Locrian
|
|
365
|
-
};
|
|
366
|
-
return modes.map((mode) => typeof mode === "number" ? mode : names[mode]);
|
|
411
|
+
return modes.map((mode) => resolveEnumOrdinal(mode, KEY_MODE_VALUES, "key mode"));
|
|
367
412
|
}
|
|
368
413
|
function keyProfileValue(profile) {
|
|
369
414
|
if (profile === void 0) {
|
|
370
415
|
return -1;
|
|
371
416
|
}
|
|
372
|
-
|
|
373
|
-
return profile;
|
|
374
|
-
}
|
|
375
|
-
const names = {
|
|
376
|
-
ks: KeyProfile.KrumhanslSchmuckler,
|
|
377
|
-
krumhansl: KeyProfile.KrumhanslSchmuckler,
|
|
378
|
-
temperley: KeyProfile.Temperley,
|
|
379
|
-
shaath: KeyProfile.Shaath,
|
|
380
|
-
keyfinder: KeyProfile.Shaath,
|
|
381
|
-
"faraldo-edmt": KeyProfile.FaraldoEDMT,
|
|
382
|
-
edmt: KeyProfile.FaraldoEDMT,
|
|
383
|
-
"faraldo-edma": KeyProfile.FaraldoEDMA,
|
|
384
|
-
edma: KeyProfile.FaraldoEDMA,
|
|
385
|
-
"faraldo-edmm": KeyProfile.FaraldoEDMM,
|
|
386
|
-
edmm: KeyProfile.FaraldoEDMM,
|
|
387
|
-
"bellman-budge": KeyProfile.BellmanBudge,
|
|
388
|
-
bellman: KeyProfile.BellmanBudge
|
|
389
|
-
};
|
|
390
|
-
return names[profile];
|
|
417
|
+
return resolveEnumOrdinal(profile, KEY_PROFILE_VALUES, "key profile");
|
|
391
418
|
}
|
|
392
419
|
function convertChordAnalysisResult(wasm) {
|
|
393
420
|
return {
|