@hyperframes/studio 0.7.107 → 0.7.108
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/dist/assets/{hyperframes-player-BLrfwq5o.js → hyperframes-player-QqavTWRK.js} +1 -1
- package/dist/assets/{index-BA9yhzfR.js → index-BQjXA1pz.js} +1 -1
- package/dist/assets/{index-BSBk5srs.js → index-BhHHMprP.js} +1 -1
- package/dist/assets/index-DNkh9mbV.css +1 -0
- package/dist/assets/index-GqONLcOl.js +428 -0
- package/dist/index.d.ts +85 -2
- package/dist/index.html +2 -2
- package/dist/index.js +17696 -12512
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/components/StudioRightPanel.tsx +18 -1
- package/src/components/TimelineToolbar.test.tsx +46 -0
- package/src/components/TimelineToolbar.tsx +17 -0
- package/src/components/editor/PropertyPanel.test.tsx +5 -1
- package/src/components/editor/PropertyPanel.tsx +7 -23
- package/src/components/editor/PropertyPanelFlat.tsx +25 -0
- package/src/components/editor/audioFxSummary.test.ts +75 -0
- package/src/components/editor/audioFxSummary.ts +36 -0
- package/src/components/editor/audioFxTelemetry.test.ts +129 -0
- package/src/components/editor/audioFxTelemetry.ts +230 -0
- package/src/components/editor/propertyPanelAudioFxGroup.test.tsx +1830 -0
- package/src/components/editor/propertyPanelAudioFxGroup.tsx +299 -0
- package/src/components/editor/propertyPanelAudioFxGroupUtils.ts +21 -0
- package/src/components/editor/propertyPanelAutomation.test.ts +60 -0
- package/src/components/editor/propertyPanelAutomation.ts +97 -0
- package/src/components/editor/propertyPanelFlatMediaSection.tsx +37 -9
- package/src/components/editor/propertyPanelFlatProps.ts +1 -0
- package/src/components/editor/propertyPanelFxAddMenu.tsx +209 -0
- package/src/components/editor/propertyPanelFxBandRuler.tsx +72 -0
- package/src/components/editor/propertyPanelFxCarveModule.tsx +382 -0
- package/src/components/editor/propertyPanelFxControls.test.tsx +115 -0
- package/src/components/editor/propertyPanelFxControls.tsx +356 -0
- package/src/components/editor/propertyPanelFxEqModule.tsx +196 -0
- package/src/components/editor/propertyPanelFxFamily.ts +83 -0
- package/src/components/editor/propertyPanelFxNodeOpenBody.tsx +269 -0
- package/src/components/editor/propertyPanelFxNodeParams.tsx +112 -0
- package/src/components/editor/propertyPanelFxNodeRow.tsx +339 -0
- package/src/components/editor/propertyPanelFxPresetMenu.tsx +159 -0
- package/src/components/editor/propertyPanelFxPresetRun.tsx +215 -0
- package/src/components/editor/propertyPanelFxPresetStyle.test.ts +142 -0
- package/src/components/editor/propertyPanelFxPresetStyle.ts +216 -0
- package/src/components/editor/propertyPanelFxRackChain.tsx +202 -0
- package/src/components/editor/propertyPanelFxSection.test.tsx +1747 -0
- package/src/components/editor/propertyPanelFxSection.tsx +550 -0
- package/src/components/editor/propertyPanelFxSectionTypes.ts +91 -0
- package/src/components/editor/propertyPanelTypes.ts +5 -0
- package/src/components/editor/useFxAudition.ts +95 -0
- package/src/components/editor/useFxCarve.ts +0 -0
- package/src/components/editor/useFxChainObserved.ts +83 -0
- package/src/components/editor/useFxLevelling.ts +235 -0
- package/src/components/editor/useVolumeAutomation.test.tsx +122 -0
- package/src/components/editor/useVolumeAutomation.ts +54 -0
- package/src/contexts/DomEditContext.tsx +11 -0
- package/src/hooks/useAppHotkeys.test.ts +198 -0
- package/src/hooks/useAppHotkeys.ts +30 -3
- package/src/hooks/useAutomationSelectionKeyboard.test.tsx +429 -0
- package/src/hooks/useAutomationSelectionKeyboard.ts +371 -0
- package/src/hooks/useDomEditAttributeCommits.ts +90 -10
- package/src/hooks/useDomEditCommits.test.tsx +38 -0
- package/src/hooks/useDomEditCommits.ts +2 -0
- package/src/hooks/useDomEditSession.ts +2 -0
- package/src/hooks/useDomEditTextCommits.ts +2 -0
- package/src/hooks/useElementLifecycleOps.ts +3 -0
- package/src/hooks/useLivePlayheadTime.ts +49 -0
- package/src/hooks/usePreviewPersistence.ts +7 -0
- package/src/hooks/useTimelineEditing.ts +3 -0
- package/src/player/components/AutomationSelectionMenu.tsx +76 -0
- package/src/player/components/AutomationValueInput.tsx +51 -0
- package/src/player/components/LayerDisclosureRow.tsx +5 -4
- package/src/player/components/Timeline.test.ts +84 -0
- package/src/player/components/TimelineAutomationLane.test.tsx +1720 -0
- package/src/player/components/TimelineAutomationLane.tsx +674 -0
- package/src/player/components/TimelineAutomationLaneSlot.test.tsx +193 -0
- package/src/player/components/TimelineLanes.test.tsx +24 -5
- package/src/player/components/TimelineLanes.tsx +142 -154
- package/src/player/components/TimelineTrackHeader.test.tsx +212 -1
- package/src/player/components/TimelineTrackHeader.tsx +166 -6
- package/src/player/components/TimelineTrackRow.tsx +8 -1
- package/src/player/components/automationClipboard.test.ts +94 -0
- package/src/player/components/automationClipboard.ts +136 -0
- package/src/player/components/automationGestureKeys.test.ts +49 -0
- package/src/player/components/automationGestureKeys.ts +49 -0
- package/src/player/components/automationLaneData.test.ts +270 -0
- package/src/player/components/automationLaneData.ts +258 -0
- package/src/player/components/automationLaneDragMath.ts +194 -0
- package/src/player/components/automationLaneGeometry.test.ts +239 -0
- package/src/player/components/automationLaneGeometry.ts +287 -0
- package/src/player/components/automationLaneHeight.ts +15 -0
- package/src/player/components/automationLanePointer.ts +20 -0
- package/src/player/components/automationLaneSelection.test.ts +183 -0
- package/src/player/components/automationLaneSelection.ts +135 -0
- package/src/player/components/automationShapes.test.ts +82 -0
- package/src/player/components/automationShapes.ts +70 -0
- package/src/player/components/automationSimplify.test.ts +48 -0
- package/src/player/components/automationSimplify.ts +51 -0
- package/src/player/components/timelineClipGestureHandlers.ts +223 -0
- package/src/player/components/timelineLaneProps.ts +19 -0
- package/src/player/components/timelineLayout.ts +11 -5
- package/src/player/components/useAutomationEdgeStretch.test.ts +27 -0
- package/src/player/components/useAutomationEdgeStretch.ts +269 -0
- package/src/player/components/useAutomationLaneGestures.ts +537 -0
- package/src/player/components/useAutomationLanes.test.tsx +112 -0
- package/src/player/components/useAutomationLanes.ts +170 -0
- package/src/player/components/useAutomationRangeDrag.ts +114 -0
- package/src/player/components/useTimelineTrackLayout.test.ts +107 -1
- package/src/player/components/useTimelineTrackLayout.ts +83 -7
- package/src/player/hooks/useExpandedTimelineElements.ts +7 -0
- package/src/player/hooks/useTimelinePlayer.ts +13 -1
- package/src/player/lib/automationStoreSync.test.ts +83 -0
- package/src/player/lib/automationStoreSync.ts +56 -0
- package/src/player/lib/timelineDOM.test.ts +33 -0
- package/src/player/lib/timelineDOM.ts +12 -0
- package/src/player/store/automationSelectionSlice.test.ts +30 -0
- package/src/player/store/automationSelectionSlice.ts +54 -0
- package/src/player/store/playerStore.test.ts +15 -0
- package/src/player/store/playerStore.ts +54 -65
- package/src/player/store/timelineElement.ts +78 -0
- package/src/styles/studio.css +89 -0
- package/src/telemetry/agentRuntime.test.ts +45 -0
- package/src/telemetry/agentRuntime.ts +62 -0
- package/src/telemetry/system.ts +8 -0
- package/src/utils/studioFileHistory.test.ts +49 -0
- package/src/utils/studioFileHistory.ts +17 -1
- package/src/utils/studioTelemetry.ts +16 -10
- package/dist/assets/index-dF-CmLZu.js +0 -428
- package/dist/assets/index-zQ4JFwwB.css +0 -1
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The add-effect shelf: Tone, the composite jobs, and the raw registry.
|
|
3
|
+
*
|
|
4
|
+
* Split out of `propertyPanelFxSection.tsx`'s `{adding ? (...) : null}` block —
|
|
5
|
+
* the section owns the audition/chain plumbing this shelf drives, and passes it
|
|
6
|
+
* straight through.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
getAudioFxDef,
|
|
11
|
+
HF_AUDIO_FX,
|
|
12
|
+
type HfAudioFxChain,
|
|
13
|
+
type HfAudioFxGroup,
|
|
14
|
+
} from "@hyperframes/core/audio-fx";
|
|
15
|
+
import {
|
|
16
|
+
HF_AUDIO_FX_JOBS,
|
|
17
|
+
HF_AUDIO_FX_JOB_TYPES,
|
|
18
|
+
type HfAudioFxJob,
|
|
19
|
+
} from "@hyperframes/core/audio-fx-jobs";
|
|
20
|
+
import { EFFECT_COPY } from "@hyperframes/core/audio-fx-copy";
|
|
21
|
+
|
|
22
|
+
const GROUP_ORDER: HfAudioFxGroup[] = ["filter", "dynamics", "nonlinear", "time"];
|
|
23
|
+
const GROUP_LABEL: Record<HfAudioFxGroup, string> = {
|
|
24
|
+
filter: "Filters",
|
|
25
|
+
dynamics: "Dynamics",
|
|
26
|
+
nonlinear: "Non-linear",
|
|
27
|
+
time: "Time",
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The add menu, with the jobs standing in for the effect they are made of.
|
|
32
|
+
*
|
|
33
|
+
* `peaking` is not offered as itself: picking it is picking a machine and
|
|
34
|
+
* leaving the real decision — which range — for afterwards. The jobs are that
|
|
35
|
+
* decision, already made. See `audioFxJobs.ts`.
|
|
36
|
+
*
|
|
37
|
+
* Computed once at module scope, not per render: it has no dependency on props
|
|
38
|
+
* or state, just the static effect registry.
|
|
39
|
+
*/
|
|
40
|
+
const GROUPED = GROUP_ORDER.map((g) => ({
|
|
41
|
+
group: g,
|
|
42
|
+
defs: HF_AUDIO_FX.filter((d) => d.group === g && !HF_AUDIO_FX_JOB_TYPES.has(d.id)),
|
|
43
|
+
jobs: HF_AUDIO_FX_JOBS.filter((job) => getAudioFxDef(job.type)?.group === g),
|
|
44
|
+
}));
|
|
45
|
+
|
|
46
|
+
export interface FxAddMenuProps {
|
|
47
|
+
disabled?: boolean;
|
|
48
|
+
analysing?: boolean;
|
|
49
|
+
levelled?: boolean;
|
|
50
|
+
auditioningLevel?: boolean;
|
|
51
|
+
/** Measure this track and write the levelling lane. Absent when unavailable. */
|
|
52
|
+
onLevel?(): void;
|
|
53
|
+
/** Take the levelling stage and its lane back out. */
|
|
54
|
+
onRemoveLevel?(): void;
|
|
55
|
+
onEq(): void;
|
|
56
|
+
onJob(job: HfAudioFxJob): void;
|
|
57
|
+
onEffect(type: string): void;
|
|
58
|
+
/** The shelf just picked something, or the levelling button did its own close. */
|
|
59
|
+
onClose(): void;
|
|
60
|
+
/** Play a hypothetical chain without committing to it, or `null` to stop. */
|
|
61
|
+
audition(make: ((base: HfAudioFxChain) => HfAudioFxChain) | null): void;
|
|
62
|
+
onAuditionLevel?(on: boolean): void;
|
|
63
|
+
withJob(base: HfAudioFxChain, job: HfAudioFxJob): HfAudioFxChain;
|
|
64
|
+
withEffect(base: HfAudioFxChain, type: string): HfAudioFxChain;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** The shelf `adding` opens: Tone, the named jobs, and the raw effect registry. */
|
|
68
|
+
export function FxAddMenu({
|
|
69
|
+
disabled,
|
|
70
|
+
analysing,
|
|
71
|
+
levelled,
|
|
72
|
+
auditioningLevel,
|
|
73
|
+
onLevel,
|
|
74
|
+
onRemoveLevel,
|
|
75
|
+
onEq,
|
|
76
|
+
onJob,
|
|
77
|
+
onEffect,
|
|
78
|
+
onClose,
|
|
79
|
+
audition,
|
|
80
|
+
onAuditionLevel,
|
|
81
|
+
withJob,
|
|
82
|
+
withEffect,
|
|
83
|
+
}: FxAddMenuProps) {
|
|
84
|
+
return (
|
|
85
|
+
<div
|
|
86
|
+
className="hf-fx-add-menu space-y-1.5 rounded-[4px] border border-panel-border-input p-1.5"
|
|
87
|
+
// On the shelf, not on each button: moving between two of them passes
|
|
88
|
+
// through the gap, and a per-button leave would revert on the way.
|
|
89
|
+
onMouseLeave={() => {
|
|
90
|
+
audition(null);
|
|
91
|
+
onAuditionLevel?.(false);
|
|
92
|
+
}}
|
|
93
|
+
// The keyboard's version of leaving. Tabbing between two entries fires
|
|
94
|
+
// this and then the next one's focus, so it reverts and re-auditions.
|
|
95
|
+
onBlur={() => {
|
|
96
|
+
audition(null);
|
|
97
|
+
onAuditionLevel?.(false);
|
|
98
|
+
}}
|
|
99
|
+
>
|
|
100
|
+
<div className="hf-fx-add-group flex flex-wrap items-center gap-1">
|
|
101
|
+
<span className="hf-fx-add-group-label w-full font-mono text-[9px] uppercase tracking-wide text-panel-text-2">
|
|
102
|
+
Tone
|
|
103
|
+
</span>
|
|
104
|
+
{onLevel ? (
|
|
105
|
+
<button
|
|
106
|
+
type="button"
|
|
107
|
+
className="hf-fx-add-composite rounded-[3px] bg-panel-surface px-1.5 py-0.5 text-[10px] text-panel-text-1 hover:text-panel-text-0"
|
|
108
|
+
title="Listen to this track and even out its loud and quiet parts."
|
|
109
|
+
disabled={disabled || analysing}
|
|
110
|
+
onClick={() => {
|
|
111
|
+
if (levelled) onRemoveLevel?.();
|
|
112
|
+
else onLevel();
|
|
113
|
+
onClose();
|
|
114
|
+
}}
|
|
115
|
+
// The one module here that cannot answer instantly: it has to
|
|
116
|
+
// decode the track and measure it before there is anything to
|
|
117
|
+
// hear. So it says it is working rather than doing nothing
|
|
118
|
+
// visible, and whoever handles this must drop a result that
|
|
119
|
+
// arrives after the pointer has gone.
|
|
120
|
+
onMouseEnter={
|
|
121
|
+
levelled
|
|
122
|
+
? undefined
|
|
123
|
+
: () => {
|
|
124
|
+
audition(null);
|
|
125
|
+
onAuditionLevel?.(true);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
onFocus={levelled ? undefined : () => onAuditionLevel?.(true)}
|
|
129
|
+
>
|
|
130
|
+
{levelled ? "Remove levelling" : "Even Out Levels"}
|
|
131
|
+
{auditioningLevel ? <span className="hf-fx-add-working"> measuring…</span> : null}
|
|
132
|
+
</button>
|
|
133
|
+
) : null}
|
|
134
|
+
<button
|
|
135
|
+
type="button"
|
|
136
|
+
// Not hf-fx-add-item: Tone is a composite over several filters, not
|
|
137
|
+
// an entry in the effect registry, and a count of the registry must
|
|
138
|
+
// not include it.
|
|
139
|
+
className="hf-fx-add-composite rounded-[3px] bg-panel-surface px-1.5 py-0.5 text-[10px] text-panel-text-1 hover:text-panel-text-0"
|
|
140
|
+
title="Bass, middle and treble on one set of faders."
|
|
141
|
+
// No audition of its own: a Tone module arrives with every band at
|
|
142
|
+
// 0 dB, so there is nothing to hear until a fader moves, and a hover
|
|
143
|
+
// that changes nothing teaches that hovering does nothing. It still
|
|
144
|
+
// has to call the neighbours' auditions off.
|
|
145
|
+
onMouseEnter={() => {
|
|
146
|
+
audition(null);
|
|
147
|
+
onAuditionLevel?.(false);
|
|
148
|
+
}}
|
|
149
|
+
onClick={onEq}
|
|
150
|
+
>
|
|
151
|
+
Tone (EQ)
|
|
152
|
+
</button>
|
|
153
|
+
</div>
|
|
154
|
+
{GROUPED.map(({ group, defs, jobs }) => (
|
|
155
|
+
<div key={group} className="hf-fx-add-group flex flex-wrap items-center gap-1">
|
|
156
|
+
<span className="hf-fx-add-group-label w-full font-mono text-[9px] uppercase tracking-wide text-panel-text-2">
|
|
157
|
+
{GROUP_LABEL[group]}
|
|
158
|
+
</span>
|
|
159
|
+
{jobs.map((job) => (
|
|
160
|
+
<button
|
|
161
|
+
key={job.id}
|
|
162
|
+
type="button"
|
|
163
|
+
// Same class as any other entry: a job IS an effect, and one
|
|
164
|
+
// that looked special would read as a preset rather than as the
|
|
165
|
+
// thing the author is about to add.
|
|
166
|
+
className="hf-fx-add-item rounded-[3px] bg-panel-surface px-1.5 py-0.5 text-[10px] text-panel-text-1 hover:text-panel-text-0"
|
|
167
|
+
title={job.does}
|
|
168
|
+
onClick={() => onJob(job)}
|
|
169
|
+
onMouseEnter={() => {
|
|
170
|
+
onAuditionLevel?.(false);
|
|
171
|
+
audition((base) => withJob(base, job));
|
|
172
|
+
}}
|
|
173
|
+
onFocus={() => audition((base) => withJob(base, job))}
|
|
174
|
+
>
|
|
175
|
+
{job.label}
|
|
176
|
+
</button>
|
|
177
|
+
))}
|
|
178
|
+
{defs.map((d) => (
|
|
179
|
+
<button
|
|
180
|
+
key={d.id}
|
|
181
|
+
type="button"
|
|
182
|
+
className="hf-fx-add-item rounded-[3px] bg-panel-surface px-1.5 py-0.5 text-[10px] text-panel-text-1 hover:text-panel-text-0"
|
|
183
|
+
// The menu that adds it has to call it what the rack will call
|
|
184
|
+
// it, or the author picks "High-pass" and a module named
|
|
185
|
+
// "Remove Rumble" appears. The registry's own description stays
|
|
186
|
+
// as the tooltip beside the plain one: the mechanism is taught
|
|
187
|
+
// here rather than withheld.
|
|
188
|
+
title={EFFECT_COPY[d.id] ? `${EFFECT_COPY[d.id]?.does} (${d.label})` : d.description}
|
|
189
|
+
onClick={() => onEffect(d.id)}
|
|
190
|
+
// Cancels the levelling audition as well as starting its own.
|
|
191
|
+
// The shelf's leave handler only fires on the way OUT of the
|
|
192
|
+
// menu, so sliding from Even Out Levels straight to here left a
|
|
193
|
+
// measurement in flight — and it landed on top of this one, a
|
|
194
|
+
// levelled version of the chain as it was, written through a
|
|
195
|
+
// channel the document never sees.
|
|
196
|
+
onMouseEnter={() => {
|
|
197
|
+
onAuditionLevel?.(false);
|
|
198
|
+
audition((base) => withEffect(base, d.id));
|
|
199
|
+
}}
|
|
200
|
+
onFocus={() => audition((base) => withEffect(base, d.id))}
|
|
201
|
+
>
|
|
202
|
+
{EFFECT_COPY[d.id]?.title ?? d.label}
|
|
203
|
+
</button>
|
|
204
|
+
))}
|
|
205
|
+
</div>
|
|
206
|
+
))}
|
|
207
|
+
</div>
|
|
208
|
+
);
|
|
209
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shared frequency ruler.
|
|
3
|
+
*
|
|
4
|
+
* Frequencies mean nothing to somebody who has not been taught them, and the
|
|
5
|
+
* rack speaks entirely in them. `BANDS` names the ranges in the words the same
|
|
6
|
+
* person would use unprompted — rumble, weight, mud, middle, presence, edge,
|
|
7
|
+
* air — and every spectral module shows where it acts on this one ruler, so
|
|
8
|
+
* naming them once teaches them everywhere they appear.
|
|
9
|
+
*
|
|
10
|
+
* Two things at once, deliberately. The bar says where this module works
|
|
11
|
+
* relative to everything else, which is the spatial fact; the caption under it
|
|
12
|
+
* names the range and what lives there, which is the vocabulary. A bar alone
|
|
13
|
+
* would be decoration and a caption alone would not teach the shape.
|
|
14
|
+
*
|
|
15
|
+
* Log-spaced, because hearing is: 20–200 Hz is as much of the range to an ear as
|
|
16
|
+
* 2–20 kHz, and a linear ruler would crush six of the seven bands into a corner.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { audioBandAt, BANDS } from "@hyperframes/core/audio-fx-copy";
|
|
20
|
+
|
|
21
|
+
const LOW = BANDS[0]?.from ?? 20;
|
|
22
|
+
const HIGH = BANDS.at(-1)?.to ?? 20000;
|
|
23
|
+
|
|
24
|
+
/** Where a frequency sits across the ruler, 0..1. */
|
|
25
|
+
function positionOf(hz: number): number {
|
|
26
|
+
const span = Math.log10(HIGH) - Math.log10(LOW);
|
|
27
|
+
const at = (Math.log10(Math.min(HIGH, Math.max(LOW, hz))) - Math.log10(LOW)) / span;
|
|
28
|
+
return Math.min(1, Math.max(0, at));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface FxBandRulerProps {
|
|
32
|
+
/** The range this effect can act over, from its copy. */
|
|
33
|
+
band: readonly [number, number];
|
|
34
|
+
/** Where it is acting right now. */
|
|
35
|
+
at: number;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function FxBandRuler({ band, at }: FxBandRulerProps) {
|
|
39
|
+
const here = audioBandAt(at);
|
|
40
|
+
if (!here) return null;
|
|
41
|
+
const [from, to] = band;
|
|
42
|
+
return (
|
|
43
|
+
<div className="hf-fx-ruler px-1.5 pb-1" data-band={here.name}>
|
|
44
|
+
<div className="hf-fx-ruler-bar relative flex h-1 w-full overflow-hidden rounded-[1px]">
|
|
45
|
+
{BANDS.map((range) => {
|
|
46
|
+
// Reachable at all, and where it is now: a module that can only work in
|
|
47
|
+
// the bottom three bands should not look like it could move anywhere.
|
|
48
|
+
const reachable = range.to > from && range.from < to;
|
|
49
|
+
return (
|
|
50
|
+
<span
|
|
51
|
+
key={range.name}
|
|
52
|
+
title={`${range.name} — ${range.says}`}
|
|
53
|
+
className={
|
|
54
|
+
range.name === here.name
|
|
55
|
+
? "hf-fx-ruler-band bg-panel-accent"
|
|
56
|
+
: reachable
|
|
57
|
+
? "hf-fx-ruler-band bg-panel-text-4/50"
|
|
58
|
+
: "hf-fx-ruler-band bg-panel-text-4/15"
|
|
59
|
+
}
|
|
60
|
+
style={{
|
|
61
|
+
width: `${(positionOf(range.to) - positionOf(range.from)) * 100}%`,
|
|
62
|
+
}}
|
|
63
|
+
/>
|
|
64
|
+
);
|
|
65
|
+
})}
|
|
66
|
+
</div>
|
|
67
|
+
<p className="hf-fx-ruler-label truncate pt-0.5 text-[9px] text-panel-text-2">
|
|
68
|
+
<span className="hf-fx-ruler-name text-panel-text-1">{here.name}</span> — {here.says}
|
|
69
|
+
</p>
|
|
70
|
+
</div>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The voiceover carve, as one module in the FX rack.
|
|
3
|
+
*
|
|
4
|
+
* Carve is deliberately not an entry in the chain. It is a relationship between
|
|
5
|
+
* two tracks — it analyses a voice and dips *this* bed where that voice sits —
|
|
6
|
+
* so it gets its own card with a source picker, the way a sidechain control
|
|
7
|
+
* lives on the track being processed. What it produces is an ordinary chain of
|
|
8
|
+
* peaking filters, so it composes with whatever else is on the track.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
defaultAudioFxParams,
|
|
13
|
+
getAudioFxDef,
|
|
14
|
+
type HfAudioFxNode,
|
|
15
|
+
type HfAudioFxParam,
|
|
16
|
+
} from "@hyperframes/core/audio-fx";
|
|
17
|
+
import { DEFAULT_CARVE, type HfCarveSettings } from "@hyperframes/core/audio-carve";
|
|
18
|
+
import { fxAutomationTarget } from "@hyperframes/core/audio-automation";
|
|
19
|
+
import { FxParamRow } from "./propertyPanelFxControls.js";
|
|
20
|
+
import { FX_FAMILY_TYPE, fxFamilyTint } from "./propertyPanelFxFamily.js";
|
|
21
|
+
import { fxTintWash } from "./propertyPanelFxPresetStyle.js";
|
|
22
|
+
// Shared with the timeline's lane labels: a band is named by its frequency in
|
|
23
|
+
// both places, and two formatters would drift.
|
|
24
|
+
import { formatHz } from "../../player/components/automationLaneData";
|
|
25
|
+
|
|
26
|
+
export interface AudioTrackOption {
|
|
27
|
+
id: string;
|
|
28
|
+
label: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** What one effect inside the module is called: its own name, plus the band. */
|
|
32
|
+
function carveMemberName(node: HfAudioFxNode): string {
|
|
33
|
+
const def = getAudioFxDef(node.type);
|
|
34
|
+
const freq = node.params?.["frequency"];
|
|
35
|
+
const label = def?.label ?? node.type;
|
|
36
|
+
return typeof freq === "number" ? `${label} ${formatHz(freq)}` : label;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** A parameter's value as the rack shows it: rounded to the step, with its unit. */
|
|
40
|
+
function formatParamValue(param: HfAudioFxParam, raw: number | string | undefined): string {
|
|
41
|
+
if (param.kind !== "number" || typeof raw !== "number") return String(raw ?? "");
|
|
42
|
+
const places = param.step >= 1 ? 0 : param.step >= 0.1 ? 1 : 2;
|
|
43
|
+
return `${Number(raw.toFixed(places))}${param.unit ? ` ${param.unit}` : ""}`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Width to reserve for a parameter's value, in characters.
|
|
48
|
+
*
|
|
49
|
+
* Derived from what the parameter CAN read rather than what it currently reads, so
|
|
50
|
+
* the column never moves: an automated value updates 30 times a second, and
|
|
51
|
+
* `-1 dB` is two characters narrower than `-3.2 dB`, which was enough to shunt
|
|
52
|
+
* everything after it sideways on every frame. `ch` is exact here because the
|
|
53
|
+
* readouts are monospace and already `tabular-nums`.
|
|
54
|
+
*/
|
|
55
|
+
function paramValueWidthCh(param: HfAudioFxParam): number {
|
|
56
|
+
if (param.kind === "enum") {
|
|
57
|
+
return Math.max(1, ...param.options.map((option) => option.value.length));
|
|
58
|
+
}
|
|
59
|
+
const places = param.step >= 1 ? 0 : param.step >= 0.1 ? 1 : 2;
|
|
60
|
+
const digits = Math.max(
|
|
61
|
+
String(Math.floor(Math.abs(param.min))).length,
|
|
62
|
+
String(Math.floor(Math.abs(param.max))).length,
|
|
63
|
+
);
|
|
64
|
+
const sign = param.min < 0 ? 1 : 0;
|
|
65
|
+
const decimals = places > 0 ? places + 1 : 0;
|
|
66
|
+
const unit = param.unit ? param.unit.length + 1 : 0;
|
|
67
|
+
return sign + digits + decimals + unit;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** One member of the module: what it is, and what every knob is set to. */
|
|
71
|
+
function FxCarveMember({
|
|
72
|
+
node,
|
|
73
|
+
automatedTargets,
|
|
74
|
+
liveAutomationValues,
|
|
75
|
+
}: {
|
|
76
|
+
node: HfAudioFxNode;
|
|
77
|
+
automatedTargets?: ReadonlySet<string>;
|
|
78
|
+
liveAutomationValues?: ReadonlyMap<string, number>;
|
|
79
|
+
}) {
|
|
80
|
+
const def = getAudioFxDef(node.type);
|
|
81
|
+
if (!def) return null;
|
|
82
|
+
const params = node.params ?? defaultAudioFxParams(node.type);
|
|
83
|
+
return (
|
|
84
|
+
<div className="hf-fx-carve-member flex flex-col gap-0.5 py-1 pl-3 pr-1.5">
|
|
85
|
+
<span className="hf-fx-carve-member-name truncate font-mono text-[9px] text-panel-text-1">
|
|
86
|
+
{carveMemberName(node)}
|
|
87
|
+
</span>
|
|
88
|
+
<div className="flex flex-wrap gap-x-3 gap-y-0.5">
|
|
89
|
+
{def.params.map((param) => {
|
|
90
|
+
const target = node.id ? fxAutomationTarget(node.id, param.key) : null;
|
|
91
|
+
const automated = Boolean(target && automatedTargets?.has(target));
|
|
92
|
+
// The envelope's value at the playhead when there is one, which is what
|
|
93
|
+
// the audio is using; the stored number is only the seed behind it.
|
|
94
|
+
const live = target ? liveAutomationValues?.get(target) : undefined;
|
|
95
|
+
const driven = automated && live !== undefined;
|
|
96
|
+
const value = formatParamValue(param, driven ? live : params[param.key]);
|
|
97
|
+
return (
|
|
98
|
+
<span
|
|
99
|
+
key={param.key}
|
|
100
|
+
className="flex items-baseline gap-1 font-mono text-[9px] text-panel-text-2"
|
|
101
|
+
{...(automated ? { "data-automated": "" } : {})}
|
|
102
|
+
{...(driven ? { "data-automation-live": "" } : {})}
|
|
103
|
+
>
|
|
104
|
+
<span className="text-panel-text-2">{param.label}</span>
|
|
105
|
+
<span
|
|
106
|
+
className="tabular-nums text-panel-text-1"
|
|
107
|
+
style={{ minWidth: `${paramValueWidthCh(param)}ch` }}
|
|
108
|
+
>
|
|
109
|
+
{value}
|
|
110
|
+
</span>
|
|
111
|
+
{/* The lane is where an automated value comes from, and where it is
|
|
112
|
+
edited — saying so is the difference between a stale readout and
|
|
113
|
+
a pointer to the thing that owns it. */}
|
|
114
|
+
{automated ? <span className="text-[#3CE6AC]">A</span> : null}
|
|
115
|
+
</span>
|
|
116
|
+
);
|
|
117
|
+
})}
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* The carve, as one module in the rack.
|
|
125
|
+
*
|
|
126
|
+
* A carve is one thing the author switched on; the peaking filters and the level
|
|
127
|
+
* stage are how it is built. Listed individually they read as hand-built effects —
|
|
128
|
+
* removable one at a time, reorderable, each with knobs the next strength change
|
|
129
|
+
* silently overwrites. So the rack shows the unit, and the unit owns everything
|
|
130
|
+
* that means anything for it: which voice it listens to, how hard it works,
|
|
131
|
+
* whether it follows that voice, and what the analysis made of it.
|
|
132
|
+
*
|
|
133
|
+
* The controls used to sit in their own block under the rack, which read as a
|
|
134
|
+
* second, unrelated feature that happened to produce effects somewhere else. One
|
|
135
|
+
* card, controls above the analysis they drive, is the same thing said once.
|
|
136
|
+
*
|
|
137
|
+
* Grouped is not hidden. Opening it lists every effect inside with all of its
|
|
138
|
+
* settings, because an author has to be able to see where the analysis landed — as
|
|
139
|
+
* readouts rather than controls, since strength is what sets them and a knob here
|
|
140
|
+
* would be overwritten by the next adjustment.
|
|
141
|
+
*/
|
|
142
|
+
export function FxCarveModule({
|
|
143
|
+
nodes,
|
|
144
|
+
carve,
|
|
145
|
+
sourceOptions,
|
|
146
|
+
automatedTargets,
|
|
147
|
+
liveAutomationValues,
|
|
148
|
+
open,
|
|
149
|
+
disabled,
|
|
150
|
+
analysing,
|
|
151
|
+
onToggleOpen,
|
|
152
|
+
onCarveChange,
|
|
153
|
+
onCarvePreview,
|
|
154
|
+
}: {
|
|
155
|
+
nodes: HfAudioFxNode[];
|
|
156
|
+
carve: HfCarveSettings;
|
|
157
|
+
sourceOptions: AudioTrackOption[];
|
|
158
|
+
automatedTargets?: ReadonlySet<string>;
|
|
159
|
+
liveAutomationValues?: ReadonlyMap<string, number>;
|
|
160
|
+
open: boolean;
|
|
161
|
+
disabled?: boolean;
|
|
162
|
+
analysing?: boolean;
|
|
163
|
+
onToggleOpen(): void;
|
|
164
|
+
onCarveChange(carve: HfCarveSettings): void;
|
|
165
|
+
onCarvePreview(carve: HfCarveSettings): void;
|
|
166
|
+
}) {
|
|
167
|
+
const bands = nodes.filter((n) => n.type === "peaking").length;
|
|
168
|
+
const hasLevel = nodes.some((n) => n.type === "gain");
|
|
169
|
+
const on = carve.enabled;
|
|
170
|
+
/**
|
|
171
|
+
* The only track this bed could be listening to, when there is exactly one.
|
|
172
|
+
*
|
|
173
|
+
* A picker with one entry is a question with one answer: it asks the author to
|
|
174
|
+
* confirm something already decided. So the voice reads out instead.
|
|
175
|
+
*
|
|
176
|
+
* Not when the stored source is some OTHER track, though — a name that no longer
|
|
177
|
+
* classifies as a voice, or a track since renamed. Reading out the one remaining
|
|
178
|
+
* candidate there would quietly claim the carve listens to something it does not,
|
|
179
|
+
* so the picker comes back and shows the mismatch.
|
|
180
|
+
*/
|
|
181
|
+
const soleVoice =
|
|
182
|
+
sourceOptions.length === 1 &&
|
|
183
|
+
(carve.sources.length === 0 ||
|
|
184
|
+
(carve.sources.length === 1 && carve.sources[0] === sourceOptions[0]?.id))
|
|
185
|
+
? sourceOptions[0]
|
|
186
|
+
: null;
|
|
187
|
+
// What the module is worth right now, in the head, so a collapsed card still
|
|
188
|
+
// says whether it is doing anything: the analysis it produced, or why not.
|
|
189
|
+
const summary = !on
|
|
190
|
+
? "off"
|
|
191
|
+
: analysing
|
|
192
|
+
? "analysing…"
|
|
193
|
+
: bands > 0
|
|
194
|
+
? [
|
|
195
|
+
`${bands} band${bands === 1 ? "" : "s"}`,
|
|
196
|
+
...(hasLevel ? ["level"] : []),
|
|
197
|
+
// Worth saying when it is more than one: the cuts follow whoever is
|
|
198
|
+
// speaking, and that is not obvious from a band count.
|
|
199
|
+
...(carve.sources.length > 1 ? [`${carve.sources.length} voices`] : []),
|
|
200
|
+
].join(" + ")
|
|
201
|
+
: carve.sources.length > 0
|
|
202
|
+
? "no analysis yet"
|
|
203
|
+
: "pick a voice";
|
|
204
|
+
// The carve's own colour, used three ways: the module's left edge, the title,
|
|
205
|
+
// and the wash behind it. A preset gets a title treatment because it is a
|
|
206
|
+
// character; the carve gets one because it is the only module in the rack
|
|
207
|
+
// that LISTENS to another track, and a plain row understates that. It stays
|
|
208
|
+
// in the smart family's monospace — what it shows is a readout, and a
|
|
209
|
+
// display face would promise settings the author chose.
|
|
210
|
+
const tint = fxFamilyTint({ type: "carve", fromCarve: true });
|
|
211
|
+
const wash = fxTintWash(tint);
|
|
212
|
+
return (
|
|
213
|
+
<div
|
|
214
|
+
className={`hf-fx-node hf-fx-carve-module hf-fx-carve rounded-[4px] border border-l-2 border-panel-border-input${
|
|
215
|
+
on ? "" : " opacity-50"
|
|
216
|
+
}`}
|
|
217
|
+
data-fx-node="carve"
|
|
218
|
+
data-fx-family="smart"
|
|
219
|
+
// Smart, like the Tone EQ and the leveller: it measures the audio and
|
|
220
|
+
// writes its own settings, and what it shows is a readout of what it
|
|
221
|
+
// decided rather than controls the author set.
|
|
222
|
+
style={{ borderLeftColor: tint, ...(wash ? { backgroundColor: wash } : {}) }}
|
|
223
|
+
data-carve-enabled={on ? "" : undefined}
|
|
224
|
+
>
|
|
225
|
+
<div className="hf-fx-node-head flex min-h-7 items-center gap-1 px-1.5">
|
|
226
|
+
<button
|
|
227
|
+
type="button"
|
|
228
|
+
className={`hf-fx-node-name min-w-0 flex-1 truncate text-left text-[13px] uppercase hover:opacity-80 ${FX_FAMILY_TYPE.smart}`}
|
|
229
|
+
// Tracking goes here rather than in a class: the smart family already
|
|
230
|
+
// sets `tracking-normal`, and two Tailwind tracking utilities on one
|
|
231
|
+
// element resolve by stylesheet order, not by the order written.
|
|
232
|
+
style={{ color: tint, letterSpacing: "0.16em" }}
|
|
233
|
+
aria-expanded={open}
|
|
234
|
+
onClick={onToggleOpen}
|
|
235
|
+
>
|
|
236
|
+
Voiceover carve
|
|
237
|
+
</button>
|
|
238
|
+
<span className="hf-fx-carve-summary shrink-0 font-mono text-[9px] text-panel-text-2">
|
|
239
|
+
{summary}
|
|
240
|
+
</span>
|
|
241
|
+
{/* One switch, not a bypass and a delete. Off drops the effects and the
|
|
242
|
+
envelopes it wrote, and is remembered — otherwise the default would
|
|
243
|
+
re-apply the carve the next time this clip was selected. */}
|
|
244
|
+
<button
|
|
245
|
+
type="button"
|
|
246
|
+
className="hf-fx-bypass hf-fx-carve-toggle rounded-[3px] border border-panel-border-input px-1.5 py-0.5 font-mono text-[9px] text-panel-text-2 hover:text-panel-text-0 disabled:opacity-40"
|
|
247
|
+
aria-pressed={on}
|
|
248
|
+
title={on ? "Switch the carve off" : "Switch the carve on"}
|
|
249
|
+
disabled={disabled}
|
|
250
|
+
onClick={() => onCarveChange({ ...carve, enabled: !on })}
|
|
251
|
+
>
|
|
252
|
+
{on ? "On" : "Off"}
|
|
253
|
+
</button>
|
|
254
|
+
</div>
|
|
255
|
+
{open && on ? (
|
|
256
|
+
<div className="hf-fx-carve-body border-t border-panel-border-input">
|
|
257
|
+
<div className="hf-fx-carve-controls space-y-0.5 px-1.5 py-1.5">
|
|
258
|
+
<div className="hf-fx-row flex min-h-6 items-center gap-2">
|
|
259
|
+
<span className="hf-fx-label w-[86px] flex-shrink-0 truncate text-[10px] text-panel-text-2">
|
|
260
|
+
Listen to
|
|
261
|
+
</span>
|
|
262
|
+
{soleVoice ? (
|
|
263
|
+
<span
|
|
264
|
+
className="hf-fx-carve-source min-w-0 flex-1 truncate font-mono text-[10px] text-panel-text-1"
|
|
265
|
+
data-carve-source={soleVoice.id}
|
|
266
|
+
>
|
|
267
|
+
{soleVoice.label}
|
|
268
|
+
</span>
|
|
269
|
+
) : (
|
|
270
|
+
/* Every voice, not one of them. A bed usually runs under a whole
|
|
271
|
+
sequence — a narrator, an answer, a second presenter — and they are
|
|
272
|
+
analysed together, so the cuts follow whoever is speaking. Which
|
|
273
|
+
makes this a set of things to include, not a choice between them. */
|
|
274
|
+
<div className="hf-fx-carve-sources flex min-w-0 flex-1 flex-wrap gap-x-2.5 gap-y-0.5">
|
|
275
|
+
{sourceOptions.map((o) => (
|
|
276
|
+
<label
|
|
277
|
+
key={o.id}
|
|
278
|
+
className="flex min-w-0 items-center gap-1 font-mono text-[9px] text-panel-text-1"
|
|
279
|
+
title={`Make room for ${o.label}`}
|
|
280
|
+
>
|
|
281
|
+
<input
|
|
282
|
+
type="checkbox"
|
|
283
|
+
className="hf-fx-carve-source h-2.5 w-2.5 accent-panel-accent"
|
|
284
|
+
data-carve-source={o.id}
|
|
285
|
+
checked={carve.sources.includes(o.id)}
|
|
286
|
+
disabled={disabled}
|
|
287
|
+
onChange={(e) =>
|
|
288
|
+
onCarveChange({
|
|
289
|
+
...carve,
|
|
290
|
+
sources: e.target.checked
|
|
291
|
+
? [...carve.sources, o.id]
|
|
292
|
+
: carve.sources.filter((id) => id !== o.id),
|
|
293
|
+
})
|
|
294
|
+
}
|
|
295
|
+
/>
|
|
296
|
+
<span className="truncate">{o.label}</span>
|
|
297
|
+
</label>
|
|
298
|
+
))}
|
|
299
|
+
</div>
|
|
300
|
+
)}
|
|
301
|
+
</div>
|
|
302
|
+
{/* One knob for the whole effect. Depth, band count, width, the
|
|
303
|
+
intelligibility weighting and both level-match numbers move together
|
|
304
|
+
anyway — a gentle carve is shallow in few bands with little ducking, a
|
|
305
|
+
hard one is deeper in more with more — so the panel sets the strength
|
|
306
|
+
and `carveProfile` derives the six numbers the analysis works in. */}
|
|
307
|
+
<FxParamRow
|
|
308
|
+
param={{
|
|
309
|
+
kind: "number",
|
|
310
|
+
key: "strength",
|
|
311
|
+
label: "Strength",
|
|
312
|
+
unit: "",
|
|
313
|
+
min: 0,
|
|
314
|
+
max: 1,
|
|
315
|
+
step: 0.05,
|
|
316
|
+
default: DEFAULT_CARVE.strength,
|
|
317
|
+
hint: "How hard to carve: deeper cuts, in more bands, and more room made by dropping the bed's level under the voice. At 0 it carves frequencies only. Moving this re-runs the analysis on what is already here.",
|
|
318
|
+
}}
|
|
319
|
+
value={carve.strength}
|
|
320
|
+
disabled={disabled || carve.sources.length === 0}
|
|
321
|
+
onChange={(_k, v) => onCarvePreview({ ...carve, strength: Number(v) })}
|
|
322
|
+
onCommit={(_k, v) => onCarveChange({ ...carve, strength: Number(v) })}
|
|
323
|
+
/>
|
|
324
|
+
</div>
|
|
325
|
+
{/* What the analysis made of all that. Divided rather than boxed: these
|
|
326
|
+
are parts of one module, and a border around each would read as the
|
|
327
|
+
separate effects this replaced. */}
|
|
328
|
+
{/* While the analysis runs, the previous filters are gone rather than
|
|
329
|
+
stale. Every number in that list is about to be replaced — a strength
|
|
330
|
+
change re-derives all of them — so leaving them up reads as the
|
|
331
|
+
settings that are in force when they are already history, and the one
|
|
332
|
+
honest thing to say is that the work is happening. */}
|
|
333
|
+
{analysing ? (
|
|
334
|
+
<p className="hf-fx-carve-working flex items-center justify-center gap-1.5 border-t border-panel-border-input py-2 text-[10px] text-panel-text-2">
|
|
335
|
+
<svg
|
|
336
|
+
className="hf-fx-carve-spinner h-3 w-3 animate-spin motion-reduce:animate-none"
|
|
337
|
+
viewBox="0 0 24 24"
|
|
338
|
+
fill="none"
|
|
339
|
+
aria-hidden="true"
|
|
340
|
+
>
|
|
341
|
+
<circle
|
|
342
|
+
className="opacity-25"
|
|
343
|
+
cx="12"
|
|
344
|
+
cy="12"
|
|
345
|
+
r="10"
|
|
346
|
+
stroke="currentColor"
|
|
347
|
+
strokeWidth="4"
|
|
348
|
+
/>
|
|
349
|
+
<path
|
|
350
|
+
className="opacity-75"
|
|
351
|
+
fill="currentColor"
|
|
352
|
+
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"
|
|
353
|
+
/>
|
|
354
|
+
</svg>
|
|
355
|
+
Analysing…
|
|
356
|
+
</p>
|
|
357
|
+
) : nodes.length > 0 ? (
|
|
358
|
+
<div className="hf-fx-carve-members divide-y divide-panel-border-input/60 border-t border-panel-border-input">
|
|
359
|
+
<div className="hf-fx-carve-members-label px-1.5 pt-1 font-mono text-[9px] uppercase tracking-wide text-panel-text-2">
|
|
360
|
+
analysed
|
|
361
|
+
</div>
|
|
362
|
+
{nodes.map((node, i) => (
|
|
363
|
+
<FxCarveMember
|
|
364
|
+
key={node.id ?? `${node.type}-${i}`}
|
|
365
|
+
node={node}
|
|
366
|
+
automatedTargets={automatedTargets}
|
|
367
|
+
liveAutomationValues={liveAutomationValues}
|
|
368
|
+
/>
|
|
369
|
+
))}
|
|
370
|
+
</div>
|
|
371
|
+
) : (
|
|
372
|
+
<p className="hf-fx-carve-working border-t border-panel-border-input py-1.5 text-center text-[10px] text-panel-text-2">
|
|
373
|
+
{carve.sources.length > 0
|
|
374
|
+
? "Nothing analysed yet."
|
|
375
|
+
: "Pick the voices this bed should make room for."}
|
|
376
|
+
</p>
|
|
377
|
+
)}
|
|
378
|
+
</div>
|
|
379
|
+
) : null}
|
|
380
|
+
</div>
|
|
381
|
+
);
|
|
382
|
+
}
|