@libraz/libsonare 1.4.1 → 1.5.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 +51 -20
- package/dist/index.d.ts +5416 -1
- package/dist/index.js +938 -583
- package/dist/index.js.map +1 -1
- package/dist/sonare.js +2 -2
- package/dist/sonare.wasm +0 -0
- package/dist/worklet.d.ts +1083 -5227
- package/dist/worklet.js +2683 -2451
- package/dist/worklet.js.map +1 -1
- package/package.json +4 -9
- package/src/clip_page_streamer.ts +298 -0
- package/src/effects_mastering.ts +85 -1089
- package/src/effects_transform.ts +286 -0
- package/src/effects_voice_change.ts +118 -0
- package/src/feature_music.ts +5 -2
- package/src/feature_spectrogram.ts +42 -2
- package/src/features.ts +1 -0
- package/src/index.ts +23 -0
- package/src/mastering_chain.ts +200 -0
- package/src/mastering_core.ts +248 -0
- package/src/mastering_dynamics.ts +105 -0
- package/src/mastering_repair.ts +161 -0
- package/src/mixer.ts +8 -0
- package/src/mixing_oneshot.ts +54 -0
- package/src/module_state.ts +1 -2
- package/src/project.ts +71 -1712
- package/src/project_class.ts +871 -0
- package/src/project_internal.ts +333 -0
- package/src/project_synth.ts +43 -0
- package/src/project_types.ts +570 -0
- package/src/public_types.ts +6 -1221
- package/src/public_types_acoustic.ts +115 -0
- package/src/public_types_mastering.ts +333 -0
- package/src/public_types_mixing.ts +97 -0
- package/src/public_types_music.ts +352 -0
- package/src/public_types_realtime.ts +163 -0
- package/src/public_types_spectral.ts +194 -0
- package/src/realtime_engine.ts +94 -0
- package/src/sonare.js.d.ts +117 -38
- package/src/stream_analyzer.ts +3 -0
- package/src/stream_types.ts +4 -0
- package/src/worklet/engine-automation.ts +73 -0
- package/src/worklet/engine-capture-facade.ts +80 -0
- package/src/worklet/engine-clips.ts +71 -0
- package/src/worklet/engine-markers.ts +93 -0
- package/src/worklet/engine-mixer-facade.ts +186 -0
- package/src/worklet/engine-node.ts +451 -0
- package/src/worklet/engine-offline.ts +162 -0
- package/src/worklet/engine-options.ts +13 -0
- package/src/worklet/engine-parameter-facade.ts +172 -0
- package/src/worklet/engine-processor.ts +764 -0
- package/src/worklet/engine-register.ts +136 -0
- package/src/worklet/engine-strips.ts +315 -0
- package/src/worklet/engine-sync.ts +94 -0
- package/src/worklet/engine-tempo-facade.ts +141 -0
- package/src/worklet/engine.ts +998 -0
- package/src/worklet/guards.ts +14 -1
- package/src/worklet/messages.ts +60 -20
- package/src/worklet/mixer-processor.ts +368 -0
- package/src/worklet/protocol.ts +3 -0
- package/src/worklet/voice-changer-processor.ts +246 -0
- package/src/worklet.ts +20 -3549
- package/dist/sonare-rt-module.js +0 -2
- package/dist/sonare-rt.js +0 -2
- package/dist/sonare-rt.wasm +0 -0
- package/src/sonare-rt.d.ts +0 -93
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import type { EngineParameterInfo, RealtimeEngine } from '../index';
|
|
2
|
+
import type { SonareRealtimeEngineNode } from './engine-node';
|
|
3
|
+
import {
|
|
4
|
+
ENGINE_MIXER_PARAM_FADER_DB,
|
|
5
|
+
ENGINE_MIXER_PARAM_PAN,
|
|
6
|
+
engineMixerBusTarget,
|
|
7
|
+
engineMixerLaneTarget,
|
|
8
|
+
engineMixerMasterTarget,
|
|
9
|
+
SonareEngineCommandType,
|
|
10
|
+
} from './protocol';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Collaborator surface the parameter / automation-id resolution helpers need
|
|
14
|
+
* from the owning {@link SonareEngine}: the offline engine they mirror into and
|
|
15
|
+
* query, the realtime node they command, the lane/bus declaration helpers, and
|
|
16
|
+
* the declared track-lane id store used to resolve insert-automation ids.
|
|
17
|
+
*/
|
|
18
|
+
export interface EngineParameterContext {
|
|
19
|
+
readonly offlineEngine: RealtimeEngine;
|
|
20
|
+
readonly realtimeNode: SonareRealtimeEngineNode;
|
|
21
|
+
readonly trackLaneIds: number[];
|
|
22
|
+
resolveParamId(nodeId: string, param: string | number): number;
|
|
23
|
+
ensureTrackLane(target: string | number): number;
|
|
24
|
+
ensureBus(busId: number): number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function setParam(
|
|
28
|
+
ctx: EngineParameterContext,
|
|
29
|
+
nodeId: string,
|
|
30
|
+
param: string | number,
|
|
31
|
+
value: number,
|
|
32
|
+
): boolean {
|
|
33
|
+
const paramId = ctx.resolveParamId(nodeId, param);
|
|
34
|
+
// Mirror the change into the offline engine so a subsequent offline render
|
|
35
|
+
// reflects the live value, then push a sample-accurate command to the
|
|
36
|
+
// realtime runtime (mirrors setTempo/setLoop above).
|
|
37
|
+
ctx.offlineEngine.setParameter(paramId, value);
|
|
38
|
+
return ctx.realtimeNode.sendCommand({
|
|
39
|
+
type: SonareEngineCommandType.SetParam,
|
|
40
|
+
targetId: paramId,
|
|
41
|
+
sampleTime: -1,
|
|
42
|
+
argFloat: value,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function setSoloMute(
|
|
47
|
+
ctx: EngineParameterContext,
|
|
48
|
+
target: string | number,
|
|
49
|
+
solo: boolean,
|
|
50
|
+
mute: boolean,
|
|
51
|
+
): boolean {
|
|
52
|
+
const laneIndex = ctx.ensureTrackLane(target);
|
|
53
|
+
ctx.offlineEngine.setSoloMute(laneIndex, solo, mute);
|
|
54
|
+
return ctx.realtimeNode.sendCommand({
|
|
55
|
+
type: SonareEngineCommandType.SetSoloMute,
|
|
56
|
+
targetId: laneIndex,
|
|
57
|
+
sampleTime: -1,
|
|
58
|
+
argInt: (mute ? 0x1 : 0) | (solo ? 0x2 : 0),
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Returns the automation target id for a mixer strip parameter.
|
|
64
|
+
*
|
|
65
|
+
* The id addresses the engine's reserved mixer namespace, so it can be fed
|
|
66
|
+
* straight to setAutomationLane to automate a fader or pan without
|
|
67
|
+
* registering a parameter.
|
|
68
|
+
*
|
|
69
|
+
* @param target Track id (declares a mixer lane on first use) or 'master'.
|
|
70
|
+
* @param kind Strip parameter to address.
|
|
71
|
+
* @returns Reserved engine parameter id for the strip parameter.
|
|
72
|
+
*/
|
|
73
|
+
export function automationParamId(
|
|
74
|
+
ctx: EngineParameterContext,
|
|
75
|
+
target: string | number,
|
|
76
|
+
kind: 'faderDb' | 'pan',
|
|
77
|
+
): number {
|
|
78
|
+
const paramKind = kind === 'pan' ? ENGINE_MIXER_PARAM_PAN : ENGINE_MIXER_PARAM_FADER_DB;
|
|
79
|
+
if (target === 'master') {
|
|
80
|
+
return engineMixerMasterTarget(paramKind);
|
|
81
|
+
}
|
|
82
|
+
return engineMixerLaneTarget(ctx.ensureTrackLane(target), paramKind);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Returns the automation target id for a bus fader.
|
|
87
|
+
*
|
|
88
|
+
* @param busId Bus id (declares the mixer bus on first use).
|
|
89
|
+
* @returns Reserved engine parameter id for the bus fader gain (dB).
|
|
90
|
+
*/
|
|
91
|
+
export function busAutomationParamId(ctx: EngineParameterContext, busId: number): number {
|
|
92
|
+
return engineMixerBusTarget(ctx.ensureBus(busId), ENGINE_MIXER_PARAM_FADER_DB);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Resolves a track-lane insert parameter (JSON-key name) to the reserved
|
|
97
|
+
* insert-automation id fed straight to setAutomationLane. Declares the track's
|
|
98
|
+
* mixer lane first (like automationParamId) so the offline engine resolves the
|
|
99
|
+
* same strip selector the realtime engine uses.
|
|
100
|
+
*
|
|
101
|
+
* @param target Track id (declares a mixer lane on first use).
|
|
102
|
+
* @param insertIndex Index into the strip's combined insert sequence.
|
|
103
|
+
* @param paramName Processor JSON-key parameter name.
|
|
104
|
+
* @returns Reserved insert-automation id, or -1 when strip/insert/key unknown.
|
|
105
|
+
*/
|
|
106
|
+
export function resolveTrackInsertAutomationId(
|
|
107
|
+
ctx: EngineParameterContext,
|
|
108
|
+
target: string | number,
|
|
109
|
+
insertIndex: number,
|
|
110
|
+
paramName: string,
|
|
111
|
+
): number {
|
|
112
|
+
const laneIndex = ctx.ensureTrackLane(target);
|
|
113
|
+
return ctx.offlineEngine.resolveTrackInsertAutomationId(
|
|
114
|
+
ctx.trackLaneIds[laneIndex],
|
|
115
|
+
insertIndex,
|
|
116
|
+
paramName,
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Resolves a master-strip insert parameter to its reserved insert-automation
|
|
122
|
+
* id.
|
|
123
|
+
*
|
|
124
|
+
* @param insertIndex Index into the master strip's insert sequence.
|
|
125
|
+
* @param paramName Processor JSON-key parameter name.
|
|
126
|
+
* @returns Reserved insert-automation id, or -1 when insert/key unknown.
|
|
127
|
+
*/
|
|
128
|
+
export function resolveMasterInsertAutomationId(
|
|
129
|
+
ctx: EngineParameterContext,
|
|
130
|
+
insertIndex: number,
|
|
131
|
+
paramName: string,
|
|
132
|
+
): number {
|
|
133
|
+
return ctx.offlineEngine.resolveMasterInsertAutomationId(insertIndex, paramName);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Resolves a bus-strip insert parameter to its reserved insert-automation id.
|
|
138
|
+
* Declares the mixer bus first so the offline engine resolves the same bus
|
|
139
|
+
* selector.
|
|
140
|
+
*
|
|
141
|
+
* @param busId Bus id (declares the mixer bus on first use).
|
|
142
|
+
* @param insertIndex Index into the bus strip's insert sequence.
|
|
143
|
+
* @param paramName Processor JSON-key parameter name.
|
|
144
|
+
* @returns Reserved insert-automation id, or -1 when bus/insert/key unknown.
|
|
145
|
+
*/
|
|
146
|
+
export function resolveBusInsertAutomationId(
|
|
147
|
+
ctx: EngineParameterContext,
|
|
148
|
+
busId: number,
|
|
149
|
+
insertIndex: number,
|
|
150
|
+
paramName: string,
|
|
151
|
+
): number {
|
|
152
|
+
ctx.ensureBus(busId);
|
|
153
|
+
return ctx.offlineEngine.resolveBusInsertAutomationId(busId, insertIndex, paramName);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Returns the number of automation lanes installed on the engine, including
|
|
158
|
+
* lanes whose breakpoint list is currently empty.
|
|
159
|
+
*
|
|
160
|
+
* @returns Engine-side automation lane count.
|
|
161
|
+
*/
|
|
162
|
+
export function automationLaneCount(ctx: EngineParameterContext): number {
|
|
163
|
+
return ctx.offlineEngine.automationLaneCount();
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export function listParameters(ctx: EngineParameterContext): EngineParameterInfo[] {
|
|
167
|
+
const parameters: EngineParameterInfo[] = [];
|
|
168
|
+
for (let index = 0; index < ctx.offlineEngine.parameterCount(); index++) {
|
|
169
|
+
parameters.push(ctx.offlineEngine.parameterInfoByIndex(index));
|
|
170
|
+
}
|
|
171
|
+
return parameters;
|
|
172
|
+
}
|