@libraz/libsonare 1.5.5 → 1.7.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/README.md +109 -20
- package/dist/analysis.d.ts +5809 -0
- package/dist/analysis.js +2574 -0
- package/dist/analysis.js.map +1 -0
- package/dist/index.d.ts +884 -55
- package/dist/index.js +1302 -292
- package/dist/index.js.map +1 -1
- package/dist/schemas/realtime-voice-changer-preset-pack.schema.json +27 -0
- package/dist/schemas/realtime-voice-changer-preset.schema.json +140 -0
- package/dist/sonare-analysis.js +2 -0
- package/dist/sonare-analysis.wasm +0 -0
- package/dist/sonare.js +1 -1
- package/dist/sonare.wasm +0 -0
- package/dist/worker.d.ts +65 -0
- package/dist/worker.js +734 -0
- package/dist/worker.js.map +1 -0
- package/dist/worklet.d.ts +628 -88
- package/dist/worklet.js +1816 -266
- package/dist/worklet.js.map +1 -1
- package/package.json +23 -11
- package/src/_chain_config.ts +5 -3
- package/src/analysis.ts +137 -0
- package/src/analysis_helpers.ts +40 -29
- package/src/audio.ts +7 -2
- package/src/clip_page_streamer.ts +62 -8
- package/src/codes.ts +87 -64
- package/src/effects_mastering.ts +1 -0
- package/src/effects_transform.ts +179 -10
- package/src/errors.ts +1 -0
- package/src/feature_core.ts +140 -2
- package/src/feature_music.ts +25 -3
- package/src/feature_pitch.ts +70 -1
- package/src/feature_spectral.ts +295 -7
- package/src/feature_spectrogram.ts +203 -3
- package/src/features.ts +16 -1
- package/src/index.ts +120 -8
- package/src/mastering_chain.ts +20 -8
- package/src/mastering_core.ts +5 -0
- package/src/mastering_dynamics.ts +7 -1
- package/src/metering.ts +6 -1
- package/src/mixer.ts +3 -3
- package/src/opfs_clip_pages.ts +26 -1
- package/src/project.ts +13 -0
- package/src/project_class.ts +204 -23
- package/src/project_internal.ts +38 -34
- package/src/project_types.ts +114 -11
- package/src/public_types.ts +68 -0
- package/src/public_types_mastering.ts +22 -0
- package/src/public_types_mixing.ts +27 -2
- package/src/public_types_music.ts +9 -0
- package/src/public_types_realtime.ts +23 -5
- package/src/public_types_spectral.ts +33 -0
- package/src/quick_analysis.ts +46 -10
- package/src/realtime_engine.ts +167 -6
- package/src/realtime_voice_changer.ts +51 -77
- package/src/sonare-analysis.js.d.ts +8 -0
- package/src/sonare.js.d.ts +340 -6
- package/src/stream_analyzer.ts +6 -1
- package/src/streaming_processors.ts +15 -0
- package/src/web_midi.ts +46 -11
- package/src/worker.ts +196 -0
- package/src/worker_client.ts +352 -0
- package/src/worker_protocol.ts +59 -0
- package/src/worklet/engine-automation.ts +2 -1
- package/src/worklet/engine-capture-facade.ts +13 -4
- package/src/worklet/engine-clips.ts +12 -3
- package/src/worklet/engine-node.ts +264 -21
- package/src/worklet/engine-offline.ts +7 -2
- package/src/worklet/engine-parameter-facade.ts +55 -5
- package/src/worklet/engine-processor.ts +435 -62
- package/src/worklet/engine-register.ts +9 -1
- package/src/worklet/engine-strips.ts +19 -3
- package/src/worklet/engine-sync.ts +2 -6
- package/src/worklet/engine-tempo-facade.ts +8 -6
- package/src/worklet/engine.ts +390 -13
- package/src/worklet/guards.ts +121 -8
- package/src/worklet/messages.ts +166 -8
- package/src/worklet/protocol.ts +305 -17
- package/src/worklet/voice-changer-processor.ts +12 -15
- package/src/worklet.ts +20 -1
|
@@ -47,6 +47,7 @@ export interface EngineTransportContext {
|
|
|
47
47
|
seekSample(timelineSample: number, sampleTime?: number): boolean;
|
|
48
48
|
};
|
|
49
49
|
offlineEngine: RealtimeEngine;
|
|
50
|
+
flushOfflineMirror(): void;
|
|
50
51
|
setTransportPlaying(playing: boolean): void;
|
|
51
52
|
flushPendingInstrumentSync(): void;
|
|
52
53
|
setTempo(bpm: number): void;
|
|
@@ -74,12 +75,16 @@ export function buildTransportFacade(ctx: EngineTransportContext): SonareEngineT
|
|
|
74
75
|
},
|
|
75
76
|
seekPpq: (ppq, sampleTime = -1) => {
|
|
76
77
|
ctx.offlineEngine.seekPpq(ppq, sampleTime);
|
|
77
|
-
|
|
78
|
+
const ok = ctx.realtimeNode.seekPpq(ppq, sampleTime);
|
|
79
|
+
ctx.flushOfflineMirror();
|
|
80
|
+
return ok;
|
|
78
81
|
},
|
|
79
82
|
seekSeconds: (seconds, sampleTime = -1) => {
|
|
80
83
|
const timelineSample = Math.max(0, Math.round(seconds * ctx.sampleRate));
|
|
81
84
|
ctx.offlineEngine.seekSample(timelineSample, sampleTime);
|
|
82
|
-
|
|
85
|
+
const ok = ctx.realtimeNode.seekSample(timelineSample, sampleTime);
|
|
86
|
+
ctx.flushOfflineMirror();
|
|
87
|
+
return ok;
|
|
83
88
|
},
|
|
84
89
|
setTempo: (bpm) => ctx.setTempo(bpm),
|
|
85
90
|
setTempoSegments: (segments) => ctx.setTempoSegments(segments),
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
1
|
+
import { trackMonitorModeCode } from '../codes';
|
|
2
|
+
import type {
|
|
3
|
+
EngineAutomationPoint,
|
|
4
|
+
EngineParameterInfo,
|
|
5
|
+
EngineTrackMonitorMode,
|
|
6
|
+
RealtimeEngine,
|
|
7
|
+
} from '../index';
|
|
8
|
+
import type { SonareEngineSyncMessage } from './messages';
|
|
3
9
|
import {
|
|
4
10
|
ENGINE_MIXER_PARAM_FADER_DB,
|
|
5
11
|
ENGINE_MIXER_PARAM_PAN,
|
|
@@ -17,7 +23,15 @@ import {
|
|
|
17
23
|
*/
|
|
18
24
|
export interface EngineParameterContext {
|
|
19
25
|
readonly offlineEngine: RealtimeEngine;
|
|
20
|
-
|
|
26
|
+
sendCommand(command: {
|
|
27
|
+
type: SonareEngineCommandType;
|
|
28
|
+
targetId?: number;
|
|
29
|
+
sampleTime?: number;
|
|
30
|
+
argFloat?: number;
|
|
31
|
+
argInt?: number;
|
|
32
|
+
}): boolean;
|
|
33
|
+
postSync(message: SonareEngineSyncMessage): void;
|
|
34
|
+
readonly automationLanes: Map<number, EngineAutomationPoint[]>;
|
|
21
35
|
readonly trackLaneIds: number[];
|
|
22
36
|
resolveParamId(nodeId: string, param: string | number): number;
|
|
23
37
|
ensureTrackLane(target: string | number): number;
|
|
@@ -35,7 +49,7 @@ export function setParam(
|
|
|
35
49
|
// reflects the live value, then push a sample-accurate command to the
|
|
36
50
|
// realtime runtime (mirrors setTempo/setLoop above).
|
|
37
51
|
ctx.offlineEngine.setParameter(paramId, value);
|
|
38
|
-
return ctx.
|
|
52
|
+
return ctx.sendCommand({
|
|
39
53
|
type: SonareEngineCommandType.SetParam,
|
|
40
54
|
targetId: paramId,
|
|
41
55
|
sampleTime: -1,
|
|
@@ -51,7 +65,7 @@ export function setSoloMute(
|
|
|
51
65
|
): boolean {
|
|
52
66
|
const laneIndex = ctx.ensureTrackLane(target);
|
|
53
67
|
ctx.offlineEngine.setSoloMute(laneIndex, solo, mute);
|
|
54
|
-
return ctx.
|
|
68
|
+
return ctx.sendCommand({
|
|
55
69
|
type: SonareEngineCommandType.SetSoloMute,
|
|
56
70
|
targetId: laneIndex,
|
|
57
71
|
sampleTime: -1,
|
|
@@ -59,6 +73,29 @@ export function setSoloMute(
|
|
|
59
73
|
});
|
|
60
74
|
}
|
|
61
75
|
|
|
76
|
+
export function setTrackMonitorMode(
|
|
77
|
+
ctx: EngineParameterContext,
|
|
78
|
+
target: string | number,
|
|
79
|
+
mode: EngineTrackMonitorMode,
|
|
80
|
+
renderFrame = -1,
|
|
81
|
+
): boolean {
|
|
82
|
+
// Resolve the mode before declaring a lane or touching either engine. This
|
|
83
|
+
// keeps booleans, fractions, and unknown spellings from reaching the queue.
|
|
84
|
+
const modeOrdinal = trackMonitorModeCode(mode);
|
|
85
|
+
const laneIndex = ctx.ensureTrackLane(target);
|
|
86
|
+
ctx.offlineEngine.setTrackMonitorMode(
|
|
87
|
+
laneIndex,
|
|
88
|
+
modeOrdinal as EngineTrackMonitorMode,
|
|
89
|
+
renderFrame,
|
|
90
|
+
);
|
|
91
|
+
return ctx.sendCommand({
|
|
92
|
+
type: SonareEngineCommandType.SetTrackMonitorMode,
|
|
93
|
+
targetId: laneIndex,
|
|
94
|
+
sampleTime: renderFrame,
|
|
95
|
+
argInt: modeOrdinal,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
62
99
|
/**
|
|
63
100
|
* Returns the automation target id for a mixer strip parameter.
|
|
64
101
|
*
|
|
@@ -170,3 +207,16 @@ export function listParameters(ctx: EngineParameterContext): EngineParameterInfo
|
|
|
170
207
|
}
|
|
171
208
|
return parameters;
|
|
172
209
|
}
|
|
210
|
+
|
|
211
|
+
/** Registers a parameter on both the offline mirror and live worklet engine. */
|
|
212
|
+
export function addParameter(ctx: EngineParameterContext, info: EngineParameterInfo): void {
|
|
213
|
+
ctx.offlineEngine.addParameter(info);
|
|
214
|
+
ctx.postSync({ type: 'syncParameters', parameters: listParameters(ctx) });
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/** Clears registered parameters and their automation lanes on both engines. */
|
|
218
|
+
export function clearParameters(ctx: EngineParameterContext): void {
|
|
219
|
+
ctx.offlineEngine.clearParameters();
|
|
220
|
+
ctx.automationLanes.clear();
|
|
221
|
+
ctx.postSync({ type: 'syncParameters', parameters: [] });
|
|
222
|
+
}
|